|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DistributionController extends BackendController |
|
|
class DistributionController extends BackendController |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
public function behaviors() |
|
|
|
|
|
{ |
|
|
|
|
|
return [ |
|
|
|
|
|
'access' => [ |
|
|
|
|
|
'class' => AccessControl::className(), |
|
|
|
|
|
'rules' => [ |
|
|
|
|
|
[ |
|
|
|
|
|
'actions' => ['report-cron'], |
|
|
|
|
|
'allow' => true, |
|
|
|
|
|
'roles' => ['?'] |
|
|
|
|
|
], |
|
|
|
|
|
[ |
|
|
|
|
|
'allow' => true, |
|
|
|
|
|
'roles' => ['@'], |
|
|
|
|
|
'matchCallback' => function ($rule, $action) { |
|
|
|
|
|
return User::getCurrentStatus() == USER::STATUS_ADMIN |
|
|
|
|
|
|| User::getCurrentStatus() == USER::STATUS_PRODUCER; |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public function actionIndex($date = '') |
|
|
public function actionIndex($date = '') |
|
|
{ |
|
|
{ |
|
|
$format = 'Y-m-d' ; |
|
|
$format = 'Y-m-d' ; |
|
|
|
|
|
|
|
|
return $json ; |
|
|
return $json ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Génére un PDF récapitulatif des des commandes d'un producteur pour une |
|
|
|
|
|
* date donnée (Méthode appelable via CRON) |
|
|
|
|
|
* |
|
|
|
|
|
* @param string $date |
|
|
|
|
|
* @param boolean $save |
|
|
|
|
|
* @param integer $idProducer |
|
|
|
|
|
* @param string $key |
|
|
|
|
|
* @return PDF|null |
|
|
|
|
|
*/ |
|
|
|
|
|
public function actionReportCron($date = '', $save = false, $idProducer = 0, $key = '') |
|
|
|
|
|
{ |
|
|
|
|
|
if($key == '64ac0bdab7e9f5e48c4d991ec5201d57') { |
|
|
|
|
|
$this->actionReport($date, $save, $idProducer) ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Génére un PDF récapitulatif des commandes d'un producteur pour une |
|
|
* Génére un PDF récapitulatif des commandes d'un producteur pour une |
|
|
* date donnée. |
|
|
* date donnée. |