Merge branch 'develop' into 18a5

This commit is contained in:
Laurent Destailleur 2023-04-09 18:00:44 +02:00 committed by GitHub
commit 8e1ffe6f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 663 additions and 379 deletions

View File

@ -816,8 +816,8 @@ class AccountancyExport
// Keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
// as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
// TODO: we should filter more than only accent to avoid wrong line size
// TODO: remove invoice number doc_ref in libelle,
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
// TODO: remove invoice number doc_ref in label,
// TODO: we should offer an option for customer to build the label using invoice number / name / date in accounting software
//$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
$Tab['codetva'] = str_repeat(' ', 2);

View File

@ -684,10 +684,10 @@ class AccountingAccount extends CommonObject
}
/**
* Retourne le libelle du statut d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -696,11 +696,11 @@ class AccountingAccount extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -312,10 +312,10 @@ class AccountingJournal extends CommonObject
}
/**
* Retourne le libelle du statut d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibType($mode = 0)
{
@ -327,7 +327,7 @@ class AccountingJournal extends CommonObject
* Return type of an accounting journal
*
* @param int $nature Id type
* @param int $mode 0=libelle long, 1=libelle court
* @param int $mode 0=label long, 1=label short
* @return string Label of type
*/
public function LibType($nature, $mode = 0)

View File

@ -104,7 +104,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code, f.vat_reverse_charge,";
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle as label, f.ref_supplier, f.date_lim_reglement as dlr, f.close_code, f.vat_reverse_charge,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
$sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,";
$sql .= " co.code as country_code, co.label as country_label,";

View File

@ -452,10 +452,10 @@ class Subscription extends CommonObject
/**
* Retourne le libelle du statut d'une adhesion
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -464,16 +464,19 @@ class Subscription extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @return string Label
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load("members");
//$langs->load("members");
return '';
}

View File

@ -478,7 +478,7 @@ if ($mode == 'feature') {
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) {
$yesno = 'Yes';
} else {
$yesno = 'No';
$yesno = '<span class="opacitymedium">No</span>';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);

View File

@ -268,10 +268,10 @@ class Bookmark extends CommonObject
}
/**
* Return label of contact status
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode)
{

View File

@ -1666,7 +1666,7 @@ class ActionComm extends CommonObject
}
$canread = 0;
if (!empty($user->rights->agenda->myactions->read) && $this->authorid == $user->id) {
if ($user->hasRight('agenda', 'myactions', 'read') && ($this->authorid == $user->id || $this->userownerid == $user->id)) {
$canread = 1; // Can read my event
}
if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) {

View File

@ -934,6 +934,7 @@ while ($i < $imaxinloop) {
$actionstatic->datep = $db->jdate($obj->dp);
$actionstatic->percentage = $obj->percent;
$actionstatic->authorid = $obj->fk_user_author;
$actionstatic->userownerid = $obj->fk_user_action;
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
// but only if we need it

View File

@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->load("mails");
$langs->loadLangs(array("mails"));
$id = (GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int'));
@ -48,20 +48,18 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$urlfrom = GETPOST('urlfrom');
$backtopageforcancel = GETPOST('backtopageforcancel');
// Initialize technical objects
$object = new Mailing($db);
$extrafields = new ExtraFields($db);
if ($id > 0) {
$result = $object->fetch($id);
}
$hookmanager->initHooks(array('mailingcard', 'globalcard'));
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('mailingcard', 'globalcard'));
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray = FormMail::getAvailableSubstitKey('emailing');
@ -86,10 +84,14 @@ $listofmethods['smtps'] = 'SMTP/SMTPS socket library';
if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
accessforbidden();
}
if (empty($action) && empty($object->id)) {
accessforbidden('Object not found');
}
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
/*
* Actions
*/
@ -567,7 +569,7 @@ if (empty($reshook)) {
}
// Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto') {
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') {
@ -582,10 +584,13 @@ if (empty($reshook)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') {
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
}
if (!$mesg) {
if ($object->update($user) >= 0) {
$result = $object->update($user);
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
@ -747,20 +752,21 @@ llxHeader(
array()
);
if ($action == 'create') {
// EMailing in creation mode
print '<form name="new_mailing" action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>';
}
$htmltext .= '</i>';
$htmltext .= '</span></i>';
$availablelink = $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'availvar');
$availablelink = $form->textwithpicto('<span class="opacitymedium">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'availvar');
//print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
@ -931,18 +937,9 @@ if ($action == 'create') {
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Description
/*
print '<tr><td class="titlefield">';
print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
print '</td><td>';
print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
print '</td></tr>';
*/
print '<table class="border centpercent tableforfield">'."\n";
// From
print '<tr><td class="titlefield">';
@ -975,10 +972,18 @@ if ($action == 'create') {
}
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td>';
print '<tr><td class="titlefield">';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) {
$text = '';
@ -1000,12 +1005,14 @@ if ($action == 'create') {
}
print '</td></tr>';
// Other attributes
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print "</div>";
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
@ -1022,11 +1029,8 @@ if ($action == 'create') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240);
}
/*
* Actions Buttons
*/
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
// Actions Buttons
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test', 'editevenunsubscribe'))) {
print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) {
@ -1198,17 +1202,32 @@ if ($action == 'create') {
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1);
$morehtmlref .= '</div>';
$morehtmlright = '';
if ($object->statut == 2) {
$morehtmlright .= ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) {
$morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
}
$morehtmlright .= ') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
@ -1217,13 +1236,20 @@ if ($action == 'create') {
print '</td></tr>';
*/
// Topic
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
// From
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
// To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
@ -1259,30 +1285,32 @@ if ($action == 'create') {
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print "<br>\n";
print "<br><br>\n";
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>';
}
$htmltext .= '</i>';
$htmltext .= '</span></i>';
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic');
print load_fiche_titre($langs->trans("EMail"), '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic');
print dol_get_fiche_head(null, '', '', -1);
print '<table class="bordernooddeven" width="100%">';
print '<table class="bordernooddeven centpercent">';
// Subject
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';
@ -1336,6 +1364,7 @@ if ($action == 'create') {
print '</table>';
// Message
print '<div style="padding-top: 10px">';

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
// Load translation files required by the page
$langs->load("mails");
@ -99,14 +100,22 @@ if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipient
$classname = "mailing_".$module;
if (file_exists($file)) {
require_once $file;
include_once $file;
// Add targets into database
$obj = new $classname($db);
dol_syslog("Call add_to_target on class ".$classname);
$result = $obj->add_to_target($id);
dol_syslog("Call add_to_target() on class ".$classname." evenunsubscribe=".$object->evenunsubscribe);
$sqlmessage = $obj->sql;
if (class_exists($classname)) {
$obj = new $classname($db);
$obj->evenunsubscribe = $object->evenunsubscribe;
$result = $obj->add_to_target($id);
$sqlmessage = $obj->sql;
} else {
$result = -1;
break;
}
}
}
if ($result > 0) {
@ -198,6 +207,38 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_dest_status = '';
}
// Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') {
$object->title = trim(GETPOST('title', 'alpha'));
} elseif ($action == 'setemail_from') {
$object->email_from = trim(GETPOST('email_from', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_replyto') {
$object->email_replyto = trim(GETPOST('email_replyto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_errorsto') {
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'settitle' && empty($object->title)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') {
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
}
if (!$mesg) {
$result = $object->update($user);
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg = $object->error;
}
setEventMessages($mesg, null, 'errors');
$action = "";
}
/*
@ -224,7 +265,7 @@ if ($object->fetch($id) >= 0) {
$morehtmlright = '';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3) {
if ($object->statut == $object::STATUS_SENTPARTIALY || $object->statut == $object::STATUS_SENTCOMPLETELY) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$nbok = ($nbtry - $nbko);
@ -239,13 +280,12 @@ if ($object->fetch($id) >= 0) {
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
//print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_from);
foreach ($emailarray as $email => $name) {
if ($name && $name != $email) {
@ -264,7 +304,7 @@ if ($object->fetch($id) >= 0) {
print '</td></tr>';
// Errors to
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_errorsto);
foreach ($emailarray as $email => $name) {
if ($name != $email) {
@ -280,10 +320,19 @@ if ($object->fetch($id) >= 0) {
}
print '</td></tr>';
// Nb of distinct emails
print '<tr><td>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td class="titlefield">';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) {
$text = '';
@ -295,7 +344,7 @@ if ($object->fetch($id) >= 0) {
}
}
if (empty($nbemail)) {
$nbemail .= ' '.img_warning('');//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
$nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
}
if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');
@ -305,16 +354,21 @@ if ($object->fetch($id) >= 0) {
}
print '</td></tr>';
print '</table>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print "</div>";
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print '<br>';
$allowaddtarget = ($object->statut == 0);
$allowaddtarget = ($object->statut == $object::STATUS_DRAFT);
// Show email selectors
if ($allowaddtarget && $user->rights->mailing->creer) {
@ -327,7 +381,11 @@ if ($object->fetch($id) >= 0) {
print '<div class="tagtd"></div>';
print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>';
print '<div class="tagtd left">'.$langs->trans("Filter").'</div>';
print '<div class="tagtd left">'.$langs->trans("Filters");
print ' &nbsp; &nbsp; <div class="floatright">'.$langs->trans("EvenUnsubscribe").' ';
print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1);
print '</div>';
print '</div>';
print '<div class="tagtd">&nbsp;</div>';
print '</div>'; // End tr
@ -386,8 +444,9 @@ if ($object->fetch($id) >= 0) {
$var = !$var;
if ($allowaddtarget) {
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&token='.newToken().'&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="page_y" value="'.newToken().'">';
} else {
print '<div '.$bctag[$var].'>';
@ -404,6 +463,8 @@ if ($object->fetch($id) >= 0) {
print '</div>';
try {
$obj->evenunsubscribe = $object->evenunsubscribe; // Set flag to include/exclude email that has opt-out.
$nbofrecipient = $obj->getNbOfRecipients('');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
@ -470,8 +531,10 @@ if ($object->fetch($id) >= 0) {
// List of selected targets
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
$sql .= " COUNT(mu.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = mc.email";
$sql .= " WHERE mc.fk_mailing=".((int) $object->id);
$asearchcriteriahasbeenset = 0;
if ($search_lastname) {
@ -494,8 +557,10 @@ if ($object->fetch($id) >= 0) {
$sql .= " AND mc.statut = ".((int) $search_dest_status);
$asearchcriteriahasbeenset++;
}
$sql .= ' GROUP BY mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms, mc.source_url, mc.source_id, mc.source_type, mc.error_text';
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -578,6 +643,14 @@ if ($object->fetch($id) >= 0) {
// Ligne des champs de filtres
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
}
// EMail
print '<td class="liste_titre">';
print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
@ -614,10 +687,13 @@ if ($object->fetch($id) >= 0) {
print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1);
print '</td>';
// Action column
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
}
print '</tr>';
if ($page) {
@ -625,6 +701,10 @@ if ($object->fetch($id) >= 0) {
}
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder);
@ -635,7 +715,10 @@ if ($object->fetch($id) >= 0) {
// Date sending
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print '</tr>';
$i = 0;
@ -656,10 +739,37 @@ if ($object->fetch($id) >= 0) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="tdoverflowmax150">'.img_picto('$obj->email', 'email', 'class="paddingright"').dol_escape_htmltag($obj->email).'</td>';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
}
print '<td class="tdoverflowmax150">';
print img_picto($obj->email, 'email', 'class="paddingright"');
if ($obj->nb > 0) {
print img_warning($langs->trans("EmailOptedOut"), 'warning', 'pictofixedwidth');
}
print dol_escape_htmltag($obj->email);
print '</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
print '<td><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>';
print '<td class="center tdoverflowmax150">';
if (empty($obj->source_id) || empty($obj->source_type)) {
print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
@ -691,7 +801,7 @@ if ($object->fetch($id) >= 0) {
print '</td>';
// Status of recipient sending email (Warning != status of emailing)
if ($obj->statut == 0) {
if ($obj->statut == $object::STATUS_DRAFT) {
// Date sent
print '<td align="center"></td>';
@ -707,19 +817,21 @@ if ($object->fetch($id) >= 0) {
print '</td>';
}
// Search Icon
print '<td class="right">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == 0) { // Not sent yet
if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
print '</tr>';
$i++;

View File

@ -357,9 +357,10 @@ class Mailing extends CommonObject
* Get object from database
*
* @param int $rowid Id of emailing
* @param string $ref Title to search from title
* @return int <0 if KO, >0 if OK
*/
public function fetch($rowid)
public function fetch($rowid, $ref = '')
{
global $conf;
@ -372,7 +373,12 @@ class Mailing extends CommonObject
$sql .= ", m.date_envoi";
$sql .= ", m.extraparams";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql .= " WHERE m.rowid = ".(int) $rowid;
$sql .= " WHERE entity IN (".getEntity('mailing').")";
if ($ref) {
$sql .= " AND m.titre = '".$this->db->escape($ref)."'";
} else {
$sql .= " AND m.rowid = ".(int) $rowid;
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
@ -899,7 +905,7 @@ class Mailing extends CommonObject
/**
* Return the label of a given status of a recipient
* Return the label of a given status of a recipient
* TODO Add class mailin_target.class.php
*
* @param int $status Id status

View File

@ -2589,10 +2589,10 @@ class AccountLine extends CommonObjectLine
/**
* Return label of status (activity, closed)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -2601,11 +2601,11 @@ class AccountLine extends CommonObjectLine
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -603,10 +603,10 @@ class PaymentVarious extends CommonObject
/**
* Retourne le libelle du statut
* Return the label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -615,11 +615,11 @@ class PaymentVarious extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -338,10 +338,10 @@ class Deplacement extends CommonObject
/**
* Retourne le libelle du statut
* Return the label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -350,11 +350,11 @@ class Deplacement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -604,10 +604,10 @@ class Localtax extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -616,16 +616,16 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
//global $langs;
return '';
}

View File

@ -995,10 +995,10 @@ class RemiseCheque extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -1007,11 +1007,11 @@ class RemiseCheque extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return label of a status
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -1303,10 +1303,10 @@ class Paiement extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -1315,11 +1315,11 @@ class Paiement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -222,11 +222,8 @@ print dol_get_fiche_end();
$disable_delete = 0;
$sql = 'SELECT f.rowid as scid, f.label as label, f.paye, f.amount as tva_amount, pf.amount';
//$sql .= ', pc.libelle as sc_type';
$sql .= ' FROM '.MAIN_DB_PREFIX.'payment_vat as pf,'.MAIN_DB_PREFIX.'tva as f';
//$sql .= ', '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql .= ' WHERE pf.fk_tva = f.rowid';
//$sql .= ' AND f.fk_type = pc.id';
$sql .= ' AND f.entity = '.$conf->entity;
$sql .= ' AND pf.rowid = '.((int) $object->id);

View File

@ -1888,7 +1888,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, substr("000000000000000".$montant, -16));
// Libelle F
// Label F
fputs($this->file, substr("*_".$ref."_RDVnet".$rowid." ", 0, 31));

View File

@ -441,9 +441,9 @@ class Cchargesociales
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@ -453,11 +453,11 @@ class Cchargesociales
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un status donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -664,10 +664,10 @@ class PaymentSocialContribution extends CommonObject
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -676,11 +676,11 @@ class PaymentSocialContribution extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -663,16 +663,16 @@ class PaymentVAT extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
global $langs;
$langs->load('compta');
/*if ($mode == 0)

View File

@ -849,7 +849,7 @@ class Tva extends CommonObject
}
/**
* Retourne le libelle du statut d'une TVA (impaye, payee)
* Return the label of the VAT status f object
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
@ -862,7 +862,7 @@ class Tva extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given VAT status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto

View File

@ -1580,10 +1580,10 @@ class Contact extends CommonObject
}
/**
* Return label of contact status
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode)
{
@ -1592,11 +1592,11 @@ class Contact extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode)
{
@ -2009,9 +2009,9 @@ class Contact extends CommonObject
/**
* Return status of prospect
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @param int $mode 0=label long, 1=label short, 2=Picto + Label short, 3=Picto, 4=Picto + Label long
* @param string $label Label to use for status for added status
* @return string Libelle
* @return string Label
*/
public function getLibProspCommStatut($mode = 0, $label = '')
{
@ -2029,7 +2029,7 @@ class Contact extends CommonObject
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Libelle du statut
* @return string Label of status
*/
public function libProspCommStatut($statut, $mode = 0, $label = '', $picto = '')
{

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2015-2022 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2015-2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
/**
* \file htdocs/core/ajax/objectonoff.php
* \brief File to set status for an object
* \brief File to set status for an object. Called when ajax_object_onoff() is used.
* This Ajax service is oftenly called when option MAIN_DIRECT_STATUS_UPDATE is set.
*/
@ -45,6 +45,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage');
$id = GETPOST('id', 'int');
$element = GETPOST('element', 'alpha'); // 'myobject' (myobject=mymodule) or 'myobject@mymodule' or 'myobject_mysubobject' (myobject=mymodule)
@ -79,7 +80,7 @@ if (!empty($user->socid)) {
// We check permission.
// Check is done on $user->rights->element->create or $user->rights->element->subelement->create (because $action = 'set')
if (preg_match('/status$/', $field)) {
if (preg_match('/status$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) {
restrictedArea($user, $object->module, $object, $object->table_element, $usesublevelpermission);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid');
@ -114,4 +115,9 @@ if (($action == 'set') && !empty($id)) {
http_response_code(500);
exit;
}
if ($backtopage) {
header('Location: '.$backtopage);
exit;
}
}

View File

@ -305,10 +305,10 @@ class EmailSenderProfile extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of a given status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -317,11 +317,11 @@ class EmailSenderProfile extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public static function LibStatut($status, $mode = 0)
{

View File

@ -1267,7 +1267,7 @@ class ExtraFields
$labeltoshow = '';
$obj = $this->db->fetch_object($resql);
// Several field into label (eq table:code|libelle:rowid)
// Several field into label (eq table:code|label:rowid)
$notrans = false;
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label) && count($fields_label) > 1) {
@ -1487,7 +1487,7 @@ class ExtraFields
$obj = $this->db->fetch_object($resql);
$notrans = false;
// Several field into label (eq table:code|libelle:rowid)
// Several field into label (eq table:code|label:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) {
$notrans = true;
@ -1722,7 +1722,7 @@ class ExtraFields
$obj = $this->db->fetch_object($resql);
// Several field into label (eq table:code|libelle:rowid)
// Several field into label (eq table:code|label:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label) && count($fields_label) > 1) {
@ -1830,7 +1830,7 @@ class ExtraFields
$value = ''; // value was used, so now we reste it to use it to build final output
$toprint = array();
while ($obj = $this->db->fetch_object($resql)) {
// Several field into label (eq table:code|libelle:rowid)
// Several field into label (eq table:code|label:rowid)
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
if (is_array($fields_label) && count($fields_label) > 1) {

View File

@ -196,7 +196,7 @@ class Form
* @param string $value Value to show/edit
* @param object $object Object (that we want to show)
* @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
* @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value, or a select combo). Use '' to use same than $value
* @param object $extObject External object ???
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
@ -267,7 +267,7 @@ class Form
$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor'
$tmp = explode(':', $typeofdata);
$cols = (empty($tmp[2]) ? '' : $tmp[2]);
@ -342,7 +342,7 @@ class Form
$ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
$ret .= dol_htmlentitiesbr($value);
} elseif (preg_match('/^safehtmlstring/', $typeofdata)) {

View File

@ -476,13 +476,17 @@ class SMTPs
if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
$hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
} else {
} elseif ($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO == 1) {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is 1, we use the domain in the from.
// So if the from to is 'aaa <bbb@ccc.com>', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*</', '', $hosth);
$hosth = preg_replace('/>.*$/', '', $hosth);
$hosth = preg_replace('/.*@/', '', $hosth);
} elseif ($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO == 2) {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is 2, we use the domain in the $dolibarr_main_url_root.
global $dolibarr_main_url_root;
$hosth = getDomainFromURL($dolibarr_main_url_root, 1);
}
}

View File

@ -690,29 +690,33 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
}
/**
* On/off button to change status of an object
* This is called when MAIN_DIRECT_STATUS_UPDATE is set and it use tha ajax service objectonoff.php
* On/off button to change a property status of an object
* This uses the ajax service objectonoff.php (May be called when MAIN_DIRECT_STATUS_UPDATE is set for some pages)
*
* @param Object $object Object to set
* @param string $code Name of property in object : 'status' or 'status_buy' for product by example
* @param string $field Name of database field : 'tosell' or 'tobuy' for product by example
* @param string $text_on Text if on ('Text' or 'Text:css picto on')
* @param string $text_off Text if off ('Text' or 'Text:css picto on')
* @param string $text_on Text if on ('Text' or 'Text:Picto on:Css picto on')
* @param string $text_off Text if off ('Text' or 'Text:Picto off:Css picto off')
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param string $morecss More CSS
* @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on same page for same property.
* @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on the same page for the same field.
* @param int $forcenojs Force the component to work as link post (without javascript) instead of ajax call
* @return string html for button on/off
*/
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '')
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '', $forcenojs = 0)
{
global $langs;
global $conf, $langs;
if (empty($htmlname)) {
$htmlname = $code;
}
//var_dump($object->module); var_dump($object->element);
$out = '<script>
$out = '';
if (!empty($conf->use_javascript_ajax)) {
$out .= '<script>
$(function() {
var input = '.json_encode($input).';
@ -781,22 +785,36 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
});
});
</script>';
}
$switchon = 'switch_on';
$switchoff = 'switch_off';
$cssswitchon = '';
$cssswitchoff = '';
$tmparray = explode(':', $text_on);
if (!empty($tmparray[1])) {
$text_on = $tmparray[0];
$switchon = $tmparray[1];
if (!empty($tmparray[2])) {
$cssswitchon = $tmparray[2];
}
}
$tmparray = explode(':', $text_off);
if (!empty($tmparray[1])) {
$text_off = $tmparray[0];
$switchoff = $tmparray[1];
if (!empty($tmparray[2])) {
$cssswitchoff = $tmparray[2];
}
}
$out .= '<span id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_off), $switchoff).'</span>';
$out .= '<span id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_on), $switchon).'</span>';
if (empty($conf->use_javascript_ajax) || $forcenojs) {
$out .= '<a id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'" href="'.DOL_URL_ROOT.'/core/ajax/objectonoff.php?action=set&token='.newToken().'&id='.((int) $object->id).'&element='.urlencode($object->element).'&field='.urlencode($field).'&value=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.img_picto($langs->trans($text_off), $switchoff, '', false, 0, 0, '', $cssswitchoff).'</a>';
$out .= '<a id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'" href="'.DOL_URL_ROOT.'/core/ajax/objectonoff.php?action=set&token='.newToken().'&id='.((int) $object->id).'&element='.urlencode($object->element).'&field='.urlencode($field).'&value=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.img_picto($langs->trans($text_on), $switchon, '', false, 0, 0, '', $cssswitchon).'</a>';
} else {
$out .= '<span id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_off), $switchoff, '', false, 0, 0, '', $cssswitchoff).'</span>';
$out .= '<span id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_on), $switchon, '', false, 0, 0, '', $cssswitchon).'</span>';
}
return $out;
}

View File

@ -9884,10 +9884,10 @@ function dol_getmypid()
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < -1000"
* If param $mode is 2, can contains a list of int id separated by comma like "1,3,4"
* If param $mode is 3, can contains a list of string separated by comma like "a,b,c"
* @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4')
* 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4'
* If param $mode is 2 or -2, can contains a list of int id separated by comma like "1,3,4"
* If param $mode is 3 or -3, can contains a list of string separated by comma like "a,b,c".
* @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4'), -2 is for exclude list,
* 3=value is list of string separated with comma (Example 'text 1,text 2'), -3 if for exclude list, 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4'
* @param integer $nofirstand 1=Do not output the first 'AND'
* @return string $res The statement to append to the SQL query
* @see dolSqlDateFilter()
@ -9902,7 +9902,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$value = preg_replace('/\*/', '%', $value); // Replace * with %
}
if ($mode == 1) {
$value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
$value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can then explode on space to get all tests to do
}
$value = preg_replace('/\s*\|\s*/', '|', $value);
@ -9913,16 +9913,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$fields = array($fields);
}
$j = 0;
foreach ($crits as $crit) {
$i1 = 0; // count the nb of and criteria added (all fields / criterias)
foreach ($crits as $crit) { // Loop on each AND criteria
$crit = trim($crit);
$i = 0;
$i2 = 0;
$i2 = 0; // count the nb of valid criteria added for this this first criteria
$newres = '';
foreach ($fields as $field) {
if ($mode == 1) {
$tmpcrits = explode('|', $crit);
$i3 = 0; // count the nb of valid criteria added for this field
$i3 = 0; // count the nb of valid criteria added for this current field
foreach ($tmpcrits as $tmpcrit) {
if ($tmpcrit !== '0' && empty($tmpcrit)) {
continue;
@ -9949,7 +9948,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$i3++; // a criteria was added to string
}
}
$i2++;
$i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 2 || $mode == -2) {
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '');
@ -9957,7 +9956,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if ($mode == -2) {
$newres .= ' OR '.$field.' IS NULL';
}
$i2++; // a criteria was added to string
$i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 3 || $mode == -3) {
$tmparray = explode(',', $crit);
if (count($tmparray)) {
@ -9970,7 +9969,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
}
}
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
$i2++; // a criteria was added to string
$i2++; // a criteria for 1 more field was added to string
}
if ($mode == -3) {
$newres .= ' OR '.$field.' IS NULL';
@ -9987,20 +9986,20 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$newres .= ' OR '.$field." LIKE '%,".$db->escape($val)."'";
$newres .= ' OR '.$field." LIKE '%,".$db->escape($val).",%'";
$newres .= ')';
$i2++;
$i2++; // a criteria for 1 more field was added to string (we can add several citeria for the same field as it is a multiselect search criteria)
}
}
}
} else { // $mode=0
$tmpcrits = explode('|', $crit);
$i3 = 0; // count the nb of valid criteria added for this field
foreach ($tmpcrits as $tmpcrit) {
$i3 = 0; // count the nb of valid criteria added for the current couple criteria/field
foreach ($tmpcrits as $tmpcrit) { // loop on each OR criteria
if ($tmpcrit !== '0' && empty($tmpcrit)) {
continue;
}
$tmpcrit = trim($tmpcrit);
if ($tmpcrit == '^$') { // If we search empty, we must combined different fields with AND
if ($tmpcrit == '^$' || strpos($crit, '!') === 0) { // If we search empty, we must combined different OR fields with AND
$newres .= (($i2 > 0 || $i3 > 0) ? ' AND ' : '');
} else {
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
@ -10046,15 +10045,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$i3++;
}
$i2++; // a criteria was added to string
$i2++; // a criteria for 1 more field was added to string
}
$i++;
}
if ($newres) {
$res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : '');
}
$j++;
$i1++;
}
$res = ($nofirstand ? "" : " AND ")."(".$res.")";
@ -11329,6 +11328,12 @@ function getElementProperties($element_type)
$classpath = 'contrat/class';
$module = 'contrat';
$subelement = 'contrat';
} elseif ($element_type == 'mailing') {
$classpath = 'comm/mailing/class';
$module = 'mailing';
$classfile = 'mailing';
$classname = 'Mailing';
$subelement = '';
} elseif ($element_type == 'member') {
$classpath = 'adherents/class';
$module = 'adherent';
@ -11425,7 +11430,6 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '')
$ret = 0;
$element_prop = getElementProperties($element_type);
//var_dump($element_prop);
if (is_array($element_prop) && isModEnabled($element_prop['module'])) {
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');

View File

@ -238,7 +238,7 @@ class CommActionRapport
$sql = "SELECT s.nom as thirdparty, s.rowid as socid, s.client,";
$sql .= " a.id, a.datep as dp, a.datep2 as dp2,";
$sql .= " a.fk_contact, a.note, a.percent as percent, a.fulldayevent, a.label, a.fk_project,";
$sql .= " c.code, c.libelle,";
$sql .= " c.code, c.libelle as label_type,";
$sql .= " u.login";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";

View File

@ -107,7 +107,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
}
/**
* Renvoi libelle d'un driver export
* Return label of driver export
*
* @param string $key Key of driver
* @return string Label
@ -140,7 +140,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
}
/**
* Renvoi libelle de librairie externe du driver
* Renvoi label of driver lib
*
* @param string $key Key of driver
* @return string Label of library
@ -151,7 +151,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
}
/**
* Renvoi version de librairie externe du driver
* Return version of driver lib
*
* @param string $key Key of driver
* @return string Version of library

View File

@ -253,7 +253,7 @@ class ModeleImports
}
/**
* Renvoi libelle d'un driver import
* Return label of driver import
*
* @param string $key Key
* @return string
@ -264,7 +264,7 @@ class ModeleImports
}
/**
* Renvoi la description d'un driver import
* Return description of import drivervoi la description d'un driver import
*
* @param string $key Key
* @return string

View File

@ -82,6 +82,9 @@ class mailing_advthirdparties extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT OUTER JOIN ".MAIN_DB_PREFIX."societe_extrafields se ON se.fk_object=s.rowid";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
$sql .= " AND s.rowid IN (".$this->db->sanitize(implode(',', $socid)).")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY email";
// Stock recipients emails into targets table
@ -132,6 +135,9 @@ class mailing_advthirdparties extends MailingTargets
if (count($socid) > 0) {
$sql .= " AND socp.fk_soc IN (".$this->db->sanitize(implode(',', $socid)).")";
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = socp.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY email";
// Stock recipients emails into targets table
@ -211,6 +217,9 @@ class mailing_advthirdparties extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.email != ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);

View File

@ -82,7 +82,6 @@ class mailing_contacts1 extends MailingTargets
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$statssql[0] .= " WHERE c.entity IN (".getEntity('contact').")";
$statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false
$statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
$statssql[0] .= " AND c.statut = 1";
return $statssql;
@ -104,7 +103,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql .= " WHERE c.entity IN (".getEntity('contact').")";
$sql .= " AND c.email <> ''"; // Note that null != '' is false
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = c.email and mu.entity = ".((int) $conf->entity).")";
}
// exclude unsubscribed users
$sql .= " AND c.statut = 1";
@ -331,7 +332,7 @@ class mailing_contacts1 extends MailingTargets
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Ajoute destinataires dans table des cibles
* Add some recipients into target table
*
* @param int $mailing_id Id of emailing
* @return int <0 si erreur, nb ajout si ok
@ -389,7 +390,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
$sql .= " AND sp.email <> ''";
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = sp.email and mu.entity = ".((int) $conf->entity).")";
}
// Exclude unsubscribed email adresses
$sql .= " AND sp.statut = 1";
$sql .= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";

View File

@ -85,6 +85,9 @@ class mailing_eventorganization extends MailingTargets
$sql .= " AND p.entity IN (".getEntity('project').")";
$sql .= " AND e.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND e.fk_project = ".((int) GETPOST('filter_eventorganization', 'int'));
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = e.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY e.email";
// Stock recipients emails into targets table
@ -159,14 +162,15 @@ class mailing_eventorganization extends MailingTargets
*/
public function getNbOfRecipients($sql = '')
{
global $conf;
$sql = "SELECT COUNT(DISTINCT(e.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee as e, ";
$sql .= " ".MAIN_DB_PREFIX."projet as p";
$sql .= " WHERE e.email <> ''";
$sql .= " AND e.fk_project = p.rowid";
$sql .= " AND p.entity IN (".getEntity('project').")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = e.email and mu.entity = ".((int) $conf->entity).")";
}
//print $sql;

View File

@ -101,6 +101,9 @@ class mailing_fraise extends MailingTargets
$sql = "SELECT count(distinct(a.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity IN (".getEntity('member').")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = a.email and mu.entity = ".((int) $conf->entity).")";
}
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
@ -278,6 +281,9 @@ class mailing_fraise extends MailingTargets
if (GETPOST('filter_type', 'int') > 0) {
$sql .= " AND ta.rowid = ".((int) GETPOST('filter_type', 'int'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = a.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY a.email";
//print $sql;

View File

@ -53,6 +53,12 @@ class MailingTargets // This can't be abstract as it is used for some method
*/
public $sql;
public $desc;
public $name;
public $evenunsubscribe = 0; // Set this to 1 if you want to flag you also want to include email in target that has opt-out.
/**
* Constructor
@ -111,8 +117,11 @@ class MailingTargets // This can't be abstract as it is used for some method
{
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
return $obj->nb;
$total = 0;
while ($obj = $this->db->fetch_object($result)) {
$total += $obj->nb;
}
return $total;
} else {
$this->error = $this->db->lasterror();
return -1;
@ -149,7 +158,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$nb = $obj->nb;
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing";
$sql .= " SET nbemail = ".$nb." WHERE rowid = ".((int) $mailing_id);
$sql .= " SET nbemail = ".((int) $nb)." WHERE rowid = ".((int) $mailing_id);
if (!$this->db->query($sql)) {
dol_syslog($this->db->error());
$this->error = $this->db->error();
@ -162,11 +171,11 @@ class MailingTargets // This can't be abstract as it is used for some method
}
/**
* Add a list of targets int the database
* Add a list of targets into the database
*
* @param int $mailing_id Id of emailing
* @param array $cibles Array with targets
* @return int < 0 si erreur, nb ajout si ok
* @return int < 0 if error, nb added if OK
*/
public function addTargetsToDatabase($mailing_id, $cibles)
{
@ -186,15 +195,15 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= " lastname, firstname, email, other, source_url, source_id,";
$sql .= " tag,";
$sql .= " source_type)";
$sql .= " VALUES (".$mailing_id.",";
$sql .= (empty($targetarray['fk_contact']) ? '0' : "'".$this->db->escape($targetarray['fk_contact'])."'").",";
$sql .= " VALUES (".((int) $mailing_id).",";
$sql .= (empty($targetarray['fk_contact']) ? '0' : (int) $targetarray['fk_contact']).",";
$sql .= "'".$this->db->escape($targetarray['lastname'])."',";
$sql .= "'".$this->db->escape($targetarray['firstname'])."',";
$sql .= "'".$this->db->escape($targetarray['email'])."',";
$sql .= "'".$this->db->escape($targetarray['other'])."',";
$sql .= "'".$this->db->escape($targetarray['source_url'])."',";
$sql .= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
$sql .= "'".$this->db->escape(dol_hash($dolibarr_main_instance_unique_id.";".$targetarray['email'].";".$targetarray['lastname'].";".$mailing_id.";".$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY, 'md5'))."',";
$sql .= "'".$this->db->escape(dol_hash($dolibarr_main_instance_unique_id.";".$targetarray['email'].";".$targetarray['lastname'].";".((int) $mailing_id).";".getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY'), 'md5'))."',";
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
@ -232,16 +241,20 @@ class MailingTargets // This can't be abstract as it is used for some method
$result=$this->db->query($sql);
*/
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " SET statut=3";
$sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
if (empty($this->evenunsubscribe)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " SET mc.statut = 3";
$sql .= " WHERE mc.fk_mailing = ".((int) $mailing_id);
$sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = mc.email and mu.entity = ".((int) $conf->entity).")";
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
dol_print_error($this->db);
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
dol_print_error($this->db);
}
}
// Update nb of recipient into emailing record
$this->update_nb($mailing_id);
$this->db->commit();

View File

@ -86,6 +86,9 @@ class mailing_partnership extends MailingTargets
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " UNION ";
@ -99,6 +102,9 @@ class mailing_partnership extends MailingTargets
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY email";
@ -180,6 +186,9 @@ class mailing_partnership extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.rowid = p.fk_soc AND s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " UNION ";
@ -187,6 +196,9 @@ class mailing_partnership extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."adherent as s";
$sql .= " WHERE s.rowid = p.fk_member AND s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('member').")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
//print $sql;

View File

@ -78,6 +78,7 @@ class mailing_pomme extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
$sql .= " AND u.entity IN (0,".$conf->entity.")";
$statssql[0] = $sql;
return $statssql;
@ -100,6 +101,9 @@ class mailing_pomme extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
$sql .= " AND u.entity IN (0,".$conf->entity.")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = u.email and mu.entity = ".((int) $conf->entity).")";
}
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
@ -183,6 +187,9 @@ class mailing_pomme extends MailingTargets
if (GETPOSTISSET("filteremployee") && GETPOST("filteremployee") == '0') {
$sql .= " AND u.employee=0";
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = u.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY u.email";
// Stocke destinataires dans cibles

View File

@ -142,6 +142,9 @@ class mailing_thirdparties extends MailingTargets
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0";
}
$sql .= $addFilter;
} else {
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
@ -154,6 +157,9 @@ class mailing_thirdparties extends MailingTargets
if (GETPOST('filter_thirdparties', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter_thirdparties', 'int'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0";
}
$sql .= $addFilter;
$sql .= " UNION ";
$sql .= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
@ -166,6 +172,9 @@ class mailing_thirdparties extends MailingTargets
if (GETPOST('filter_thirdparties', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter_thirdparties', 'int'));
}
if (empty($this->evenunsubscribe)) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0";
}
$sql .= $addFilter;
}
$sql .= " ORDER BY email";
@ -250,7 +259,10 @@ class mailing_thirdparties extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
}

View File

@ -116,6 +116,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
$sql .= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
$sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid AND p.ref = '".$this->db->escape($product)."'";
$sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$sql .= " ORDER BY s.email";
// Stocke destinataires dans cibles
@ -201,6 +204,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
$sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid";
$sql .= " AND p.ref IN (".$this->db->sanitize("'".join("','", $this->arrayofproducts)."'", 1).")";
$sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
}
$a = parent::getNbOfRecipients($sql);

View File

@ -1479,7 +1479,7 @@ class Cronjob extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return label of a giver status
*
* @param int $status Id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto

View File

@ -899,10 +899,10 @@ class Delivery extends CommonObject
/**
* Retourne le libelle du statut d'une expedition
* Return the label of the status
*
* @param int $mode Mode
* @return string Label
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -911,11 +911,11 @@ class Delivery extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode)
{

View File

@ -507,10 +507,10 @@ class PaymentDonation extends CommonObject
/**
* Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -519,11 +519,11 @@ class PaymentDonation extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -589,9 +589,9 @@ class EcmDirectory extends CommonObject
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)

View File

@ -918,9 +918,9 @@ class EcmFiles extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)

View File

@ -2228,6 +2228,8 @@ class EmailCollector extends CommonObject
}
}
}
} else {
dol_syslog("One and only one existing third party has been found");
}
}
}
@ -2723,6 +2725,8 @@ class EmailCollector extends CommonObject
}
}
}
} else {
$operationslog .= '<br>Project already exists for msgid ='.dol_escape_htmltag($msgid);
}
} elseif ($operation['type'] == 'ticket') {
// Create ticket

View File

@ -1874,7 +1874,7 @@ class Expedition extends CommonObject
* Return status label
*
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
* @return string Libelle
* @return string Label
*/
public function getLibStatut($mode = 0)
{

View File

@ -445,10 +445,10 @@ class PaymentExpenseReport extends CommonObject
/**
* Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -457,16 +457,16 @@ class PaymentExpenseReport extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
//global $langs;
return '';
}

View File

@ -86,6 +86,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine
public $qty_asked;
public $libelle;
public $label;
public $desc;
public $tva_tx;
public $vat_src_code;

View File

@ -581,10 +581,10 @@ class PaiementFourn extends Paiement
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -593,11 +593,11 @@ class PaiementFourn extends Paiement
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -947,7 +947,7 @@ if ($action == 'create') {
}
$htmltext .= '</i>';
// Libelle
// Label
print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>';
print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">';
print '</td></tr>';

View File

@ -162,9 +162,9 @@ class Import
$this->array_import_perms[$i] = $user->rights->import->run;
// Icon
$this->array_import_icon[$i] = (isset($module->import_icon[$r]) ? $module->import_icon[$r] : $module->picto);
// Code du dataset export
// Code of dataset export
$this->array_import_code[$i] = $module->import_code[$r];
// Libelle du dataset export
// Label of dataset export
$this->array_import_label[$i] = $module->getImportDatasetLabel($r);
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i] = $module->import_tables_array[$r];

View File

@ -386,9 +386,11 @@ ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_
ALTER TABLE llx_bordereau_cheque ADD COLUMN label varchar(255) AFTER ref;
ALTER TABLE llx_societe ADD COLUMN vat_reverse_charge tinyint DEFAULT 0 AFTER tva_assuj;
ALTER TABLE llx_facture_fourn ADD COLUMN vat_reverse_charge tinyint DEFAULT 0 AFTER close_note;
ALTER TABLE llx_societe ADD COLUMN vat_reverse_charge smallint DEFAULT 0 AFTER tva_assuj;
ALTER TABLE llx_facture_fourn ADD COLUMN vat_reverse_charge smallint DEFAULT 0 AFTER close_note;
ALTER TABLE llx_c_email_templates add COLUMN defaultfortype smallint DEFAULT 0;
ALTER TABLE llx_mailing ADD COLUMN fk_user_modif integer AFTER fk_user_creat;
ALTER TABLE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0;
ALTER TABLE llx_mailing ADD COLUMN name_from varchar(128) AFTER email_from;

View File

@ -18,10 +18,10 @@
-- ========================================================================
-- redaction : 0
-- valide : 1
-- approuve : 2
-- envoye : 3
-- draft : 0
-- valid : 1
-- approved : 2
-- sent : 3
create table llx_mailing
(
@ -37,6 +37,7 @@ create table llx_mailing
cible varchar(60),
nbemail integer,
email_from varchar(160), -- Email address of sender
name_from varchar(128), -- Name to show of sender
email_replyto varchar(160), -- Email address for reply
email_errorsto varchar(160), -- Email addresse for errors
tag varchar(128) NULL,
@ -46,6 +47,7 @@ create table llx_mailing
date_envoi datetime, -- date d'envoi
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer, -- user creator
fk_user_modif integer, -- user of last modification
fk_user_valid integer, -- user validator
fk_user_appro integer, -- not used
extraparams varchar(255), -- for stock other parameters with json format

View File

@ -180,3 +180,6 @@ DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new c
DefaultStatusEmptyMandatory=Empty but mandatory
WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to <b>%s</b>. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota.
NoMoreRecipientToSendTo=No more recipient to send the email to
EmailOptedOut=Email owner has requested to not contact him with this email anymore
EvenUnsubscribe=Include opt-out emails
EvenUnsubscribeDesc=Include opt-out emails when you select emails as targets. Usefull for mandatory service emails for example.

View File

@ -453,10 +453,10 @@ class PaymentLoan extends CommonObject
}
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{

View File

@ -753,13 +753,14 @@ class MyObject extends CommonObject
/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
* @since v18
* @return array
*
* @param array $params Params to construct tooltip data
* @since v18
* @return array
*/
public function getTooltipContentArray($params)
{
global $conf, $langs, $user;
global $conf, $langs;
$datas = [];
@ -959,7 +960,7 @@ class MyObject extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the status
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto

View File

@ -666,8 +666,8 @@ class Opensurveysondage extends CommonObject
/**
* Return status label of Order
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label if status
*/
public function getLibStatut($mode)
{
@ -678,9 +678,9 @@ class Opensurveysondage extends CommonObject
/**
* Return label of status
*
* @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode)
{

View File

@ -607,9 +607,9 @@ class Inventory extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)

View File

@ -1154,10 +1154,10 @@ class MouvementStock extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un status donne
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($mode = 0)
{

View File

@ -532,9 +532,9 @@ class ProductStockEntrepot extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)

View File

@ -506,7 +506,6 @@ if ($search_opp_percent) {
$sql .= dolSqlDateFilter('p.dateo', $search_sday, $search_smonth, $search_syear);
$sql .= dolSqlDateFilter('p.datee', $search_eday, $search_emonth, $search_eyear);
if ($search_date_start_start) {
$sql .= " AND p.dateo >= '".$db->idate($search_date_start_start)."'";
}
@ -1469,7 +1468,7 @@ while ($i < $imaxinloop) {
}
// Project url
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowraponall">';
print '<td class="nowraponall tdoverflowmax200" title="'.dol_escape_htmltag($object->ref).'">';
print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':''));
if ($object->hasDelay()) {
print img_warning($langs->trans('Late'));

View File

@ -1383,7 +1383,8 @@ class Reception extends CommonObject
while ($xnbp < $nbp) {
$line = new CommandeFournisseurDispatch($this->db);
$line->desc = $langs->trans("Description")." ".$xnbp;
$line->libelle = $langs->trans("Description")." ".$xnbp;
$line->libelle = $langs->trans("Description")." ".$xnbp; // deprecated
$line->label = $langs->trans("Description")." ".$xnbp;
$line->qty = 10;
$line->fk_product = $this->commande->lines[$xnbp]->fk_product;

View File

@ -750,7 +750,7 @@ class Dolresource extends CommonObject
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("ResourceTypeShort".$obj->code) != ("ResourceTypeShort".$obj->code) ? $langs->trans("ResourceTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_code_type_resource[$obj->rowid]['code'] = $obj->code;
$this->cache_code_type_resource[$obj->rowid]['label'] = $label;
@ -875,9 +875,9 @@ class Dolresource extends CommonObject
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)

View File

@ -674,9 +674,9 @@ class Salary extends CommonObject
/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
* Return label of current status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=label long, 1=labels short, 2=Picto + Label short, 3=Picto, 4=Picto + Label long, 5=Label short + Picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
@ -687,7 +687,7 @@ class Salary extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto

View File

@ -4643,7 +4643,7 @@ class Societe extends CommonObject
/**
* Return prostect level
*
* @return string Libelle
* @return string Label of prospect status
*/
public function getLibProspLevel()
{
@ -4673,9 +4673,9 @@ class Societe extends CommonObject
/**
* Return status of prospect
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @param int $mode 0=label long, 1=label short, 2=Picto + Label short, 3=Picto, 4=Picto + Label long
* @param string $label Label to use for status for added status
* @return string Libelle
* @return string Label
*/
public function getLibProspCommStatut($mode = 0, $label = '')
{

View File

@ -467,10 +467,10 @@ class SocieteAccount extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of a given status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{

View File

@ -685,17 +685,14 @@ class Ticket extends CommonObject
$this->timing = $obj->timing;
$this->type_code = $obj->type_code;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : ''));
$this->type_label = $label_type;
$this->category_code = $obj->category_code;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : ''));
$this->category_label = $label_category;
$this->severity_code = $obj->severity_code;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : ''));
$this->severity_label = $label_severity;
@ -855,17 +852,14 @@ class Ticket extends CommonObject
$line->progress = $obj->progress;
$line->timing = $obj->timing;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : ''));
$line->type_label = $label_type;
$this->category_code = $obj->category_code;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : ''));
$line->category_label = $label_category;
$this->severity_code = $obj->severity_code;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : ''));
$line->severity_label = $label_severity;
@ -1254,7 +1248,6 @@ class Ticket extends CommonObject
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("TicketTypeShort".$obj->code) != ("TicketTypeShort".$obj->code) ? $langs->trans("TicketTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_types_tickets[$obj->rowid]['code'] = $obj->code;
$this->cache_types_tickets[$obj->rowid]['label'] = $label;
@ -1343,7 +1336,6 @@ class Ticket extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->cache_severity_tickets[$obj->rowid]['code'] = $obj->code;
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("TicketSeverityShort".$obj->code) != ("TicketSeverityShort".$obj->code) ? $langs->trans("TicketSeverityShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_severity_tickets[$obj->rowid]['label'] = $label;
$this->cache_severity_tickets[$obj->rowid]['use_default'] = $obj->use_default;

View File

@ -698,9 +698,9 @@ class UserGroup extends CommonObject
/**
* Return label of status of user (active, inactive)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@ -710,11 +710,11 @@ class UserGroup extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -305,12 +305,37 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
}
}
if ($prodcomb->update($user) > 0) {
$error = 0;
$db->begin();
// Update product variant ref
$product_child = new Product($db);
$product_child->fetch($prodcomb->fk_product_child);
$product_child->oldcopy = clone $product_child;
$product_child->ref = $reference;
$result = $product_child->update($product_child->id, $user);
if ($result < 0) {
setEventMessages($product_child->error, $product_child->errors, 'errors');
$error++;
}
if (!$error) {
// Update product variant infos
$result = $prodcomb->update($user);
if ($result < 0) {
setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
$error++;
}
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
header('Location: ' . dol_buildpath('/variants/combinations.php?id=' . $id, 2));
exit();
} else {
setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
$db->rollback();
}
}
@ -339,6 +364,9 @@ if ($action === 'confirm_deletecombination') {
exit();
}
$product_child = new Product($db);
$product_child->fetch($prodcomb->fk_product_child);
$reference = $product_child->ref;
$weight_impact = $prodcomb->variation_weight;
$price_impact = $prodcomb->variation_price;
$price_impact_percent = $prodcomb->variation_price_percentage;

View File

@ -852,9 +852,9 @@ class Website extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@ -864,11 +864,11 @@ class Website extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un status donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -795,9 +795,9 @@ class WebsitePage extends CommonObject
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
* Return the label of the status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@ -807,11 +807,11 @@ class WebsitePage extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un status donne
* Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{

View File

@ -156,8 +156,6 @@ class Workstation extends CommonObject
$this->db = $db;
$this->fields['ref']['default'] = $this->getNextNumRef();
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
$this->fields['rowid']['visible'] = 0;
}

View File

@ -148,8 +148,6 @@ if (empty($reshook)) {
/*
* View
*
* Put here all code to build page
*/
$form = new Form($db);
@ -190,6 +188,9 @@ llxHeader('', $title, $help_url);
// Part to create
if ($action == 'create') {
// Set default value of the property ref
$object->fields['ref']['default'] = $object->getNextNumRef();
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Workstation")), '', 'object_'.$object->picto);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -213,7 +213,7 @@ $formresource = new FormResource($db);
$now = dol_now();
$help_url = 'EN:Module_Workstation';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Workstations"));
$title = $langs->trans("Workstations");
$morejs = array();
$morecss = array();