Merge pull request #9743 from atm-maxime/new_mass_generate
New mass generate
This commit is contained in:
commit
bcf2e751b5
@ -462,6 +462,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -449,6 +449,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
'cancelorders'=>$langs->trans("Cancel"),
|
'cancelorders'=>$langs->trans("Cancel"),
|
||||||
|
|||||||
@ -595,6 +595,7 @@ if ($resql)
|
|||||||
|
|
||||||
$arrayofmassactions=array(
|
$arrayofmassactions=array(
|
||||||
'validate'=>$langs->trans("Validate"),
|
'validate'=>$langs->trans("Validate"),
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -364,6 +364,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1169,6 +1169,67 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
|
|||||||
//var_dump($listofobjectthirdparties);exit;
|
//var_dump($listofobjectthirdparties);exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate document foreach object according to model linked to object
|
||||||
|
// @TODO : propose model selection
|
||||||
|
if (! $error && $massaction == 'generate_doc' && $permtoread)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$objecttmp=new $objectclass($db);
|
||||||
|
$nbok = 0;
|
||||||
|
foreach($toselect as $toselectid)
|
||||||
|
{
|
||||||
|
$result=$objecttmp->fetch($toselectid);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ...
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
// To be sure vars is defined
|
||||||
|
if (empty($hidedetails)) $hidedetails=0;
|
||||||
|
if (empty($hidedesc)) $hidedesc=0;
|
||||||
|
if (empty($hideref)) $hideref=0;
|
||||||
|
if (empty($moreparams)) $moreparams=null;
|
||||||
|
|
||||||
|
$result= $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||||
|
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else $nbok++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs');
|
||||||
|
else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs');
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$parameters['toselect']=$toselect;
|
$parameters['toselect']=$toselect;
|
||||||
$parameters['uploaddir']=$uploaddir;
|
$parameters['uploaddir']=$uploaddir;
|
||||||
|
|
||||||
|
|||||||
@ -359,6 +359,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -269,6 +269,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -647,6 +647,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -477,6 +477,7 @@ if ($resql)
|
|||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'validate'=>$langs->trans("Validate"),
|
'validate'=>$langs->trans("Validate"),
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -117,6 +117,7 @@ if ($fourn_id)
|
|||||||
|
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -86,6 +86,7 @@ GoToWikiHelpPage=Read online help (Internet access needed)
|
|||||||
GoToHelpPage=Read help
|
GoToHelpPage=Read help
|
||||||
RecordSaved=Record saved
|
RecordSaved=Record saved
|
||||||
RecordDeleted=Record deleted
|
RecordDeleted=Record deleted
|
||||||
|
RecordGenerated=Record generated
|
||||||
LevelOfFeature=Level of features
|
LevelOfFeature=Level of features
|
||||||
NotDefined=Not defined
|
NotDefined=Not defined
|
||||||
DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr authentication mode is set to <b>%s</b> in configuration file <b>conf.php</b>.<br>This means that the password database is external to Dolibarr, so changing this field may have no effect.
|
DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr authentication mode is set to <b>%s</b> in configuration file <b>conf.php</b>.<br>This means that the password database is external to Dolibarr, so changing this field may have no effect.
|
||||||
@ -650,8 +651,9 @@ ValueIsValid=Value is valid
|
|||||||
ValueIsNotValid=Value is not valid
|
ValueIsNotValid=Value is not valid
|
||||||
RecordCreatedSuccessfully=Record created successfully
|
RecordCreatedSuccessfully=Record created successfully
|
||||||
RecordModifiedSuccessfully=Record modified successfully
|
RecordModifiedSuccessfully=Record modified successfully
|
||||||
RecordsModified=%s record(s) modified
|
RecordsModified=%s record modified
|
||||||
RecordsDeleted=%s record(s) deleted
|
RecordsDeleted=%s record deleted
|
||||||
|
RecordsGenerated=%s record generated
|
||||||
AutomaticCode=Automatic code
|
AutomaticCode=Automatic code
|
||||||
FeatureDisabled=Feature disabled
|
FeatureDisabled=Feature disabled
|
||||||
MoveBox=Move widget
|
MoveBox=Move widget
|
||||||
|
|||||||
@ -417,6 +417,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -438,6 +438,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
// 'presend'=>$langs->trans("SendByMail"),
|
// 'presend'=>$langs->trans("SendByMail"),
|
||||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -396,6 +396,7 @@ if ($resql)
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("Generate"),
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user