Skip to content

Commit

Permalink
Merge pull request #8640 from atm-florian/6.0
Browse files Browse the repository at this point in the history
fix : use template at the goos place for generate doc for supplier
  • Loading branch information
eldy committed Apr 19, 2018
2 parents e4635c9 + 882863a commit e1585ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 46 deletions.
6 changes: 6 additions & 0 deletions htdocs/core/class/conf.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ function setValues($db)
$this->fournisseur->facture=new stdClass();
$this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture";
$this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp";
$this->supplierproposal=new stdClass();
$this->supplierproposal->dir_output=$rootfordata."/supplier_proposal";
$this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp";
$this->fournisseur->payment=new stdClass();
$this->fournisseur->payment->dir_output =$rootfordata."/fournisseur/payment";
$this->fournisseur->payment->dir_temp =$rootfordata."/fournisseur/payment/temp";
Expand All @@ -358,6 +361,9 @@ function setValues($db)
$this->supplier_invoice->enabled=1;
$this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture";
$this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp";
$this->supplierproposal=new stdClass();
$this->supplierproposal->dir_output=$rootfordata."/supplier_proposal";
$this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp";
}
}

Expand Down
57 changes: 11 additions & 46 deletions htdocs/supplier_proposal/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,6 @@
// Action for direct print
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';

// Actions to send emails
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
$paramname='id';
$mode='emailfromsupplierproposal';
$trackid='spr'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';



// Go back to draft
if ($action == 'modif' && $user->rights->supplier_proposal->creer)
{
Expand Down Expand Up @@ -876,46 +867,20 @@
exit();
}

// Generation doc (depuis lien ou depuis cartouche doc)
else if ($action == 'builddoc' && $user->rights->supplier_proposal->creer) {
if (GETPOST('model')) {
$object->setDocModel($user, GETPOST('model'));
}

// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang);
}
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Actions to send emails
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
$paramname='id';
$mode='emailfromsupplierproposal';
$trackid='spr'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

// Remove file in doc form
else if ($action == 'remove_file' && $user->rights->supplier_proposal->creer) {
if ($object->id > 0) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';

$langs->load("other");
$upload_dir = $conf->supplier_proposal->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret)
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
else
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
}
}
// Actions to build doc
$upload_dir = $conf->supplier_proposal->dir_output;
$permissioncreate=$user->rights->supplier_proposal->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';

// Set project
else if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
$object->setProject($_POST['projectid']);
}

Expand Down

0 comments on commit e1585ef

Please sign in to comment.