Ajout du montant avant commande

This commit is contained in:
Michael RICOIS 2014-02-11 10:01:06 +00:00
parent 04b23a60d8
commit 5302700ab3

View File

@ -16,7 +16,7 @@ class ReportController extends Zend_Controller_Action
}
/**
*
* Page d'entrée
*/
public function indexAction()
{
@ -99,7 +99,7 @@ class ReportController extends Zend_Controller_Action
}
/**
*
* Page de commande
*/
public function cmdAction()
{
@ -179,14 +179,16 @@ class ReportController extends Zend_Controller_Action
$html = $report->getContent();
if ( $html !== false ) {
$pathCmd = $c->profil->path->data;
//Replace some HTML contents
$html = preg_replace('@<link href="/@si','<link href="./', $html);
$html = preg_replace('@src="/@si','src="./', $html);
$path = $c->profil->path->pages;
$id = uniqid();
//Write the file (name with commande id)
if ( file_put_contents($pathCmd . DIRECTORY_SEPARATOR . $id.'.html', $html) ) {
if ( file_put_contents($path . DIRECTORY_SEPARATOR . $id.'.html', $html) ) {
$session->CmdID = $this->view->CmdID = $id;
}
}
}
@ -254,6 +256,12 @@ class ReportController extends Zend_Controller_Action
$this->view->montant = $this->montantht." &euro; HT" . " (".$this->montant." &euro; TTC)";
$data = array(
'mt' => $this->montantht,
'tax' => $this->tva,
);
$commandM->update($data, 'id='.$row->id);
//Paybox
$paybox = new Paybox_System(false);
$paybox->setUrlPaiement();
@ -272,7 +280,7 @@ class ReportController extends Zend_Controller_Action
}
/**
*
* Retour après paiement Paybox
*/
public function retourAction()
{
@ -345,7 +353,9 @@ class ReportController extends Zend_Controller_Action
}
/**
* Command delivery
*/
public function deliverAction()
{
$this->_helper->layout()->disableLayout();
@ -451,17 +461,15 @@ class ReportController extends Zend_Controller_Action
$row = $commandM->fetchRow($where);
if ( $row !== null ) {
//Copy html from command directory to temporary storage
$c = Zend_Registry::get('config');
$source = $c->profil->path->data . DIRECTORY_SEPARATOR . $row->cmdId . '.html';
$dest = $c->profil->path->pages . DIRECTORY_SEPARATOR . $row->cmdId . '.html';
$c = Zend_Registry::get('config');
$html = $c->profil->path->pages . DIRECTORY_SEPARATOR . $row->cmdId . '.html';
$content = file_get_contents($source);
$content = preg_replace('@<link href="/@si','<link href="./',$content);
$content = preg_replace('@src="/@si','src="./',$content);
file_put_contents($dest, $content);
$pdf = new Scores_Wkhtml_Pdf();
$file = $pdf->exec($dest);
//Save the HTML file
copy($html, $c->profil->path->data . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . $id.'.html');
//Generate the PDF
$pdf = new Scores_Wkhtml_Pdf();
$file = $pdf->exec($html);
}
@ -495,9 +503,7 @@ class ReportController extends Zend_Controller_Action
$request = $this->getRequest();
$cmdId = $request->getParam('id');
$c = Zend_Registry::get('config');
$path = $c->profil->path->pages;
$regen = $request->getParam('regen');
$auth = Zend_Auth::getInstance();
@ -506,7 +512,24 @@ class ReportController extends Zend_Controller_Action
//If REF and EMAIL and eta = 0, OK => file et commande moins d'un mois
) {
$file = $path . DIRECTORY_SEPARATOR . $cmdId . '.pdf';
$c = Zend_Registry::get('config');
//Regen command
if ($regen !== null) {
$source = $c->profil->path->data . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $cmdId . 'html';
$dest = $c->profil->path->pages . DIRECTORY_SEPARATOR . $cmdId . '.html';
copy($source, $dest);
//Generate the PDF
$pdf = new Scores_Wkhtml_Pdf();
$file = $pdf->exec($dest);
}
//Serve the file
$path = $c->profil->path->pages;
$file = $path . DIRECTORY_SEPARATOR . $cmdId . '.pdf';
if( file_exists($file) && filesize($file)>0 ) {
header('Content-Transfer-Encoding: none');
header('Content-type: application/pdf');