fix : use template at the goos place for generate doc for supplier
propoal
This commit is contained in:
parent
e4635c9401
commit
bf27ca1b11
@ -465,15 +465,6 @@ if (empty($reshook))
|
|||||||
// Action for direct print
|
// Action for direct print
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
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
|
// Go back to draft
|
||||||
if ($action == 'modif' && $user->rights->supplier_proposal->creer)
|
if ($action == 'modif' && $user->rights->supplier_proposal->creer)
|
||||||
{
|
{
|
||||||
@ -876,46 +867,20 @@ if (empty($reshook))
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generation doc (depuis lien ou depuis cartouche doc)
|
// Actions to send emails
|
||||||
else if ($action == 'builddoc' && $user->rights->supplier_proposal->creer) {
|
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
|
||||||
if (GETPOST('model')) {
|
$paramname='id';
|
||||||
$object->setDocModel($user, GETPOST('model'));
|
$mode='emailfromsupplierproposal';
|
||||||
}
|
$trackid='spr'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
// Define output language
|
// Actions to build doc
|
||||||
$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='';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
$upload_dir = $conf->supplier_proposal->dir_output;
|
||||||
$file = $upload_dir . '/' . GETPOST('file');
|
$permissioncreate=$user->rights->supplier_proposal->creer;
|
||||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
if ($ret)
|
|
||||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
|
||||||
else
|
|
||||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set project
|
// Set project
|
||||||
else if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
|
if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
|
||||||
$object->setProject($_POST['projectid']);
|
$object->setProject($_POST['projectid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user