Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
close stati-consegna
Browse files Browse the repository at this point in the history
  • Loading branch information
jambtc committed Apr 5, 2020
1 parent c9fe36e commit 0ec5f58
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
23 changes: 16 additions & 7 deletions protected/controllers/ConsegneController.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ public function actionIndex()
//if (Yii::app()->user->objUser['privilegi'] == 0)
$criteria->compare('id_volontario',Yii::app()->user->objUser['id_user'],false);
$criteria->compare('in_consegna',1,false);
$criteria->compare('consegnato',0,false);

// carico la lista delle consegne
$dataProvider=new CActiveDataProvider('Consegne', array(
Expand All @@ -492,6 +493,7 @@ public function actionIndex()
//if (Yii::app()->user->objUser['privilegi'] == 0)
$criteria2->compare('id_volontario',Yii::app()->user->objUser['id_user'],false);
$criteria2->compare('in_consegna',2,false);
$criteria2->compare('consegnato',0,false);
// carico la lista delle consegne
$dataSpedite=new CActiveDataProvider('Consegne', array(
'criteria'=>$criteria2,
Expand All @@ -513,14 +515,21 @@ public function actionTutti(){
));

$iterator = new CDataProviderIterator($dataProvider);

foreach($iterator as $item) {
$consegna = $this->loadModel($item->id_archive);
$consegna->consegnato = 1;
$consegna->time_consegnato = time();
$consegna->in_consegna = 3;
$consegna->update();
if (isset($iterator)){
foreach($iterator as $item) {
$idlist[] = $item->id_archive;
}
if (isset($idlist)){
foreach ($idlist as $id){
$model = $this->loadModel($id);
$model->consegnato = 1;
$model->time_consegnato = time();
$model->in_consegna = 3;
$model->update();
}
}
}

$this->redirect(array('index'));
}

Expand Down
8 changes: 6 additions & 2 deletions protected/models/Consegne.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,16 @@ public function search()
$criteria->compare('indirizzo',$this->indirizzo,true);
$criteria->compare('trigger_alert',$this->trigger_alert);
$criteria->compare('id_volontario',$this->id_volontario);
$criteria->compare('in_consegna',$this->in_consegna);
$criteria->compare('consegnato',$this->consegnato);
//$criteria->compare('in_consegna',$this->in_consegna);
//$criteria->compare('consegnato',$this->consegnato);
$criteria->compare('time_inconsegna',$this->time_inconsegna);
$criteria->compare('time_consegnato',$this->time_consegnato);
$criteria->compare('note',$this->note);

$criteria->compare('in_consegna',0,false);
$criteria->compare('consegnato',0,false);


return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
Expand Down

0 comments on commit 0ec5f58

Please sign in to comment.