2
0
forked from Wavyzz/dolibarr

Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2021-08-17 13:52:36 +02:00
11 changed files with 80 additions and 40 deletions

View File

@@ -1027,6 +1027,12 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}

View File

@@ -47,7 +47,7 @@ $error = 0;
*/
// Action to update or add a constant
if ($action == 'settemplates') {
if ($action == 'settemplates' && $user->admin) {
$db->begin();
if (!$error && is_array($_POST)) {
@@ -192,7 +192,8 @@ print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationEMailFrom").'</td>';
print '<td>';
print '<input size="32" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input class="width300" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) {
print ' '.img_warning($langs->trans("ErrorBadEMail"));
}
@@ -270,7 +271,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
}
$helptext = '';
form_constantes($constantes, 3, $helptext);
form_constantes($constantes, 3, $helptext, 'EmailTemplate');
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
} else {
@@ -316,15 +324,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '</td></tr>';
print '</table>';
}
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
}
print '</div>';
print '</form>';
@@ -335,6 +342,7 @@ print '<br><br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setfixednotif">';
print '<input type="hidden" name="page_y" value="">';
print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', '');
@@ -376,6 +384,12 @@ foreach ($listofnotifiedevents as $notifiedevent) {
$elementLabel = $langs->trans('ExpenseReport');
}
$labelfortrigger = 'AmountHT';
$codehasnotrigger = 0;
if (preg_match('/^HOLIDAY/', $notifiedevent['code'])) {
$codehasnotrigger++;
}
print '<tr class="oddeven">';
print '<td>';
print img_picto('', $elementPicto, 'class="pictofixedwidth"');
@@ -384,6 +398,7 @@ foreach ($listofnotifiedevents as $notifiedevent) {
print '<td>'.$notifiedevent['code'].'</td>';
print '<td><span class="opacitymedium">'.$label.'</span></td>';
print '<td>';
$inputfieldalreadyshown = 0;
// Notification with threshold
foreach ($conf->global as $key => $val) {
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) {
@@ -407,24 +422,35 @@ foreach ($listofnotifiedevents as $notifiedevent) {
}
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
print '<br>';
$inputfieldalreadyshown++;
}
// New entry input fields
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
if (empty($inputfieldalreadyshown) || !$codehasnotrigger) {
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
}
print '</td>';
print '<td>';
// Notification with threshold
$inputfieldalreadyshown = 0;
foreach ($conf->global as $key => $val) {
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) {
continue;
}
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
if (!$codehasnotrigger) {
print $langs->trans($labelfortrigger).' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
$inputfieldalreadyshown++;
}
}
// New entry input fields
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
if (!$codehasnotrigger) {
print $langs->trans($labelfortrigger).' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
}
print '</td>';
print '<td>';
@@ -437,7 +463,7 @@ print '</table>';
print '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
print '<div class="center"><input type="submit" class="button button-save reposition" value="'.$langs->trans("Save").'"></div>';
print '</form>';

View File

@@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
// Load translation files required by the page
$langs->loadLangs(array('products', 'contracts', 'companies'));
$optioncss = GETPOST('optioncss', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
@@ -58,7 +60,6 @@ $search_name = GETPOST("search_name", 'alpha');
$search_contract = GETPOST("search_contract", 'alpha');
$search_service = GETPOST("search_service", 'alpha');
$search_status = GETPOST("search_status", 'alpha');
$statut = GETPOST('statut', 'int') ?GETPOST('statut', 'int') : 1;
$search_product_category = GETPOST('search_product_category', 'int');
$socid = GETPOST('socid', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractservicelist'.$mode;
@@ -412,16 +413,16 @@ if (!empty($filter_op2) && $filter_op2 != -1) {
if (!empty($filter_opcloture) && $filter_opcloture != -1) {
$param .= '&amp;filter_opcloture='.urlencode($filter_opcloture);
}
if ($filter_dateouvertureprevue != '') {
if ($filter_dateouvertureprevue_start != '') {
$param .= '&amp;opouvertureprevueday='.$opouvertureprevueday.'&amp;opouvertureprevuemonth='.$opouvertureprevuemonth.'&amp;opouvertureprevueyear='.$opouvertureprevueyear;
}
if ($filter_date1 != '') {
if ($filter_date1_start != '') {
$param .= '&amp;op1day='.$op1day.'&amp;op1month='.$op1month.'&amp;op1year='.$op1year;
}
if ($filter_date2 != '') {
if ($filter_date2_start != '') {
$param .= '&amp;op2day='.$op2day.'&amp;op2month='.$op2month.'&amp;op2year='.$op2year;
}
if ($filter_datecloture != '') {
if ($filter_datecloture_start != '') {
$param .= '&amp;opclotureday='.$op2day.'&amp;opcloturemonth='.$op2month.'&amp;opclotureyear='.$op2year;
}
if ($optioncss != '') {

View File

@@ -515,7 +515,7 @@ class Notify
case 'SHIPPING_VALIDATE':
$link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
$object_type = 'expedition';
$object_type = 'shipping';
$labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE;
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
break;

View File

@@ -1528,10 +1528,11 @@ function complete_elementList_with_modules(&$elementList)
* @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label)
* where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended)
* @param string $helptext Help
* @param string $helptext Tooltip help to use for the column name of values
* @param string $text Text to use for the column name of values
* @return void
*/
function form_constantes($tableau, $strictw3c = 0, $helptext = '')
function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Value')
{
global $db, $langs, $conf, $user;
global $_Avery_Labels;
@@ -1552,7 +1553,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
print '<tr class="liste_titre">';
print '<td class="">'.$langs->trans("Description").'</td>';
print '<td>';
$text = $langs->trans("Value");
$text = $langs->trans($text);
print $form->textwithpicto($text, $helptext, 1, 'help', '', 0, 2, 'idhelptext');
print '</td>';
if (empty($strictw3c)) {

View File

@@ -20,7 +20,7 @@
/**
* \file htdocs/core/lib/barcode.lib.php
* \brief Set of functions used for barcode generation
* \brief Set of functions used for barcode generation (internal lib, also code 'phpbarcode')
* \ingroup core
*/
@@ -69,7 +69,7 @@ if (defined('PHP-BARCODE_PATH_COMMAND')) {
* Print barcode
*
* @param string $code Code
* @param string $encoding Encoding
* @param string $encoding Encoding ('EAN13', 'ISBN', 'C128', 'UPC', 'CBR', 'QRCODE', 'DATAMATRIX', 'ANY'...)
* @param integer $scale Scale
* @param string $mode 'png' or 'jpg' ...
* @return array|string $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) or string with error message
@@ -149,12 +149,10 @@ function barcode_encode($code, $encoding)
dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
$bars = barcode_encode_genbarcode($code, $encoding);
} else {
print "barcode_encode needs an external programm for encodings other then EAN/ISBN (code=".$code.", encoding=".$encoding.")<BR>\n";
print "barcode_encode needs an external program for encodings other then EAN/ISBN (code=".dol_escape_htmltag($code).", encoding=".dol_escape_htmltag($encoding).")<BR>\n";
print "<UL>\n";
print "<LI>download gnu-barcode from <A href=\"https://www.gnu.org/software/barcode/\">www.gnu.org/software/barcode/</A>\n";
print "<LI>compile and install them\n";
print "<LI>download genbarcode from <A href=\"http://www.ashberg.de/bar/\">www.ashberg.de/bar/</A>\n";
print "<LI>compile and install them\n";
print "<LI>specify path the genbarcode in barcode module setup\n";
print "</UL>\n";
print "<BR>\n";

View File

@@ -20,7 +20,7 @@
/**
* \file htdocs/core/modules/barcode/doc/phpbarcode.modules.php
* \ingroup barcode
* \brief File with class to generate barcode images using php barcode generator
* \brief File with class to generate barcode images using php internal lib barcode generator
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php';
@@ -126,7 +126,7 @@ class modPhpbarcode extends ModeleBarCode
*
* @param string $code Value to encode
* @param string $encoding Mode of encoding
* @param string $readable Code can be read
* @param string $readable Code can be read (What is this ? is this used ?)
* @param integer $scale Scale
* @param integer $nooutputiferror No output if error
* @return int <0 if KO, >0 if OK
@@ -163,7 +163,7 @@ class modPhpbarcode extends ModeleBarCode
if (!is_array($result)) {
$this->error = $result;
if (empty($nooutputiferror)) {
print $this->error;
print dol_escape_htmltag($this->error);
}
return -1;
}

View File

@@ -100,7 +100,7 @@ class modTcpdfbarcode extends ModeleBarCode
*
* @param string $code Value to encode
* @param string $encoding Mode of encoding
* @param string $readable Code can be read
* @param string $readable Code can be read (What is this ? is this used ?)
* @param integer $scale Scale (not used with this engine)
* @param integer $nooutputiferror No output if error (not used with this engine)
* @return int <0 if KO, >0 if OK

View File

@@ -1372,7 +1372,7 @@ AccountCodeManager=Options for automatic generation of customer/vendor accountin
NotificationsDesc=Email notifications can be sent automatically for some Dolibarr events.<br>Recipients of notifications can be defined:
NotificationsDescUser=* per user, one user at a time.
NotificationsDescContact=* per third-party contacts (customers or vendors), one contact at a time.
NotificationsDescGlobal=* or by setting global email addresses in this setup page.
NotificationsDescGlobal=* or by setting global email addresses in the setup page of the module.
ModelModules=Document Templates
DocumentModelOdt=Generate documents from OpenDocument templates (.ODT / .ODS files from LibreOffice, OpenOffice, KOffice, TextEdit,...)
WatermarkOnDraft=Watermark on draft document

View File

@@ -226,13 +226,14 @@ if ($result > 0) {
// List of notifications enabled for contacts
$sql = "SELECT n.rowid, n.type,";
$sql .= " a.code, a.label,";
$sql .= " c.rowid as userid, c.lastname, c.firstname, c.email";
$sql .= " c.rowid as userid, c.entity, c.login, c.lastname, c.firstname, c.email, c.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql .= " ".MAIN_DB_PREFIX."notify_def as n,";
$sql .= " ".MAIN_DB_PREFIX."user c";
$sql .= " WHERE a.rowid = n.fk_action";
$sql .= " AND c.rowid = n.fk_user";
$sql .= " AND c.rowid = ".$object->id;
$sql .= " AND c.entity IN (".getEntity('user').')';
$resql = $db->query($sql);
if ($resql) {
@@ -311,6 +312,9 @@ if ($result > 0) {
$userstatic->id = $obj->userid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->status;
print '<tr class="oddeven"><td>'.$userstatic->getNomUrl(1);
if ($obj->type == 'email') {
if (isValidEmail($obj->email)) {

View File

@@ -282,10 +282,14 @@ if (preg_match('/\.\./', $fullpath_original_file) || preg_match('/[<>|]/', $full
if ($modulepart == 'barcode') {
$generator = GETPOST("generator", "alpha");
$code = GETPOST("code", 'none'); // This can be rich content (qrcode, datamatrix, ...)
$encoding = GETPOST("encoding", "alpha");
$readable = GETPOST("readable", 'alpha') ?GETPOST("readable", "alpha") : "Y";
$generator = GETPOST("generator", "aZ09");
$encoding = GETPOST("encoding", "aZ09");
$readable = GETPOST("readable", 'aZ09') ? GETPOST("readable", "aZ09") : "Y";
if (in_array($encoding, array('EAN8', 'EAN13'))) {
$code = GETPOST("code", 'alphanohtml');
} else {
$code = GETPOST("code", 'none'); // This can be rich content (qrcode, datamatrix, ...)
}
if (empty($generator) || empty($encoding)) {
print 'Error: Parameter "generator" or "encoding" not defined';