Merge branch 'develop' into NEW_Needs_net_tab_on_bom

This commit is contained in:
Laurent Destailleur 2022-02-17 20:06:38 +01:00 committed by GitHub
commit 6e5c7358de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
248 changed files with 7851 additions and 903 deletions

View File

@ -205,6 +205,8 @@ with
with
foreach ($value[1] as $k => $v) {
JSGANTT:
--------
* Replace in function JSGantt.taskLink
@ -233,11 +235,13 @@ JCROP:
* Remove analytics tag into file index.html
JQUERYFILETREE:
---------------
* Remove directory htdocs/includes/jquery/plugins/jqueryFileTree/connectors
RESTLER:
--------

View File

@ -476,7 +476,7 @@ class AccountingAccount extends CommonObject
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
{
global $langs, $conf;
global $langs, $conf, $hookmanager;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (!empty($conf->dol_no_mouse_hover)) {
@ -561,6 +561,15 @@ class AccountingAccount extends CommonObject
if ($withpicto != 2) {
$result .= $linkstart . $label_link . $linkend;
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -221,7 +221,7 @@ class AccountingJournal extends CommonObject
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -276,6 +276,15 @@ class AccountingJournal extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array('accountingjournaldao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -460,7 +460,7 @@ class BookKeeping extends CommonObject
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
global $menumanager, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -512,6 +512,15 @@ class BookKeeping extends CommonObject
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -516,7 +516,7 @@ if ($result) {
}
print '</td>';
print '<td>'.$objp->tva_intra.'</td>';
print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);

View File

@ -631,7 +631,7 @@ if ($result) {
print $product_static->getNomUrl(1);
}
if ($product_static->label) {
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
}
print '</td>';
@ -665,7 +665,7 @@ if ($result) {
print '</td>';
// VAT Num
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
// Found accounts
print '<td class="small">';

View File

@ -199,7 +199,25 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
$cursormonth = $j;
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td width="60" class="right">';
if (!empty($tmp['mday'])) {
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
$param .= '&search_month='.$tmp['mon'].'&search_year='.$tmp['year'];
print '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/list.php?'.$param.'">';
}
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '</a>';
}
print '</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';

View File

@ -171,7 +171,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "<br>\n";
}
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
if (!empty($conf->expensereport->enabled)) {
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);

View File

@ -1057,7 +1057,7 @@ if (empty($action) || $action == 'view') {
}
print '<div class="tabsAction tabsActionNoBottom">';
print '<div class="tabsAction tabsActionNoBottom centerimp">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';

View File

@ -521,7 +521,7 @@ if (empty($action) || $action == 'view') {
print $desc;
print '</div>';
}
print '<div class="tabsAction tabsActionNoBottom">';
print '<div class="tabsAction tabsActionNoBottom centerimp">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';

View File

@ -774,7 +774,7 @@ if (empty($action) || $action == 'view') {
print $desc;
print '</div>';
}
print '<div class="tabsAction tabsActionNoBottom">';
print '<div class="tabsAction tabsActionNoBottom centerimp">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
}

View File

@ -716,7 +716,7 @@ if (empty($action) || $action == 'view') {
print $desc;
print '</div>';
}
print '<div class="tabsAction tabsActionNoBottom">';
print '<div class="tabsAction tabsActionNoBottom centerimp">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
}

View File

@ -521,7 +521,7 @@ if ($result) {
}
print '</td>';
print '<td>'.$objp->tva_intra.'</td>';
print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);

View File

@ -672,7 +672,7 @@ if ($result) {
print '</td>';
// VAT Num
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
// Found accounts
print '<td class="small">';

View File

@ -65,6 +65,9 @@ if (GETPOST('actioncode', 'array')) {
}
$search_agenda_label = GETPOST('search_agenda_label');
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$objcanvas = null;
// Security check
$result = restrictedArea($user, 'adherent', $id);

View File

@ -55,6 +55,7 @@ $id = GETPOST('id') ?GETPOST('id', 'int') : $rowid;
$typeid = GETPOST('typeid', 'int');
$userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
if (!empty($conf->mailmanspip->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
@ -2164,7 +2164,7 @@ class Adherent extends CommonObject
*/
public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1, $notooltip = 0, $addlinktonotes = 0)
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) {
$withpictoimg = 0;
@ -2282,7 +2282,15 @@ class Adherent extends CommonObject
$result .= '</span>';
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -40,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'other'));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');

View File

@ -119,7 +119,7 @@ print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->
// Name
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" autofocus value="'.(GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<input name="nom" id="name" class="minwidth200" value="'.(GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
// Address
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';

View File

@ -164,6 +164,9 @@ $urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentit
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').'</span>');
$message .= '<div class="urllink">';
$message .= '<input type="text" id="onlinepaymenturl1" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
}
$message .= '</div>';
$message .= ajax_autoselect('onlinepaymenturl1');
$message .= '<br>';
@ -173,6 +176,9 @@ $urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').'</span>');
$message .= '<div class="urllink">';
$message .= '<input type="text" id="onlinepaymenturl2" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
}
$message .= '</div>';
$message .= ajax_autoselect('onlinepaymenturl2');
$message .= '<br>';
@ -182,6 +188,9 @@ $urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'rss', '').'</span>');
$message .= '<div class="urllink">';
$message .= '<input type="text" id="onlinepaymenturl3" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
if (!empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) {
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
}
$message .= '</div>';
$message .= ajax_autoselect('onlinepaymenturl3');
$message .= '<br>';

View File

@ -107,7 +107,7 @@ print '<td>'.$langs->trans("SendingsAbility").'</td>';
print '<td>';
print '</td>';
print '<td class="center">';
print $langs->trans("Required");
print '<span class="opacitymedium">'.img_picto($langs->trans("Required"), 'switch_on').'</span>';
/*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{
print '<a href="confexped.php?action=activate_sending&token='.newToken().'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';

View File

@ -222,7 +222,8 @@ if ($action == 'edit') {
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td>';
print '<td class="right">'.$langs->trans("LateWarningAfter").'</td></tr>';
foreach ($modules as $module => $delays) {
if (!empty($conf->$module->enabled)) {
@ -230,7 +231,7 @@ if ($action == 'edit') {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall right">';
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
}
}
@ -242,10 +243,10 @@ if ($action == 'edit') {
// Show if meteo is enabled
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Option").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="right">';
print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO));
print '</td></tr>';
@ -256,7 +257,7 @@ if ($action == 'edit') {
*/
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) {
if (!empty($conf->$module->enabled)) {
@ -276,7 +277,7 @@ if ($action == 'edit') {
// Show if meteo is enabled
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Option").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
@ -301,7 +302,7 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE
} else {
$str_mode_enabled = $str_mode_percentage;
}
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
print '<br><a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? $conf->global->MAIN_USE_METEO_WITH_PERCENTAGE : '').'" />';
print '<br><br>';
@ -451,8 +452,9 @@ if ($action == 'edit') {
print $form->buttonsSaveCancel("Save", '');
print '</form>';
} else {
print '<br><div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a></div>';
print '<br><br><div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>';
}
// End of page

View File

@ -97,7 +97,7 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') {
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="monday" id="monday" class="minwidth100" autofocus value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_MONDAY : GETPOST("monday", 'alpha')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<input name="monday" id="monday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_MONDAY : GETPOST("monday", 'alpha')).'"'.(empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc"));

View File

@ -249,7 +249,7 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
$head = pdf_admin_prepare_head();
print dol_get_fiche_head($head, 'general', $langs->trans("PDF"), -1, 'pdf');
print dol_get_fiche_head($head, 'general', '', -1, '');
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFDesc"), $s)."</span><br>\n";
print "<br>\n";

View File

@ -84,7 +84,7 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
$head = pdf_admin_prepare_head();
print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf');
print dol_get_fiche_head($head, 'other', '', -1, '');
$tooltiptext = '';
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";

View File

@ -143,6 +143,20 @@ if ($action == 'updateMask') {
}
}
if ($action == 'setvarworkflow') {
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if ($action == 'setvarother') {
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
@ -177,12 +191,6 @@ if ($action == 'setvarother') {
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
@ -467,7 +475,7 @@ print '</div><br>';
if (!$conf->use_javascript_ajax) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarother">';
print '<input type="hidden" name="action" value="setvarworkflow">';
}
print load_fiche_titre($langs->trans("Other"), '', '');
@ -479,6 +487,21 @@ print '<td></td>';
print '<td></td>';
print "</tr>\n";
// Auto mark ticket read when created from backoffice
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoReadTicket").'</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Auto assign ticket at user who created it
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoAssignTicket").'</td>';
print '<td class="left">';

View File

@ -254,6 +254,60 @@ $head = translation_prepare_head();
print dol_get_fiche_head($head, $mode, '', -1, '');
$langcode = GETPOSTISSET('langcode') ? GETPOST('langcode') : $langs->defaultlang;
$newlang = new Translate('', $conf);
$newlang->setDefaultLang($langcode);
$langsenfileonly = new Translate('', $conf);
$langsenfileonly->setDefaultLang('en_US');
$newlangfileonly = new Translate('', $conf);
$newlangfileonly->setDefaultLang($langcode);
$recordtoshow = array();
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$nbtotaloffiles = 0;
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
$i = 0;
foreach ($modulesdir as $keydir => $tmpsearchdir) {
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
// Directory of translation files
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
$dir_lang_osencoded = dol_osencode($dir_lang);
$filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
foreach ($filearray as $file) {
$tmpfile = preg_replace('/.lang/i', '', basename($file['name']));
$moduledirname = (basename(dirname(dirname($dir_lang))));
$langkey = $tmpfile;
if ($i > 0) {
$langkey .= '@'.$moduledirname;
}
//var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey);
$result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite
$result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only
if ($result < 0) {
print 'Failed to load language file '.$tmpfile.'<br>'."\n";
} else {
$nbtotaloffiles++;
}
//print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
$result = $langsenfileonly->load($langkey, 0, 0, '', 1); // Load translation files only
}
$i++;
}
if ($mode == 'overwrite') {
print '<input type="hidden" name="page" value="'.$page.'">';
@ -348,7 +402,14 @@ if ($mode == 'overwrite') {
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int')) {
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
} else {
//print $obj->transkey.' '.$langsenfileonly->tab_translate[$obj->transkey];
$titleforvalue = $langs->trans("Translation").' en_US for key '.$obj->transkey.':<br>'.($langsenfileonly->tab_translate[$obj->transkey] ? $langsenfileonly->trans($obj->transkey) : '<span class="opacitymedium">'.$langs->trans("None").'</span>');
/*if ($obj->lang != 'en_US') {
$titleforvalue .= '<br>'.$langs->trans("Translation").' '.$obj->lang.' '...;
}*/
print '<span title="'.dol_escape_htmltag($titleforvalue).'" class="classfortooltip">';
print dol_escape_htmltag($obj->transvalue);
print '</span>';
}
print '</td>';
@ -376,20 +437,6 @@ if ($mode == 'overwrite') {
}
if ($mode == 'searchkey') {
$langcode = GETPOSTISSET('langcode') ? GETPOST('langcode') : $langs->defaultlang;
$newlang = new Translate('', $conf);
$newlang->setDefaultLang($langcode);
$newlangfileonly = new Translate('', $conf);
$newlangfileonly->setDefaultLang($langcode);
$recordtoshow = array();
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$nbtotaloffiles = 0;
$nbempty = 0;
/*var_dump($langcode);
var_dump($transkey);
@ -403,41 +450,10 @@ if ($mode == 'searchkey') {
if (empty($transvalue)) {
$nbempty++;
}
if ($action == 'search' && ($nbempty > 999)) { // 999 to disable this
setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings');
} else {
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
$i = 0;
foreach ($modulesdir as $keydir => $tmpsearchdir) {
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
// Directory of translation files
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
$dir_lang_osencoded = dol_osencode($dir_lang);
$filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
foreach ($filearray as $file) {
$tmpfile = preg_replace('/.lang/i', '', basename($file['name']));
$moduledirname = (basename(dirname(dirname($dir_lang))));
$langkey = $tmpfile;
if ($i > 0) {
$langkey .= '@'.$moduledirname;
}
//var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey);
$result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite
$result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only
if ($result < 0) {
print 'Failed to load language file '.$tmpfile.'<br>'."\n";
} else {
$nbtotaloffiles++;
}
//print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
}
$i++;
}
// Now search into translation array
foreach ($newlang->tab_translate as $key => $val) {
if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) {
@ -532,8 +548,12 @@ if ($mode == 'searchkey') {
break;
}
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td class="small">';
$titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':<br>'.($langsenfileonly->tab_translate[$key] ? $langsenfileonly->trans($key) : '<span class="opacitymedium">'.$langs->trans("None").'</span>');
print '<span title="'.dol_escape_htmltag($titleforvalue).'" class="classfortooltip">';
print dol_escape_htmltag($val);
print '</td><td class="right nowraponall">';
print '</span>';
print '</td>';
print '<td class="right nowraponall">';
if (!empty($newlangfileonly->tab_translate[$key])) {
if ($val != $newlangfileonly->tab_translate[$key]) {
// retrieve rowid

View File

@ -173,6 +173,7 @@ class DolibarrApi
unset($object->stats_mrptoproduce);
unset($object->element);
unset($object->element_for_permission);
unset($object->fk_element);
unset($object->table_element);
unset($object->table_element_line);

View File

@ -209,7 +209,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -239,7 +239,6 @@ class Setup extends DolibarrApi
return $list;
}
/**
* Get the list of states/provinces.
*
@ -252,27 +251,34 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param string $filter To filter the countries by name
* @param int $country To filter on country
* @param string $filter To filter the states by name
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of countries
* @return array List of states
*
* @url GET dictionary/states
*
* @throws RestException
*/
public function getListOfStates($sortfield = "code_departement", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $sqlfilters = '')
public function getListOfStates($sortfield = "code_departement", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '')
{
$list = array();
// Note: The filter is not applied in the SQL request because it must
// be applied to the translated names, not to the names in database.
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_departements as t";
$sql = "SELECT t.rowid FROM ".MAIN_DB_PREFIX."c_departements as t";
if ($country) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as d ON t.fk_region = d.code_region";
}
$sql .= " WHERE 1 = 1";
if ($country) {
$sql .= " AND d.fk_pays = ".((int) $country);
}
// Add sql filters
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -373,7 +379,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -665,7 +671,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -729,7 +735,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -797,7 +803,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -860,7 +866,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -933,7 +939,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1004,7 +1010,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1078,7 +1084,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1143,9 +1149,9 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -1202,9 +1208,9 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -1261,7 +1267,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1301,7 +1307,7 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param string $country To filter on country
* @param int $country To filter on country
* @param int $active Lega form is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of legal form
@ -1310,7 +1316,7 @@ class Setup extends DolibarrApi
*
* @throws RestException
*/
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = '', $active = 1, $sqlfilters = '')
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $active = 1, $sqlfilters = '')
{
$list = array();
@ -1318,13 +1324,13 @@ class Setup extends DolibarrApi
$sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique as t";
$sql .= " WHERE t.active = ".((int) $active);
if ($country) {
$sql .= " AND t.fk_pays = '".$this->db->escape($country)."'";
$sql .= " AND t.fk_pays = ".((int) $country);
}
// Add sql filters
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1383,7 +1389,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1449,7 +1455,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1508,7 +1514,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1567,7 +1573,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1628,7 +1634,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";

View File

@ -55,12 +55,27 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
}
// Response for preflight requests (used by browser when into a CORS context)
if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
http_response_code(204);
exit;
}
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
}
// When we request url to get an API, we accept Cross site so we can make js API call inside another website
if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
}
$res = 0;
if (!$res && file_exists("../main.inc.php")) {
@ -304,7 +319,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
foreach ($listofendpoints as $endpointrule) {
$tmparray = explode(':', $endpointrule);
if ($classfile == $tmparray[0] && $tmparray[1] == 1) {
if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) {
$endpointisallowed = true;
break;
}

View File

@ -305,7 +305,7 @@ class Asset extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs;
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
@ -360,7 +360,15 @@ class Asset extends CommonObject
}
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -374,24 +374,24 @@ jQuery(document).ready(function() {
</script>';
// Checkbox to select from free text
print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' &nbsp; ';
print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"><label for="fillmanually"> '.$langs->trans("FillBarCodeTypeAndValueManually").'</label>';
print '<br>';
if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)) {
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' &nbsp; ';
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"><label for="fillfromproduct"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'</label>';
print '<br>';
print '<div class="showforproductselector">';
$form->select_produits(GETPOST('productid', 'int'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
print ' &nbsp; <input type="submit" class="button" id="submitproduct" name="submitproduct" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print ' &nbsp; <input type="submit" class="button small" id="submitproduct" name="submitproduct" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print '</div>';
}
if (!empty($user->rights->societe->lire)) {
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' &nbsp; ';
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"><label for="fillfromthirdparty"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'</label>';
print '<br>';
print '<div class="showforthirdpartyselector">';
print $form->select_company(GETPOST('socid', 'int'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector small" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print '</div>';
}

View File

@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Common attributes
$keyforbreak = 'duration';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
$object->calculateCosts();
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';

View File

@ -847,7 +847,7 @@ class BOM extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('bomdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -1086,7 +1086,7 @@ class BOM extends CommonObject
if ($res>0) {
$bom_child->calculateCosts();
$line->childBom[] = $bom_child;
$this->total_cost += $bom_child->total_cost;
$this->total_cost += $bom_child->total_cost * $line->qty;
} else {
$this->error = $bom_child->error;
return -2;
@ -1521,7 +1521,7 @@ class BOMLine extends CommonObjectLine
global $action, $hookmanager;
$hookmanager->initHooks(array('bomlinedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -180,6 +180,7 @@ if ($action == 'selectlines') {
print '</tr>';
// Select of all the sub-BOM lines
// From this pont to the end of the file, we only take care of sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
$resql = $object->db->query($sql);
@ -191,7 +192,9 @@ if ($resql) {
$sub_bom_product->fetch($obj->fk_product);
$sub_bom = new BOM($object->db);
$sub_bom->fetch($obj->fk_bom_child);
if (!empty($obj->fk_bom_child)) {
$sub_bom->fetch($obj->fk_bom_child);
}
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
@ -233,20 +236,23 @@ if ($resql) {
// Efficiency
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
// Cost price if it's defined
if ($sub_bom_product->cost_price > 0) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $line->qty).'</td>';
$total_cost+= $sub_bom_product->cost_price * $line->qty;
if (!empty($sub_bom->id)) {
$sub_bom->calculateCosts();
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</td>';
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->cost_price > 0) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</td>';
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
$total_cost.= $sub_bom_product->pmp * $line->qty;
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</td>';
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty;
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($line_cost).'</td>';
$total_cost+= $line_cost;

View File

@ -344,7 +344,7 @@ class Bookmark extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('mybookmarkdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 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
* it under the terms of the GNU General Public License as published by
@ -185,7 +185,8 @@ class Categorie extends CommonObject
'contact' => 'socpeople',
'account' => 'bank_account', // old for bank account
'project' => 'projet',
'warehouse'=> 'entrepot'
'warehouse'=> 'entrepot',
'knowledgemanagement' => 'knowledgemanagement_knowledgerecord'
);
/**
@ -1612,7 +1613,7 @@ class Categorie extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '')
{
global $langs;
global $langs, $hookmanager;
$result = '';
$label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label);
@ -1640,6 +1641,15 @@ class Categorie extends CommonObject
if ($withpicto != 2) {
$result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend;
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -76,11 +76,14 @@ if ($complete == 'na' || $complete == -2) {
}
if ($fulldayevent) {
$datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
// For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere)
$datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel');
$datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel');
//print $db->idate($datep); exit;
} else {
$datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
$datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel');
$datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel');
}
// Security check
@ -252,8 +255,15 @@ if (empty($reshook) && $action == 'add') {
$percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
if ($fulldayevent) {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
// For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere)
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser');
} else {
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
}
// Check parameters
if (!$datef && $percentage == 100) {
@ -513,8 +523,16 @@ if (empty($reshook) && $action == 'update') {
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
// Clean parameters
if ($fulldayevent) {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
// For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere)
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser');
} else {
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
}
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml");
@ -1005,11 +1023,11 @@ if ($action == 'create') {
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) {
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
}
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) {
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
}
if (empty($datef) && !empty($datep)) {
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
@ -1024,16 +1042,16 @@ if ($action == 'create') {
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
print '</td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo"
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart');
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
//print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend');
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend');
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
}
print '</td></tr>';
@ -1518,20 +1536,21 @@ if ($id > 0) {
// Date start - end
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
} else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
}
print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
} else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
}
print '</td></tr>';
@ -1972,7 +1991,8 @@ if ($id > 0) {
if (empty($object->fulldayevent)) {
print dol_print_date($object->datep, 'dayhour', 'tzuser');
} else {
print dol_print_date($object->datep, 'day', 'tzuser');
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
}
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
print img_warning($langs->trans("Late"));
@ -1985,7 +2005,8 @@ if ($id > 0) {
if (empty($object->fulldayevent)) {
print dol_print_date($object->datef, 'dayhour', 'tzuser');
} else {
print dol_print_date($object->datef, 'day', 'tzuser');
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
}
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
print img_warning($langs->trans("Late"));

View File

@ -1669,7 +1669,7 @@ class ActionComm extends CommonObject
global $action;
$hookmanager->initHooks(array('actiondao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -1955,14 +1955,14 @@ class ActionComm extends CommonObject
$event = array();
$event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
$event['type'] = $type;
$datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600));
// fix for -> Warning: A non-numeric value encountered
if (is_numeric($this->db->jdate($obj->datep2))) {
$dateend = $this->db->jdate($obj->datep2)
- (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600));
$dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600));
} else {
// use start date as fall-back to avoid import erros on empty end date
// use start date as fall-back to avoid pb with empty end date on ICS readers
$dateend = $datestart;
}

View File

@ -201,7 +201,8 @@ if ($object->id > 0) {
if (empty($object->fulldayevent)) {
print dol_print_date($object->datep, 'dayhour', 'tzuser');
} else {
print dol_print_date($object->datep, 'day', 'tzuser');
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
}
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
print img_warning($langs->trans("Late"));
@ -214,7 +215,8 @@ if ($object->id > 0) {
if (empty($object->fulldayevent)) {
print dol_print_date($object->datef, 'dayhour', 'tzuser');
} else {
print dol_print_date($object->datef, 'day', 'tzuser');
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
}
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
print img_warning($langs->trans("Late"));

View File

@ -545,7 +545,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
$newparam .= '&month='.((int) $month).'&year='.((int) $tmpforcreatebutton['year']).'&mode='.urlencode($mode);
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000';
$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')));
}
@ -808,11 +809,21 @@ if ($resql) {
$event->id = $obj->id;
$event->ref = $event->id;
$event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin
$event->datef = $db->jdate($obj->datep2);
$event->fulldayevent = $obj->fulldayevent;
// event->datep and event->datef must be GMT date.
if ($event->fulldayevent) {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
$event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz
$event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver');
} else {
// Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1)
$event->datep = $db->jdate($obj->datep, 'tzserver');
$event->datef = $db->jdate($obj->datep2, 'tzserver');
}
//$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt');
//var_dump($obj->datep);
//var_dump($event->datep);
//var_dump($obj->id.' '.$obj->datep.' '.dol_print_date($obj->datep, 'dayhour', 'gmt'));
//var_dump($obj->id.' '.$event->datep.' '.dol_print_date($event->datep, 'dayhour', 'gmt'));
$event->type_code = $obj->type_code;
$event->type_label = $obj->type_label;
@ -829,7 +840,6 @@ if ($resql) {
$event->fetch_userassigned(); // This load $event->userassigned
$event->priority = $obj->priority;
$event->fulldayevent = $obj->fulldayevent;
$event->location = $obj->location;
$event->transparency = $obj->transparency;
$event->fk_element = $obj->fk_element;
@ -865,25 +875,43 @@ if ($resql) {
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
$daycursorend = $event->date_end_in_calendar;
$anneeend = dol_print_date($daycursorend, '%Y', 'tzuserrel');
$moisend = dol_print_date($daycursorend, '%m', 'tzuserrel');
$jourend = dol_print_date($daycursorend, '%d', 'tzuserrel');
//var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); // Hour at greenwich
//var_dump($annee.'-'.$mois.'-'.$jour);
//print 'annee='.$annee.' mois='.$mois.' jour='.$jour.'<br>';
// Loop on each day covered by action to prepare an index to show on calendar
$loop = true; $j = 0;
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
$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
/*
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 '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 '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>';
*/
do {
//if ($event->id==408)
//print 'daykey='.$daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$event->datep.' '.$event->datef.'<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>';
//print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'tzuserrel').' - '.dol_print_date($event->datep, 'dayhour', 'tzuserrel').' '.dol_print_date($event->datef, 'dayhour', 'tzuserrel').'<br>';
$eventarray[$daykey][] = $event;
$j++;
$daykey += 60 * 60 * 24;
if ($daykey > $event->date_end_in_calendar) {
//if ($daykey > $event->date_end_in_calendar) {
if ($daykey > $daykeyend) {
$loop = false;
}
} while ($loop);
//var_dump($eventarray);
//print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef);
//print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array<br>';
}
@ -1805,12 +1833,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$cssclass .= " unmovable";
} elseif ($event->type_code == 'ICALEVENT') {
$cssclass .= " unmovable";
} elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) {
$tmpyearend = date('Y', $event->date_end_in_calendar);
$tmpmonthend = date('m', $event->date_end_in_calendar);
$tmpdayend = date('d', $event->date_end_in_calendar);
} elseif ($event->date_start_in_calendar && $event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) {
// If the event is on several days
$tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
$tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
$tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
//var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend);
if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) {
$cssclass .= " unmovable";
$cssclass .= " unmovable unmovable-mustusefirstdaytodrag";
} else {
$cssclass .= ' movable cursormove';
}
} else {
if ($user->rights->agenda->allactions->create ||

View File

@ -693,7 +693,7 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true);
$newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000';
$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec;
@ -953,7 +953,12 @@ while ($i < min($num, $limit)) {
// Start date
if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
} else {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser'));
}
$late = 0;
if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) {
$late = 1;
@ -967,7 +972,12 @@ while ($i < min($num, $limit)) {
// End date
if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
if (empty($obj->fulldayevent)) {
print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
} else {
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser'));
}
print '</td>';
}

View File

@ -740,7 +740,7 @@ class Mailing extends CommonObject
global $action;
$hookmanager->initHooks(array('emailingdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -2543,7 +2543,7 @@ if ($action == 'create') {
if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|| ($object->statut == Propal::STATUS_DRAFT && !empty($conf->global->PROPAL_ENABLE_NEGATIVE) && count($object->lines) > 0)) {
if ($usercanvalidate) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans('Validate').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Validate').'</a>';
}
@ -2555,7 +2555,7 @@ if ($action == 'create') {
}*/
// Edit
if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif&token='.newToken().'">'.$langs->trans('Modify').'</a>';
}
// ReOpen
@ -2578,7 +2578,7 @@ if ($action == 'create') {
// Create a sale order
if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateorder) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>';
}
}
@ -2586,7 +2586,7 @@ if ($action == 'create') {
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) {
if ($object->statut == Propal::STATUS_SIGNED && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) {
if ($usercancreatepurchaseorder) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
}
}
}
@ -2595,7 +2595,7 @@ if ($action == 'create') {
if (!empty($conf->service->enabled) && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateintervention) {
$langs->load("interventions");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a>';
}
}
@ -2604,14 +2604,14 @@ if ($action == 'create') {
$langs->load("contracts");
if ($usercancreatecontract) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>';
}
}
// Create an invoice and classify billed
if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) {
if (!empty($conf->facture->enabled) && $usercancreateinvoice) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();

View File

@ -1248,7 +1248,7 @@ class Propal extends CommonObject
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -3569,7 +3569,7 @@ class Propal extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -3690,6 +3690,15 @@ class Propal extends CommonObject
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1486,8 +1486,11 @@ if ($resql) {
) {
$with_margin_info = true;
}
$total_ht = 0;
$total_margin = 0;
while ($i < min($num, $limit)) {
$last_num = min($num, $limit);
while ($i < $last_num) {
$obj = $db->fetch_object($resql);
$objectstatic->id = $obj->rowid;
@ -1541,6 +1544,8 @@ if ($resql) {
if ($with_margin_info === true) {
$objectstatic->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($objectstatic);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
print '<tr class="oddeven">';
@ -1959,7 +1964,7 @@ if ($resql) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
}
$totalarray['val']['total_margin'] += $marginInfo['total_margin'];
$totalarray['val']['total_margin'] = $total_margin;
}
// Total margin rate
if (!empty($arrayfields['total_margin_rate']['checked'])) {
@ -1974,6 +1979,16 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
}
if ($i >= $last_num - 1) {
if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else {
$totalarray['val']['total_mark_rate'] = '';
}
}
}
// Extra fields

View File

@ -421,7 +421,7 @@ if (empty($reshook)) {
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}

View File

@ -11,7 +11,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -1056,7 +1056,7 @@ class Commande extends CommonOrder
return -1;
}
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -3663,7 +3663,7 @@ class Commande extends CommonOrder
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
{
global $conf, $langs, $user;
global $conf, $langs, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -3764,6 +3764,15 @@ class Commande extends CommonOrder
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1463,8 +1463,11 @@ if ($resql) {
) {
$with_margin_info = true;
}
$total_ht = 0;
$total_margin = 0;
while ($i < min($num, $limit)) {
$last_num = min($num, $limit);
while ($i < $last_num) {
$obj = $db->fetch_object($resql);
$notshippable = 0;
@ -1510,6 +1513,8 @@ if ($resql) {
if ($with_margin_info === true) {
$generic_commande->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($generic_commande);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
print '<tr class="oddeven">';
@ -1879,6 +1884,16 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
}
if ($i >= $last_num - 1) {
if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else {
$totalarray['val']['total_mark_rate'] = '';
}
}
}
// Extra fields

View File

@ -56,19 +56,23 @@ $currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoi
$amountPayment = $amountPayment != '' ? (is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '') : ''; // keep void if not a valid entry
// Clean checkamounts
foreach ($amounts as $key => $value) {
$value = price2num($value);
$amounts[$key] = $value;
if (empty($value)) {
unset($amounts[$key]);
if (is_array($amounts)) {
foreach ($amounts as $key => $value) {
$value = price2num($value);
$amounts[$key] = $value;
if (empty($value)) {
unset($amounts[$key]);
}
}
}
// Clean remains
foreach ($remains as $key => $value) {
$value = price2num($value);
$remains[$key] = (($invoice_type) == 2 ?-1 : 1) * $value;
if (empty($value)) {
unset($remains[$key]);
if (is_array($remains)) {
foreach ($remains as $key => $value) {
$value = price2num($value);
$remains[$key] = (($invoice_type) == 2 ?-1 : 1) * $value;
if (empty($value)) {
unset($remains[$key]);
}
}
}

View File

@ -544,7 +544,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
} else {
$buttonreconcile = '<a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
@ -554,7 +554,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}

View File

@ -345,7 +345,7 @@ if ($action == 'create') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() {
jQuery("#type").change(function() {
document.formsoc.action.value="create";
document.formsoc.submit();
});
@ -368,16 +368,16 @@ if ($action == 'create') {
// Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref") ?GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST('label', 'alpha')).'"></td></tr>';
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td>';
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST("type") : Account::TYPE_CURRENT, "type");
$formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'alpha') : Account::TYPE_CURRENT, 'type');
print '</td></tr>';
// Currency
@ -395,7 +395,7 @@ if ($action == 'create') {
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td>';
print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
print $form->selectarray("clos", $object->status, (GETPOST('clos', 'int') != '' ? GETPOST('clos', 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
print '</td></tr>';
// Country
@ -833,7 +833,7 @@ if ($action == 'create') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() {
jQuery("#type").change(function() {
document.formsoc.action.value="edit";
document.formsoc.submit();
});
@ -861,16 +861,16 @@ if ($action == 'create') {
// Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET("ref") ? GETPOST("ref") : $object->ref).'"></td></tr>';
print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET("label") ? GETPOST("label") : $object->label).'"></td></tr>';
print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label', 'alpha') : $object->label).'"></td></tr>';
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td class="maxwidth200onsmartphone">';
$formbank->selectTypeOfBankAccount((GETPOSTISSET("type") ? GETPOST("type") : $object->type), "type");
$formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'alpha') : $object->type), 'type');
print '</td></tr>';
// Currency
@ -891,7 +891,7 @@ if ($action == 'create') {
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td class="maxwidth200onsmartphone">';
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos") : $object->clos));
print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
print '</td></tr>';
// Country

View File

@ -1511,10 +1511,10 @@ class Account extends CommonObject
{
$country_code = $this->getCountryCode();
if (in_array($country_code, array('AD', 'FR', 'ES', 'GA', 'IT', 'NC'))) {
if (in_array($country_code, array('FR', 'ES', 'GA', 'IT', 'NC'))) {
return 1; // France, Spain, Gabon, ... - Not valid for CH
}
if (in_array($country_code, array('AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) {
if (in_array($country_code, array('AD', 'AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) {
return 2; // Australia, England...
}
return 0;

View File

@ -721,7 +721,7 @@ class PaymentVarious extends CommonObject
global $action;
$hookmanager->initHooks(array('variouspayment'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -626,7 +626,7 @@ foreach ($accounts as $key => $type) {
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">';
print $result->nbtodo;
print '</span>';

View File

@ -275,7 +275,7 @@ if (empty($numref)) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
$buttonreconcile = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0&search_account='.$id.$param.'">'.$titletoconciliatemanual.'</a>';
} else {
$buttonreconcile = '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}
@ -286,7 +286,7 @@ if (empty($numref)) {
if ($user->rights->banque->consolidate) {
$newparam = $param;
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&amp;sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc,desc,desc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
} else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}

View File

@ -466,7 +466,7 @@ class CashControl extends CommonObject
global $action;
$hookmanager->initHooks(array('cashfencedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1270,7 +1270,7 @@ if (empty($reshook)) {
$object->lines[] = $line; // insert new line in current object
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -1781,7 +1781,7 @@ if (empty($reshook)) {
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -4951,14 +4951,14 @@ if ($action == 'create') {
// List of payments already done
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder paymenttable" width="100%">';
print '<table class="noborder paymenttable centpercent">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
print '<td class="liste_titre">'.$langs->trans('Date').'</td>';
print '<td class="liste_titre">'.$langs->trans('Type').'</td>';
if (!empty($conf->banque->enabled)) {
print '<td class="liste_titre right">'.$langs->trans('BankAccount').'</td>';
print '<td class="liste_titre">'.$langs->trans('BankAccount').'</td>';
}
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
print '<td class="liste_titre" width="18">&nbsp;</td>';

View File

@ -1388,7 +1388,7 @@ class FactureRec extends CommonInvoice
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -1440,7 +1440,15 @@ class FactureRec extends CommonInvoice
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -788,6 +788,9 @@ class Facture extends CommonInvoice
dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects");
foreach ($this->lines as $i => $val) {
$newinvoiceline = $this->lines[$i];
$newinvoiceline->context = $this->context;
$newinvoiceline->fk_facture = $this->id;
$newinvoiceline->origin = $this->lines[$i]->element;
@ -820,7 +823,7 @@ class Facture extends CommonInvoice
$result = $newinvoiceline->insert();
// Defined the new fk_parent_line
if ($result > 0 && $newinvoiceline->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -1569,7 +1572,7 @@ class Facture extends CommonInvoice
global $action, $hookmanager;
$hookmanager->initHooks(array('invoicedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -178,6 +178,7 @@ $diroutputmassaction = $conf->facture->dir_output.'/temp/massgeneration/'.$user-
$object = new Facture($db);
$now = dol_now();
$error = 0;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Facture($db);
@ -376,61 +377,78 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement)) {
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$arrayofselected = is_array($toselect) ? $toselect : array();
if (!empty($arrayofselected)) {
$bankid = GETPOST('bankid', 'int');
$paiementid = GETPOST('paiementid', 'int');
$paiementdate = dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
foreach ($arrayofselected as $toselectid) {
$errorpayment = 0;
$facture = new Facture($db);
$result = $facture->fetch($toselectid);
if ($result < 0) {
setEventMessage($facture->error, 'errors');
$errorpayment++;
} else {
if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == 1 && $facture->paye == 0) {
$paiementAmount = $facture->getSommePaiement();
$totalcreditnotes = $facture->getSumCreditNotesUsed();
$totaldeposits = $facture->getSumDepositsUsed();
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facture->total_ttc - $totalpay);
if ($remaintopay != 0) {
$resultBank = $facture->setBankAccount($bankid);
if ($resultBank < 0) {
setEventMessage($facture->error, 'errors');
$errorpayment++;
} else {
$paiement = new Paiement($db);
$paiement->datepaye = $paiementdate;
$paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts[$facture->id] = $remaintopay;
$paiement->paiementid = $paiementid;
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
if ($paiement_id < 0) {
setEventMessage($facture->ref.' '.$paiement->error, 'errors');
if (empty($paiementdate)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;
$action = 'makepayment';
}
if (!$error) {
foreach ($arrayofselected as $toselectid) {
$errorpayment = 0;
$facture = new Facture($db);
$result = $facture->fetch($toselectid);
$db->begin();
if ($result < 0) {
setEventMessage($facture->error, 'errors');
$errorpayment++;
} else {
if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == Facture::STATUS_VALIDATED && $facture->paye == 0) {
$paiementAmount = $facture->getSommePaiement();
$totalcreditnotes = $facture->getSumCreditNotesUsed();
$totaldeposits = $facture->getSumDepositsUsed();
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facture->total_ttc - $totalpay);
if ($remaintopay != 0) {
$resultBank = $facture->setBankAccount($bankid);
if ($resultBank < 0) {
setEventMessages($facture->error, null, 'errors');
$errorpayment++;
} else {
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
if ($result < 0) {
setEventMessages($facture->ref.' '.$paiement->error, $paiement->errors, 'errors');
$paiement = new Paiement($db);
$paiement->datepaye = $paiementdate;
$paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts[$facture->id] = $remaintopay;
$paiement->paiementid = $paiementid;
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
if ($paiement_id < 0) {
$langs->load("errors");
setEventMessages($facture->ref.' '.$langs->trans($paiement->error), $paiement->errors, 'errors');
$errorpayment++;
} else {
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
if ($result < 0) {
$langs->load("errors");
setEventMessages($facture->ref.' '.$langs->trans($paiement->error), $paiement->errors, 'errors');
$errorpayment++;
}
}
}
} else {
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
$errorpayment++;
}
} else {
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
setEventMessage($langs->trans('BulkPaymentNotPossibleForInvoice', $facture->ref), 'warnings');
$errorpayment++;
}
} else {
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
$errorpayment++;
}
}
if (empty($errorpayment)) {
setEventMessage($langs->trans('PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
if (empty($errorpayment)) {
setEventMessage($langs->trans('PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
$db->commit();
} else {
$db->rollback();
}
}
}
}
@ -1039,8 +1057,9 @@ if ($resql) {
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($user->rights->facture->paiement) {
$arrayofmassactions['makepayment'] = $langs->trans("RegisterPaymentAndClasiffiedPayed");
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
@ -1097,12 +1116,12 @@ if ($resql) {
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")),
array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date"), 'datenow' => 1),
array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 0, 0, 1, 0, 1, '', 1)),
array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("BankAccount"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)),
//array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>'<input type="hidden" id="invoicesid" name="invoicesid" value="'.implode('#',GETPOST('toselect','array')).'">'),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('RegisterPaymentAndClasiffiedPayed'), $langs->trans('RegisterPaymentAndClasiffiedPayed', $object->ref), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('MakePaymentAndClassifyPayed'), $langs->trans('EnterPaymentReceivedFromCustomer'), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
print $formconfirm;
}
@ -1632,8 +1651,11 @@ if ($resql) {
) {
$with_margin_info = true;
}
$total_ht = 0;
$total_margin = 0;
while ($i < min($num, $limit)) {
$last_num = min($num, $limit);
while ($i < $last_num) {
$obj = $db->fetch_object($resql);
$datelimit = $db->jdate($obj->datelimite);
@ -1721,6 +1743,8 @@ if ($resql) {
if ($with_margin_info === true) {
$facturestatic->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($facturestatic);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
print '<tr class="oddeven"';
@ -2212,6 +2236,16 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
}
if ($i >= $last_num - 1) {
if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else {
$totalarray['val']['total_mark_rate'] = '';
}
}
}
// Extra fields

View File

@ -1209,7 +1209,15 @@ class Paiement extends CommonObject
$result .= ($this->ref ? $this->ref : $this->id);
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -192,6 +192,7 @@ $limit = 5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " WHERE p.type = 'bank-transfer'";
$sql .= " AND p.entity IN (".getEntity('invoice').")";
$sql .= " ORDER BY datec DESC";
$sql .= $db->plimit($limit);

View File

@ -290,7 +290,7 @@ if ($id > 0 || $ref) {
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans('CreditDate').'</td><td>';
print $form->selectDate('', '', '', '', '', "infocredit", 1, 1);
print $form->selectDate(-1, '', '', '', '', "infocredit", 1, 1);
print '</td></tr>';
print '</table>';
print '<br><div class="center"><span class="opacitymedium">'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'</span></div>';

View File

@ -1260,7 +1260,7 @@ class BonPrelevement extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('banktransferdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -262,12 +262,20 @@ if ($id) {
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
if ($type == 'bank-transfer') {
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
} else {
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
}
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND pf.fk_facture = f.rowid";
if ($type == 'bank-transfer') {
$sql .= " AND pf.fk_facture_fourn = f.rowid";
} else {
$sql .= " AND pf.fk_facture = f.rowid";
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= " AND pl.rowid = ".((int) $id);
if ($socid) {

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
@ -560,7 +560,7 @@ class ChargeSociales extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
{
global $langs, $conf, $user, $form;
global $langs, $conf, $user, $form, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -625,7 +625,15 @@ class ChargeSociales extends CommonObject
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -321,6 +321,15 @@ $dolibarr_cron_allow_cli='0';
//
// $php_session_save_handler='';
// force_install_lockinstall
// If this value is set to a value, it forces the creation of a file install.lock once an upgrade process into a new version end.
// The value is the octal value of permission to set on created file.
// The file install.lock prevents the use of the migration process another time. You will have to delete it manually for
// next upgrade.
// Default value: '0'
// Example: '444';
// $force_install_lockinstall='440';
//##################

View File

@ -1488,7 +1488,7 @@ class Contact extends CommonObject
global $action;
$hookmanager->initHooks(array('contactdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1132,18 +1132,16 @@ if ($action == 'create') {
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
if ($soc->remise_percent) {
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent).' ';
} else {
print $langs->trans("CompanyHasNoRelativeDiscount");
print '<span class="hideonsmartphone">'.$langs->trans("CompanyHasNoRelativeDiscount").'. </span>';
}
print '. ';
$absolute_discount = $soc->getAvailableDiscounts();
if ($absolute_discount) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency)).'.';
} else {
print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '<span class="hideonsmartphone">'.$langs->trans("CompanyHasNoAbsoluteDiscount").'.</span>';
}
print '.';
print '</td></tr>';
}
@ -1370,18 +1368,16 @@ if ($action == 'create') {
// Line info of thirdparty discounts
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
if ($object->thirdparty->remise_percent) {
print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent).'. ';
} else {
print $langs->trans("CompanyHasNoRelativeDiscount");
print '<span class="hideonsmartphone">'.$langs->trans("CompanyHasNoRelativeDiscount").'. </span>';
}
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
print '. ';
if ($absolute_discount) {
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency)).'.';
} else {
print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '<span class="hideonsmartphone">'.$langs->trans("CompanyHasNoAbsoluteDiscount").'.</span>';
}
print '.';
print '</td></tr>';
// Date

View File

@ -2042,7 +2042,7 @@ class Contrat extends CommonObject
global $action;
$hookmanager->initHooks(array('contractdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -2591,6 +2591,12 @@ class ContratLigne extends CommonObjectLine
*/
public $table_element = 'contratdet';
/**
* @var string Name to use for 'features' parameter to check module permissions with restrictedArea()
*/
public $element_for_permission = 'contrat';
/**
* @var int ID
*/
@ -2723,6 +2729,34 @@ class ContratLigne extends CommonObjectLine
const STATUS_CLOSED = 5;
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'qty' =>array('type'=>'integer', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35, 'isameasure'=>1),
'total_ht' =>array('type'=>'integer', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>36, 'isameasure'=>1),
'total_tva' =>array('type'=>'integer', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>37, 'isameasure'=>1),
'total_ttc' =>array('type'=>'integer', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>38, 'isameasure'=>1),
//'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
//'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
//'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
//'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
//'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
//'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserOpen', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCloture', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed'))
);
// END MODULEBUILDER PROPERTIES
/**
* Constructor

View File

@ -95,6 +95,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'facture_fourn_det' && $user->rights->fournisseur->facture->creer) {
$perm = 1;
} elseif ($table_element_line == 'facture_fourn_det_rec' && $user->rights->fournisseur->facture->creer) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {

View File

@ -244,6 +244,7 @@ class box_members_by_type extends ModeleBoxes
);
} else {
$this->info_box_contents[$line][] = array(
'tr' => 'class="liste_total"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")
);

View File

@ -196,6 +196,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
);
} else {
$this->info_box_contents[$line][] = array(
'tr' => 'class="liste_total"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total"),
);

View File

@ -83,6 +83,11 @@ abstract class CommonObject
*/
public $element;
/**
* @var string Name to use for 'features' parameter to check module permissions with restrictedArea(). Undefined means same value than $element.
*/
public $element_for_permission;
/**
* @var string Name of table without prefix where object is stored
*/
@ -681,13 +686,20 @@ abstract class CommonObject
*/
public function getKanbanView($option = '')
{
$return = '<div class="box-flex-item">';
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-title">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'label')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->label.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
@ -3378,7 +3390,7 @@ abstract class CommonObject
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER";
} elseif ($this->element == 'facture' || $this->element == 'invoice') {
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE";
} elseif ($this->element == 'facture_fourn' || $this->element == 'supplier_invoice' || $this->element == 'invoice_supplier') {
} elseif ($this->element == 'facture_fourn' || $this->element == 'supplier_invoice' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') {
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_INVOICE";
} elseif ($this->element == 'order_supplier' || $this->element == 'supplier_order') {
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_ORDER";
@ -3423,6 +3435,9 @@ abstract class CommonObject
$fieldtva = 'tva';
$fieldup = 'pu_ht';
}
if ($this->element == 'invoice_supplier_rec') {
$fieldup = 'pu_ht';
}
if ($this->element == 'expensereport') {
$fieldup = 'value_unit';
}
@ -3573,7 +3588,7 @@ abstract class CommonObject
if ($this->element == 'facture' || $this->element == 'facturerec') {
$fieldtva = 'total_tva';
}
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') {
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') {
$fieldtva = 'total_tva';
}
if ($this->element == 'propal') {
@ -8036,6 +8051,8 @@ abstract class CommonObject
$element = $this->element;
if ($element == 'facturerec') {
$element = 'facture';
} elseif ($element == 'invoice_supplier_rec') {
return $user->rights->fournisseur->facture;
}
return $user->rights->{$element};

View File

@ -287,6 +287,8 @@ class DolEditor
$out .= '">';
$out .= htmlspecialchars($this->content);
$out .= '</pre>';
$out .= '<input type="hidden" id="'.$this->htmlname.'_x" name="'.$this->htmlname.'_x">';
$out .= '<input type="hidden" id="'.$this->htmlname.'_y" name="'.$this->htmlname.'_y">';
$out .= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
$out .= htmlspecialchars($this->content);
$out .= '</textarea>';
@ -315,11 +317,23 @@ class DolEditor
$out .= 'jQuery(document).ready(function() {
jQuery(".buttonforacesave").click(function() {
console.log("We click on savefile button for component '.$this->htmlname.'");
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
console.log(aceEditor.getSession().getValue());
jQuery("#'.$this->htmlname.'").val(aceEditor.getSession().getValue());
/*if (jQuery("#'.$this->htmlname.'").html().length > 0) return true;
else return false;*/
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
if (aceEditor) {
var cursorPos = aceEditor.getCursorPosition();
console.log(cursorPos);
if (cursorPos) {
jQuery("#'.$this->htmlname.'_x").val(cursorPos.row);
jQuery("#'.$this->htmlname.'_y").val(cursorPos.column);
}
//console.log(aceEditor.getSession().getValue());
// Inject content of editor into the original HTML field.
jQuery("#'.$this->htmlname.'").val(aceEditor.getSession().getValue());
/*if (jQuery("#'.$this->htmlname.'").html().length > 0) return true;
else return false;*/
} else {
console.log("Failed to retrieve js object ACE from its name");
return false;
}
});
})';
$out .= '</script>'."\n";

View File

@ -608,10 +608,14 @@ class ExtraFields
if ($unique) {
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
} else {
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX uk_".$table."_".$attrname;
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX IF EXISTS uk_".$table."_".$attrname;
}
dol_syslog(get_class($this).'::update', LOG_DEBUG);
$resql = $this->db->query($sql, 1, 'dml');
/*if ($resql < 0) {
$this->error = $this->db->lasterror();
return -1;
}*/
return 1;
} else {
$this->error = $this->db->lasterror();

View File

@ -1106,13 +1106,13 @@ class Form
}
print '<option value="0"';
if (0 == $selected) {
if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
print ' selected';
}
print '>'.$langs->trans("Product");
print '<option value="1"';
if (1 == $selected) {
if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
print ' selected';
}
print '>'.$langs->trans("Service");
@ -2219,9 +2219,10 @@ class Form
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param string $nooutput No print, return the output into a string
* @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0)
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1)
{
// phpcs:enable
global $langs, $conf;
@ -2261,7 +2262,7 @@ class Form
}
}
// mode=1 means customers products
$urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
$urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
$urloption .= '&socid='.$socid;
@ -2357,7 +2358,7 @@ class Form
$out .= img_picto($langs->trans("Search"), 'search');
}
} else {
$out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus);
$out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus, $status_purchase);
}
if (empty($nooutput)) {
@ -2453,9 +2454,10 @@ class Form
* 'warehouseopen' = count products from open warehouses,
* 'warehouseclosed' = count products from closed warehouses,
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @return array Array of keys for json
*/
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $status_purchase = -1)
{
// phpcs:enable
global $langs, $conf;
@ -2593,6 +2595,9 @@ class Form
} elseif ($status >= 0) {
$sql .= " AND p.tosell = ".((int) $status);
}
if ($status_purchase >= 0) {
$sql .= " AND p.tobuy = ".((int) $status_purchase);
}
// Filter by product type
if (strval($filtertype) != '') {
$sql .= " AND p.fk_product_type = ".((int) $filtertype);
@ -7379,7 +7384,18 @@ class Form
$objecttmp = null;
$InfoFieldList = explode(":", $objectdesc);
// Example of value for $objectdec:
// Bom:bom/class/bom.class.php:0:t.status=1
// Bom:bom/class/bom.class.php:0:t.status=1:ref
// Bom:bom/class/bom.class.php:0:(t.status:=:1):ref
$InfoFieldList = explode(":", $objectdesc, 4);
$vartmp = $InfoFieldList[3];
$reg = array();
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
$InfoFieldList[4] = $reg[1]; // take the sort field
}
$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
$classname = $InfoFieldList[0];
$classpath = $InfoFieldList[1];
$addcreatebuttonornot = empty($InfoFieldList[2]) ? 0 : $InfoFieldList[2];
@ -8122,8 +8138,15 @@ class Form
}
$out .= '};'."\n";
$out .= '$(document).ready(function () {
$(\'#'.$htmlname.'\').'.$tmpplugin.'({
dir: \'ltr\',
$(\'#'.$htmlname.'\').'.$tmpplugin.'({';
if ($placeholder) {
$out .= '
placeholder: {
id: \'-1\',
text: \''.dol_escape_js($placeholder).'\'
},';
}
$out .= ' dir: \'ltr\',
// Specify format function for dropdown item
formatResult: formatResult,
templateResult: formatResult, /* For 4.0 */
@ -9740,24 +9763,45 @@ class Form
$ret = '';
$ret .= '<div class="nowrap centpercent">';
$ret .= '<div class="divadvancedsearchfieldcomp inline-block">';
//$ret .= '<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor paddingright">';
$ret .= '<span class="fas fa-filter linkobject boxfilter" title="Filter" id="idsubimgproductdistribution"></span>';
$ret .= $langs->trans("Filters");
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
$ret .= '<span class="fas fa-filter linkobject boxfilter pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
//$ret .= $langs->trans("Filters");
$ret .= '</a>';
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$ret .= '<div name="search_component_params" class="search_component_params inline-block minwidth500 maxwidth300onsmartphone valignmiddle">';
$texttoshow = '<div class="opacitymedium inline-block search_component_searchtext">'.$langs->trans("Search").'</div>';
$ret .= '<div class="search_component inline-block valignmiddle">'.$texttoshow.'</div>';
$ret .= '</div>';
$ret .= "<!-- Syntax of Generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
if (GETPOST('show_search_component_params_hidden', 'int')) {
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
// Show select fields as tags.
$ret .= '<div name="divsearch_component_params" class="noborderbottom search_component_params inline-block valignmiddle">';
if ($search_component_params_hidden) {
if (!preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with ()
$search_component_params_hidden .= '('.$search_component_params_hidden.')';
}
$errormessage = '';
if (!dolCheckFilters($search_component_params_hidden, $errormessage)) {
print 'ERROR in parsing search string';
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
//var_dump($search_component_params_hidden);
$htmltags = preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $search_component_params_hidden);
//var_dump($htmltags);
$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch"><span class="tagsearchdelete select2-selection__choice__remove">x</span> '.$htmltags.'</span>';
}
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
//$ret .= search_component_params
//$texttoshow = '<div class="opacitymedium inline-block search_component_searchtext">'.$langs->trans("Search").'</div>';
//$ret .= '<div class="search_component inline-block valignmiddle">'.$texttoshow.'</div>';
$show_search_component_params_hidden = 1;
if ($show_search_component_params_hidden) {
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
}
$ret .= '<input type="'.(GETPOST('show_search_component_params_hidden', 'int') ? 'text' : 'hidden').'" name="search_component_params_hidden" class="search_component_params_hidden marginleftonly" value="'.$search_component_params_hidden.'">';
$ret .= "<!-- We store the full search string into this field. For example: (t.ref:like:'SO-%') and ((t.ref:like:'CO-%') or (t.ref:like:'AA%')) -->";
$ret .= '<input type="hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
// For compatibility with forms that show themself the search criteria in addition of this component, we output the fields
foreach ($arrayofcriterias as $criterias) {
foreach ($criterias as $criteriafamilykey => $criteriafamilyval) {
@ -9781,8 +9825,14 @@ class Form
}
}
}
$ret .= '</div>';
$ret .= "<!-- Syntax of Generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
$ret .= '<input type="text" placeholder="'.$langs->trans("Search").'" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
$ret .= '</div>';
$ret .= '</div>';
return $ret;
}

View File

@ -460,7 +460,7 @@ class FormOther
* @param string $htmlname Name of combo list (example: 'search_sale')
* @param User $user Object user
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param int|string $showempty 1=show also an empty value
* @param int|string $showempty 1=show also an empty value or text to show for empty
* @param string $morecss More CSS
* @param int $norepresentative Show also an entry "Not categorized"
* @return string Html combo list code
@ -489,12 +489,12 @@ class FormOther
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) {
$textforempty = ' ';
if (!empty($conf->use_javascript_ajax)) {
$textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
}
if (!is_numeric($showempty)) {
$textforempty = $showempty;
}
if (!empty($conf->use_javascript_ajax) && $textforempty == ' ') {
$textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
}
$out .= '<option class="optiongrey" value="'.($showempty < 0 ? $showempty : -1).'"'.($selected == $showempty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
}
@ -1479,9 +1479,10 @@ class FormOther
* @param array $search_groupby Array of preselected fields
* @param array $arrayofgroupby Array of groupby to fill
* @param string $morecss More CSS
* @param string $showempty '1' or 'text'
* @return string HTML string component
*/
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250')
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250', $showempty = '1')
{
global $langs, $extrafields, $form;
@ -1493,7 +1494,7 @@ class FormOther
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
foreach ($object->fields as $key => $val) {
if (!$val['measure']) {
if (!$val['isameasure']) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
@ -1541,7 +1542,7 @@ class FormOther
foreach ($arrayofgroupby as $key => $val) {
$arrayofgroupbylabel[$key] = $val['label'];
}
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', $morecss, 1);
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
return $result;
}
@ -1552,9 +1553,10 @@ class FormOther
* @param mixed $object Object analyzed
* @param array $search_xaxis Array of preselected fields
* @param array $arrayofxaxis Array of groupby to fill
* @return string HTML string component
* @param string $showempty '1' or 'text'
* @return string HTML string component
*/
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis)
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1')
{
global $langs, $extrafields, $form;
@ -1589,9 +1591,9 @@ class FormOther
continue;
}
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => $val['position'].'-y');
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => $val['position'].'-m');
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => $val['position'].'-d');
} else {
$arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
}
@ -1617,7 +1619,7 @@ class FormOther
foreach ($arrayofxaxis as $key => $val) {
$arrayofxaxislabel[$key] = $val['label'];
}
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
return $result;
}

View File

@ -99,7 +99,8 @@ $arrayoftype = array(
'order' => array('label' => 'Orders', 'ObjectClassName' => 'Commande', 'enabled' => $conf->commande->enabled, 'ClassPath' => "/commande/class/commande.class.php"),
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/facture/class/facture.class.php"),
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/class/facturerec.class.php", 'langs'=>'bills'),
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contract'),
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contracts'),
'contractdet' => array('label' => 'ContractLines', 'ObjectClassName' => 'ContratLigne', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contracts'),
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => "/mrp/class/mo.class.php"),
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
@ -159,6 +160,11 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
$search_component_params = array('');
$search_component_params_hidden = GETPOST('search_component_params_hidden', 'alphanohtml');
// For the case we enter a criteria manually, the search_component_params_input will be defined and must be used in priority
if (GETPOST('search_component_params_input', 'alphanohtml')) {
$search_component_params_hidden = GETPOST('search_component_params_input', 'alphanohtml');
}
$MAXUNIQUEVALFORGROUP = 20;
$MAXMEASURESINBARGRAPH = 20;
@ -175,7 +181,12 @@ $arrayofgroupby = array();
$arrayofyaxis = array();
$arrayofvaluesforgroupby = array();
restrictedArea($user, $object->element, 0, '');
$features = $object->element;
if (!empty($object->element_for_permission)) {
$features = $object->element_for_permission;
}
restrictedArea($user, $features, 0, '');
$error = 0;
@ -420,22 +431,22 @@ if ($object->isextrafieldmanaged) {
}
}
}
print '<div class="inline-block"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1);
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span></div>';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields
print '</div>';
// XAxis
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis);
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>';
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields
print '</div>';
// Group by
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby);
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>';
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
print '</div>';
@ -561,7 +572,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) {
$sql .= ' AND entity IN ('.getEntity($object->element).')';
}
// Add the where here
$sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml');
$sqlfilters = $search_component_params_hidden;
if ($sqlfilters) {
$errormessage = '';
if (dolCheckFilters($sqlfilters, $errormessage)) {

View File

@ -302,8 +302,8 @@ abstract class DoliDB implements Database
/**
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
* 19700101020000 -> 3600 with server TZ = +1 and $gm='tzserver'
* 19700101020000 -> 7200 whaterver is server TZ if $gm='gmt'
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ

View File

@ -26,7 +26,8 @@
$(document).ready(function () {
var timezone = jstz.determine();
console.log("Timezone detected for user: "+timezone.name());
// Detect and save TZ and DST
var rightNow = new Date();
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);

View File

@ -199,7 +199,7 @@ function societe_prepare_head(Societe $object)
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) {
$nbBankAccount = 0;
$foundonexternalonlinesystem = 0;
$langs->load("banks");
$langs->load("bills");
$title = $langs->trans("PaymentModes");

View File

@ -357,18 +357,18 @@ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $exclu
* Convert a string date into a GM Timestamps date
* Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not supported. If parameter gm is 1, we will use no TZ, if not we will use TZ of server, not the one inside string.
*
* @param string $string Date in a string
* YYYYMMDD
* YYYYMMDDHHMMSS
* YYYYMMDDTHHMMSSZ
* YYYY-MM-DDTHH:MM:SSZ (RFC3339)
* DD/MM/YY or DD/MM/YYYY (deprecated)
* DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated)
* @param int $gm 1 =Input date is GM date,
* 0 =Input date is local date using PHP server timezone
* @return int Date as a timestamp
* 19700101020000 -> 7200 with gm=1
* 19700101000000 -> 0 with gm=1
* @param string $string Date in a string
* YYYYMMDD
* YYYYMMDDHHMMSS
* YYYYMMDDTHHMMSSZ
* YYYY-MM-DDTHH:MM:SSZ (RFC3339)
* DD/MM/YY or DD/MM/YYYY (deprecated)
* DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated)
* @param int|string $gm 'gmt' or 1 =Input date is GM date,
* 'tzserver' or 0 =Input date is date using PHP server timezone
* @return int Date as a timestamp
* 19700101020000 -> 7200 with gm=1
* 19700101000000 -> 0 with gm=1
*
* @see dol_print_date(), dol_mktime(), dol_getdate()
*/
@ -408,7 +408,14 @@ function dol_stringtotime($string, $gm = 1)
$string = preg_replace('/([^0-9])/i', '', $string);
$tmp = $string.'000000';
$date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), ($gm ? 1 : 0));
// Clean $gm
if ($gm === 1) {
$gm = 'gmt';
} elseif (empty($gm) || $gm === 'tzserver') {
$gm = 'tzserver';
}
$date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm);
return $date;
}

View File

@ -353,12 +353,14 @@ function GETPOSTISSET($paramname)
}
}
}
// If there is saved contextpage, page or limit
// If there is saved contextpage, limit, page or mode
if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) {
$isset = true;
} elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
$isset = true;
} elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
$isset = true;
} elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
} elseif ($paramname == 'mode' && !empty($_SESSION['lastsearch_mode_'.$relativepathstring])) {
$isset = true;
}
} else {
@ -448,10 +450,12 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
// If there is saved contextpage, page or limit
if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) {
$out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
} elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
$out = $_SESSION['lastsearch_page_'.$relativepathstring];
} elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
$out = $_SESSION['lastsearch_limit_'.$relativepathstring];
} elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
$out = $_SESSION['lastsearch_page_'.$relativepathstring];
} elseif ($paramname == 'mode' && !empty($_SESSION['lastsearch_mode_'.$relativepathstring])) {
$out = $_SESSION['lastsearch_mode_'.$relativepathstring];
}
} elseif (!isset($_GET['sortfield'])) {
// Else, retrieve default values if we are not doing a sort
@ -2569,11 +2573,11 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto',
{
global $conf;
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
//print 'gm:'.$gm.' gm==auto:'.($gm == 'auto').'<br>';
if ($gm === 'auto') {
$gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
}
//print 'gm:'.$gm.' gm === auto:'.($gm === 'auto').'<br>';exit;
// Clean parameters
if ($hour == -1 || empty($hour)) {
@ -3719,7 +3723,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building',
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building',
'card', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
'multicurrency',
@ -3745,7 +3749,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring',
'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
'uncheck', 'user-cog', 'vat', 'website', 'workstation',
'uncheck', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation',
'conferenceorbooth', 'eventorganization'
))) {
$fakey = $pictowithouttext;
@ -10797,7 +10801,7 @@ function dolForgeCriteriaCallback($matches)
{
global $db;
//dol_syslog("Convert matches ".$matches[1]);
dol_syslog("Convert matches ".$matches[1]);
if (empty($matches[1])) {
return '';
}

View File

@ -87,7 +87,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
// Turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false));
// Restrict use to some protocols only
$protocols = 0;

View File

@ -200,7 +200,7 @@ function invoice_rec_prepare_head($object)
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card-rec.php?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT . '/compta/facture/card-rec.php?id=' . $object->id;
$head[$h][1] = $langs->trans("RepeatableInvoice");
$head[$h][2] = 'card';
$h++;
@ -216,6 +216,35 @@ function invoice_rec_prepare_head($object)
return $head;
}
/**
* Return array head with list of tabs to view object informations.
*
* @param Facture $object Invoice object
* @return array head array with tabs
*/
function supplier_invoice_rec_prepare_head($object)
{
global $db, $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/fourn/facture/card-rec.php?id=' . $object->id;
$head[$h][1] = $langs->trans("RepeatableSupplierInvoice");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice_supplier_rec');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice_supplier_rec', 'remove');
return $head;
}
/**
* Return a HTML table that contains a pie chart of customer invoices
*

View File

@ -1065,12 +1065,12 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
}
// Capital
if (!empty($fromcompany->capital) && $fromcompany->capital) {
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
if (!empty($fromcompany->capital)) {
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string or a float
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
} else {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
} elseif (!empty($fromcompany->capital)) {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $fromcompany->capital, $outputlangs);
}
}
// Prof Id 1

View File

@ -892,8 +892,10 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
}
if ($feature == 'expensereport') {
$useridtocheck = $object->fk_user_author;
if (!in_array($useridtocheck, $childids)) {
return false;
if (!$user->rights->expensereport->readall) {
if (!in_array($useridtocheck, $childids)) {
return false;
}
}
}
}

View File

@ -100,6 +100,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
$created = $event["created"];
$modified = $event["modified"];
$assignedUsers = $event["assignedUsers"];
//print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt');
// Format
$summary = format_cal($format, $summary);
@ -191,16 +192,16 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
// Date must be GMT dates
// Current date
fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n");
fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt')."\n");
// Start date
$prefix = "";
$startdatef = dol_print_date($startdate, "dayhourxcard", true);
$startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt');
if ($fulldayevent) {
// Local time
$prefix = ";VALUE=DATE";
$startdatef = dol_print_date($startdate, "dayxcard", false);
$startdatef = dol_print_date($startdate, "dayxcard", 'gmt');
}
fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n");
@ -208,6 +209,9 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
// End date
if ($fulldayevent) {
if (empty($enddate)) {
// We add 1 day needed for full day event (DTEND must be next day after event).
// This is mention in https://datatracker.ietf.org/doc/html/rfc5545:
// "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event."
$enddate = dol_time_plus_duree($startdate, 1, "d");
}
} else {
@ -217,14 +221,14 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
}
$prefix = "";
$enddatef = dol_print_date($enddate, "dayhourxcard", true);
$enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt');
if ($fulldayevent) {
$prefix = ";VALUE=DATE";
$enddatef = dol_print_date($enddate + 1, "dayxcard", false);
// Local time
//$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false);
// We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event)
// This is mention in https://datatracker.ietf.org/doc/html/rfc5545:
// "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event."
$enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt');
}
fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n");
@ -256,11 +260,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
}
if ($created) {
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n");
fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", 'gmt')."\n");
}
if ($modified) {
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n");
fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt')."\n");
}
fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n");
@ -270,7 +274,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
fwrite($calfileh, "LOCATION:".$location."\n");
fwrite($calfileh, "TRANSP:OPAQUE\n");
fwrite($calfileh, "CLASS:CONFIDENTIAL\n");
fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n");
fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", 'gmt')."\n");
fwrite($calfileh, "END:VJOURNAL\n");
}

View File

@ -1087,6 +1087,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&amp;search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid');
}
$newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list');
$newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment');
if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {

View File

@ -1216,35 +1216,6 @@ class pdf_eratosthene extends ModelePDFCommandes
}
//}
// VAT
foreach ($this->tva_array as $tvakey => $tvaval) {
if ($tvakey != 0) { // On affiche pas taux 0
$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl = '';
if (preg_match('/\*/', $tvakey)) {
$tvakey = str_replace('*', '', $tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
$totalvat .= ' ';
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
$totalvat .= $tvaval['vatcode'].$tvacompl;
} else {
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
}
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
}
}
// VAT
foreach ($this->tva_array as $tvakey => $tvaval) {
if ($tvakey != 0) { // On affiche pas taux 0

View File

@ -215,6 +215,11 @@ class modAsset extends DolibarrModules
*/
public function init($options = '')
{
$result = $this->_load_tables('/install/mysql/tables/', 'asset');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Permissions
$this->remove($options);

View File

@ -129,6 +129,25 @@ class modFournisseur extends DolibarrModules
6=>array('file'=>'box_supplier_orders_awaiting_reception.php', 'enabledbydefaulton'=>'Home'),
);
$arraydate = dol_getdate(dol_now());
$datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
$this->cronjobs = array(
0 => array(
'label'=>'RecurringSupplierInvoices',
'jobtype'=>'method',
'class'=>'fourn/class/fournisseur.facture-rec.class.php',
'objectname'=>'FactureFournisseurRec',
'method'=>'createRecurringInvoices',
'parameters'=>'',
'comment'=>'Generate recurring supplier invoices',
'frequency'=>1,
'unitfrequency'=>3600 * 24,
'priority'=>50,
'status'=>1,
'datestart'=>$datestart
));
// Permissions
$this->rights = array();
$this->rights_class = 'fournisseur';

View File

@ -159,6 +159,11 @@ class modMailing extends DolibarrModules
*/
public function init($options = '')
{
$result = $this->_load_tables('/install/mysql/tables/', 'mailing');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Permissions
$this->remove($options);

View File

@ -106,7 +106,8 @@ class modTicket extends DolibarrModules
$this->const = array(
1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0),
2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0),
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)
);
@ -320,6 +321,11 @@ class modTicket extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'ticket');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Permissions
$this->remove($options);

View File

@ -37,6 +37,9 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n";
if (isset($totalarray) && isset($totalarray['nbfield'])) {
$totalarray['nbfield']++;
}
}
}
}

View File

@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) {
}
// DDOS protection
$size = (int) $_SERVER['CONTENT_LENGTH'];
$size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']);
if ($size > 10000) {
http_response_code(413);
$langs->loadLangs(array("errors", "install"));
@ -136,7 +136,7 @@ $(document).ready(function () {
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<input type="hidden" name="actionlogin" value="login">
<input type="hidden" name="loginfunction" value="loginfunction" />
<!-- Add fields to send local user information -->
<!-- Add fields to store and send local user information. This fields are filled by the core/js/dst.js -->
<input type="hidden" name="tz" id="tz" value="" />
<input type="hidden" name="tz_string" id="tz_string" value="" />
<input type="hidden" name="dst_observed" id="dst_observed" value="" />

View File

@ -65,7 +65,7 @@ $colspan = 3; // Columns: total ht + col edit + col delete
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
$colspan++; //Add column for Total (currency) if required
}
if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) {
if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) {
$colspan++; // With this, there is a column move button
}
@ -89,6 +89,8 @@ if (!empty($extrafields)) {
$objectline = new SupplierInvoiceLine($this->db);
} elseif ($this->table_element_line == 'facturedet_rec') {
$objectline = new FactureLigneRec($this->db);
} elseif ($this->table_element_line == 'facture_fourn_det_rec') {
$objectline = new FactureFournisseurLigneRec($this->db);
}
}
print "<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
@ -103,7 +105,7 @@ if ($nolinesbefore) {
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span>
</td>
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { // We must have same test in printObjectLines
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines
?>
<td class="linecolrefsupplier"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); ?></span></td>
<?php
@ -343,7 +345,7 @@ if ($nolinesbefore) {
$doleditor = new DolEditor('dp_desc', GETPOST('dp_desc', 'restricthtml'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT) ? 100 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%');
$doleditor->Create();
// Show autofill date for recurring invoices
if (!empty($conf->service->enabled) && $object->element == 'facturerec') {
if (!empty($conf->service->enabled) && ($object->element == 'facturerec' || $object->element == 'invoice_supplier_rec')) {
echo '<div class="divlinefordates"><br>';
echo $langs->trans('AutoFillDateFrom').' ';
echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1);
@ -362,7 +364,7 @@ if ($nolinesbefore) {
}
}
echo '</td>';
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { // We must have same test in printObjectLines
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines
$coldisplay++;
?>
<td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat minwidth50 maxwidth125" value="<?php echo (GETPOSTISSET("fourn_ref") ? GETPOST("fourn_ref", 'alpha', 2) : ''); ?>"></td>

View File

@ -66,7 +66,7 @@ $colspan = 3; // Col total ht + col edit + col delete
if (!empty($inputalsopricewithtax)) {
$colspan++; // We add 1 if col total ttc
}
if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier'))) {
if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) {
$colspan++; // With this, there is a column move button
}
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) {
@ -170,7 +170,11 @@ $coldisplay++;
}
// Show autofill date for recuring invoices
if (!empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec') {
if (!empty($conf->service->enabled) && $line->product_type == 1 && ($line->element == 'facturedetrec' || $line->element == 'invoice_supplier_det_rec')) {
if ($line->element == 'invoice_supplier_det_rec') {
$line->date_start_fill = $line->date_start;
$line->date_end_fill = $line->date_end;
}
echo '<br>';
echo $langs->trans('AutoFillDateFrom').' ';
echo $form->selectyesno('date_start_fill', GETPOSTISSET('date_start_fill') ? GETPOST('date_start_fill', 'int') : $line->date_start_fill, 1);
@ -183,7 +187,7 @@ $coldisplay++;
</td>
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') { // We must have same test in printObjectLines
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines
$coldisplay++;
?>
<td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth50 maxwidth150" value="<?php echo GETPOSTISSET('fourn_ref') ? GETPOST('fourn_ref') : ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>

Some files were not shown because too many files have changed in this diff Show More