Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/core/actions_massactions.inc.php
This commit is contained in:
commit
609eefaf08
@ -72,6 +72,8 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$listofobjectid=array();
|
$listofobjectid=array();
|
||||||
$listofobjectthirdparties=array();
|
$listofobjectthirdparties=array();
|
||||||
$listofobjectref=array();
|
$listofobjectref=array();
|
||||||
|
$attachedfilesThirdpartyObj=array();
|
||||||
|
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -202,7 +204,6 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$sendtocc=implode(',',$tmparray);
|
$sendtocc=implode(',',$tmparray);
|
||||||
|
|
||||||
//var_dump($listofobjectref);exit;
|
//var_dump($listofobjectref);exit;
|
||||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
|
||||||
$listofqualifiedobj=array();
|
$listofqualifiedobj=array();
|
||||||
$listofqualifiedref=array();
|
$listofqualifiedref=array();
|
||||||
$thirdpartywithoutemail=array();
|
$thirdpartywithoutemail=array();
|
||||||
@ -217,7 +218,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>';
|
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>';
|
||||||
continue; // Payment done or started or canceled
|
continue; // Payment done or started or canceled
|
||||||
}
|
}
|
||||||
if ($objectclass == 'Commande' && $objectojb->statut == Commande::STATUS_DRAFT)
|
if ($objectclass == 'Commande' && $objectobj->statut == Commande::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$nbignored++;
|
$nbignored++;
|
||||||
@ -290,10 +291,10 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
if (dol_is_file($file))
|
if (dol_is_file($file))
|
||||||
{
|
{
|
||||||
// Create form object
|
// Create form object
|
||||||
$attachedfiles=array(
|
$attachedfilesThirdpartyObj[$thirdpartyid][$objectid]=array(
|
||||||
'paths'=>array_merge($attachedfiles['paths'], array($file)),
|
'paths'=>array($file),
|
||||||
'names'=>array_merge($attachedfiles['names'], array($filename)),
|
'names'=>array($filename),
|
||||||
'mimes'=>array_merge($attachedfiles['mimes'], array($mime))
|
'mimes'=>array($mime)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -310,6 +311,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$listofqualifiedobj[$objectid]=$objectobj;
|
$listofqualifiedobj[$objectid]=$objectobj;
|
||||||
$listofqualifiedref[$objectid]=$objectobj->ref;
|
$listofqualifiedref[$objectid]=$objectobj->ref;
|
||||||
|
|
||||||
|
|
||||||
//var_dump($listofqualifiedref);
|
//var_dump($listofqualifiedref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +363,6 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
|
|
||||||
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
|
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
|
||||||
// $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty)
|
// $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty)
|
||||||
$oneemailperrecipient=(GETPOST('oneemailperrecipient', 'alpha')=='on'?1:0);
|
|
||||||
$looparray=array();
|
$looparray=array();
|
||||||
if (! $oneemailperrecipient)
|
if (! $oneemailperrecipient)
|
||||||
{
|
{
|
||||||
@ -403,6 +404,28 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$subjectreplaced=make_substitutions($subject, $substitutionarray);
|
$subjectreplaced=make_substitutions($subject, $substitutionarray);
|
||||||
$messagereplaced=make_substitutions($message, $substitutionarray);
|
$messagereplaced=make_substitutions($message, $substitutionarray);
|
||||||
|
|
||||||
|
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||||
|
if ($oneemailperrecipient)
|
||||||
|
{
|
||||||
|
// if "one email per recipient" is check we must collate $attachedfiles by thirdparty
|
||||||
|
if (is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id]))
|
||||||
|
{
|
||||||
|
foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles){
|
||||||
|
// Create form object
|
||||||
|
$attachedfiles=array(
|
||||||
|
'paths'=>array_merge($attachedfiles['paths'], $objAttachedFiles['paths']),
|
||||||
|
'names'=>array_merge($attachedfiles['names'], $objAttachedFiles['names']),
|
||||||
|
'mimes'=>array_merge($attachedfiles['mimes'], $objAttachedFiles['mimes'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])){
|
||||||
|
// Create form object
|
||||||
|
// if "one email per recipient" isn't check we must separate $attachedfiles by object
|
||||||
|
$attachedfiles=$attachedfilesThirdpartyObj[$thirdparty->id][$objectid];
|
||||||
|
}
|
||||||
|
|
||||||
$filepath = $attachedfiles['paths'];
|
$filepath = $attachedfiles['paths'];
|
||||||
$filename = $attachedfiles['names'];
|
$filename = $attachedfiles['names'];
|
||||||
$mimetype = $attachedfiles['mimes'];
|
$mimetype = $attachedfiles['mimes'];
|
||||||
@ -503,9 +526,9 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR);
|
dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$nbsent++; // Nb of email sent (may be lower than number of record selected if we group thirdparties)
|
$nbsent++; // Nb of object sent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -824,6 +847,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
|||||||
|
|
||||||
if (!$error && $massaction == 'cancelorders')
|
if (!$error && $massaction == 'cancelorders')
|
||||||
{
|
{
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$nbok = 0;
|
$nbok = 0;
|
||||||
@ -1285,3 +1309,6 @@ $parameters['diroutputmassaction']=$diroutputmassaction;
|
|||||||
|
|
||||||
$reshook=$hookmanager->executeHooks('doMassActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doMassActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6521,7 +6521,7 @@ abstract class CommonObject
|
|||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
function showOptions(child_list, parent_list)
|
function showOptions(child_list, parent_list)
|
||||||
{
|
{
|
||||||
var val = $("select[name=\"options_"+parent_list+"\"]").val();
|
var val = $("select[name=\""+parent_list+"\"]").val();
|
||||||
var parentVal = parent_list + ":" + val;
|
var parentVal = parent_list + ":" + val;
|
||||||
if(val > 0) {
|
if(val > 0) {
|
||||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||||
|
|||||||
@ -936,7 +936,6 @@ class FormMail extends Form
|
|||||||
$defaultmessage=preg_replace("/^(<br>)+/", "", $defaultmessage);
|
$defaultmessage=preg_replace("/^(<br>)+/", "", $defaultmessage);
|
||||||
$defaultmessage=preg_replace("/^\n+/", "", $defaultmessage);
|
$defaultmessage=preg_replace("/^\n+/", "", $defaultmessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= '<tr>';
|
$out.= '<tr>';
|
||||||
$out.= '<td valign="top">';
|
$out.= '<td valign="top">';
|
||||||
$out.=$form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
$out.=$form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||||
|
|||||||
@ -1790,7 +1790,7 @@ else
|
|||||||
if (! empty($object->email))
|
if (! empty($object->email))
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init#presend">'.$langs->trans('SendMail').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user