Merge branch 'dolibarrdevelop' into WIP_Facture_dolGetButtonAction

This commit is contained in:
Steve 2022-03-09 11:49:34 +01:00
commit dcf5d984b0
85 changed files with 845 additions and 441 deletions

View File

@ -21,11 +21,12 @@ For developers:
--------------- ---------------
NEW: NEW:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true. * verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
* The deprecated mdethod thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
@ -36,6 +37,7 @@ For users:
NEW: Online proposal signature NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...) NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation. NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
NEW: Add option to disable globaly some notifications emails. NEW: Add option to disable globaly some notifications emails.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference. NEW: #18401 Add __NEWREF__ subtitute to get new object reference.

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedopjectblock.tpl.php -->\n"; echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
@ -201,7 +201,7 @@ $tabsql = array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
@ -1093,6 +1093,45 @@ if ($action == 'disable_favorite') {
} }
} }
// Is in EEC - Activate
if ($action == 'activate_eec') {
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
} else {
$rowidcol = "rowid";
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
if (!$result) {
dol_print_error($db);
}
}
// Is in EEC - Disable
if ($action == 'disable_eec') {
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
} else {
$rowidcol = "rowid";
}
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET eec = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
}
$result = $db->query($sql);
if (!$result) {
dol_print_error($db);
}
}
/* /*
* View * View
@ -1452,6 +1491,7 @@ if ($id) {
if ($id == 4) { if ($id == 4) {
$tdsoffields .= '<td></td>'; $tdsoffields .= '<td></td>';
$tdsoffields .= '<td></td>';
} }
$tdsoffields .= '<td>'; $tdsoffields .= '<td>';
$tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">'; $tdsoffields .= '<input type="hidden" name="id" value="'.$id.'">';
@ -1496,6 +1536,7 @@ if ($id) {
if ($id == 4) { if ($id == 4) {
print '<td></td>'; print '<td></td>';
print '<td></td>';
} }
print '<td colspan="3" class="center">'; print '<td colspan="3" class="center">';
if ($action != 'edit') { if ($action != 'edit') {
@ -1569,6 +1610,7 @@ if ($id) {
} }
if ($id == 4) { if ($id == 4) {
print '<td></td>'; print '<td></td>';
print '<td></td>';
} }
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre right" colspan="2">'; print '<td class="liste_titre right" colspan="2">';
@ -1592,10 +1634,10 @@ if ($id) {
// Determines the name of the field in relation to the possible names // Determines the name of the field in relation to the possible names
// in data dictionaries // in data dictionaries
$showfield = 1; // By defaut $showfield = 1; // By default
$cssprefix = ''; $cssprefix = '';
$sortable = 1; $sortable = 1;
$valuetoshow = ucfirst($value); // By defaut $valuetoshow = ucfirst($value); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate $valuetoshow = $langs->trans($valuetoshow); // try to translate
// Special cases // Special cases
@ -1794,8 +1836,9 @@ if ($id) {
print getTitleFieldOfList($newvaluetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $value : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix); print getTitleFieldOfList($newvaluetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $value : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
} }
} }
// Favorite - Only activated on country dictionary // Favorite & EEC - Only activated on country dictionary
if ($id == 4) { if ($id == 4) {
print getTitleFieldOfList($langs->trans("InEEC"), 0, $_SERVER["PHP_SELF"], "eec", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder, '', 0, $langs->trans("CountryIsInEEC"));
print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
} }
@ -2089,10 +2132,19 @@ if ($id) {
} }
$url .= '&'; $url .= '&';
// Favorite // Favorite & EEC
// Only activated on country dictionary // Only activated on country dictionary
if ($id == 4) { if ($id == 4) {
print '<td class="nowrap center">'; print '<td class="nowrap center">';
// Is in EEC
if ($iserasable) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->eec].'_eec&token='.newToken().'">'.$actl[$obj->eec].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print '</td>';
print '<td class="nowrap center">';
// Favorite
if ($iserasable) { if ($iserasable) {
print '<a class="reposition" href="'.$url.'action='.$acts[$obj->favorite].'_favorite&token='.newToken().'">'.$actl[$obj->favorite].'</a>'; print '<a class="reposition" href="'.$url.'action='.$acts[$obj->favorite].'_favorite&token='.newToken().'">'.$actl[$obj->favorite].'</a>';
} else { } else {

View File

@ -332,8 +332,8 @@ foreach ($TCurrency as &$currency) {
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">'; print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
print '1 '.$conf->currency.' = '; print '1 '.$conf->currency.' = ';
print '<input type="text" name="rate" class="width75 right" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13">&nbsp;'.$currency->code.'&nbsp;'; print '<input type="text" name="rate" class="width75 right" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13">&nbsp;'.$currency->code.'&nbsp;';
print '<input type="submit" name="updatecurrency" class="button button-edit" value="'.$langs->trans("Modify").'">&nbsp;'; print '<input type="submit" name="updatecurrency" class="button button-edit smallpaddingimp" value="'.$langs->trans("Modify").'">&nbsp;';
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">'; print '<input type="submit" name="deletecurrency" class="button smallpaddingimp" value="'.$langs->trans("Delete").'">';
print '</form>'; print '</form>';
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -203,6 +203,12 @@ if ($action == 'setvarother') {
if (!($res > 0)) { if (!($res > 0)) {
$error++; $error++;
} }
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
} }
@ -530,6 +536,21 @@ print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1,
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Auto notify contacts when closing the ticket
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoNotifyClose").'</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFY_AT_CLOSING');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, $conf->global->TICKET_NOTIFY_AT_CLOSING);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help');
print '</td>';
print '</tr>';
if (!$conf->use_javascript_ajax) { if (!$conf->use_javascript_ajax) {
print '</form>'; print '</form>';
} }

View File

@ -327,33 +327,6 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>'; print '</td></tr>';
// Activate email creation to user
print '<tr class="pair"><td>'.$langs->trans("TicketsDisableCustomerEmail").'</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Texte de création d'un ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>'.$langs->trans("TicketNewEmailBodyLabel").'</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
// Url public interface // Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE; $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>'; print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
@ -364,8 +337,45 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>'; print '</td></tr>';
print '</table>';
print '<br><br>';
print_fiche_titre($langs->trans("Emails"));
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
// Activate email creation to user
print '<tr class="pair"><td>';
print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
print '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
}
print '</td>';
print '</tr>';
// Text of email after creatio of a ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>';
print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '</tr>';
// Activate email notification when a new message is added // Activate email notification when a new message is added
print '<tr class="pair"><td>'.$langs->trans("TicketsPublicNotificationNewMessage").'</td>'; print '<tr class="pair"><td>';
print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
print '</td>';
print '<td class="left">'; print '<td class="left">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED'); print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
@ -374,19 +384,15 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED); print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
} }
print '</td>'; print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
print '</td>';
print '</tr>'; print '</tr>';
// Send notification when a new message is added to a email if a user is not assigned to the ticket // Send notification when a new message is added to a email if a user is not assigned to the ticket
print '<tr><td>'.$langs->trans("TicketPublicNotificationNewMessageDefaultEmail").'</label>'; print '<tr><td>';
print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
print '</td><td>'; print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL.'" size="40" ></td>'; print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL.'" size="40" ></td>';
print '</td>'; print '</td>';
print '<td align="center">'; print '</tr>';
print $form->textwithpicto('', $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -41,7 +41,7 @@ https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**a
Develop an API Develop an API
-------------- --------------
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/ The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples https://restler3.luracast.com/examples/index.html
Github contains also useful information : https://github.com/Luracast/Restler Github contains also useful information : https://github.com/Luracast/Restler

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedobjectblock.tpl.php -->\n";
global $user, $db; global $user, $db;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;

View File

@ -186,35 +186,55 @@ class CActionComm
$qualified = 1; $qualified = 1;
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto // $obj->type can be 'system', 'systemauto', 'module', 'moduleauto', 'xxx', 'xxxauto'
// Note: type = system... than type of event is added among other standard events.
// type = module... then type of event is grouped into module defined into module = myobject@mymodule. Example: Event organization or external modules
// type = xxx... then type of event is added into list as a new flat value (not grouped). Example: Agefod external module
if ($qualified && $onlyautoornot > 0 && preg_match('/^system/', $obj->type) && !preg_match('/^AC_OTH/', $obj->code)) { if ($qualified && $onlyautoornot > 0 && preg_match('/^system/', $obj->type) && !preg_match('/^AC_OTH/', $obj->code)) {
$qualified = 0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) $qualified = 0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
} }
if ($qualified && !empty($obj->module)) { if ($qualified && !empty($obj->module)) {
if ($obj->module == 'invoice' && empty($conf->facture->enabled) && empty($user->facture->lire)) { //var_dump($obj->type.' '.$obj->module.' '); var_dump($user->rights->facture->lire);
$qualified = 0; $qualified = 0;
// Special cases
if ($obj->module == 'invoice' && !empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
$qualified = 1;
} }
if ($obj->module == 'order' && empty($conf->commande->enabled) && empty($user->commande->lire)) { if ($obj->module == 'order' && !empty($conf->commande->enabled) && empty($user->rights->commande->lire)) {
$qualified = 0; $qualified = 1;
} }
if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) { if ($obj->module == 'propal' && !empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) {
$qualified = 0; $qualified = 1;
} }
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && empty($user->fournisseur->facture->lire)) || (!empty($conf->supplier_invoice->enabled) && empty($user->supplier_invoice->lire)))) { if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->facture->lire)) || (!empty($conf->rights->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire)))) {
$qualified = 0; $qualified = 1;
} }
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && empty($user->fournisseur->commande->lire)) || (empty($conf->supplier_order->enabled) && empty($user->supplier_order->lire)))) { if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->commande->lire)) || (empty($conf->rights->supplier_order->enabled) && !empty($user->rights->supplier_order->lire)))) {
$qualified = 0; $qualified = 1;
} }
if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) { if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) {
$qualified = 0; $qualified = 1;
} }
if (preg_match('/@eventorganization/', $obj->module) && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) { // For the generic case with type = 'module...' and module = 'myobject@mymodule'
$qualified = 0; $regs = array();
if (preg_match('/^module/', $obj->type)) {
if (preg_match('/^(.+)@(.+)$/', $obj->module, $regs)) {
$tmpobject = $regs[1];
$tmpmodule = $regs[2];
//var_dump($user->$tmpmodule);
if ($tmpmodule && isset($conf->$tmpmodule) && !empty($conf->$tmpmodule->enabled) && (!empty($user->rights->$tmpmodule->read) || !empty($user->rights->$tmpmodule->lire) || !empty($user->rights->$tmpmodule->$tmpobject->read) || !empty($user->rights->$tmpmodule->$tmpobject->lire))) {
$qualified = 1;
}
}
} }
if (!preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && empty($conf->{$obj->module}->enabled)) { // For the case type is not 'system...' neither 'module', we just check module is on
$qualified = 0; if (! in_array($obj->type, array('system', 'systemauto', 'module', 'moduleauto'))) {
$tmpmodule = $obj->module;
//var_dump($tmpmodule);
if ($tmpmodule && isset($conf->$tmpmodule) && !empty($conf->$tmpmodule->enabled)) {
$qualified = 1;
}
} }
} }

View File

@ -49,10 +49,11 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
} }
$MAXAGENDA = $conf->global->AGENDA_EXT_NB; $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
$filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3); $check_holiday = GETPOST('check_holiday', 'int');
$filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3); $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$usergroup = GETPOST("search_usergroup", "int", 3) ?GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3); $filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
$showbirthday = empty($conf->use_javascript_ajax) ?GETPOST("showbirthday", "int") : 1; $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
$showbirthday = empty($conf->use_javascript_ajax) ? GETPOST("showbirthday", "int") : 1;
// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. // If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
@ -207,16 +208,16 @@ if (GETPOST("viewperuser", 'alpha') || $mode == 'show_peruser') {
} }
/* /*
if ($action == 'delete_action' && $user->rights->agenda->delete) { if ($action == 'delete_action' && $user->rights->agenda->delete) {
$event = new ActionComm($db); $event = new ActionComm($db);
$event->fetch($actionid); $event->fetch($actionid);
$event->fetch_optionals(); $event->fetch_optionals();
$event->fetch_userassigned(); $event->fetch_userassigned();
$event->oldcopy = clone $event; $event->oldcopy = clone $event;
$result = $event->delete(); $result = $event->delete();
} }
*/ */
/* /*
@ -579,10 +580,10 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
$s .= '</script>'."\n"; $s .= '</script>'."\n";
// Local calendar // Local calendar
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>'; $s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
// Holiday calendar // Holiday calendar
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" class="check_holiday"><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> &nbsp; </div>'; $s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"'.($check_holiday ? ' checked' : '').'><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> &nbsp; </div>';
// External calendars // External calendars
if (is_array($showextcals) && count($showextcals) > 0) { if (is_array($showextcals) && count($showextcals) > 0) {
@ -607,13 +608,13 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
foreach ($showextcals as $val) { foreach ($showextcals as $val) {
$htmlname = md5($val['name']); $htmlname = md5($val['name']);
if (!empty($val['default'])) { if (!empty($val['default']) || GETPOST('check_ext'.$htmlname, 'int')) {
$default = "checked"; $default = "checked";
} else { } else {
$default = ''; $default = '';
} }
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>'; $s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" value="1" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>';
} }
} }
@ -848,6 +849,7 @@ if ($resql) {
$event->fk_project = $obj->fk_project; $event->fk_project = $obj->fk_project;
$event->socid = $obj->fk_soc; $event->socid = $obj->fk_soc;
$event->thirdparty_id = $obj->fk_soc;
$event->contact_id = $obj->fk_contact; $event->contact_id = $obj->fk_contact;
// Defined date_start_in_calendar and date_end_in_calendar property // Defined date_start_in_calendar and date_end_in_calendar property
@ -890,13 +892,13 @@ if ($resql) {
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz
$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz
/* /*
print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>'; print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>';
print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>'; print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>';
print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'<br>'; print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'<br>';
print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'<br>'; print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'<br>';
print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'<br>'; print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'<br>';
print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'<br>'; print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'<br>';
*/ */
do { do {
//if ($event->id==408) //if ($event->id==408)
//print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'<br>'; //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'<br>';

View File

@ -30,7 +30,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -1369,7 +1369,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to build doc // Actions to build doc
$upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output; $upload_dir = !empty($conf->commande->multidir_output[$object->entity])?$conf->commande->multidir_output[$object->entity]:$conf->commande->dir_output;
$permissiontoadd = $usercancreate; $permissiontoadd = $usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';

View File

@ -3666,9 +3666,10 @@ class Commande extends CommonOrder
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $addlinktonotes Add link to notes * @param int $addlinktonotes Add link to notes
* @param string $target attribute target for link
* @return string String with URL * @return string String with URL
*/ */
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target = '')
{ {
global $conf, $langs, $user, $hookmanager; global $conf, $langs, $user, $hookmanager;
@ -3737,6 +3738,11 @@ class Commande extends CommonOrder
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip"'; $linkclose .= ' class="classfortooltip"';
$target_value=array('_self', '_blank', '_parent', '_top');
if (in_array($target, $target_value)) {
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
}
} }
$linkstart = '<a href="'.$url.'"'; $linkstart = '<a href="'.$url.'"';

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedopjectblockForRec.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblockForRec.tpl.php -->\n";
global $user; global $user;

View File

@ -41,12 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
// Security check $object = new RemiseCheque($db);
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
@ -63,11 +58,22 @@ if (empty($page) || $page == -1) {
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;
$dir = $conf->bank->dir_output.'/checkdeposits/'; $upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
$filterdate = dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear')); $filterdate = dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear'));
$filteraccountid = GETPOST('accountid', 'int'); $filteraccountid = GETPOST('accountid', 'int');
$object = new RemiseCheque($db); // Security check
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
$usercanread = $user->rights->banque->cheque;
$usercancreate = $user->rights->banque->cheque;
$usercandelete = $user->rights->banque->cheque;
/* /*
@ -241,7 +247,9 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) {
$langs->load("other"); $langs->load("other");
$file = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'cheque').GETPOST('file'); $filetodelete = GETPOST('file', 'alpha');
$file = $upload_dir.'/'.$filetodelete;
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) { if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
@ -634,6 +642,12 @@ if ($action == 'new') {
$i = 1; $i = 1;
if ($num > 0) { if ($num > 0) {
while ($objp = $db->fetch_object($resql)) { while ($objp = $db->fetch_object($resql)) {
$paymentstatic->id = $objp->pid;
$paymentstatic->ref = $objp->pref;
$accountlinestatic->id = $objp->rowid;
$accountlinestatic->ref = $objp->ref;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="center">'.$i.'</td>'; print '<td class="center">'.$i.'</td>';
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; // Operation date print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; // Operation date
@ -643,8 +657,6 @@ if ($action == 'new') {
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>'; print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
// Link to payment // Link to payment
print '<td class="center">'; print '<td class="center">';
$paymentstatic->id = $objp->pid;
$paymentstatic->ref = $objp->pref;
if ($paymentstatic->id) { if ($paymentstatic->id) {
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
} else { } else {
@ -653,8 +665,6 @@ if ($action == 'new') {
print '</td>'; print '</td>';
// Link to bank transaction // Link to bank transaction
print '<td class="center">'; print '<td class="center">';
$accountlinestatic->id = $objp->rowid;
$accountlinestatic->ref = $objp->ref;
if ($accountlinestatic->id > 0) { if ($accountlinestatic->id > 0) {
print $accountlinestatic->getNomUrl(1); print $accountlinestatic->getNomUrl(1);
} else { } else {
@ -664,10 +674,10 @@ if ($action == 'new') {
// Action button // Action button
print '<td class="right">'; print '<td class="right">';
if ($object->statut == 0) { if ($object->statut == 0) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&token='.newToken().'&lineid='.$objp->rowid.'">'.img_delete().'</a>';
} }
if ($object->statut == 1 && $objp->statut != 2) { if ($object->statut == 1 && $objp->statut != 2) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reject_check&token='.newToken().'&lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').'</a>';
} }
if ($objp->statut == 2) { if ($objp->statut == 2) {
print ' &nbsp; '.img_picto($langs->trans('CheckRejected'), 'statut8').'</a>'; print ' &nbsp; '.img_picto($langs->trans('CheckRejected'), 'statut8').'</a>';
@ -723,11 +733,13 @@ print '</div>';
if ($action != 'new') { if ($action != 'new') {
if ($object->statut == 1) { if ($object->statut == 1) {
$filename = dol_sanitizeFileName($object->ref); // Documents
$filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits'); $objref = dol_sanitizeFileName($object->ref);
$filedir = $upload_dir.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $usercancreate;
print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1); $delallowed = $usercandelete;
print $formfile->showdocuments('remisecheque', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
print '<br>'; print '<br>';
} }

View File

@ -615,6 +615,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8. // output format that does not support UTF8.
$sav_charseSupprimert_output = $outputlangs->charset_output; $sav_charseSupprimert_output = $outputlangs->charset_output;
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs); $result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
if ($result > 0) { if ($result > 0) {
//$outputlangs->charset_output=$sav_charset_output; //$outputlangs->charset_output=$sav_charset_output;

View File

@ -83,7 +83,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
} }
} }
if ($amounts[key($amounts)] <= 0) { if (empty($amounts[key($amounts)])) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create'; $action = 'create';

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE contrat/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -1579,17 +1579,20 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$nbok = 0; $nbok = 0;
foreach ($toselect as $toselectid) { foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid); $result = $objecttmp->fetch($toselectid);
if ($result>0) { if ($result > 0) {
if ($objecttmp->statut == Holiday::STATUS_VALIDATED && $user->id == $objecttmp->fk_validator) { if ($objecttmp->statut != Holiday::STATUS_VALIDATED) {
setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $langs->transnoentitiesnoconv('Validated')), null, 'warnings');
continue;
}
if ($user->id == $objecttmp->fk_validator) {
$objecttmp->oldcopy = dol_clone($objecttmp); $objecttmp->oldcopy = dol_clone($objecttmp);
$objecttmp->date_valid = dol_now(); $objecttmp->date_valid = dol_now();
$objecttmp->fk_user_valid = $user->id; $objecttmp->fk_user_valid = $user->id;
$objecttmp->statut = Holiday::STATUS_APPROVED; $objecttmp->statut = Holiday::STATUS_APPROVED;
$db->begin();
$verif = $objecttmp->approve($user); $verif = $objecttmp->approve($user);
if ($verif <= 0) { if ($verif <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++; $error++;
@ -1664,14 +1667,9 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
} }
} }
} }
} else {
if (!$error) { $langs->load("errors");
$db->commit(); setEventMessages($langs->trans('ErrorNotApproverForHoliday', $objecttmp->ref), null, 'errors');
$nbok++;
} else {
$db->rollback();
$action = '';
}
} }
} else { } else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
@ -1683,7 +1681,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
if (!$error) { if (!$error) {
if ($nbok > 1) { if ($nbok > 1) {
setEventMessages($langs->trans("RecordsApproved", $nbok), null, 'mesgs'); setEventMessages($langs->trans("RecordsApproved", $nbok), null, 'mesgs');
} else { } elseif ($nbok == 1) {
setEventMessages($langs->trans("RecordAproved"), null, 'mesgs'); setEventMessages($langs->trans("RecordAproved"), null, 'mesgs');
} }
$db->commit(); $db->commit();

View File

@ -165,7 +165,7 @@ class Conf
/** /**
* Load setup values into conf object (read llx_const) for a specified entity * Load setup values into conf object (read llx_const) for a specified entity
* Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called. * Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setEntityValues is called.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $entity Entity to get * @param int $entity Entity to get

View File

@ -642,14 +642,14 @@ class dolReceiptPrinter extends Printer
case 'DOL_PRINT_OBJECT_LINES': case 'DOL_PRINT_OBJECT_LINES':
foreach ($object->lines as $line) { foreach ($object->lines as $line) {
if ($line->fk_product) { if ($line->fk_product) {
$spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1; $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - strlen($line->subprice) - 10 - 1;
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
$this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); $this->printer->text($line->ref . $spaces . $line->qty . str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT) . ' ' . str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT) . "\n");
$this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n"); $this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n \n");
} else { } else {
$spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - 10 - 1; $spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - strlen($line->subprice) - 10 - 1;
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
$this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); $this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT).' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
} }
} }
break; break;

View File

@ -791,7 +791,7 @@ class Form
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER. $ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="button small'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; $ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
$ret .= '</div>'; $ret .= '</div>';
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
@ -5131,7 +5131,7 @@ class Form
$formconfirm .= '<td class="valid">'.$question.'</td>'; $formconfirm .= '<td class="valid">'.$question.'</td>';
$formconfirm .= '<td class="valid center">'; $formconfirm .= '<td class="valid center">';
$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly'); $formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly');
$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton" type="submit" value="'.$langs->trans("Validate").'">'; $formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
$formconfirm .= '</td>'; $formconfirm .= '</td>';
$formconfirm .= '</tr>'."\n"; $formconfirm .= '</tr>'."\n";
@ -5202,6 +5202,7 @@ class Form
$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; $out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
$out .= '</form>'; $out .= '</form>';
} else { } else {
$out .= '<span class="project_head_block">';
if ($selected) { if ($selected) {
$projet = new Project($this->db); $projet = new Project($this->db);
$projet->fetch($selected); $projet->fetch($selected);
@ -5209,6 +5210,7 @@ class Form
} else { } else {
$out .= "&nbsp;"; $out .= "&nbsp;";
} }
$out .= '</span>';
} }
if (empty($nooutput)) { if (empty($nooutput)) {

View File

@ -360,8 +360,8 @@ class FormFile
* This also set the property $this->numoffiles * This also set the property $this->numoffiles
* *
* @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...) * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...)
* @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module.
* @param string $filedir Directory to scan * @param string $filedir Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234'
* @param string $urlsource Url of origin page (for return) * @param string $urlsource Url of origin page (for return)
* @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates) * @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates)
* @param int $delallowed Remove is allowed (1/0) * @param int $delallowed Remove is allowed (1/0)

View File

@ -1250,7 +1250,7 @@ class FormMail extends Form
* Return templates of email with type = $type_template or type = 'all'. * Return templates of email with type = $type_template or type = 'all'.
* This search into table c_email_templates. Used by the get_form function. * This search into table c_email_templates. Used by the get_form function.
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param string $type_template Get message for model/type=$type_template, type='all' also included. * @param string $type_template Get message for model/type=$type_template, type='all' also included.
* @param User $user Get template public or limited to this user * @param User $user Get template public or limited to this user
* @param Translate $outputlangs Output lang object * @param Translate $outputlangs Output lang object
@ -1259,7 +1259,7 @@ class FormMail extends Form
* @param string $label Label of template * @param string $label Label of template
* @return ModelMail|integer One instance of ModelMail or -1 if error * @return ModelMail|integer One instance of ModelMail or -1 if error
*/ */
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') public function getEMailTemplate($dbs, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{ {
global $conf, $langs; global $conf, $langs;
@ -1279,18 +1279,18 @@ class FormMail extends Form
} }
$sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang"; $sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang";
$sql .= " FROM ".$db->prefix().'c_email_templates'; $sql .= " FROM ".$dbs->prefix().'c_email_templates';
$sql .= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')"; $sql .= " WHERE (type_template='".$dbs->escape($type_template)."' OR type_template='all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")"; $sql .= " AND entity IN (".getEntity('c_email_templates').")";
$sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // Get all public or private owned $sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // Get all public or private owned
if ($active >= 0) { if ($active >= 0) {
$sql .= " AND active = ".((int) $active); $sql .= " AND active = ".((int) $active);
} }
if ($label) { if ($label) {
$sql .= " AND label = '".$db->escape($label)."'"; $sql .= " AND label = '".$dbs->escape($label)."'";
} }
if (!($id > 0) && $languagetosearch) { if (!($id > 0) && $languagetosearch) {
$sql .= " AND (lang = '".$db->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$db->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')"; $sql .= " AND (lang = '".$dbs->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$dbs->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')";
} }
if ($id > 0) { if ($id > 0) {
$sql .= " AND rowid=".(int) $id; $sql .= " AND rowid=".(int) $id;
@ -1299,22 +1299,22 @@ class FormMail extends Form
$sql .= " AND position=0"; $sql .= " AND position=0";
} }
if ($languagetosearch) { if ($languagetosearch) {
$sql .= $db->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or '' $sql .= $dbs->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''
} else { } else {
$sql .= $db->order("position,lang,label", "ASC,ASC,ASC"); // If no language provided, we give priority to lang not defined $sql .= $dbs->order("position,lang,label", "ASC,ASC,ASC"); // If no language provided, we give priority to lang not defined
} }
//$sql .= $db->plimit(1); //$sql .= $dbs->plimit(1);
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $dbs->query($sql);
if (!$resql) { if (!$resql) {
dol_print_error($db); dol_print_error($dbs);
return -1; return -1;
} }
// Get first found // Get first found
while (1) { while (1) {
$obj = $db->fetch_object($resql); $obj = $dbs->fetch_object($resql);
if ($obj) { if ($obj) {
// If template is for a module, check module is enabled; if not, take next template // If template is for a module, check module is enabled; if not, take next template
@ -1386,7 +1386,8 @@ class FormMail extends Form
} }
} }
$db->free($resql); $dbs->free($resql);
return $ret; return $ret;
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1176,4 +1177,112 @@ class Utils
return 1; return 1;
} }
/**
* Make a send last backup of database or fil in param
* CAN BE A CRON TASK
*
* @param string $sendto Recipients emails
* @param string $from Sender email
* @param string $subject Topic/Subject of mail
* @param string $message Message
* @param string $filename List of files to attach (full path of filename on file system)
* @param string $filter Filter file send
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
public function sendBackup($sendto = '', $from = '', $subject = '', $message = '', $filename = '', $filter = '')
{
global $conf, $langs;
$filepath = '';
$output = '';
$error = 0;
if (!empty($from)) {
$from = dol_escape_htmltag($from);
} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
$from = dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL);
} else {
$error++;
}
if (!empty($sendto)) {
$sendto = dol_escape_htmltag($sendto);
} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
$from = dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL);
} else {
$error++;
}
if (!empty($subject)) {
$subject = dol_escape_htmltag($subject);
} else {
$subject = dol_escape_htmltag($langs->trans('MakeSendLocalDatabaseDumpShort'));
}
if (empty($message)) {
$message = dol_escape_htmltag($langs->trans('MakeSendLocalDatabaseDumpShort'));
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($filename) {
if (dol_is_file($conf->admin->dir_output.'/backup/'.$filename)) {
$tmpfiles = dol_most_recent_file($conf->admin->dir_output.'/backup', $filename);
}
} else {
$tmpfiles = dol_most_recent_file($conf->admin->dir_output.'/backup', $filter);
}
if ($tmpfiles) {
foreach ($tmpfiles as $key => $val) {
if ($key == 'fullname') {
$filepath = array($val);
$filesize = dol_filesize($val);
}
if ($key == 'type') {
$mimetype = array($val);
}
if ($key == 'relativename') {
$filename = array($val);
}
}
}
if ($filepath) {
if ($filesize > 100000000) {
$output = 'Sorry, last backup file is too large to be send by email';
$error++;
}
} else {
$output = 'No backup file found';
$error++;
}
if (!$error) {
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
if ($mailfile->error) {
$error++;
$output = $mailfile->error;
}
}
if (!$error) {
$result = $mailfile->sendfile();
if ($result <= 0) {
$error++;
$output = $mailfile->error;
}
}
dol_syslog(__METHOD__, LOG_DEBUG);
$this->error = $error;
$this->output = $output;
if ($result == true) {
return 0;
} else {
return $result;
}
}
} }

View File

@ -10142,7 +10142,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
$class = 'butAction'; $class = 'butAction';
if ($actionType == 'danger' || $actionType == 'delete') { if ($actionType == 'danger' || $actionType == 'delete') {
$class = 'butActionDelete'; $class = 'butActionDelete';
if (strpos($url, 'token=') === false) $url .= '&token='.newToken(); if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken();
} }
$attr = array( $attr = array(
@ -10153,6 +10153,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
if (empty($html)) { if (empty($html)) {
$html = $label; $html = $label;
$attr['title'] = ''; // if html not set, leave label on title is redundant
} else { } else {
$attr['aria-label'] = $label; $attr['aria-label'] = $label;
} }
@ -10166,6 +10167,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
$attr['id'] = $id; $attr['id'] = $id;
} }
// Override attr // Override attr
if (!empty($params['attr']) && is_array($params['attr'])) { if (!empty($params['attr']) && is_array($params['attr'])) {
foreach ($params['attr'] as $key => $value) { foreach ($params['attr'] as $key => $value) {
@ -10179,6 +10181,11 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
} }
} }
// automatic add tooltip when title is detected
if (!empty($attr['title']) && !empty($attr['class']) && strpos($attr['class'], 'classfortooltip') === false) {
$attr['class'].= ' classfortooltip';
}
// Js Confirm button // Js Confirm button
if ($userRight && !empty($params['confirm'])) { if ($userRight && !empty($params['confirm'])) {
if (!is_array($params['confirm'])) { if (!is_array($params['confirm'])) {

View File

@ -126,8 +126,7 @@ abstract class ModeleNumRefChequeReceipts
} }
/** /**
* \class ModeleChequeReceipts * Class parent for templates of document generation
* \brief Classe mere des modeles de
*/ */
abstract class ModeleChequeReceipts extends CommonDocGenerator abstract class ModeleChequeReceipts extends CommonDocGenerator
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -98,7 +99,8 @@ class modCron extends DolibarrModules
// Cronjobs // Cronjobs
$this->cronjobs = array( $this->cronjobs = array(
0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true), 0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>in_array($this->db->type, array('mysql', 'mysqli'))), 1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendDumpDatabase', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
// 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) // 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
); );

View File

@ -5,6 +5,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -480,7 +481,6 @@ class modSociete extends DolibarrModules
's.fax' => "Fax", 's.fax' => "Fax",
's.url' => "Url", 's.url' => "Url",
's.email' => "Email", 's.email' => "Email",
's.skype' => "Skype",
's.fk_effectif' => "Staff", 's.fk_effectif' => "Staff",
's.fk_typent' => "ThirdPartyType", 's.fk_typent' => "ThirdPartyType",
"s.fk_forme_juridique" => "JuridicalStatus", "s.fk_forme_juridique" => "JuridicalStatus",
@ -621,7 +621,6 @@ class modSociete extends DolibarrModules
's.fax' => "eg. +34987654321", 's.fax' => "eg. +34987654321",
's.url' => "e.g. https://www.mybigcompany.com", 's.url' => "e.g. https://www.mybigcompany.com",
's.email' => "e.g. test@mybigcompany.com", 's.email' => "e.g. test@mybigcompany.com",
's.skype' => "Skype name",
's.fk_effectif' => "1/2/3/5: represents one of the five ranges of employees", 's.fk_effectif' => "1/2/3/5: represents one of the five ranges of employees",
's.fk_typent' => 'matches field "id" (1-9 etc.) OR "code" (TE_SMALL etc.) in table "'.MAIN_DB_PREFIX.'c_typent"', 's.fk_typent' => 'matches field "id" (1-9 etc.) OR "code" (TE_SMALL etc.) in table "'.MAIN_DB_PREFIX.'c_typent"',
's.fk_forme_juridique' => '1/2/3 etc...matches field "code" in table "'.MAIN_DB_PREFIX.'c_forme_juridique"', 's.fk_forme_juridique' => '1/2/3 etc...matches field "code" in table "'.MAIN_DB_PREFIX.'c_forme_juridique"',
@ -693,7 +692,6 @@ class modSociete extends DolibarrModules
's.phone_mobile' => "PhoneMobile", 's.phone_mobile' => "PhoneMobile",
's.fax' => "Fax", 's.fax' => "Fax",
's.email' => "Email", 's.email' => "Email",
's.skype' => "Skype",
's.note_private' => "NotePrivate", 's.note_private' => "NotePrivate",
's.note_public' => "NotePublic" 's.note_public' => "NotePublic"
); );
@ -759,7 +757,6 @@ class modSociete extends DolibarrModules
's.phone_mobile' => "5551144", 's.phone_mobile' => "5551144",
's.fax' => "5551155", 's.fax' => "5551155",
's.email' => "johnsmith@email.com", 's.email' => "johnsmith@email.com",
's.skype' => "skype username",
's.note_private' => "My private note", 's.note_private' => "My private note",
's.note_public' => "My public note" 's.note_public' => "My public note"
); );

View File

@ -109,7 +109,8 @@ class modTicket extends DolibarrModules
3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0),
4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0), 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0),
5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0),
6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0) 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0),
7 => array('TICKET_NOTIFY_AT_CLOSING', 'chaine', '0', 'Default notify contacts when closing a module', 0),
); );

View File

@ -43,20 +43,18 @@ abstract class ModelePDFProduct extends CommonDocGenerator
/** /**
* Return list of active generation modules * Return list of active generation modules
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param integer $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array List of templates * @return array List of templates
*/ */
public static function liste_modeles($db, $maxfilenamelength = 0) public static function liste_modeles($dbs, $maxfilenamelength = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf;
$type = 'product'; $type = 'product';
$list = array(); $list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$list = getListOfModels($db, $type, $maxfilenamelength); $list = getListOfModels($dbs, $type, $maxfilenamelength);
return $list; return $list;
} }
} }
@ -156,22 +154,22 @@ abstract class ModeleProductCode
/** /**
* Renvoi la liste des modeles de numérotation * Renvoi la liste des modeles de numérotation
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param integer $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers * @return array List of numbers
*/ */
public static function liste_modeles($db, $maxfilenamelength = 0) public static function liste_modeles($dbs, $maxfilenamelength = 0)
{ {
// phpcs:enable // phpcs:enable
$list = array(); $list = array();
$sql = ""; $sql = "";
$resql = $db->query($sql); $resql = $dbs->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $dbs->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$row = $db->fetch_row($resql); $row = $dbs->fetch_row($resql);
$list[$row[0]] = $row[1]; $list[$row[0]] = $row[1];
$i++; $i++;
} }

View File

@ -41,20 +41,19 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
/** /**
* Return list of active generation modules * Return list of active generation modules
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param integer $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array List of templates * @return array List of templates
*/ */
public static function liste_modeles($db, $maxfilenamelength = 0) public static function liste_modeles($dbs, $maxfilenamelength = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf;
$type = 'company'; $type = 'company';
$list = array(); $list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$list = getListOfModels($db, $type, $maxfilenamelength); $list = getListOfModels($dbs, $type, $maxfilenamelength);
return $list; return $list;
} }
@ -161,22 +160,22 @@ abstract class ModeleThirdPartyCode
/** /**
* Renvoie la liste des modeles de numérotation * Renvoie la liste des modeles de numérotation
* *
* @param DoliDB $db Database handler * @param DoliDB $dbs Database handler
* @param integer $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array|int List of numbers * @return array|int List of numbers
*/ */
public static function liste_modeles($db, $maxfilenamelength = 0) public static function liste_modeles($dbs, $maxfilenamelength = 0)
{ {
// phpcs:enable // phpcs:enable
$list = array(); $list = array();
$sql = ""; $sql = "";
$resql = $db->query($sql); $resql = $dbs->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $dbs->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$row = $db->fetch_row($resql); $row = $dbs->fetch_row($resql);
$list[$row[0]] = $row[1]; $list[$row[0]] = $row[1];
$i++; $i++;
} }
@ -401,26 +400,3 @@ abstract class ModeleAccountancyCode
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
} }
/**
* Create a document onto disk according to template module.
*
* @param DoliDB $db Database handler
* @param Facture $object Object invoice
* @param string $message Message (not used, deprecated)
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @return int <0 if KO, >0 if OK
* @deprecated Use the new function generateDocument of Objects class
* @see Societe::generateDocument()
*/
function thirdparty_doc_create(DoliDB $db, Societe $object, $message, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
dol_syslog(__METHOD__." is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}

View File

@ -212,14 +212,14 @@ if ($massaction == 'presend') {
} }
if ($massaction == 'preenable') { if ($massaction == 'preenable') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassEnabling"), $langs->trans("ConfirmMassEnablingQuestion", count($toselect)), "enable", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassEnabling"), $langs->trans("ConfirmMassEnablingQuestion", count($toselect)), "enable", null, 'yes', 0, 200, 500, 1);
} }
if ($massaction == 'predisable') { if ($massaction == 'predisable') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDisabling"), $langs->trans("ConfirmMassDisablingQuestion", count($toselect)), "disable", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDisabling"), $langs->trans("ConfirmMassDisablingQuestion", count($toselect)), "disable", null, '', 0, 200, 500, 1);
} }
if ($massaction == 'preapproveleave') { if ($massaction == 'preapproveleave') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, 'yes', 0, 200, 500, 1);
} }
// Allow Pre-Mass-Action hook (eg for confirmation dialog) // Allow Pre-Mass-Action hook (eg for confirmation dialog)

View File

@ -133,77 +133,28 @@ class InterfaceTicketEmail extends DolibarrTriggers
$langs->load('ticket'); $langs->load('ticket');
$subject_admin = 'TicketNewEmailSubjectAdmin';
$body_admin = 'TicketNewEmailBodyAdmin';
$subject_customer = 'TicketNewEmailSubjectCustomer';
$body_customer = 'TicketNewEmailBodyCustomer';
$see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer';
// Send email to notification email // Send email to notification email
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) {
$sendto = empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; $sendto = empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
if ($sendto) { if ($sendto) {
// Init to avoid errors $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs);
$filepath = array();
$filename = array();
$mimetype = array();
/* Send email to admin */
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin');
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'<br><br>';
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
$message_admin .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
$message_admin .= '<li>'.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
$message_admin .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
$message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
// Extrafields
$extraFields = new ExtraFields($this->db);
$extraFields->fetch_name_optionals_label($object->table_element);
if (is_array($object->array_options) && count($object->array_options) > 0) {
foreach ($object->array_options as $key => $value) {
$key = substr($key, 8); // remove "options_"
$message_admin .= '<li>'.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value, '', $object->table_element).'</li>';
}
}
$message_admin .= '</ul>';
if ($object->fk_soc > 0) {
$object->fetch_thirdparty();
$message_admin .= '<p>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</p>';
}
$message = $object->message;
if (!dol_textishtml($message)) {
$message = dol_nl2br($message);
}
$message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$message.'</p>';
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$replyto = $from;
$trackid = 'tic'.$object->id;
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
if ($mailfile->error) {
dol_syslog($mailfile->error, LOG_DEBUG);
} else {
$result = $mailfile->sendfile();
}
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
}
} }
} }
// Send email to customer // Send email to customer
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) {
$sendto = ''; $sendto = '';
//if contact selected send to email's contact else send to email's thirdparty //if contact selected send to email's contact else send to email's thirdparty
$contactid = GETPOST('contactid', 'alpha'); $contactid = GETPOST('contactid', 'alpha');
$res = 0;
if (!empty($contactid)) { if (!empty($contactid)) {
$contact = new Contact($this->db); $contact = new Contact($this->db);
@ -218,77 +169,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
} }
if ($sendto) { if ($sendto) {
// Init to avoid errors $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf);
$filepath = array();
$filename = array();
$mimetype = array();
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer');
$message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id).'<br><br>';
$message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
$message_customer .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
$message_customer .= '<li>'.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
$message_customer .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
// Extrafields
foreach ($this->attributes[$object->table_element]['label'] as $key => $value) {
$enabled = 1;
if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) {
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
}
$perms = 1;
if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) {
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
}
$qualified = true;
if (empty($enabled)) {
$qualified = false;
}
if (empty($perms)) {
$qualified = false;
}
if ($qualified) {
$message_customer .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
}
}
$message_customer .= '</ul>';
$message = $object->message;
if (!dol_textishtml($message)) {
$message = dol_nl2br($message);
}
$message_customer .= '<p>'.$langs->trans('Message').' : <br>'.$message.'</p>';
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$message_customer .= '<p>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
$from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$replyto = $from;
$trackid = 'tic'.$object->id;
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
if ($mailfile->error) {
dol_syslog($mailfile->error, LOG_DEBUG);
} else {
$result = $mailfile->sendfile();
if ($result) {
// update last_msg_sent date
$object->date_last_msg_sent = dol_now();
$object->update($user);
}
}
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
}
} }
} }
@ -305,10 +186,226 @@ class InterfaceTicketEmail extends DolibarrTriggers
case 'TICKET_CLOSE': case 'TICKET_CLOSE':
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load('ticket');
$subject_admin = 'TicketCloseEmailSubjectAdmin';
$body_admin = 'TicketCloseEmailBodyAdmin';
$subject_customer = 'TicketCloseEmailSubjectCustomer';
$body_customer = 'TicketCloseEmailBodyCustomer';
$see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer';
// Send email to notification email
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) {
$sendto = empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
if ($sendto) {
$this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs);
}
}
// Send email to customer.
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail'])) {
$linked_contacts = $object->listeContact(-1, 'thirdparty');
$linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal'));
if (empty($linked_contacts) && !empty($conf->global->TICKET_NOTIFY_AT_CLOSING) && !empty($object->fk_soc)) {
$object->fetch_thirdparty();
$linked_contacts[] = $object->thirdparty->email;
}
$contactid = GETPOST('contactid', 'int');
$res = 0;
if ($contactid > 0) {
$contact = new Contact($this->db);
$res = $contact->fetch($contactid);
if (! in_array($contact, $linked_contacts)) {
$error_msg = $langs->trans('Error'). ': ';
$error_msg .= $langs->transnoentities('TicketWrongContact');
setEventMessages($error_msg, [], 'errors');
$ok = 0;
break;
}
}
$sendto = '';
if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
$sendto = $contact->email;
} elseif ( !empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) {
// if sending to all contacts or sending to contacts while mass closing
$temp_emails = [];
foreach ($linked_contacts as $contact) {
$temp_emails[] = $contact['email'];
}
$sendto = implode(", ", $temp_emails);
unset($temp_emails);
unset($linked_contacts);
}
if ($sendto) {
$this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf);
}
}
$ok = 1;
break; break;
} }
return $ok; return $ok;
} }
/**
* Composes and sends a message concerning a ticket, to be sent to admin address.
*
* @param string $sendto Addresses to send the mail, format "first@address.net, second@address.net," etc.
* @param string $base_subject email subject. Non-translated string.
* @param string $body email body (first line). Non-translated string.
* @param Ticket $object the ticket thet the email refers to
* @param Translate $langs the translation object
* @return void
*/
private function composeAndSendAdminMessage($sendto, $base_subject, $body, Ticket $object, Translate $langs)
{
global $conf;
// Init to avoid errors
$filepath = array();
$filename = array();
$mimetype = array();
/* Send email to admin */
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities($base_subject, $object->ref, $object->track_id);
$message_admin = $langs->transnoentities($body, $object->track_id).'<br>';
$message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
$message_admin .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
$message_admin .= '<li>'.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
$message_admin .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
$message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
// Extrafields
$extraFields = new ExtraFields($this->db);
$extraFields->fetch_name_optionals_label($object->table_element);
if (is_array($object->array_options) && count($object->array_options) > 0) {
foreach ($object->array_options as $key => $value) {
$key = substr($key, 8); // remove "options_"
$message_admin .= '<li>'.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value, '', $object->table_element).'</li>';
}
}
if ($object->fk_soc > 0) {
$object->fetch_thirdparty();
$message_admin .= '<li>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</li>';
}
$message_admin .= '</ul>';
$message = $object->message;
if (!dol_textishtml($message)) {
$message = dol_nl2br($message);
}
$message_admin .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$trackid = 'tic'.$object->id;
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
if ($mailfile->error) {
dol_syslog($mailfile->error, LOG_DEBUG);
} else {
$result = $mailfile->sendfile();
}
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
}
}
/**
* Composes and sends a message concerning a ticket, to be sent to customer addresses.
*
* @param string $sendto Addresses to send the mail, format "first@address.net, second@address.net, " etc.
* @param string $base_subject email subject. Non-translated string.
* @param string $body email body (first line). Non-translated string.
* @param string $see_ticket string indicating the ticket public address
* @param Ticket $object the ticket thet the email refers to
* @param Translate $langs the translation object
* @return void
*/
private function composeAndSendCustomerMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
{
global $conf, $user;
// Init to avoid errors
$filepath = array();
$filename = array();
$mimetype = array();
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities($base_subject);
$message_customer = $langs->transnoentities($body, $object->track_id).'<br>';
$message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
$message_customer .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
$message_customer .= '<li>'.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
$message_customer .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
// Extrafields
if (is_array($this->attributes[$object->table_element]['label'])) {
foreach ($this->attributes[$object->table_element]['label'] as $key => $value) {
$enabled = 1;
if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) {
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
}
$perms = 1;
if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) {
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
}
$qualified = true;
if (empty($enabled)) {
$qualified = false;
}
if (empty($perms)) {
$qualified = false;
}
if ($qualified) {
$message_customer .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>';
}
}
}
$message_customer .= '</ul>';
$message = $object->message;
if (!dol_textishtml($message)) {
$message = dol_nl2br($message);
}
$message_customer .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
$from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$trackid = 'tic'.$object->id;
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
if ($mailfile->error) {
dol_syslog($mailfile->error, LOG_DEBUG);
} else {
$result = $mailfile->sendfile();
if ($result) {
// update last_msg_sent date
$object->fetch($object->id);
$object->date_last_msg_sent = dol_now();
$object->update($user);
}
}
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
}
}
} }

View File

@ -478,8 +478,12 @@ if ($num > 0) {
if (empty($obj)) { if (empty($obj)) {
break; break;
} }
if (isset($obj->test) && !verifCond($obj->test)) {
continue; // Discard line with test = false if (isset($obj->test)) {
$veriftest = verifCond($obj->test);
if (!$veriftest) {
continue; // Discard line with test = false
}
} }
$object->id = $obj->rowid; $object->id = $obj->rowid;

View File

@ -19,7 +19,7 @@
* *
*/ */
print "<!-- BEGIN PHP TEMPLATE don/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE don/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;

View File

@ -327,7 +327,11 @@ class EcmFiles extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = 'Error '.$this->db->lasterror(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$this->errors[] = 'Error DB_ERROR_RECORD_ALREADY_EXISTS : '.$this->db->lasterror();
} else {
$this->errors[] = 'Error '.$this->db->lasterror();
}
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
} }

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
echo "<!-- BEGIN PHP TEMPLATE eventorganization/tpl/linkedopjectblock.tpl.php -->\n"; echo "<!-- BEGIN PHP TEMPLATE eventorganization/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -1208,6 +1208,7 @@ if ($action == 'create') {
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.'">'; print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.'">';
} else { } else {
if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">'; print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">';
} }

View File

@ -367,13 +367,15 @@ class Expedition extends CommonObject
// Insert of lines // Insert of lines
$num = count($this->lines); $num = count($this->lines);
for ($i = 0; $i < $num; $i++) { for ($i = 0; $i < $num; $i++) {
if (!isset($this->lines[$i]->detail_batch)) { // no batch management if (empty($this->lines[$i]->product_type) || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) { if (!isset($this->lines[$i]->detail_batch)) { // no batch management
$error++; if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) {
} $error++;
} else { // with batch management }
if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) { } else { // with batch management
$error++; if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) {
$error++;
}
} }
} }
} }
@ -913,6 +915,7 @@ class Expedition extends CommonObject
// Copy the rang of the order line to the expedition line // Copy the rang of the order line to the expedition line
$line->rang = $orderline->rang; $line->rang = $orderline->rang;
$line->product_type = $orderline->product_type;
if (!empty($conf->stock->enabled) && !empty($orderline->fk_product)) { if (!empty($conf->stock->enabled) && !empty($orderline->fk_product)) {
$fk_product = $orderline->fk_product; $fk_product = $orderline->fk_product;
@ -965,6 +968,8 @@ class Expedition extends CommonObject
} }
$this->lines[$num] = $line; $this->lines[$num] = $line;
return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -2611,6 +2616,12 @@ class ExpeditionLigne extends CommonObjectLine
*/ */
public $product_desc; public $product_desc;
/**
* Type of the product. 0 for product, 1 for service
* @var int
*/
public $product_type = 0;
/** /**
* @var int rang of line * @var int rang of line
*/ */

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE expedition/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE expedition/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE expensereport/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE expensereport/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -22,7 +22,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE fichinter/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE fichinter/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -477,15 +477,15 @@ class CommandeFournisseur extends CommonOrder
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid); $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND l.qty >= pfp.quantity AND pfp.fk_soc = ".((int) $this->socid);
} }
$sql .= " WHERE l.fk_commande = ".((int) $this->id); $sql .= " WHERE l.fk_commande = ".((int) $this->id);
if ($only_product) { if ($only_product) {
$sql .= ' AND p.fk_product_type = 0'; $sql .= ' AND p.fk_product_type = 0';
} }
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql.= " AND l.qty >= pfp.quantity "; $sql.= " GROUP BY l.rowid";
$sql.= " GROUP BY l.rowid HAVING max_qty = MAX(pfp.quantity) "; $sql.= " HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)";
} }
$sql .= " ORDER BY l.rang, l.rowid"; $sql .= " ORDER BY l.rang, l.rowid";
//print $sql; //print $sql;
@ -3552,11 +3552,11 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn AND cd.qty >= pfp.quantity";
} }
$sql .= ' WHERE cd.rowid = '.((int) $rowid); $sql .= ' WHERE cd.rowid = '.((int) $rowid);
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " AND cd.qty >= pfp.quantity GROUP BY cd.rowid HAVING max_qty = MAX(pfp.quantity)"; $sql .= " GROUP BY cd.rowid HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)";
} }
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {

View File

@ -12,7 +12,7 @@
* Copyright (C) 2015-2019 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -245,7 +245,7 @@ class FactureFournisseur extends CommonInvoice
public $multicurrency_total_ht; public $multicurrency_total_ht;
public $multicurrency_total_tva; public $multicurrency_total_tva;
public $multicurrency_total_ttc; public $multicurrency_total_ttc;
//! id of source var_dump($$this);invoice if replacement invoice or credit note //! id of source invoice if replacement invoice or credit note
/** /**
* @var int ID * @var int ID
*/ */

View File

@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE fourn/commande/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE fourn/commande/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE fourn/facture/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE fourn/facture/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -1083,7 +1083,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
if (empty($include_users)) { if (empty($include_users)) {
print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays"); print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
} else { } else {
$defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator); // Will work only if supervisor has permission to approve so is inside include_users // Defined default approver (the forced approved of user or the supervisor if no forced value defined)
// Note: This use will be set only if the deinfed approvr has permission to approve so is inside include_users
$defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) { if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
$defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver
} }

View File

@ -25,10 +25,9 @@
-- Availability type -- Availability type
-- --
delete from llx_c_availability; INSERT INTO llx_c_availability (code,label,active,position) VALUES ('AV_NOW', 'Immediate', 1, 10);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (1, 'AV_NOW', 'Immediate', 1, 10); INSERT INTO llx_c_availability (code,label,active,position) VALUES ('AV_1W', '1 week', 1, 20);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20); INSERT INTO llx_c_availability (code,label,active,position) VALUES ('AV_2W', '2 weeks', 1, 30);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30); INSERT INTO llx_c_availability (code,label,active,position) VALUES ('AV_3W', '3 weeks', 1, 40);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40); INSERT INTO llx_c_availability (code,label,active,position) VALUES ('AV_4W', '4 weeks', 1, 50);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (5, 'AV_4W', '4 weeks', 1, 50);

View File

@ -30,9 +30,8 @@
-- Civilities -- Civilities
-- --
delete from llx_c_civility; insert into llx_c_civility (code, label, active) values ('MME', 'Madame', 1);
insert into llx_c_civility (rowid, code, label, active) values (1 , 'MME', 'Madame', 1); insert into llx_c_civility (code, label, active) values ('MR', 'Monsieur', 1);
insert into llx_c_civility (rowid, code, label, active) values (3 , 'MR', 'Monsieur', 1); insert into llx_c_civility (code, label, active) values ('MLE', 'Mademoiselle', 1);
insert into llx_c_civility (rowid, code, label, active) values (5 , 'MLE', 'Mademoiselle', 1); insert into llx_c_civility (code, label, active) values ('MTRE', 'Maître', 1);
insert into llx_c_civility (rowid, code, label, active) values (7 , 'MTRE', 'Maître', 1); insert into llx_c_civility (code, label, active) values ('DR', 'Docteur', 1);
insert into llx_c_civility (rowid, code, label, active) values (8 , 'DR', 'Docteur', 1);

View File

@ -6,6 +6,7 @@
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> -- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> -- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2019 Markus Welters <markus@welters.de> -- Copyright (C) 2019 Markus Welters <markus@welters.de>
-- Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de>
-- --
-- This program is free software; you can redistribute it and/or modify -- 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 -- it under the terms of the GNU General Public License as published by
@ -62,6 +63,24 @@ INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, m
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-CONSTITUIZION', 0, 4, '', 0, 12, 6, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-CONSTITUIZION', 0, 4, '', 0, 12, 6, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-IMMACULE', 0, 4, '', 0, 12, 8, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-IMMACULE', 0, 4, '', 0, 12, 8, 1);
-- Germany (5)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-NEUJAHR', 0, 5, '', 0, 1, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-HL3KOEN--TLW', 0, 5, '', 0, 1, 6, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-INTFRAUENTAG--TLW', 0, 5, '', 0, 3, 8, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-KARFREITAG', 0, 5, 'goodfriday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-OSTERMONTAG', 0, 5, 'eastermonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-TAGDERARBEIT', 0, 5, '', 0, 5, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-HIMMELFAHRT', 0, 5, 'ascension', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-PFINGSTEN', 0, 5, 'pentecotemonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-FRONLEICHNAM--TLW', 0, 5, 'fronleichnam', 0, 0, 0, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-MARIAEHIMMEL--TLW', 0, 5, '', 0, 8, 15, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-WELTKINDERTAG--TLW', 0, 5, '', 0, 9, 20, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-TAGDERDEUTEINHEIT', 0, 5, '', 0, 10, 3, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-REFORMATIONSTAG--TLW', 0, 5, '', 0, 10, 31, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-ALLERHEILIGEN--TLW', 0, 5, '', 0, 11, 1, 0);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-WEIHNACHTSTAG1', 0, 5, '', 0, 12, 25, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('DE-WEIHNACHTSTAG2', 0, 5, '', 0, 12, 26, 1);
-- Austria (41) -- Austria (41)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-EASTER', 0, 41, 'eastermonday', 0, 0, 0, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-EASTER', 0, 41, 'eastermonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-ASCENSION', 0, 41, 'ascension', 0, 0, 0, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-ASCENSION', 0, 41, 'ascension', 0, 0, 0, 1);

View File

@ -43,6 +43,8 @@ create table llx_commande_fournisseur_dispatch_extrafields
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object); ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1;
UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA'; UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA';
create table llx_c_shipment_package_type create table llx_c_shipment_package_type

View File

@ -566,7 +566,8 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1); -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1); -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;

View File

@ -84,6 +84,9 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'a
UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo'; UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo';
DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo'); DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo');
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
-- For v14 -- For v14

View File

@ -35,6 +35,9 @@
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL; -- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL;
-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL; ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;

View File

@ -272,4 +272,11 @@ ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128);
ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation; ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation;
-- Set default ticket type to OTHER if no default exists -- Set default ticket type to OTHER if no default exists
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf;
UPDATE llx_c_country SET eec=0 WHERE eec IS NULL;
ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL;

View File

@ -24,8 +24,8 @@ create table llx_c_country
rowid integer PRIMARY KEY, rowid integer PRIMARY KEY,
code varchar(2) NOT NULL, code varchar(2) NOT NULL,
code_iso varchar(3) , code_iso varchar(3) ,
label varchar(128) NOT NULL, label varchar(128) NOT NULL,
eec integer , eec tinyint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,
favorite tinyint DEFAULT 0 NOT NULL favorite tinyint DEFAULT 0 NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -50,8 +50,7 @@ create table llx_product_fournisseur_price
import_key varchar(14), -- Import key import_key varchar(14), -- Import key
delivery_time_days integer, delivery_time_days integer,
supplier_reputation varchar(10), supplier_reputation varchar(10),
packaging varchar(64), packaging varchar(64) DEFAULT NULL,
fk_multicurrency integer, fk_multicurrency integer,
multicurrency_code varchar(3), multicurrency_code varchar(3),
multicurrency_tx double(24,8) DEFAULT 1, multicurrency_tx double(24,8) DEFAULT 1,

View File

@ -77,7 +77,8 @@ create table llx_societe
fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status
note_private text, -- note_private text, --
note_public text, -- note_public text, --
model_pdf varchar(255), model_pdf varchar(255),
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
prefix_comm varchar(5), -- prefix commercial (deprecated) prefix_comm varchar(5), -- prefix commercial (deprecated)
client tinyint DEFAULT 0, -- client 0/1/2 client tinyint DEFAULT 0, -- client 0/1/2
fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 fournisseur tinyint DEFAULT 0, -- fournisseur 0/1

View File

@ -82,6 +82,8 @@ UseMenuModuleToolsToAddCronJobs=Go into menu "<a href="%s">Home - Admin tools -
JobDisabled=Job disabled JobDisabled=Job disabled
MakeLocalDatabaseDumpShort=Local database backup MakeLocalDatabaseDumpShort=Local database backup
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
MakeSendLocalDatabaseDumpShort=Send local database backup
MakeSendLocalDatabaseDump=Send local database backup by email. Parameters are: to, from, subject, message, filename (Name of file sent), filter ('sql' for backup of database only)
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run. WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
DATAPOLICYJob=Data cleaner and anonymizer DATAPOLICYJob=Data cleaner and anonymizer
JobXMustBeEnabled=Job %s must be enabled JobXMustBeEnabled=Job %s must be enabled

View File

@ -278,6 +278,7 @@ ErrorIsNotADraft=%s is not a draft
ErrorExecIdFailed=Can't execute command "id" ErrorExecIdFailed=Can't execute command "id"
ErrorBadCharIntoLoginName=Unauthorized character in the login name ErrorBadCharIntoLoginName=Unauthorized character in the login name
ErrorRequestTooLarge=Error, request too large ErrorRequestTooLarge=Error, request too large
ErrorNotApproverForHoliday=You are not the approver for leave %s
# Warnings # Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@ -142,6 +142,9 @@ TicketsDelayBeforeFirstAnswer=A new ticket should receive a first answer before
TicketsDelayBeforeFirstAnswerHelp=If a new ticket has not received an answer after this time period (in hours), an important warning icon will be displayed in the list view. TicketsDelayBeforeFirstAnswerHelp=If a new ticket has not received an answer after this time period (in hours), an important warning icon will be displayed in the list view.
TicketsDelayBetweenAnswers=An unresolved ticket should not be unactive during (hours): TicketsDelayBetweenAnswers=An unresolved ticket should not be unactive during (hours):
TicketsDelayBetweenAnswersHelp=If an unresolved ticket that has already received an answer has not had further interaction after this time period (in hours), a warning icon will be displayed in the list view. TicketsDelayBetweenAnswersHelp=If an unresolved ticket that has already received an answer has not had further interaction after this time period (in hours), a warning icon will be displayed in the list view.
TicketsAutoNotifyClose=Automatically notify thirdparty when closing a ticket
TicketsAutoNotifyCloseHelp=When closing a ticket, you will be proposed to send a message to one of thirdparty's contacts. On mass closing, a message will be sent to one contact of the thirdparty linked to the ticket.
TicketWrongContact=Provided contact is not part of current ticket contacts. Email not sent.
# #
# Index & list page # Index & list page
@ -158,6 +161,8 @@ OrderByDateAsc=Sort by ascending date
OrderByDateDesc=Sort by descending date OrderByDateDesc=Sort by descending date
ShowAsConversation=Show as conversation list ShowAsConversation=Show as conversation list
MessageListViewType=Show as table list MessageListViewType=Show as table list
ConfirmMassTicketClosingSendEmail=Automatically send emails when closing tickets
ConfirmMassTicketClosingSendEmailQuestion=Do you want to notify thirdparties when closing these tickets ?
# #
# Ticket card # Ticket card
@ -245,6 +250,9 @@ TicketChangeStatus=Change status
TicketConfirmChangeStatus=Confirm the status change: %s ? TicketConfirmChangeStatus=Confirm the status change: %s ?
TicketLogStatusChanged=Status changed: %s to %s TicketLogStatusChanged=Status changed: %s to %s
TicketNotNotifyTiersAtCreate=Not notify company at create TicketNotNotifyTiersAtCreate=Not notify company at create
NotifyThirdpartyOnTicketClosing=Contacts to notify while closing the ticket
TicketNotifyAllTiersAtClose=All related contacts
TicketNotNotifyTiersAtClose=No related contact
Unread=Unread Unread=Unread
TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface. TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface.
ErrorTicketRefRequired=Ticket reference name is required ErrorTicketRefRequired=Ticket reference name is required
@ -279,6 +287,7 @@ TicketNewEmailBodyInfosTicket=Information for monitoring the ticket
TicketNewEmailBodyInfosTrackId=Ticket tracking number: %s TicketNewEmailBodyInfosTrackId=Ticket tracking number: %s
TicketNewEmailBodyInfosTrackUrl=You can view the progress of the ticket by clicking the link above. TicketNewEmailBodyInfosTrackUrl=You can view the progress of the ticket by clicking the link above.
TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket in the specific interface by clicking the following link TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket in the specific interface by clicking the following link
TicketCloseEmailBodyInfosTrackUrlCustomer=You can consult the history of this ticket by clicking the following link
TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface. TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface.
TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system. TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system.
TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe the problem. Provide the most information possible to allow us to correctly identify your request. TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe the problem. Provide the most information possible to allow us to correctly identify your request.
@ -300,6 +309,10 @@ NewUser=New user
NumberOfTicketsByMonth=Number of tickets per month NumberOfTicketsByMonth=Number of tickets per month
NbOfTickets=Number of tickets NbOfTickets=Number of tickets
# notifications # notifications
TicketCloseEmailSubjectCustomer=Ticket closed
TicketCloseEmailBodyCustomer=This is an automatic message to notify you that ticket %s has just been closed.
TicketCloseEmailSubjectAdmin=Ticket closed - Réf %s (public ticket ID %s)
TicketCloseEmailBodyAdmin=A ticket with ID #%s has just been closed, see information:
TicketNotificationEmailSubject=Ticket %s updated TicketNotificationEmailSubject=Ticket %s updated
TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated
TicketNotificationRecipient=Notification recipient TicketNotificationRecipient=Notification recipient

View File

@ -432,7 +432,7 @@ class modMyModule extends DolibarrModules
$sql = array(); $sql = array();
// Document templates // Document templates
$moduledir = 'mymodule'; $moduledir = dol_sanitizeFileName('mymodule');
$myTmpObjects = array(); $myTmpObjects = array();
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); $myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
@ -441,8 +441,8 @@ class modMyModule extends DolibarrModules
continue; continue;
} }
if ($myTmpObjectArray['includerefgeneration']) { if ($myTmpObjectArray['includerefgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule'; $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
$dest = $dirodt.'/template_myobjects.odt'; $dest = $dirodt.'/template_myobjects.odt';
if (file_exists($src) && !file_exists($dest)) { if (file_exists($src) && !file_exists($dest)) {

View File

@ -22,7 +22,7 @@ if (empty($conf) || !is_object($conf)) {
} }
print "<!-- BEGIN PHP TEMPLATE mymodule/core/tpl/linkedopjectblock_myobject.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE mymodule/core/tpl/linkedobjectblock_myobject.tpl.php -->\n";
global $user; global $user;

View File

@ -113,8 +113,8 @@ class Mo extends CommonObject
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,), 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'), 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),

View File

@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
print "<!-- BEGIN PHP TEMPLATE mrp/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE mrp/tpl/linkedobjectblock.tpl.php -->\n";
global $user, $db; global $user, $db;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;

View File

@ -493,20 +493,20 @@ class MultiCurrency extends CommonObject
/** /**
* Get id of currency from code * Get id of currency from code
* *
* @param DoliDB $db object db * @param DoliDB $dbs object db
* @param string $code code value search * @param string $code code value search
* *
* @return int 0 if not found, >0 if OK * @return int 0 if not found, >0 if OK
*/ */
public static function getIdFromCode($db, $code) public static function getIdFromCode($dbs, $code)
{ {
global $conf; global $conf;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE code = '".$db->escape($code)."' AND entity = ".$conf->entity; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE code = '".$dbs->escape($code)."' AND entity = ".((int) $conf->entity);
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $db->query($sql); $resql = $dbs->query($sql);
if ($resql && $obj = $db->fetch_object($resql)) { if ($resql && $obj = $dbs->fetch_object($resql)) {
return $obj->rowid; return $obj->rowid;
} else { } else {
return 0; return 0;
@ -516,38 +516,38 @@ class MultiCurrency extends CommonObject
/** /**
* Get id and rate of currency from code * Get id and rate of currency from code
* *
* @param DoliDB $db Object db * @param DoliDB $dbs Object db
* @param string $code Code value search * @param string $code Code value search
* @param integer $date_document Date from document (propal, order, invoice, ...) * @param integer $date_document Date from document (propal, order, invoice, ...)
* *
* @return array [0] => id currency * @return array [0] => id currency
* [1] => rate * [1] => rate
*/ */
public static function getIdAndTxFromCode($db, $code, $date_document = '') public static function getIdAndTxFromCode($dbs, $code, $date_document = '')
{ {
global $conf; global $conf;
$sql1 = "SELECT m.rowid, mc.rate FROM ".MAIN_DB_PREFIX."multicurrency m"; $sql1 = "SELECT m.rowid, mc.rate FROM ".MAIN_DB_PREFIX."multicurrency m";
$sql1 .= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; $sql1 .= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
$sql1 .= " WHERE m.code = '".$db->escape($code)."'"; $sql1 .= " WHERE m.code = '".$dbs->escape($code)."'";
$sql1 .= " AND m.entity IN (".getEntity('multicurrency').")"; $sql1 .= " AND m.entity IN (".getEntity('multicurrency').")";
$sql2 = ''; $sql2 = '';
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) { // Use last known rate compared to document date if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) { // Use last known rate compared to document date
$tmparray = dol_getdate($date_document); $tmparray = dol_getdate($date_document);
$sql2 .= " AND mc.date_sync <= '".$db->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'"; $sql2 .= " AND mc.date_sync <= '".$dbs->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'";
} }
$sql3 = " ORDER BY mc.date_sync DESC LIMIT 1"; $sql3 = " ORDER BY mc.date_sync DESC LIMIT 1";
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $db->query($sql1.$sql2.$sql3); $resql = $dbs->query($sql1.$sql2.$sql3);
if ($resql && $obj = $db->fetch_object($resql)) { if ($resql && $obj = $dbs->fetch_object($resql)) {
return array($obj->rowid, $obj->rate); return array($obj->rowid, $obj->rate);
} else { } else {
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE)) { if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE)) {
$resql = $db->query($sql1.$sql3); $resql = $dbs->query($sql1.$sql3);
if ($resql && $obj = $db->fetch_object($resql)) { if ($resql && $obj = $dbs->fetch_object($resql)) {
return array($obj->rowid, $obj->rate); return array($obj->rowid, $obj->rate);
} }
} }
@ -746,7 +746,7 @@ class CurrencyRate extends CommonObjectLine
*/ */
public function __construct(DoliDB $db) public function __construct(DoliDB $db)
{ {
$this->db = &$db; $this->db = $db;
return 1; return 1;
} }

View File

@ -250,6 +250,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent"><tr>'; print '<table class="noborder centpercent"><tr>';
print ' <td>'.$langs->trans('Date').'</td>'; print ' <td>'.$langs->trans('Date').'</td>';
@ -265,10 +266,12 @@ if (!in_array($action, array("updateRate", "deleteRate"))) {
print '<td>'; print '<td>';
print '<input type="hidden" name="action" value="create">'; print '<input type="hidden" name="action" value="create">';
print '<input type="submit" class="butAction" name="btnCreateCurrencyRate" value="'.$langs->trans('CreateRate').'">'; print '<input type="submit" class="button button-add small" name="btnCreateCurrencyRate" value="'.$langs->trans('CreateRate').'">';
print '</td>'; print '</td>';
print '</tr></table>'; print '</tr></table>';
print '</div>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
@ -404,7 +407,7 @@ if ($resql) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive">';
print '<table class="tagtable centpercent nomarginbottom liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable centpercent nomarginbottom liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Lines with input filters // Lines with input filters
@ -426,7 +429,7 @@ if ($resql) {
// rate // rate
if (!empty($arrayfields['cr.rate']['checked'])) { if (!empty($arrayfields['cr.rate']['checked'])) {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_rate" size="8" value="'.dol_escape_htmltag($search_rate).'">'; print '<input class="flat maxwidth75" type="text" name="search_rate" value="'.dol_escape_htmltag($search_rate).'">';
print '</td>'; print '</td>';
} }

View File

@ -150,25 +150,8 @@ if ($action == 'other') {
$value = GETPOST('activate_FillProductDescAuto', 'alpha'); $value = GETPOST('activate_FillProductDescAuto', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity);
if ($value) {
$sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
$resql = $db->query($sql_test);
if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
$sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN desc_fourn text";
$resql_new = $db->query($sql_new);
}
}
$value = GETPOST('activate_useProdSupplierPackaging', 'alpha'); $value = GETPOST('activate_useProdSupplierPackaging', 'alpha');
$res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity);
if ($value) {
$sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
$resql = $db->query($sql_test);
if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
$sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1";
$resql_new = $db->query($sql_new);
}
}
} }
if ($action == 'specimen') { // For products if ($action == 'specimen') { // For products

View File

@ -272,7 +272,7 @@ class Product extends CommonObject
public $fk_default_bom; public $fk_default_bom;
/** /**
* We must manage lot/batch number, sell-by date and so on : '1':yes '0':no * We must manage lot/batch number, sell-by date and so on : '0':no, '1':yes, '2": yes with unique serial number
* *
* @var int * @var int
*/ */
@ -1979,7 +1979,10 @@ class Product extends CommonObject
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
$sql .= " pfp.packaging"; $sql .= " pfp.packaging";
$sql .= " FROM ".$this->db->prefix()."product_fournisseur_price as pfp"; $sql .= " FROM ".$this->db->prefix()."product_fournisseur_price as pfp";
$sql .= " WHERE pfp.fk_product = ".((int) $product_id); $sql .= " WHERE 1 = 1";
if ($product_id > 0) {
$sql .= " AND pfp.fk_product = ".((int) $product_id);
}
if ($fourn_ref != 'none') { if ($fourn_ref != 'none') {
$sql .= " AND pfp.ref_fourn = '".$this->db->escape($fourn_ref)."'"; $sql .= " AND pfp.ref_fourn = '".$this->db->escape($fourn_ref)."'";
} }

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('projects', 'other')); $langs->loadLangs(array('projects', 'other'));
$hookmanager->initHooks(array('projectcarddocument'));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');

View File

@ -62,6 +62,8 @@ if (GETPOST('actioncode', 'array')) {
} }
$search_agenda_label = GETPOST('search_agenda_label'); $search_agenda_label = GETPOST('search_agenda_label');
$hookmanager->initHooks(array('projectcardinfo'));
// Security check // Security check
$id = GETPOST("id", 'int'); $id = GETPOST("id", 'int');
$socid = 0; $socid = 0;

View File

@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf)) {
?> ?>
<!-- BEGIN PHP TEMPLATE reception/tpl/linkedopjectblock.tpl.php --> <!-- BEGIN PHP TEMPLATE reception/tpl/linkedobjectblock.tpl.php -->
<?php <?php

View File

@ -2530,9 +2530,10 @@ class Societe extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $noaliasinname 1=Do not add alias into the link ref * @param int $noaliasinname 1=Do not add alias into the link ref
* @param string $target add attribute target
* @return string String with URL * @return string String with URL
*/ */
public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0) public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '')
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
@ -2705,6 +2706,10 @@ class Societe extends CommonObject
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip refurl"'; $linkclose .= ' class="classfortooltip refurl"';
$target_value = array('_self', '_blank', '_parent', '_top');
if (in_array($target, $target_value)) {
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
}
/* /*
$hookmanager->initHooks(array('thirdpartydao')); $hookmanager->initHooks(array('thirdpartydao'));

View File

@ -912,6 +912,7 @@ $form = new Form($db);
<script type="text/javascript"> <script type="text/javascript">
var selectedline=0; var selectedline=0;
var selectedtext=""; var selectedtext="";
<?php if ($action=="valid") echo "var place=0;";?> // Set to default place after close sale
var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>; var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>;
$(document).ready(function() { $(document).ready(function() {
var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>; var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>;

View File

@ -48,7 +48,7 @@ if (!isset($action)) {
} }
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->loadLangs(array("main", "cashdesk", "companies")); $langs->loadLangs(array("main", "bills", "cashdesk", "companies"));
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
@ -69,7 +69,7 @@ if (empty($user->rights->takepos->run)) {
top_httphead('text/html'); top_httphead('text/html');
if ($place > 0) { if ($place > 0) {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
$resql = $db->query($sql); $resql = $db->query($sql);
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) { if ($obj) {
@ -80,6 +80,7 @@ $object = new Facture($db);
$object->fetch($facid); $object->fetch($facid);
// Call to external receipt modules if exist // Call to external receipt modules if exist
$parameters = array();
$hookmanager->initHooks(array('takeposfrontend'), $facid); $hookmanager->initHooks(array('takeposfrontend'), $facid);
$reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object); $reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object);
if (!empty($hookmanager->resPrint)) { if (!empty($hookmanager->resPrint)) {

View File

@ -15,7 +15,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
color: #<?php echo $colortextbackhmenu; ?>; color: var(--colortextbackhmenu);
} }
.fa-15x { .fa-15x {

View File

@ -15,7 +15,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
text-align:center; text-align:center;
text-decoration:none; text-decoration:none;
color: #<?php echo $colortextbackhmenu; ?>; color: var(--colortextbackhmenu);
} }
.fa-15x { .fa-15x {

View File

@ -59,8 +59,8 @@ $backtopage = GETPOST('$backtopage', 'alpha');
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma') ? GETPOST('sortfield', 'aZ09comma') : "a.datep";
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma') ? GETPOST('sortorder', 'aZ09comma') : "desc";
if (GETPOST('actioncode', 'array')) { if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
@ -820,10 +820,28 @@ if ($action == 'create' || $action == 'presend') {
// Confirmation close // Confirmation close
if ($action == 'close') { if ($action == 'close') {
print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", '', '', 1); $thirdparty_contacts = $object->getInfosTicketExternalContact();
if ($ret == 'html') { $contacts_select = array(
print '<br>'; '-2' => $langs->trans('TicketNotifyAllTiersAtClose'),
'-3' => $langs->trans('TicketNotNotifyTiersAtClose')
);
foreach ($thirdparty_contacts as $thirdparty_contact) {
$contacts_select[$thirdparty_contact['id']] = $thirdparty_contact['civility'] . ' ' . $thirdparty_contact['lastname'] . ' ' . $thirdparty_contact['firstname'];
} }
// Default select all or no contact
$default = (!empty($conf->global->TICKET_NOTIFY_AT_CLOSING)) ? -2 : -3;
$formquestion = array(
array(
'name' => 'contactid',
'type' => 'select',
'label' => $langs->trans('NotifyThirdpartyOnTicketClosing'),
'values' => $contacts_select,
'default' => $default
),
);
print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", $formquestion, '', 1);
} }
// Confirmation abandon // Confirmation abandon
if ($action == 'abandon') { if ($action == 'abandon') {

View File

@ -185,7 +185,7 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $action = 'list';
$massaction = ''; $massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'presendonclose' && $massaction != 'close') {
$massaction = ''; $massaction = '';
} }
@ -690,7 +690,7 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
); );
if ($permissiontoadd) { if ($permissiontoadd) {
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close"); $arrayofmassactions['presendonclose'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close");
$arrayofmassactions['reopen'] = img_picto('', 'folder-open', 'class="pictofixedwidth"').$langs->trans("ReOpen"); $arrayofmassactions['reopen'] = img_picto('', 'folder-open', 'class="pictofixedwidth"').$langs->trans("ReOpen");
} }
if ($permissiontodelete) { if ($permissiontodelete) {
@ -743,6 +743,17 @@ $objecttmp = new Ticket($db);
$trackid = 'tic'.$object->id; $trackid = 'tic'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
// confirm auto send on close
if ($massaction == 'presendonclose') {
$hidden_form = array([
"type" => "hidden",
"name" => "massaction",
"value" => "close"
]);
$selectedchoice = (!empty($conf->global->TICKET_NOTIFY_AT_CLOSING)) ? "yes" : "no";
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassTicketClosingSendEmail"), $langs->trans("ConfirmMassTicketClosingSendEmailQuestion"), 'confirm_send_close', $hidden_form, $selectedchoice, 0, 200, 500, 1);
}
if ($search_all) { if ($search_all) {
foreach ($fieldstosearchall as $key => $val) { foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);

View File

@ -21,7 +21,7 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
print "<!-- BEGIN PHP TEMPLATE ticket/tpl/linkedopjectblock.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE ticket/tpl/linkedobjectblock.tpl.php -->\n";
global $user; global $user;

View File

@ -204,14 +204,10 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
'commonobject.class.php', 'commonobject.class.php',
'conf.class.php', 'conf.class.php',
'html.form.class.php', 'html.form.class.php',
'html.formmail.class.php',
'translate.class.php', 'translate.class.php',
'utils.class.php', 'utils.class.php',
'modules_product.class.php',
'modules_societe.class.php',
'TraceableDB.php', 'TraceableDB.php',
'multicurrency.class.php', 'multicurrency.class.php',
'reception.class.php',
'infobox.class.php' 'infobox.class.php'
))) { ))) {
// Must not find $db-> // Must not find $db->
@ -365,7 +361,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
preg_match_all('/(sql|SET|WHERE|INSERT|VALUES|LIKE).+\s*\'"\s*\.\s*\$(.......)/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/(sql|SET|WHERE|INSERT|VALUES|LIKE).+\s*\'"\s*\.\s*\$(.......)/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) { foreach ($matches as $key => $val) {
if (! in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) { if (! in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'dbs->id', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) {
$ok=false; // This will generate error $ok=false; // This will generate error
break; break;
} }