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:
Laurent Destailleur 2019-06-24 16:36:08 +02:00
commit 609eefaf08
4 changed files with 982 additions and 956 deletions

View File

@ -53,7 +53,7 @@ if (! empty($massaction) && is_array($toselect) && count($toselect) < 1)
} }
if (! $error && is_array($toselect) && count($toselect) > $maxformassaction) if (! $error && is_array($toselect) && count($toselect) > $maxformassaction)
{ {
setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors'); setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++; $error++;
} }
@ -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)
{ {
@ -102,7 +104,7 @@ if (! $error && $massaction == 'confirm_presend')
} }
// Check mandatory parameters // Check mandatory parameters
if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email)) if (GETPOST('fromtype','alpha') === 'user' && empty($user->email))
{ {
$error++; $error++;
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
@ -122,7 +124,7 @@ if (! $error && $massaction == 'confirm_presend')
$massaction='presend'; $massaction='presend';
} }
if (! GETPOST('subject', 'none')) if (! GETPOST('subject','none'))
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings');
@ -164,12 +166,12 @@ if (! $error && $massaction == 'confirm_presend')
} }
elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact
{ {
$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
$sendtoid[] = $val; $sendtoid[] = $val;
} }
} }
} }
$sendto=implode(',', $tmparray); $sendto=implode(',',$tmparray);
// Define $sendtocc // Define $sendtocc
$receivercc=$_POST['receivercc']; $receivercc=$_POST['receivercc'];
@ -194,15 +196,14 @@ if (! $error && $massaction == 'confirm_presend')
} }
elseif ($val) // Id du contact elseif ($val) // Id du contact
{ {
$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
//$sendtoid[] = $val; TODO Add also id of contact in CC ? //$sendtoid[] = $val; TODO Add also id of contact in CC ?
} }
} }
} }
$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();
@ -214,21 +215,21 @@ if (! $error && $massaction == 'confirm_presend')
{ {
$langs->load("errors"); $langs->load("errors");
$nbignored++; $nbignored++;
$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++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction', $objectobj->ref).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'</div><br>';
continue; continue;
} }
if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT) if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT)
{ {
$langs->load("errors"); $langs->load("errors");
$nbignored++; $nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction', $objectobj->ref).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$objectobj->ref).'</div><br>';
continue; // Payment done or started or canceled continue; // Payment done or started or canceled
} }
@ -260,7 +261,7 @@ if (! $error && $massaction == 'confirm_presend')
$nbignored++; $nbignored++;
if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id]))
{ {
$resaction.='<div class="error">'.$langs->trans('NoRecipientEmail', $objectobj->thirdparty->name).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('NoRecipientEmail',$objectobj->thirdparty->name).'</div><br>';
} }
dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING); dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING);
$thirdpartywithoutemail[$objectobj->thirdparty->id]=1; $thirdpartywithoutemail[$objectobj->thirdparty->id]=1;
@ -281,7 +282,7 @@ if (! $error && $massaction == 'confirm_presend')
// For supplier invoices, we use the file provided by supplier, not the one we generate // For supplier invoices, we use the file provided by supplier, not the one we generate
if ($objectobj->element == 'invoice_supplier') if ($objectobj->element == 'invoice_supplier')
{ {
$fileparams = dol_most_recent_file($uploaddir.'/'.get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element).$objectobj->ref, preg_quote($objectobj->ref, '/').'([^\-])+'); $fileparams = dol_most_recent_file($uploaddir . '/' . get_exdir($objectobj->id,2,0,0,$objectobj,$objectobj->element).$objectobj->ref, preg_quote($objectobj->ref,'/').'([^\-])+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
} }
@ -290,17 +291,17 @@ 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
{ {
$nbignored++; $nbignored++;
$langs->load("errors"); $langs->load("errors");
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile', $file).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
dol_syslog('Failed to read file: '.$file, LOG_WARNING); dol_syslog('Failed to read file: '.$file, LOG_WARNING);
continue; continue;
} }
@ -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);
} }
@ -347,8 +349,8 @@ if (! $error && $massaction == 'confirm_presend')
} }
$replyto = $from; $replyto = $from;
$subject = GETPOST('subject', 'none'); $subject = GETPOST('subject','none');
$message = GETPOST('message', 'none'); $message = GETPOST('message','none');
$sendtobcc = GETPOST('sendtoccc'); $sendtobcc = GETPOST('sendtoccc');
if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
@ -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)
{ {
@ -384,17 +385,17 @@ if (! $error && $massaction == 'confirm_presend')
{ {
// Make substitution in email content // Make substitution in email content
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp);
$substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ',array_keys($listofqualifiedobj)) : $objecttmp->id);
$substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ',$listofqualifiedref) : $objecttmp->ref);
$substitutionarray['__EMAIL__'] = $thirdparty->email; $substitutionarray['__EMAIL__'] = $thirdparty->email;
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>'; $substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$parameters=array('mode'=>'formemail'); $parameters=array('mode'=>'formemail');
if ( ! empty($listofobjectthirdparties) ) { if ( ! empty( $listofobjectthirdparties ) ) {
$parameters['listofobjectthirdparties'] = $listofobjectthirdparties; $parameters['listofobjectthirdparties'] = $listofobjectthirdparties;
} }
if ( ! empty($listofobjectref) ) { if ( ! empty( $listofobjectref ) ) {
$parameters['listofobjectref'] = $listofobjectref; $parameters['listofobjectref'] = $listofobjectref;
} }
@ -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'];
@ -443,7 +466,7 @@ if (! $error && $massaction == 'confirm_presend')
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$resaction.=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'<br>'; // Must not contain " $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
$error=0; $error=0;
@ -503,16 +526,16 @@ 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
{ {
$langs->load("other"); $langs->load("other");
if ($mailfile->error) if ($mailfile->error)
{ {
$resaction.=$langs->trans('ErrorFailedToSendMail', $from, $sendto); $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
$resaction.='<br><div class="error">'.$mailfile->error.'</div>'; $resaction.='<br><div class="error">'.$mailfile->error.'</div>';
} }
else else
@ -551,7 +574,7 @@ if (! $error && $massaction == 'confirm_presend')
if ($massaction == 'confirm_createbills') // Create bills from orders if ($massaction == 'confirm_createbills') // Create bills from orders
{ {
$orders = GETPOST('toselect', 'array'); $orders = GETPOST('toselect','array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('validate_invoices', 'int'); $validate_invoices = GETPOST('validate_invoices', 'int');
@ -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;
@ -901,9 +925,9 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
} }
$arrayofinclusion=array(); $arrayofinclusion=array();
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'\.pdf$';
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files
$listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
// build list of files with full path // build list of files with full path
$files = array(); $files = array();
@ -912,7 +936,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
$basename = dol_sanitizeFileName($basename); $basename = dol_sanitizeFileName($basename);
foreach($listoffiles as $filefound) foreach($listoffiles as $filefound)
{ {
if (strstr($filefound["name"], $basename)) if (strstr($filefound["name"],$basename))
{ {
$files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"];
break; break;
@ -923,10 +947,10 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
// Define output language (Here it is not used because we do only merging existing PDF) // Define output language (Here it is not used because we do only merging existing PDF)
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
@ -937,7 +961,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
// Defined name of merged file // Defined name of merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
$filename=preg_replace('/\s/', '_', $filename); $filename=preg_replace('/\s/','_',$filename);
// Save merged file // Save merged file
if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
@ -951,7 +975,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
if (count($files)>0) if (count($files)>0)
{ {
$now=dol_now(); $now=dol_now();
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$input_files = ''; $input_files = '';
foreach($files as $f) { foreach($files as $f) {
@ -965,7 +989,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->load("exports"); $langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
} }
else else
{ {
@ -1009,7 +1033,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
// Defined name of merged file // Defined name of merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
$filename=preg_replace('/\s/', '_', $filename); $filename=preg_replace('/\s/','_',$filename);
// Save merged file // Save merged file
if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
@ -1022,13 +1046,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
if ($pagecount) if ($pagecount)
{ {
$now=dol_now(); $now=dol_now();
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$pdf->Output($file, 'F'); $pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->load("exports"); $langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
} }
else else
{ {
@ -1169,7 +1193,7 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
{ {
$langs->load("errors"); $langs->load("errors");
$nbignored++; $nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'</div><br>'; $resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'</div><br>';
continue; continue;
} }
@ -1233,12 +1257,12 @@ if (! $error && $massaction == 'generate_doc' && $permtoread)
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); 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->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 ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
@ -1283,5 +1307,8 @@ $parameters['uploaddir']=$uploaddir;
$parameters['massaction']=$massaction; $parameters['massaction']=$massaction;
$parameters['diroutputmassaction']=$diroutputmassaction; $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');

View File

@ -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();

View File

@ -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');

View File

@ -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.'&amp;action=presend&amp;mode=init#presend">'.$langs->trans('SendMail').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=presend&amp;mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
} }
else else
{ {