From 090b0e90d20aceed65805bd0950dd45703142f37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Feb 2020 23:52:48 +0100 Subject: [PATCH 01/69] FIX #13183 --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c5d1d7837e9..b5cf6e4c9dd 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -5024,7 +5024,7 @@ function migrate_users_socialnetworks() $obj->socialnetworks = '[]'; } $socialnetworks = array_merge($arraysocialnetworks, json_decode($obj->socialnetworks, true)); - $sqlupd = 'UPDATE '.MAIN_DB_PREFIX.'user SET socialnetworks="'.$db->escape(json_encode($socialnetworks, true)).'"'; + $sqlupd = 'UPDATE '.MAIN_DB_PREFIX."user SET socialnetworks='".$db->escape(json_encode($socialnetworks, true))."'"; $sqlupd.= ', skype=null'; $sqlupd.= ', twitter=null'; $sqlupd.= ', facebook=null'; From 6366881f91e0a14cd3f9d02b5a8c3ad22448a95d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Feb 2020 00:41:25 +0100 Subject: [PATCH 02/69] FIX #13175 --- .../bank/account_statement_document.php | 6 +-- htdocs/compta/bank/releve.php | 2 +- htdocs/core/photos_resize.php | 49 ++++++++++++------- .../tpl/document_actions_post_headers.tpl.php | 3 +- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 08447216dda..bdb3ac4620e 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -137,9 +137,9 @@ if ($id > 0 || !empty($ref)) { $modulepart = 'bank'; $permission = $user->rights->banque->modifier; $permtoedit = $user->rights->banque->modifier; - $param = '&id='.$object->id.'&num='.$num; - $uri = '&num='.$num; - $relativepathwithnofile = $id."/statement/".$num."/"; + $param = '&id='.$object->id.'&num='.urlencode($num); + $moreparam = '&num='.urlencode($num);; + $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($num)."/"; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 9ae1d5d7d83..a16927bda0b 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $langs->loadLangs(array("banks", "categories", "companies", "bills", "trips", "donations", "loan")); $action = GETPOST('action', 'alpha'); -$id = GETPOST('account', 'int'); +$id = GETPOST('account', 'int') ? GETPOST('account', 'int') : GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $dvid = GETPOST('dvid', 'alpha'); $numref = GETPOST('num', 'alpha'); diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 17c7cb9e974..dd59b20c964 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -38,6 +38,10 @@ $original_file = GETPOST("file"); $backtourl = GETPOST('backtourl'); $cancel = GETPOST('cancel', 'alpha'); +$file = GETPOST('file', 'alpha'); +$num = GETPOST('num', 'alpha'); // Used for document on bank statement + + // Security check if (empty($modulepart)) accessforbidden('Bad value for modulepart'); $accessallowed = 0; @@ -249,19 +253,25 @@ else { if (empty($backtourl)) { - if (in_array($modulepart, array('product', 'produit', 'service', 'produit|service'))) $backtourl = DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('expensereport'))) $backtourl = DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('holiday'))) $backtourl = DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('member'))) $backtourl = DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('project'))) $backtourl = DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('propal'))) $backtourl = DOL_URL_ROOT."/comm/propal/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('societe'))) $backtourl = DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('tax'))) $backtourl = DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('ticket'))) $backtourl = DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('user'))) $backtourl = DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('bank'))) $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - elseif (in_array($modulepart, array('mrp'))) $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".$id.'&file='.urldecode($_POST["file"]); - else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($_POST["file"]); + $regs = array(); + + if (in_array($modulepart, array('product', 'produit', 'service', 'produit|service'))) $backtourl = DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('expensereport'))) $backtourl = DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('holiday'))) $backtourl = DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('member'))) $backtourl = DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('project'))) $backtourl = DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('propal'))) $backtourl = DOL_URL_ROOT."/comm/propal/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('societe'))) $backtourl = DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('tax'))) $backtourl = DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('ticket'))) $backtourl = DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('user'))) $backtourl = DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('bank')) && preg_match('/\/statement\/([^\/]+)\//', $file, $regs)) { + $num = $regs[1]; + $backtourl = DOL_URL_ROOT."/compta/bank/account_statement_document.php?id=".$id.'&num='.urlencode($num).'&file='.urldecode($file); + } + elseif (in_array($modulepart, array('bank'))) $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($file); + elseif (in_array($modulepart, array('mrp'))) $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".$id.'&file='.urldecode($file); + else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file); } @@ -283,11 +293,11 @@ if ($cancel) } } -if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != "")) +if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex") && GETPOSTISSET("sizey")) { $fullpath = $dir."/".$original_file; - $result = dol_imageResizeOrCrop($fullpath, 0, $_POST['sizex'], $_POST['sizey']); + $result = dol_imageResizeOrCrop($fullpath, 0, GETPOST('sizex', 'int'), GETPOST('sizey', 'int')); if ($result == $fullpath) { @@ -357,7 +367,7 @@ if ($action == 'confirm_crop') $fullpath = $dir."/".$original_file; //var_dump($_POST['w'].'x'.$_POST['h'].'-'.$_POST['x'].'x'.$_POST['y']);exit; - $result = dol_imageResizeOrCrop($fullpath, 1, $_POST['w'], $_POST['h'], $_POST['x'], $_POST['y']); + $result = dol_imageResizeOrCrop($fullpath, 1, GETPOST('w', 'int'), GETPOST('h', 'int'), GETPOST('x', 'int'), GETPOST('y', 'int')); if ($result == $fullpath) { @@ -445,7 +455,7 @@ print '
'."\n"; */ print ''."\n"; -print '
'; +print ''; print ''; print '
'; @@ -454,7 +464,7 @@ print $langs->trans("ResizeDesc").'
'; print $langs->trans("NewLength").': px   '.$langs->trans("or").'   '; print $langs->trans("NewHeight").': px  
'; -print ''; +print ''; print ''; print ''; print ''; @@ -497,7 +507,8 @@ if (!empty($conf->use_javascript_ajax)) print ''; print ''; print '
'; - print ''; + + print ''; print ''; print '
diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index a3de72723a4..2a3d703d16f 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -23,6 +23,7 @@ // $permissiontoadd = permission or not to add a file (can use also $permission) and permission or not to edit file name or crop file (can use also $permtoedit) // $modulepart = for download // $param = param to add to download links +// $moreparam = param to add to download link for the form_attach_new_file function // $upload_dir // $object // $filearray @@ -109,7 +110,7 @@ if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_ // Show upload form (document and links) $formfile->form_attach_new_file( - $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject)?'':'&withproject=1'), + $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject)?'':'&withproject=1').(empty($moreparam)?'':$moreparam), '', 0, 0, From 4b4d1bcce21fbfd959eaa1760ca4947e0c1e0eae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Feb 2020 03:05:58 +0100 Subject: [PATCH 03/69] Fix disable accountancy chart that is deprecated. --- htdocs/accountancy/admin/account.php | 3 +++ htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 333efefbc9d..d75d61e347f 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -278,6 +278,8 @@ if ($resql) '."\n"; $out .= ''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on') : img_picto($langs->trans("Disabled"), 'switch_off')).''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off') : img_picto($langs->trans("Enabled"), 'switch_on')).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f058097ca81..0b732f9372a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3077,7 +3077,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @param string $alt Force alt for bind people - * @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty. + * @param string $morecss Add more class css on img tag (For example 'myclascss'). * @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only. * @return string Return img tag * @see img_object(), img_picto_common() diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index bcb3b576e0e..086a929b723 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -132,7 +132,7 @@ print '
'; print ''; print ''; -print ''; +print ''; print "\n"; // Terminals @@ -149,7 +149,8 @@ if (!empty($conf->service->enabled)) print '\n"; } @@ -161,65 +162,12 @@ print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEP print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID'); print "\n"; -// Bar Restaurant mode -print ''; -print '\n"; - -if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { - print ''; - - print ''; -} - -if ($conf->global->TAKEPOS_BAR_RESTAURANT) -{ - print ''; - - print ''; - - if ($conf->global->TAKEPOS_SUPPLEMENTS) - { - print '\n"; - } -} - +// VAT Grouped on ticket print '\n"; - -// Payment numpad -print '\n"; // Sort product @@ -248,11 +196,20 @@ $array = array(0=>"eldy", 1=>$langs->trans("Colorful")); print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0); print "\n"; +// Payment numpad +print '\n"; + // Direct Payment print '\n"; // Head Bar @@ -290,6 +247,70 @@ print "\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Parameters").''.$langs->trans("Value").'
'; print $langs->trans("CashdeskShowServices"); print ''; - print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1); + print ajax_constantonoff("CASHDESK_SERVICES", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1); print "
'; -print $langs->trans("EnableBarOrRestaurantFeatures"); -print ''; -print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); -print "
'; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; - print ''; - print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); - print '
'; - print $langs->trans("OrderNotes"); - print ''; - print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); - print '
'; - print $langs->trans("BasicPhoneLayout"); - print ''; - print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); - print '
'; - print $langs->trans("ProductSupplements"); - print ''; - print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); - print '
'; - print $langs->trans("SupplementCategory"); - print ''; - print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); - print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); - print "
'; print $langs->trans('TicketVatGrouped'); print ''; -print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1); -print "
'; -print $langs->trans("Paymentnumpad"); -print ''; -$array = array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad")); -print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0); +print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1); print "
'; +print $langs->trans("Paymentnumpad"); +print ''; +$array = array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad")); +print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0); +print "
'; print $langs->trans('DirectPaymentButton'); print ''; -print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1); +print ajax_constantonoff("TAKEPOS_DIRECT_PAYMENT", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1); print "
'; print '
'; +print '
'; + +// Bar Restaurant mode +print '
'; +print ''; + +print ''; +print ''; +print "\n"; + +print ''; +print '\n"; + +if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { + print ''; + + print ''; +} + +if ($conf->global->TAKEPOS_BAR_RESTAURANT) +{ + print ''; + + print ''; + + if ($conf->global->TAKEPOS_SUPPLEMENTS) + { + print '\n"; + } +} +print '
'.$langs->trans("Other").''.$langs->trans("Value").'
'; +print $langs->trans("EnableBarOrRestaurantFeatures"); +print ''; +print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0); +//print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); +print "
'; + print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); + print '
'; + print $langs->trans("OrderNotes"); + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); + print '
'; + print $langs->trans("BasicPhoneLayout"); + print ''; + //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); + print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); + print '
'; + print $langs->trans("ProductSupplements"); + print ''; + //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); + print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); + print '
'; + print $langs->trans("SupplementCategory"); + print ''; + print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); + print "
'; +print '
'; + + // Sumup options if ($conf->global->TAKEPOS_ENABLE_SUMUP) { print '
'; @@ -298,7 +319,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) { print ''; print ''; - print ''; + print ''; print "\n"; print '\n"; $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); @@ -343,42 +340,5 @@ print '
\n"; - -print '

'; - -// Marketplace -print "
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Sumup").''.$langs->trans("Value").'
'; From 16b3e6f7bb6f0eb55a8dca5aa6acdde20d46bb74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 12:44:18 +0100 Subject: [PATCH 43/69] Move external access on dedicated tab Translate field to sort products --- htdocs/core/lib/takepos.lib.php | 7 +- htdocs/takepos/admin/other.php | 179 ++++++++++++++++++++++++++++++++ htdocs/takepos/admin/setup.php | 44 +------- 3 files changed, 187 insertions(+), 43 deletions(-) create mode 100644 htdocs/takepos/admin/other.php diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index 65ad4c091a0..6cf8189f3c8 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -52,7 +52,12 @@ function takepos_prepare_head() $h++; } - complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos'); + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/other.php'; + $head[$h][1] = $langs->trans("Other"); + $head[$h][2] = 'other'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos'); return $head; } diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php new file mode 100644 index 00000000000..ddaaf7dac51 --- /dev/null +++ b/htdocs/takepos/admin/other.php @@ -0,0 +1,179 @@ + + * Copyright (C) 2011-2017 Juanjo Menent + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/admin/setup.php + * \ingroup takepos + * \brief Setup page for TakePos module + */ + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; + +// If socid provided by ajax company selector +if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) +{ + $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); + $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); + $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); +} + +// Security check +if (!$user->admin) accessforbidden(); + +$langs->loadLangs(array("admin", "cashdesk")); + +global $db; + +$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement"; +$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; +$sql .= " AND active = 1"; +$sql .= " ORDER BY libelle"; +$resql = $db->query($sql); +$paiements = array(); +if ($resql) { + while ($obj = $db->fetch_object($resql)) { + array_push($paiements, $obj); + } +} + +/* + * Actions + */ +if (GETPOST('action', 'alpha') == 'set') +{ + $db->begin(); + if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; + + $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity); + //$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); + if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { + $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); + } + if ($conf->global->TAKEPOS_ORDER_NOTES == 1) + { + $extrafields = new ExtraFields($db); + $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1); + } + + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); + + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +/* + * View + */ + +$form = new Form($db); +$formproduct = new FormProduct($db); + +llxHeader('', $langs->trans("CashDeskSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'other', 'TakePOS', -1); +print '
'; + + +// Mode +print ''; +print ''; +print ''; + + +print '
'; + +// Marketplace +print "\n"; +print "\n"; +print ''; +print ''; +print ''; + +print "\n"; +$url = 'https://www.dolistore.com/45-pos'; +print ''; +print ''; +print ''; +print ''; + +print "
'.$langs->trans("WebSiteDesc").''.$langs->trans("URL").'
'.$langs->trans("DolistorePosCategory").''.$url.'
\n"; + +print '
'; + +print '
'; + + + + +print '
'; + +// Support +print "\n"; +print "\n"; +print ''; +print ''; +print ''; + +print "\n"; +$url = 'http://www.takepos.com'; +print ''; +print ''; +print ''; +print ''; + +print "
TakePOS Support'.$langs->trans("URL").'
TakePOS original developers'.$url.'
\n"; + +print '
'; +print '
'; + +llxFooter(); +$db->close(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 086a929b723..5b6fe25af44 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -175,11 +175,8 @@ print '
'; print $langs->trans("SortProductField"); print ''; $prod = new Product($db); -$array = []; -foreach ($prod->fields as $k => $v) { - $array[$k] = $k; -} -print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0); +$array = array('rowid' => 'ID', 'ref' => 'Ref', 'datec' => 'DateCreation', 'tms' => 'DateModification'); +print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1); print "
\n"; -print "\n"; -print ''; -print ''; -print ''; - -print "\n"; -$url = 'https://www.dolistore.com/45-pos'; - print ''; -print ''; -print ''; -print ''; - -print "
'.$langs->trans("WebSiteDesc").''.$langs->trans("URL").'
'.$langs->trans("DolistorePosCategory").''.$url.'
\n"; -print '
'; - -// Support -print "\n"; -print "\n"; -print ''; -print ''; -print ''; - -print "\n"; -$url = 'http://www.takepos.com'; -print ''; -print ''; -print ''; -print ''; - -print "
TakePOS Support'.$langs->trans("URL").'
TakePOS original developers'.$url.'
\n"; -print '
'; - llxFooter(); $db->close(); From 6c4d782a816ab1ce679b15ebd88537250b8705f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 12:48:22 +0100 Subject: [PATCH 44/69] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2ed11212c49..9920b613daa 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -642,7 +642,7 @@ Module50000Desc=Offer customers a PayBox online payment page (credit/debit cards Module50100Name=POS SimplePOS Module50100Desc=Point of Sale module SimplePOS (simple POS). Module50150Name=POS TakePOS -Module50150Desc=Point of Sale module TakePOS (touchscreen POS). +Module50150Desc=Point of Sale module TakePOS (touchscreen POS, for shops, bars or restaurants). Module50200Name=Paypal Module50200Desc=Offer customers a PayPal online payment page (PayPal account or credit/debit cards). This can be used to allow your customers to make ad-hoc payments or payments related to a specific Dolibarr object (invoice, order etc...) Module50300Name=Stripe From b995dc87fa116e5c19f234bc6ac9f5f755cce48f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 12:57:26 +0100 Subject: [PATCH 45/69] NEW Add profile for PSR12 for Eclipse --- dev/setup/eclipse/PSR-12 [built-in].xml | 215 ++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 dev/setup/eclipse/PSR-12 [built-in].xml diff --git a/dev/setup/eclipse/PSR-12 [built-in].xml b/dev/setup/eclipse/PSR-12 [built-in].xml new file mode 100644 index 00000000000..47925209682 --- /dev/null +++ b/dev/setup/eclipse/PSR-12 [built-in].xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 0fbde14b33e57db9f5a6fb6a226c7224159a77f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 12:58:15 +0100 Subject: [PATCH 46/69] Clean syntax of code --- htdocs/takepos/admin/other.php | 87 ++++++++++++++++------------------ 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index ddaaf7dac51..383a710a47a 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -21,17 +21,15 @@ * \ingroup takepos * \brief Setup page for TakePos module */ - require '../../main.inc.php'; // Load $user and permissions -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT . "/core/lib/takepos.lib.php"; // If socid provided by ajax company selector -if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) -{ +if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) { $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); @@ -44,8 +42,8 @@ $langs->loadLangs(array("admin", "cashdesk")); global $db; -$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement"; -$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; +$sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement"; +$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; $sql .= " AND active = 1"; $sql .= " ORDER BY libelle"; $resql = $db->query($sql); @@ -56,11 +54,12 @@ if ($resql) { } } + /* * Actions */ -if (GETPOST('action', 'alpha') == 'set') -{ + +if (GETPOST('action', 'alpha') == 'set') { $db->begin(); if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; @@ -80,52 +79,46 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity); //$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); } - if ($conf->global->TAKEPOS_ORDER_NOTES == 1) - { + if ($conf->global->TAKEPOS_ORDER_NOTES == 1) { $extrafields = new ExtraFields($db); $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1); } - dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); + dol_syslog("admin/cashdesk: level " . GETPOST('level', 'alpha')); if (!$res > 0) $error++; - if (!$error) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } } + /* * View */ -$form = new Form($db); -$formproduct = new FormProduct($db); - llxHeader('', $langs->trans("CashDeskSetup")); -$linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); +$linkback = '' . $langs->trans("BackToModuleList") . ''; +print load_fiche_titre($langs->trans("CashDeskSetup") . ' (TakePOS)', $linkback, 'title_setup'); $head = takepos_prepare_head(); dol_fiche_head($head, 'other', 'TakePOS', -1); print '
'; // Mode -print ''; -print ''; +print ''; +print ''; print ''; @@ -133,16 +126,17 @@ print '
'; // Marketplace print "\n"; -print "\n"; -print ''; -print ''; +print '' . "\n"; +print ''; +print ''; print ''; -print "\n"; $url = 'https://www.dolistore.com/45-pos'; -print ''; -print ''; -print ''; + +print '' . "\n"; +print ''; +print ''; +print ''; print ''; print "
'.$langs->trans("WebSiteDesc").''.$langs->trans("URL").'
' . $langs->trans("WebSiteDesc") . '' . $langs->trans("URL") . '
'.$langs->trans("DolistorePosCategory").''.$url.'
' . $langs->trans("DolistorePosCategory") . '' . $url . '
\n"; @@ -152,22 +146,21 @@ print '
'; print '
'; - - print '
'; // Support print "\n"; -print "\n"; +print '' . "\n"; print ''; -print ''; +print ''; print ''; -print "\n"; $url = 'http://www.takepos.com'; -print ''; + +print '' . "\n"; +print ''; print ''; -print ''; +print ''; print ''; print "
TakePOS Support'.$langs->trans("URL").'' . $langs->trans("URL") . '
TakePOS original developers'.$url.'' . $url . '
\n"; From 376e19f6211455f9c1e25d052b5feefea9654504 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 25 Feb 2020 13:05:23 +0100 Subject: [PATCH 47/69] Update HOWTO-Translation.txt --- htdocs/langs/HOWTO-Translation.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/HOWTO-Translation.txt b/htdocs/langs/HOWTO-Translation.txt index 2d7c910d98a..0a05133fdb8 100644 --- a/htdocs/langs/HOWTO-Translation.txt +++ b/htdocs/langs/HOWTO-Translation.txt @@ -1,8 +1,9 @@ --- Translation How to --- -Document explaining how to translate Dolibarr in a new language is -available on wiki: +An instruction guide for translating Dolibarr in a new language is +available on Dolibarr wiki: -English: http://wiki.dolibarr.org/index.php/Translator_documentation -French: http://wiki.dolibarr.org/index.php/Documentation_traducteur -Spanish: http://wiki.dolibarr.org/index.php/Documentaci%C3%B3n_traductores +English: https://wiki.dolibarr.org/index.php/Translator_documentation +French: https://wiki.dolibarr.org/index.php/Documentation_traducteur +Spanish: https://wiki.dolibarr.org/index.php/Documentaci%C3%B3n_traductores +German: https://wiki.dolibarr.org/index.php/Dokumentation_Uebersetzung From dbe770a24fbbc17e69c8d11adc77255fe45273f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 13:07:39 +0100 Subject: [PATCH 48/69] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9920b613daa..4ba8ac211c9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -328,7 +328,7 @@ SetupIsReadyForUse=Module deployment is finished. You must however enable and se NotExistsDirect=The alternative root directory is not defined to an existing directory.
InfDirAlt=Since version 3, it is possible to define an alternative root directory. This allows you to store, into a dedicated directory, plug-ins and custom templates.
Just create a directory at the root of Dolibarr (eg: custom).
InfDirExample=
Then declare it in the file conf.php
$dolibarr_main_url_root_alt='/custom'
$dolibarr_main_document_root_alt='/path/of/dolibarr/htdocs/custom'
If these lines are commented with "#", to enable them, just uncomment by removing the "#" character. -YouCanSubmitFile=Alternatively, you may upload the module .zip file package: +YouCanSubmitFile=You can upload the .zip file of module package from here: CurrentVersion=Dolibarr current version CallUpdatePage=Browse to the page that updates the database structure and data: %s. LastStableVersion=Latest stable version From e4e8173b7a3b3900890a42e68a9fe0e2c293ec79 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 25 Feb 2020 13:15:15 +0100 Subject: [PATCH 49/69] Update README --- htdocs/install/doctemplates/README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/doctemplates/README b/htdocs/install/doctemplates/README index 9ac615ea7c4..b1978fb3de7 100644 --- a/htdocs/install/doctemplates/README +++ b/htdocs/install/doctemplates/README @@ -1,8 +1,8 @@ README (English) -------------------------------- -This directory contains samples of odttemplates used by install +This directory contains samples of odt-templates used by install process. WARNING: -Do not edit files in those directories, but in installed data -directory instead. \ No newline at end of file +Do not edit/change files in these directories, +only in installed data directory instead (e.g. //dolibarr/documents/doctemplates/). From 61abfb95a59a8ec1e251158fc1fe3df6b7401642 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 13:28:11 +0100 Subject: [PATCH 50/69] Look and feel v12 --- htdocs/core/lib/project.lib.php | 3 +- htdocs/projet/class/project.class.php | 10 ++-- htdocs/projet/index.php | 15 ++++-- htdocs/theme/eldy/global.inc.php | 71 +++++++++++++-------------- 4 files changed, 54 insertions(+), 45 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 3d9cd447802..9eab5cd6a70 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2175,7 +2175,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if ($userAccess >= 0) { $projectstatic->ref = $objp->ref; - $projectstatic->statut = $objp->status; + $projectstatic->statut = $objp->status; // deprecated + $projectstatic->status = $objp->status; $projectstatic->title = $objp->title; $projectstatic->datee = $db->jdate($objp->datee); $projectstatic->dateo = $db->jdate($objp->dateo); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 74c82423966..54075318246 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -493,7 +493,7 @@ class Project extends CommonObject if (empty($id) && empty($ref)) return -1; $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; - $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent,"; + $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; $sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, entity"; $sql .= " FROM ".MAIN_DB_PREFIX."projet"; if (!empty($id)) @@ -534,7 +534,8 @@ class Project extends CommonObject $this->user_modification_id = $obj->fk_user_modif; $this->user_close_id = $obj->fk_user_close; $this->public = $obj->public; - $this->statut = $obj->fk_statut; + $this->statut = $obj->status; // deprecated + $this->status = $obj->status; $this->opp_status = $obj->fk_opp_status; $this->opp_amount = $obj->opp_amount; $this->opp_percent = $obj->opp_percent; @@ -994,7 +995,7 @@ class Project extends CommonObject */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->statut, $mode); + return $this->LibStatut(isset($this->statut)?$this->statut:$this->status, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1055,6 +1056,9 @@ class Project extends CommonObject if (!empty($this->datee)) $label .= ($label ? '
' : '').''.$langs->trans('DateEnd').': '.dol_print_date($this->datee, 'day'); // The space must be after the : to not being explode when showing the title in img_picto if ($moreinpopup) $label .= '
'.$moreinpopup; + if (isset($this->status)) { + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + } $url = ''; if ($option != 'nolink') diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 0613fd75e8f..143a932ff28 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -172,8 +172,8 @@ print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppst print '
'; // Latest modified projects -$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.tms as datem,"; -$sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas"; +$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut as status, p.tms as datem,"; +$sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status as thirdpartystatus"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; @@ -208,6 +208,7 @@ if ($resql) $projectstatic->dateo = $obj->dateo; $projectstatic->datep = $obj->datep; $projectstatic->thirdparty_name = $obj->name; + $projectstatic->status = $obj->status; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; @@ -217,6 +218,7 @@ if ($resql) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->status = $obj->thirdpartystatus; print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; } @@ -265,14 +267,14 @@ print_liste_field_titre("NbOfProjects", "", "", "", "", '', $sortfield, $sortord print "\n"; $sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)"; -$sql .= ", s.nom as name, s.rowid as socid"; +$sql .= ", s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_statut = 1"; if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; // If we have this test true, it also means projectset is not 2 if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; -$sql .= " GROUP BY s.nom, s.rowid"; +$sql .= " GROUP BY s.rowid, s.nom, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status"; $sql .= $db->order($sortfield, $sortorder); //$sql .= $db->plimit($max + 1, 0); @@ -299,6 +301,9 @@ if ($resql) { $companystatic->id = $obj->socid; $companystatic->name = $obj->name; + $companystatic->email = $obj->email; + $companystatic->status = $obj->status; + print $companystatic->getNomUrl(1); } else diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index bd35d29f3b2..13011cbb5f7 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6,41 +6,40 @@ /* ============================================================================== */ :root { - --colorbackhmenu1: rgb(); - --colorbackvmenu1: rgb(); - --colorbacktitle1: rgb(); - --colorbacktabcard1: rgb(); - --colorbacktabactive: rgb(); - --colorbacklineimpair1: rgb(); - --colorbacklineimpair2: rgb(); - --colorbacklinepair1: rgb(); - --colorbacklinepair2: rgb(); - --colorbacklinepairhover: rgb(); - --colorbacklinepairchecked: rgb(); - --colorbackbody: rgb(); - --colortexttitlenotab: rgb(); - --colortexttitle: rgb(); - --colortext: rgb(); - --colortextlink: rgb(); - --colortextbackhmenu: #; - --colortextbackvmenu: #) ; - --listetotal: #551188; - --inputbackgroundcolor: #FFF; - --inputbordercolor: rgba(0,0,0,.2); - --tooltipbgcolor: ; - --tooltipfontcolor : ; - --oddevencolor: #202020; - --colorboxstatsborder: #ddd; - --dolgraphbg: rgba(255,255,255,0); - --fieldrequiredcolor: #000055; - --colortextbacktab: #) ; - --colorboxiconbg: #eee; - --refidnocolor:#444; - --tableforfieldcolor:#666; - --amountremaintopaycolor:#880000; - --amountpaymentcomplete:#008800; - --amountremaintopaybackcolor:none; - + --colorbackhmenu1: rgb(); + --colorbackvmenu1: rgb(); + --colorbacktitle1: rgb(); + --colorbacktabcard1: rgb(); + --colorbacktabactive: rgb(); + --colorbacklineimpair1: rgb(); + --colorbacklineimpair2: rgb(); + --colorbacklinepair1: rgb(); + --colorbacklinepair2: rgb(); + --colorbacklinepairhover: rgb(); + --colorbacklinepairchecked: rgb(); + --colorbackbody: rgb(); + --colortexttitlenotab: rgb(); + --colortexttitle: rgb(); + --colortext: rgb(); + --colortextlink: rgb(); + --colortextbackhmenu: #; + --colortextbackvmenu: #) ; + --listetotal: #551188; + --inputbackgroundcolor: #FFF; + --inputbordercolor: rgba(0,0,0,.2); + --tooltipbgcolor: ; + --tooltipfontcolor : ; + --oddevencolor: #202020; + --colorboxstatsborder: #ddd; + --dolgraphbg: rgba(255,255,255,0); + --fieldrequiredcolor: #000055; + --colortextbacktab: #) ; + --colorboxiconbg: #eee; + --refidnocolor:#444; + --tableforfieldcolor:#666; + --amountremaintopaycolor:#880000; + --amountpaymentcomplete:#008800; + --amountremaintopaybackcolor:none; } Date: Tue, 25 Feb 2020 13:29:24 +0100 Subject: [PATCH 51/69] add composer entry add entry of sub-directories: * composer To test an upgrade of a lib. --- build/README | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/README b/build/README index 07f0ebe3b55..67ceb05c8d2 100644 --- a/build/README +++ b/build/README @@ -45,9 +45,12 @@ Dolibarr working. It is here only to build Dolibarr packages, and those generated packages will not contains this "build" directory. -We can find in "build", following sub-directories: +You can find in "build", following sub-directories: -* debian: +* composer +To test an upgrade of a lib. + +* debian To build Debian package. * dmg: From 2543f3f21bffd6914c9eaceca21025c17ecf3b2c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 25 Feb 2020 13:37:39 +0100 Subject: [PATCH 52/69] Update README --- build/obs/README | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/build/obs/README b/build/obs/README index c8a29e1dac4..44427c01d49 100644 --- a/build/obs/README +++ b/build/obs/README @@ -1,20 +1,24 @@ README (English) ################################################## OBS Package tools +OBE - openSUSE Build Service ################################################## -This directory contains files to explain how to publish -a package onto OBS +This directory contains an instruction to explain +how to publish a package onto OBS. -# Create a project onto OBS -#---------------------------------- -https://build.opensuse.org +# Create a project onto OBS +--------------------------- +https://build.opensuse.org -Packaging rules: http://en.opensuse.org/Portal:Packaging + +# Packaging rules: +------------------ +https://en.opensuse.org/Portal:Packaging Add attributes: -OBS:Screenshots URL of screenshot http://www.dolibarr.org/images/dolibarr_screenshot1.png +OBS:Screenshots URL of screenshot https://www.dolibarr.org/images/dolibarr_screenshot1.png OBS:QualityCategory Development|Testing|Stable|Private OBS:Maintained 1 @@ -28,22 +32,24 @@ To submit a snapshot for building, we should have a service file with content -How to have such a service file created automatically ? -Go into project you want to update. It mught be: +# How to have such a service file created automatically ? +--------------------------------------------------------- +Go into project you want to update. It might be: - openSUSE Build Service > Projects > Application:ERP:Dolibarr > dolibarr - or your private project Once logged, click on "Add file" in section "Source Files", then select mode "Upload From: Remote URL" Keep empty for "Filename", choose "Remote URL" and enter into last field, URL that should looks like this: -http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-0.4.src.rpm +https://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-0.4.src.rpm Then add into Advanded - Attributes -OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png -OBS:QualityCategory Stable|Testing|Development|Private +OBS:Screenshots https://www.dolibarr.org/images/dolibarr_screenshot1.png +OBS:QualityCategory Stable|Testing|Development|Private # Move project into official directory +-------------------------------------- - Enter a bug to ask to be a maintener of a category or to add a new one. For example: https://bugzilla.novell.com/show_bug.cgi?id=848083 to be a maintener of category https://build.opensuse.org/project/show/Application:ERP From 2c6e7f2917b8fbc582a6b99e461f65e2f12dfddf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 13:40:19 +0100 Subject: [PATCH 53/69] Tooltip for example on IP restrictions --- htdocs/admin/dav.php | 10 ++++++++-- htdocs/api/admin/index.php | 4 +++- htdocs/langs/en_US/admin.lang | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index eb62c224e5c..bb7e82901f5 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -87,7 +87,10 @@ if ($action == 'edit') print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4ba8ac211c9..96be43b305c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1971,8 +1971,8 @@ DeleteEmailCollector=Delete email collector ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector? RecipientEmailsWillBeReplacedWithThisValue=Recipient emails will be always replaced with this value AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be defined -RESTRICT_API_ON_IP=Allow available APIs to some host IP only (wildcard not allowed, use space between values). Empty means every hosts can use the available APIs. RESTRICT_ON_IP=Allow access to some host IP only (wildcard not allowed, use space between values). Empty means every hosts can access. +IPListExample=127.0.0.1 192.168.0.2 [::1] BaseOnSabeDavVersion=Based on the library SabreDAV version NotAPublicIp=Not a public IP MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation. From fb385827a9702c8363d8fe3e35e4c00218b453ed Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 25 Feb 2020 14:04:54 +0100 Subject: [PATCH 54/69] Update README --- test/README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/README b/test/README index 3e13bbbec70..2c53e31daee 100644 --- a/test/README +++ b/test/README @@ -3,6 +3,10 @@ README (English) This directory contains unit tests and docs for Dolibarr quality analysis. +- PHPUnit - https://phpunit.de +- PHP_CodeSniffer - https://pear.php.net/package/PHP_CodeSniffer/ +- PHP Depend - https://pdepend.org/ + PHPUNIT ------- From ec981632ca652c42e4155163f832502237933c20 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 25 Feb 2020 14:11:58 +0100 Subject: [PATCH 55/69] Create README --- test/selenium/README | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/selenium/README diff --git a/test/selenium/README b/test/selenium/README new file mode 100644 index 00000000000..1d0b7ad44d1 --- /dev/null +++ b/test/selenium/README @@ -0,0 +1,11 @@ +README (English) +-------------------------------- + +This directory contains test files for Selenium. + +Selenium is a tool for automatic testing of web applications. + +https://www.selenium.dev/ + + + From 7ec32278b4a30c5d566e47d105af7c1b7e660a1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:16:40 +0100 Subject: [PATCH 56/69] FIX API to push an expense report --- .../class/api_expensereports.class.php | 33 +++++++++++- .../class/expensereport.class.php | 51 +++++++++++++------ 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 60e5eafcb48..7fdd731aa88 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -33,7 +33,7 @@ class ExpenseReports extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'socid' + 'fk_user_author' ); /** @@ -501,6 +501,11 @@ class ExpenseReports extends DolibarrApi // phpcs:enable $object = parent::_cleanObjectDatas($object); + unset($object->fk_statut); + unset($object->statut); + unset($object->user); + unset($object->thirdparty); + unset($object->cond_reglement); unset($object->shipping_method_id); @@ -509,6 +514,32 @@ class ExpenseReports extends DolibarrApi unset($object->barcode_type_label); unset($object->barcode_type_coder); + unset($object->code_paiement); + unset($object->code_statut); + unset($object->fk_c_paiement); + unset($object->fk_incoterms); + unset($object->label_incoterms); + unset($object->location_incoterms); + unset($object->mode_reglement_id); + unset($object->cond_reglement_id); + + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->cond_reglement_id); + unset($object->contact); + unset($object->contact_id); + + unset($object->state); + unset($object->state_id); + unset($object->state_code); + unset($object->country); + unset($object->country_id); + unset($object->country_code); + + unset($object->note); // We already use note_public and note_pricate + return $object; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 14ab2b88f22..c98d8af18d2 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -58,19 +58,20 @@ class ExpenseReport extends CommonObject public $date_fin; + /** + * 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied + * + * @var int Status + */ public $status; - public $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied + public $fk_statut; + public $fk_c_paiement; public $paid; public $user_author_infos; public $user_validator_infos; - public $fk_typepayment; - public $num_payment; - public $code_paiement; - public $code_statut; - // ACTIONS // Create @@ -285,10 +286,33 @@ class ExpenseReport extends CommonObject { if (is_array($this->lines) && count($this->lines) > 0) { - foreach ($this->lines as $i => $val) + foreach ($this->lines as $line) { + // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. + if (!is_object($line)) { + $line = (object) $line; + $newndfline = new ExpenseReportLine($this->db); + $newndfline->fk_expensereport = $line->fk_expensereport; + $newndfline->fk_c_type_fees = $line->fk_c_type_fees; + $newndfline->fk_project = $line->fk_project; + $newndfline->vatrate = $line->vatrate; + $newndfline->vat_src_code = $line->vat_src_code; + $newndfline->comments = $line->comments; + $newndfline->qty = $line->qty; + $newndfline->value_unit = $line->value_unit; + $newndfline->total_ht = $line->total_ht; + $newndfline->total_ttc = $line->total_ttc; + $newndfline->total_tva = $line->total_tva; + $newndfline->date = $line->date; + $newndfline->rule_warning_message = $line->rule_warning_message; + $newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat; + $newndfline->fk_ecm_files = $line->fk_ecm_files; + } + else { + $newndfline = $line; + } //$newndfline=new ExpenseReportLine($this->db); - $newndfline = $this->lines[$i]; $newndfline->fk_expensereport = $this->id; $result = $newndfline->insert(); if ($result < 0) @@ -514,10 +538,8 @@ class ExpenseReport extends CommonObject $sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime) $sql .= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,"; $sql .= " d.fk_user_valid, d.fk_user_approve,"; - $sql .= " d.fk_statut as status, d.fk_c_paiement, d.paid,"; - $sql .= " dp.libelle as label_payment, dp.code as code_paiement"; // INNER JOIN paiement + $sql .= " d.fk_statut as status, d.fk_c_paiement, d.paid"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id"; if ($ref) $sql .= " WHERE d.ref = '".$this->db->escape($ref)."'"; else $sql .= " WHERE d.rowid = ".$id; //$sql.= $restrict; @@ -566,7 +588,7 @@ class ExpenseReport extends CommonObject elseif ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator); // For backward compatibility $this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname); - $this->fk_statut = $obj->status; + $this->fk_statut = $obj->status; // deprecated $this->status = $obj->status; $this->fk_c_paiement = $obj->fk_c_paiement; $this->paid = $obj->paid; @@ -578,9 +600,6 @@ class ExpenseReport extends CommonObject $this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname); } - $this->code_statut = $obj->code_statut; - $this->code_paiement = $obj->code_paiement; - $this->lines = array(); $result = $this->fetch_lines(); @@ -2650,7 +2669,7 @@ class ExpenseReportLine $sql .= " ".$this->db->escape($this->total_ht).","; $sql .= " ".$this->db->escape($this->total_tva).","; $sql .= " ".$this->db->escape($this->total_ttc).","; - $sql .= "'".$this->db->idate($this->date)."',"; + $sql .= " '".$this->db->idate($this->date)."',"; $sql .= " '".$this->db->escape($this->rule_warning_message)."',"; $sql .= " ".$this->db->escape($this->fk_c_exp_tax_cat).","; $sql .= " ".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null'); From 91f7a14602552e0c793d0b5c015ce1cde9d64f6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:16:40 +0100 Subject: [PATCH 57/69] FIX API to push an expense report --- .../class/api_expensereports.class.php | 33 +++++++++++- .../class/expensereport.class.php | 51 +++++++++++++------ 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 60e5eafcb48..7fdd731aa88 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -33,7 +33,7 @@ class ExpenseReports extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'socid' + 'fk_user_author' ); /** @@ -501,6 +501,11 @@ class ExpenseReports extends DolibarrApi // phpcs:enable $object = parent::_cleanObjectDatas($object); + unset($object->fk_statut); + unset($object->statut); + unset($object->user); + unset($object->thirdparty); + unset($object->cond_reglement); unset($object->shipping_method_id); @@ -509,6 +514,32 @@ class ExpenseReports extends DolibarrApi unset($object->barcode_type_label); unset($object->barcode_type_coder); + unset($object->code_paiement); + unset($object->code_statut); + unset($object->fk_c_paiement); + unset($object->fk_incoterms); + unset($object->label_incoterms); + unset($object->location_incoterms); + unset($object->mode_reglement_id); + unset($object->cond_reglement_id); + + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->cond_reglement_id); + unset($object->contact); + unset($object->contact_id); + + unset($object->state); + unset($object->state_id); + unset($object->state_code); + unset($object->country); + unset($object->country_id); + unset($object->country_code); + + unset($object->note); // We already use note_public and note_pricate + return $object; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 05272aa2ff7..869e1b84e90 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -58,19 +58,20 @@ class ExpenseReport extends CommonObject public $date_fin; + /** + * 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied + * + * @var int Status + */ public $status; - public $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied + public $fk_statut; + public $fk_c_paiement; public $paid; public $user_author_infos; public $user_validator_infos; - public $fk_typepayment; - public $num_payment; - public $code_paiement; - public $code_statut; - // ACTIONS // Create @@ -285,10 +286,33 @@ class ExpenseReport extends CommonObject { if (is_array($this->lines) && count($this->lines) > 0) { - foreach ($this->lines as $i => $val) + foreach ($this->lines as $line) { + // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. + if (!is_object($line)) { + $line = (object) $line; + $newndfline = new ExpenseReportLine($this->db); + $newndfline->fk_expensereport = $line->fk_expensereport; + $newndfline->fk_c_type_fees = $line->fk_c_type_fees; + $newndfline->fk_project = $line->fk_project; + $newndfline->vatrate = $line->vatrate; + $newndfline->vat_src_code = $line->vat_src_code; + $newndfline->comments = $line->comments; + $newndfline->qty = $line->qty; + $newndfline->value_unit = $line->value_unit; + $newndfline->total_ht = $line->total_ht; + $newndfline->total_ttc = $line->total_ttc; + $newndfline->total_tva = $line->total_tva; + $newndfline->date = $line->date; + $newndfline->rule_warning_message = $line->rule_warning_message; + $newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat; + $newndfline->fk_ecm_files = $line->fk_ecm_files; + } + else { + $newndfline = $line; + } //$newndfline=new ExpenseReportLine($this->db); - $newndfline = $this->lines[$i]; $newndfline->fk_expensereport = $this->id; $result = $newndfline->insert(); if ($result < 0) @@ -514,10 +538,8 @@ class ExpenseReport extends CommonObject $sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime) $sql .= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,"; $sql .= " d.fk_user_valid, d.fk_user_approve,"; - $sql .= " d.fk_statut as status, d.fk_c_paiement, d.paid,"; - $sql .= " dp.libelle as label_payment, dp.code as code_paiement"; // INNER JOIN paiement + $sql .= " d.fk_statut as status, d.fk_c_paiement, d.paid"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id"; if ($ref) $sql .= " WHERE d.ref = '".$this->db->escape($ref)."'"; else $sql .= " WHERE d.rowid = ".$id; //$sql.= $restrict; @@ -566,7 +588,7 @@ class ExpenseReport extends CommonObject elseif ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator); // For backward compatibility $this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname); - $this->fk_statut = $obj->status; + $this->fk_statut = $obj->status; // deprecated $this->status = $obj->status; $this->fk_c_paiement = $obj->fk_c_paiement; $this->paid = $obj->paid; @@ -578,9 +600,6 @@ class ExpenseReport extends CommonObject $this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname); } - $this->code_statut = $obj->code_statut; - $this->code_paiement = $obj->code_paiement; - $this->lines = array(); $result = $this->fetch_lines(); @@ -2650,7 +2669,7 @@ class ExpenseReportLine $sql .= " ".$this->db->escape($this->total_ht).","; $sql .= " ".$this->db->escape($this->total_tva).","; $sql .= " ".$this->db->escape($this->total_ttc).","; - $sql .= "'".$this->db->idate($this->date)."',"; + $sql .= " '".$this->db->idate($this->date)."',"; $sql .= " '".$this->db->escape($this->rule_warning_message)."',"; $sql .= " ".$this->db->escape($this->fk_c_exp_tax_cat).","; $sql .= " ".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null'); From f38661451145f1dd33ca9c7fdad08bb916ecb364 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:29:41 +0100 Subject: [PATCH 58/69] Doc --- htdocs/expensereport/class/api_expensereports.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 7fdd731aa88..770d39ec951 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -384,6 +384,10 @@ class ExpenseReports extends DolibarrApi * @param array $request_data Datas * * @return int + * + * @throws RestException 401 Not allowed + * @throws RestException 404 Expense report not found + * @throws RestException 500 */ public function put($id, $request_data = null) { From 2438b48a1d0525aa812ef423c6932706d35e4017 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:36:05 +0100 Subject: [PATCH 59/69] FIX API upload/download doc for expensereport --- htdocs/api/class/api_documents.class.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 891c3969f81..3d2ff2aadb4 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -401,6 +401,22 @@ class Documents extends DolibarrApi $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); } + elseif ($modulepart == 'expensereport') + { + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + + if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) { + throw new RestException(401); + } + + $object = new ExpenseReport($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Expense report not found'); + } + + $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); + } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); @@ -523,6 +539,11 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $object = new Product($this->db); } + elseif ($modulepart == 'expensereport') + { + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $object = new ExpenseReport($this->db); + } // TODO Implement additional moduleparts else { From 69c2f4bd27d66af36ff28b5f5280d1ae9a5acae6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:36:05 +0100 Subject: [PATCH 60/69] FIX API upload/download doc for expensereport --- htdocs/api/class/api_documents.class.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 75e27ad0e0d..ebfe3d7b0e0 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -387,6 +387,22 @@ class Documents extends DolibarrApi $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); } + elseif ($modulepart == 'expensereport') + { + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + + if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) { + throw new RestException(401); + } + + $object = new ExpenseReport($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Expense report not found'); + } + + $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); + } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); @@ -518,6 +534,11 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $object = new Product($this->db); } + elseif ($modulepart == 'expensereport') + { + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $object = new ExpenseReport($this->db); + } // TODO Implement additional moduleparts else { From 028287d8fa04e176bb8aca21013711149f3e4fc3 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 25 Feb 2020 14:41:18 +0100 Subject: [PATCH 61/69] Update erp_comparison_translation.txt --- .../erp_comparison_translation.txt | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/dev/translation/erp_comparison_translation.txt b/dev/translation/erp_comparison_translation.txt index c99a5f4cc1c..6cf7c4f7c60 100644 --- a/dev/translation/erp_comparison_translation.txt +++ b/dev/translation/erp_comparison_translation.txt @@ -1,17 +1,25 @@ +comparison of terms -Term Dolibarr SAP Odoo ... ----------------------------------------------------------------------------- -Thirdparty Contact partner Partner/Contact (company) -Contact/address Contact person Partner/Contact (individual) +Dolibarr SAP ERP Odoo +------------------------------------------------------------------------- +Thirdparty Contact partner Partner/Contact (company) +Contact/address Contact person Partner/Contact (individual) -Financial ?? Invoicing - -Income / Expense ?? Profit / Loss -Balance ?? Net profit -Subledger account Subledger account ?? +Financial Finance (FI) Accounting +Accounting -Proposal ?? Quotation Proposal is ok but proposition looks better (proposal is for a detailed proposition). We can say also "business proposition or business proposal". - Indian are using "Quotation". +Income / Expense ?? Profit / Loss +Balance ?? Net profit +Subledger account Subledger account ?? + +CRM Sales & Distribution Sales +Proposal ?? Quotation + + + +Proposal is ok but proposition looks better (proposal is for a detailed proposition). +We can say also "business proposition or business proposal". +In India they are using "Quotation". From 9c7debf27fd31c9714de0675efc87eaead00ac5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:47:05 +0100 Subject: [PATCH 62/69] FIX API Get list of documents for supplier_invoice --- htdocs/api/class/api_documents.class.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d84bb328faa..2f81b7a1695 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -228,7 +228,7 @@ class Documents extends DolibarrApi /** * Return the list of documents of a dedicated element (from its ID or Ref) * - * @param string $modulepart Name of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'shipment', 'project', ...) + * @param string $modulepart Name of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...) * @param int $id ID of element * @param string $ref Ref of element * @param string $sortfield Sort criteria ('','fullname','relativename','name','date','size') @@ -369,6 +369,24 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); } + elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') + { + $modulepart = 'supplier_invoice'; + + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->lire) { + throw new RestException(401); + } + + $object = new FactureFournisseur($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Invoice not found'); + } + + $upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); + } elseif ($modulepart == 'produit' || $modulepart == 'product') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; From f6014798d9bf5f50ed1abf2f3ffbe660e7b8b3ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 14:59:47 +0100 Subject: [PATCH 63/69] Comment --- htdocs/api/class/api_documents.class.php | 39 ++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 2f81b7a1695..e58ebf7d280 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -80,7 +80,18 @@ class Documents extends DolibarrApi //--- Finds and returns the document $entity = $conf->entity; - $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read'); + // Special cases that need to use get_exdir to get real dir of object + // If future, all object should use this to define path of documents. + /* + $tmpreldir = ''; + if ($modulepart == 'supplier_invoice') { + $tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier'); + } + + $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */ + $relativefile = $original_file; + + $check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'read'); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $original_file = $check_access['original_file']; @@ -146,7 +157,18 @@ class Documents extends DolibarrApi //--- Finds and returns the document $entity = $conf->entity; - $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write'); + // Special cases that need to use get_exdir to get real dir of object + // If future, all object should use this to define path of documents. + /* + $tmpreldir = ''; + if ($modulepart == 'supplier_invoice') { + $tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier'); + } + + $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */ + $relativefile = $original_file; + + $check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write'); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $original_file = $check_access['original_file']; @@ -696,7 +718,18 @@ class Documents extends DolibarrApi //--- Finds and returns the document $entity = $conf->entity; - $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read'); + // Special cases that need to use get_exdir to get real dir of object + // If future, all object should use this to define path of documents. + /* + $tmpreldir = ''; + if ($modulepart == 'supplier_invoice') { + $tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier'); + } + + $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */ + $relativefile = $original_file; + + $check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'read'); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $original_file = $check_access['original_file']; From cb9637e38d76ad8d32f24f27ffc1b71f70c48ea2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 15:04:56 +0100 Subject: [PATCH 64/69] Doc --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 96be43b305c..7a4de856ba2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1688,7 +1688,7 @@ StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatib CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sale from Point of Sale. Hence a warehouse is required. CashDeskForceDecreaseStockLabel=Stock decrease for batch products was forced. CashDeskForceDecreaseStockDesc=Decrease first by the oldest eatby and sellby dates. -CashDeskReaderKeyCodeForEnter=Key code for "Enter" defined in barcode reader. +CashDeskReaderKeyCodeForEnter=Key code for "Enter" defined in barcode reader (Example: 13) ##### Bookmark ##### BookmarkSetup=Bookmark module setup BookmarkDesc=This module allows you to manage bookmarks. You can also add shortcuts to any Dolibarr pages or external web sites on your left menu. From 39624f21e758b3a9bad1575a8181d184728bee91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 15:36:34 +0100 Subject: [PATCH 65/69] Fix var not always defined --- htdocs/core/lib/project.lib.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 9eab5cd6a70..dbfeef03259 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2035,15 +2035,19 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $listofstatus = array_keys($listofoppstatus); - $statusOppList = array(); - $themeColorId = 0; - foreach ($listofstatus as $oppStatus) { - $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code'); - if ($oppStatusCode) { - $statusOppList[$oppStatus]['code'] = $oppStatusCode; - $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : ''; + + if (is_array($listofstatus) && ! empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { + // Define $themeColorId and array $statusOppList for each $listofstatus + $themeColorId = 0; + $statusOppList = array(); + foreach ($listofstatus as $oppStatus) { + $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code'); + if ($oppStatusCode) { + $statusOppList[$oppStatus]['code'] = $oppStatusCode; + $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : ''; + } + $themeColorId++; } - $themeColorId++; } $projectstatic = new Project($db); @@ -2203,6 +2207,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print '
'; @@ -243,7 +245,7 @@ if ($resql) } print ''.dol_print_date($db->jdate($obj->datem), 'day').''.$projectstatic->LibStatut($obj->fk_statut, 3).''.$projectstatic->LibStatut($obj->status, 3).'
'; $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $label = $langs->trans($key); - if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP"); + if ($key == 'DAV_RESTICT_ON_IP') { + $label = $langs->trans("RESTRICT_ON_IP"); + $label .= ' '.$langs->trans("Example").': '.$langs->trans("IPListExample"); + } print $form->textwithpicto($label, $tooltiphelp); print ''; if ($key == 'DAV_ALLOW_PRIVATE_DIR') @@ -124,7 +127,10 @@ else print '
'; $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $label = $langs->trans($key); - if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP"); + if ($key == 'DAV_RESTICT_ON_IP') { + $label = $langs->trans("RESTRICT_ON_IP"); + $label .= ' '.$langs->trans("Example").': '.$langs->trans("IPListExample"); + } print $form->textwithpicto($label, $tooltiphelp); print ''; if ($key == 'DAV_ALLOW_PRIVATE_DIR') diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 45cf082763e..73041f6c386 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -130,7 +130,9 @@ print ' 
'.$langs->trans("RESTRICT_API_ON_IP").''.$langs->trans("RESTRICT_ON_IP"); +print ' '.$langs->trans("Example").': '.$langs->trans("IPListExample"); +print ''; print ''; // Because color of prospection status has no meaning yet, it is used if hidden constant is set if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { + $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); if ($langs->trans("OppStatus".$oppStatusCode) != "OppStatus".$oppStatusCode) { print $langs->trans("OppStatus".$oppStatusCode); } From 45771663aafb03ba1d4550a61d39711e9d19b799 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Feb 2020 18:53:25 +0100 Subject: [PATCH 66/69] NEW Add API to get types of expense reports --- htdocs/api/class/api_setup.class.php | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 7c471dfd0bd..d3543683db2 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -554,6 +554,70 @@ class Setup extends DolibarrApi return $list; } + + /** + * Get the list of Expense Report types. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $module To filter on module + * @param int $active Event's type 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 expense report types + * + * @url GET dictionary/expensereport_types + * + * @throws RestException + */ + public function getListOfExpenseReportsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT id, code, label, accountancy_code, active, module, position"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t"; + $sql .= " WHERE t.active = ".$active; + if ($module) $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'"; + // Add sql filters + if ($sqlfilters) + { + if (!DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql .= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of expense report types : '.$this->db->lasterror()); + } + + return $list; + } + + /** * Get the list of contacts types. * From c5ad18b8c82a60ddbb7806d29d1db83228ed18e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Feb 2020 04:24:34 +0100 Subject: [PATCH 67/69] Increase limit per day --- .github/workflows/stale-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 0be87022eef..5b55cdc54c8 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -17,7 +17,7 @@ jobs: exempt-issue-label: 'Priority High / Blocking' days-before-stale: 365 days-before-close: 15 - operations-per-run: 30 + operations-per-run: 50 #stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.' stale-pr-label: 'PR Stale (automatic label)' stale-pr-message: From 6cf6719cfb80fc3e1936d9d44d1d65f1e659ad41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Feb 2020 06:39:02 +0100 Subject: [PATCH 68/69] FIX Bad sort link in accounting report --- htdocs/compta/resultat/clientfourn.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index ee76a29d282..0a60e928db9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -67,8 +67,7 @@ if (!$sortorder) $sortorder = 'ASC'; // Date range $year = GETPOST('year', 'int'); -if (empty($year)) -{ +if (empty($year)) { $year_current = strftime("%Y", dol_now()); $month_current = strftime("%m", dol_now()); $year_start = $year_current; @@ -114,7 +113,7 @@ $tmps = dol_getdate($date_start); $year_start = $tmps['year']; $tmpe = dol_getdate($date_end); $year_end = $tmpe['year']; -$nbofyear = ($year_end - $start_year) + 1; +$nbofyear = ($year_end - $year_start) + 1; //var_dump("year_start=".$year_start." year_end=".$year_end." nbofyear=".$nbofyear." date_start=".dol_print_date($date_start, 'dayhour')." date_end=".dol_print_date($date_end, 'dayhour')); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') @@ -199,11 +198,15 @@ if ($date_startmonth) $param .= '&date_startmonth='.$date_startmonth; if ($date_startyear) $param .= '&date_startyear='.$date_startyear; if ($date_endday) $param .= '&date_endday='.$date_endday; if ($date_endmonth) $param .= '&date_endmonth='.$date_endmonth; -if ($date_endyear) $param .= '&date_endyear='.$date_startyear; +if ($date_endyear) $param .= '&date_endyear='.$date_endyear; print ''; print ''; -print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, 'width200 '); +if ($modecompta == 'BOOKKEEPING') { + print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, 'width200 '); +} else { + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'width200 '); +} print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { From 4831d22354c92cd01d0a5db75f2352d907729b18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Feb 2020 06:43:21 +0100 Subject: [PATCH 69/69] FIX sort link --- htdocs/compta/resultat/clientfourn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 0a60e928db9..a07aacd127f 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -192,7 +192,7 @@ if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') } // Show report array -$param = '&modecompta='.$modecompta; +$param = '&modecompta='.urlencode($modecompta).'&showaccountdetail='.urlencode($showaccountdetail); if ($date_startday) $param .= '&date_startday='.$date_startday; if ($date_startmonth) $param .= '&date_startmonth='.$date_startmonth; if ($date_startyear) $param .= '&date_startyear='.$date_startyear;