From 104439f79dcd875849a6699358a8d8f61f1c31a4 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 11 Aug 2023 10:38:11 +0200 Subject: [PATCH 01/54] FIX: warning when Workboard Responses display non numeric strings --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index 06a829ea4b5..8dbe7681920 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -437,7 +437,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop foreach ($valid_dashboardlines as $board) { - if ($board->nbtodolate > 0) { + if ($board->nbtodolate > 0 && is_numeric($board->nbtodo) && is_numeric($board->nbtodolate)) { $totaltodo += $board->nbtodo; $totallate += $board->nbtodolate; } From 4a453d0805c4ba959ab5b0bfeb67f58ef4a8b342 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Aug 2023 10:40:03 +0200 Subject: [PATCH 02/54] fix: use of getDolGlobal in module builder template --- .../template/class/myobject.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index f309ef346c5..57358e2d110 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -740,12 +740,12 @@ class MyObject extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) + if (! ((getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->write)) + || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->mymodule_advance->validate)))) { $this->error='Permission denied'; return -1; - }*/ + } return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYOBJECT_REOPEN'); } @@ -1034,15 +1034,15 @@ class MyObject extends CommonObject global $langs, $conf; $langs->load("mymodule@mymodule"); - if (empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { + if (empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON'))) { $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_myobject_standard'; } - if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON)) { + if (!empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON'))) { $mybool = false; - $file = $conf->global->MYMODULE_MYOBJECT_ADDON.".php"; - $classname = $conf->global->MYMODULE_MYOBJECT_ADDON; + $file = getDolGlobalString('MYMODULE_MYOBJECT_ADDON').".php"; + $classname = getDolGlobalString('MYMODULE_MYOBJECT_ADDON'); // Include file with class $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); From 83ff60a131d68de5e007170d72dff1b2997f045e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Aug 2023 10:44:01 +0200 Subject: [PATCH 03/54] fix: use of getDolGlobal in module builder template --- htdocs/modulebuilder/template/class/myobject.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 57358e2d110..eca483f0c8b 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -740,12 +740,13 @@ class MyObject extends CommonObject return 0; } - if (! ((getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->write)) - || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->mymodule_advance->validate)))) + /*if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write')) + || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','mymodule_advance','validate')))) { $this->error='Permission denied'; return -1; - } + }*/ + return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYOBJECT_REOPEN'); } From e387e009bf77625a2103c4ff03dc6161a95d7536 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Aug 2023 11:59:14 +0200 Subject: [PATCH 04/54] fix: use of getDolGlobal in module builder template --- htdocs/modulebuilder/template/admin/setup.php | 12 +-- .../template/class/myobject.class.php | 24 ++--- .../template/core/boxes/mymodulewidget1.php | 4 +- .../core/modules/modMyModule.class.php | 4 +- .../doc/doc_generic_myobject_odt.modules.php | 22 ++--- .../doc/pdf_standard_myobject.modules.php | 95 +++++++++---------- .../template/lib/mymodule_myobject.lib.php | 2 +- .../modulebuilder/template/mymoduleindex.php | 4 +- .../template/myobject_agenda.php | 4 +- .../modulebuilder/template/myobject_card.php | 4 +- .../modulebuilder/template/myobject_list.php | 4 +- 11 files changed, 89 insertions(+), 90 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index dea2a1a596e..10a02f6507c 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -244,7 +244,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } @@ -257,7 +257,7 @@ if ($action == 'updateMask') { if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { // The constant that was read before the new set // We therefore requires a variable to have a coherent view - $conf->global->$constforval = $value; + $conf->global->{$constforval} = $value; } // We disable/enable the document template (into llx_document_model table) @@ -357,10 +357,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -494,10 +494,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index eca483f0c8b..5122bf3e59e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -84,7 +84,7 @@ class MyObject extends CommonObject * Note: Filter must be a Dolibarr filter syntax string. Example: "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.status:!=:0) or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalInt('MY_SETUP_PARAM')' or 'isModEnabled("multicurrency")' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -251,7 +251,7 @@ class MyObject extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { + if (empty(getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID')) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { $this->fields['rowid']['visible'] = 0; } if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { @@ -574,8 +574,8 @@ class MyObject extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->myobject->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->myobject->myobject_advance->validate)))) + /* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write')) + || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->myobject->myobject_advance->validate)))) { $this->error='NotEnoughPermissions'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); @@ -692,8 +692,8 @@ class MyObject extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) + /* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write')) + || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','mymodule_advance','validate')))) { $this->error='Permission denied'; return -1; @@ -716,8 +716,8 @@ class MyObject extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate)))) + /* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write')) + || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','mymodule_advance','validate')))) { $this->error='Permission denied'; return -1; @@ -793,7 +793,7 @@ class MyObject extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -833,7 +833,7 @@ class MyObject extends CommonObject $pospoint = strpos($filearray[0]['name'], '.'); $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); - if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) { + if (empty(getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'))) { $result .= '
No photo
'; } else { $result .= '
No photo
'; @@ -1105,8 +1105,8 @@ class MyObject extends CommonObject if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) { - $modele = $conf->global->MYOBJECT_ADDON_PDF; + } elseif (!empty(getDolGlobalString('MYOBJECT_ADDON_PDF'))) { + $modele = getDolGlobalString('MYOBJECT_ADDON_PDF'); } } diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php index 7ea4b553e71..4c34d790df4 100644 --- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php +++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php @@ -101,8 +101,8 @@ class mymodulewidget1 extends ModeleBoxes $this->param = $param; - //$this->enabled = $conf->global->FEATURES_LEVEL > 0; // Condition when module is enabled or not - //$this->hidden = ! ($user->rights->mymodule->myobject->read); // Condition when module is visible by user (test on permission) + //$this->enabled = getDolGlobalInt(FEATURES_LEVEL) > 0; // Condition when module is enabled or not + //$this->hidden = ! ($user->hasRight('mymodule,'myobject','read'); // Condition when module is visible by user (test on permission) } /** diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 99cd900b512..311bc6c14b5 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -403,8 +403,8 @@ class modMyModule extends DolibarrModules $this->import_convertvalue_array[$r] = array( 't.ref' => array( 'rule'=>'getrefifauto', - 'class'=>(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON), - 'path'=>"/core/modules/commande/".(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON).'.php' + 'class'=>(empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')), + 'path'=>"/core/modules/commande/".(empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')).'.php' 'classobject'=>'MyObject', 'pathobject'=>'/mymodule/class/myobject.class.php', ), diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index b7dfc374a52..17936af12de 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -129,7 +129,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH')))); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -155,7 +155,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -163,7 +163,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH)) { + if (!empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH'))) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -287,8 +287,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { - $format = $conf->global->MAIN_DOC_USE_TIMING; + if (!empty(getDolGlobalString('MAIN_DOC_USE_TIMING'))) { + $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; } @@ -321,7 +321,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $contactobject = null; if (!empty($usecontact)) { // We can use the company of contact instead of thirdparty company - if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + if ($object->contact->socid != $object->thirdparty->id && ) { $object->contact->fetch_thirdparty(); $socobject = $object->contact->thirdparty; $contactobject = $object->contact; @@ -350,8 +350,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Line of free text $newfreetext = ''; $paramfreetext = 'MYMODULE_MYOBJECT_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + if (!empty(getDolGlobalString($paramfreetext))) { + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template @@ -477,7 +477,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file - if (!empty($conf->global->MAIN_ODT_AS_PDF)) { + if (!empty(getDolGlobalString($MAIN_ODT_AS_PDF))) { try { $odfHandler->exportAsAttachedPDF($file); } catch (Exception $e) { @@ -498,8 +498,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (!empty($conf->global->MAIN_UMASK)) { - @chmod($file, octdec($conf->global->MAIN_UMASK)); + if (!empty(getDolGlobalString('MAIN_UMASK'))) { + @chmod($file, octdec(getDolGlobalString('MAIN_UMASK'))); } $odfHandler = null; // Destroy object diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 05486989e1d..6a28e07a336 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -172,32 +172,32 @@ class pdf_standard_myobject extends ModelePDFMyObject $outputlangs = $langs; } // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (!empty($conf->global->MAIN_USE_FPDF)) { + if (getDolGlobalInt('MAIN_USE_FPDF')) { $outputlangs->charset_output = 'ISO-8859-1'; } // Load translation files required by the page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); - if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) { + if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); - $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE); + $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies")); } $nblines = (is_array($object->lines) ? count($object->lines) : 0); $hidetop = 0; - if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) { - $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE; + if (!empty(getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE'))) { + $hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE'); } // Loop on each lines to detect if there is at least one image to show $realpatharray = array(); $this->atleastonephoto = false; /* - if (!empty($conf->global->MAIN_GENERATE_MYOBJECT_WITH_PICTURE)) + if (!empty(getDolGlobalString('MAIN_GENERATE_MYOBJECT_WITH_PICTURE'))) { $objphoto = new Product($this->db); @@ -288,8 +288,8 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50; // Height reserved to output the info and total part and payment part - $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + $heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') ? getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') : 5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + (empty(getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) ? 12 : 22); // Height reserved to output the footer (value include bottom margin) if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -298,8 +298,8 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty(getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'))) { + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -320,7 +320,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; // If user has no certificate, we try to take the company one if (!$cert) { - $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; + $cert = empty(getDolGlobalString('CERTIFICATE_CRT')) ? '' : getDolGlobalString('CERTIFICATE_CRT'); } // If a certificate is found if ($cert) { @@ -348,10 +348,10 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetTextColor(0, 0, 0); $tab_top = 90 + $top_shift; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); + $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); $tab_height = 130 - $top_shift; $tab_height_newpage = 150; - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { $tab_height_newpage -= $top_shift; } @@ -395,7 +395,7 @@ class pdf_standard_myobject extends ModelePDFMyObject if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { $this->_pagehead($pdf, $object, 0, $outputlangs); } // $this->_pagefoot($pdf,$object,$outputlangs,1); @@ -453,7 +453,7 @@ class pdf_standard_myobject extends ModelePDFMyObject if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { $this->_pagehead($pdf, $object, 0, $outputlangs); } $height_note = $posyafter - $tab_top_newpage; @@ -475,7 +475,7 @@ class pdf_standard_myobject extends ModelePDFMyObject if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { $this->_pagehead($pdf, $object, 0, $outputlangs); } @@ -532,7 +532,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { + if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; } else { $showpricebeforepagebreak = 0; @@ -573,7 +573,7 @@ class pdf_standard_myobject extends ModelePDFMyObject } else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { + if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; } else { $showpricebeforepagebreak = 0; @@ -693,7 +693,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $nexY = max($nexY, $posYAfterImage); // Add line - if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { + if (getDolGlobalInt('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); @@ -713,7 +713,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { $this->_pagehead($pdf, $object, 0, $outputlangs); } if (!empty($tplidx)) { @@ -734,7 +734,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->useTemplate($tplidx); } $pagenb++; - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { $this->_pagehead($pdf, $object, 0, $outputlangs); } } @@ -757,7 +757,7 @@ class pdf_standard_myobject extends ModelePDFMyObject // Display payment area /* - if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) + if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty(getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS'))) { $posy = $this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } @@ -783,8 +783,8 @@ class pdf_standard_myobject extends ModelePDFMyObject $this->errors = $hookmanager->errors; } - if (!empty($conf->global->MAIN_UMASK)) { - @chmod($file, octdec($conf->global->MAIN_UMASK)); + if (!empty(getDolGlobalString('MAIN_UMASK'))) { + @chmod($file, octdec(getDolGlobalString('MAIN_UMASK'))); } $this->result = array('fullpath'=>$file); @@ -848,16 +848,15 @@ class pdf_standard_myobject extends ModelePDFMyObject if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) { + if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && is_object($outputlangsbis)) { $titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency)); } $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (!empty(getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))) { + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -913,13 +912,13 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetXY($this->marge_gauche, $posy); // Logo - if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { + if (empty(getDolGlobalString('PDF_DISABLE_MYCOMPANY_LOGO'))) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; if (!empty($conf->mycompany->multidir_output[$object->entity])) { $logodir = $conf->mycompany->multidir_output[$object->entity]; } - if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; } else { $logo = $logodir.'/logos/'.$this->emetteur->logo; @@ -943,7 +942,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $title = $outputlangs->transnoentities("PdfTitle"); - if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) { + if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && is_object($outputlangsbis)) { $title .= ' - '; $title .= $outputlangsbis->transnoentities("PdfTitle"); } @@ -971,7 +970,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { + if (getDolGlobalInt('PDF_SHOW_PROJECT_TITLE')) { $object->fetch_projet(); if (!empty($object->project->ref)) { $posy += 3; @@ -981,7 +980,7 @@ class pdf_standard_myobject extends ModelePDFMyObject } } - if (!empty($conf->global->PDF_SHOW_PROJECT)) { + if (getDolGlobalInt('PDF_SHOW_PROJECT')) { $object->fetch_projet(); if (!empty($object->project->ref)) { $outputlangs->load("projects"); @@ -997,7 +996,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetTextColor(0, 0, 60); $title = $outputlangs->transnoentities("Date"); - if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) { + if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && is_object($outputlangsbis)) { $title .= ' - '.$outputlangsbis->transnoentities("Date"); } $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R'); @@ -1010,7 +1009,7 @@ class pdf_standard_myobject extends ModelePDFMyObject } // Get contact - if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { + if (getDolGlobalInt('DOC_SHOW_FIRST_SALES_REP')) { $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); if (count($arrayidcontact) > 0) { $usertmp = new User($this->db); @@ -1037,15 +1036,15 @@ class pdf_standard_myobject extends ModelePDFMyObject $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); // Show sender - $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; + $posy = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posy += $top_shift; $posx = $this->marge_gauche; - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { + if (getDolGlobalInt('MAIN_INVERT_SENDER_RECIPIENT')) { $posx = $this->page_largeur - $this->marge_droite - 80; } - $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; - $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; + $hautcadre = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 38 : 40; + $widthrecbox = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82; // Show sender frame @@ -1078,7 +1077,7 @@ class pdf_standard_myobject extends ModelePDFMyObject } // Recipient name - if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) { + if ($object->contact->socid != $object->thirdparty->id && getDolGlobalInt('MAIN_USE_COMPANY_NAME_OF_CONTACT')) { $thirdparty = $object->contact; } else { $thirdparty = $object->thirdparty; @@ -1091,14 +1090,14 @@ class pdf_standard_myobject extends ModelePDFMyObject $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object); // Show recipient - $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; + $widthrecbox = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100; if ($this->page_largeur < 210) { $widthrecbox = 84; // To work with US executive format } - $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; + $posy = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posy += $top_shift; $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { + if (getDolGlobalInt('MAIN_INVERT_SENDER_RECIPIENT')) { $posx = $this->marge_gauche; } @@ -1139,7 +1138,7 @@ class pdf_standard_myobject extends ModelePDFMyObject protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; - $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + $showdetails = !getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 0 : getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS'); return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } @@ -1209,7 +1208,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $rank = $rank + 10; $this->cols['photo'] = array( 'rank' => $rank, - 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm + 'width' => (!getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')), // in mm 'status' => false, 'title' => array( 'textkey' => 'Photo', @@ -1221,7 +1220,7 @@ class pdf_standard_myobject extends ModelePDFMyObject 'border-left' => false, // remove left line separator ); - if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto)) { + if (getDolGlobalInt('MAIN_GENERATE_DOCUEMENTS_WITH_PICTURE') && !empty($this->atleastonephoto)) { $this->cols['photo']['status'] = true; } @@ -1237,7 +1236,7 @@ class pdf_standard_myobject extends ModelePDFMyObject 'border-left' => true, // add left line separator ); - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { + if (!getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) { $this->cols['vat']['status'] = true; } @@ -1288,7 +1287,7 @@ class pdf_standard_myobject extends ModelePDFMyObject ), 'border-left' => true, // add left line separator ); - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } diff --git a/htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php b/htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php index d75f69a47f5..9f4bc9654fa 100644 --- a/htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php +++ b/htdocs/modulebuilder/template/lib/mymodule_myobject.lib.php @@ -65,7 +65,7 @@ function myobjectPrepareHead($object) $head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); + $head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.$nbNote.'' : ''); } $head[$h][2] = 'note'; $h++; diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 3b7b1b13009..3c7cc5f9ec5 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -186,8 +186,8 @@ END MODULEBUILDER DRAFT MYOBJECT */ print '
'; -$NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; -$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; +$NBMAX = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); +$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT'); /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT // Last modified myobject diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 6abb64d71c9..968076385c9 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -94,7 +94,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty(getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'))); } $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); @@ -186,7 +186,7 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); - //if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + $help_url = 'EN:Module_Agenda_En'; llxHeader('', $title, $help_url); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index dc8dafd433e..dea30f5c110 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -390,10 +390,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* // Ref customer $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(getDolGlobalInt('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalInt('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { + if (!getDolGlobalInt('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { $morehtmlref .= ' (
'.$langs->trans("OtherOrders").')'; } // Project diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 2c38e685b83..9865abb6533 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -369,7 +369,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -404,7 +404,7 @@ $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { +if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id); From cb8a6796df6450b0895676fa4d37d96ec8ee1655 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Aug 2023 14:32:31 +0200 Subject: [PATCH 05/54] FIX: Quick search Intervention redirect to wrong page --- htdocs/fichinter/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index ebff3305365..83c6d15431d 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -364,7 +364,7 @@ $num = $db->num_rows($resql); if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id); + header("Location: ".dol_buildpath('/fichinter/card.php', 1).'?id='.$id); exit; } From b37ca6772915754eef2f38392da1f58d1fd987f8 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Sat, 19 Aug 2023 21:49:56 +0200 Subject: [PATCH 06/54] Update myobject.class.php fix https://github.com/Dolibarr/dolibarr/pull/25633#discussion_r1299167338 --- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 5122bf3e59e..b9fcc4da829 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -833,7 +833,7 @@ class MyObject extends CommonObject $pospoint = strpos($filearray[0]['name'], '.'); $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); - if (empty(getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'))) { + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { $result .= '
No photo
'; } else { $result .= '
No photo
'; From f255fac00013c2512d2886102f5748c60922ca4d Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 23 Aug 2023 20:06:42 +0200 Subject: [PATCH 07/54] Update doc_generic_myobject_odt.modules.php --- .../modules/mymodule/doc/doc_generic_myobject_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 17936af12de..fc826e6caad 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -321,7 +321,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $contactobject = null; if (!empty($usecontact)) { // We can use the company of contact instead of thirdparty company - if ($object->contact->socid != $object->thirdparty->id && ) { + if ($object->contact->socid != $object->thirdparty->id) { $object->contact->fetch_thirdparty(); $socobject = $object->contact->thirdparty; $contactobject = $object->contact; From 1cbe8c9327bbb26f01b1fafae13a054a465a302a Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 23 Aug 2023 20:08:58 +0200 Subject: [PATCH 08/54] Update doc_generic_myobject_odt.modules.php --- .../modules/mymodule/doc/doc_generic_myobject_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index fc826e6caad..dc0c0945278 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -321,7 +321,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $contactobject = null; if (!empty($usecontact)) { // We can use the company of contact instead of thirdparty company - if ($object->contact->socid != $object->thirdparty->id) { + if ($object->contact->socid != $object->thirdparty->id && getDolGlobalInt("MAIN_USE_COMPANY_NAME_OF_CONTACT")) { $object->contact->fetch_thirdparty(); $socobject = $object->contact->thirdparty; $contactobject = $object->contact; From 5deaaa08a21bac262f97d6662228cd2d4422b2ad Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 25 Aug 2023 09:10:47 +0200 Subject: [PATCH 09/54] fix review --- .../modules/mymodule/doc/pdf_standard_myobject.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 6a28e07a336..9b0cd33c283 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -179,7 +179,7 @@ class pdf_standard_myobject extends ModelePDFMyObject // Load translation files required by the page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); - if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { + if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); @@ -189,7 +189,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $nblines = (is_array($object->lines) ? count($object->lines) : 0); $hidetop = 0; - if (!empty(getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE'))) { + if (getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE')) { $hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE'); } From e56fed15c53f664d8f879a2af54ebfd6288a552f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 28 Aug 2023 14:12:06 +0200 Subject: [PATCH 10/54] fix travais --- htdocs/modulebuilder/template/class/myobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index b9fcc4da829..b70a1d1a7b1 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -251,7 +251,7 @@ class MyObject extends CommonObject $this->db = $db; - if (empty(getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID')) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { + if (!getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { $this->fields['rowid']['visible'] = 0; } if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { @@ -1035,11 +1035,11 @@ class MyObject extends CommonObject global $langs, $conf; $langs->load("mymodule@mymodule"); - if (empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON'))) { + if (getDolGlobalString('MYMODULE_MYOBJECT_ADDON')=='') { $conf->global->MYMODULE_MYOBJECT_ADDON = 'mod_myobject_standard'; } - if (!empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON'))) { + if (getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) { $mybool = false; $file = getDolGlobalString('MYMODULE_MYOBJECT_ADDON').".php"; @@ -1105,7 +1105,7 @@ class MyObject extends CommonObject if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty(getDolGlobalString('MYOBJECT_ADDON_PDF'))) { + } elseif (getDolGlobalString('MYOBJECT_ADDON_PDF')) { $modele = getDolGlobalString('MYOBJECT_ADDON_PDF'); } } From 3db024e6b593ee60e496ff0023e8dd0f9ca563a3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 28 Aug 2023 14:33:02 +0200 Subject: [PATCH 11/54] fix travis --- .../core/modules/modMyModule.class.php | 4 ++-- .../doc/doc_generic_myobject_odt.modules.php | 10 ++++----- .../doc/pdf_standard_myobject.modules.php | 22 +++++++++---------- .../template/myobject_agenda.php | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 311bc6c14b5..b5dfb86dba7 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -403,8 +403,8 @@ class modMyModule extends DolibarrModules $this->import_convertvalue_array[$r] = array( 't.ref' => array( 'rule'=>'getrefifauto', - 'class'=>(empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')), - 'path'=>"/core/modules/commande/".(empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')).'.php' + 'class'=>(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')=='') ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')), + 'path'=>"/core/modules/commande/".(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')=='') ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')).'.php' 'classobject'=>'MyObject', 'pathobject'=>'/mymodule/class/myobject.class.php', ), diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index dc0c0945278..829cba459e1 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Scan directories $nbofiles = count($listoffiles); - if (!empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH'))) { + if (getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH')) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -287,7 +287,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Get extension (ods or odt) $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); - if (!empty(getDolGlobalString('MAIN_DOC_USE_TIMING'))) { + if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); if ($format == '1') { $format = '%Y%m%d%H%M%S'; @@ -350,7 +350,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Line of free text $newfreetext = ''; $paramfreetext = 'MYMODULE_MYOBJECT_FREE_TEXT'; - if (!empty(getDolGlobalString($paramfreetext))) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } @@ -477,7 +477,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file - if (!empty(getDolGlobalString($MAIN_ODT_AS_PDF))) { + if (getDolGlobalString('MAIN_ODT_AS_PDF')) { try { $odfHandler->exportAsAttachedPDF($file); } catch (Exception $e) { @@ -498,7 +498,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (!empty(getDolGlobalString('MAIN_UMASK'))) { + if (getDolGlobalString('MAIN_UMASK')) { @chmod($file, octdec(getDolGlobalString('MAIN_UMASK'))); } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 9b0cd33c283..38be530e909 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -197,7 +197,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $realpatharray = array(); $this->atleastonephoto = false; /* - if (!empty(getDolGlobalString('MAIN_GENERATE_MYOBJECT_WITH_PICTURE'))) + if (getDolGlobalString('MAIN_GENERATE_MYOBJECT_WITH_PICTURE')) { $objphoto = new Product($this->db); @@ -289,7 +289,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $heightforinfotot = 50; // Height reserved to output the info and total part and payment part $heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') ? getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') : 5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + (empty(getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + $heightforfooter = $this->marge_basse + ((getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')=='') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -298,7 +298,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty(getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'))) { + if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -320,7 +320,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; // If user has no certificate, we try to take the company one if (!$cert) { - $cert = empty(getDolGlobalString('CERTIFICATE_CRT')) ? '' : getDolGlobalString('CERTIFICATE_CRT'); + $cert = getDolGlobalString('CERTIFICATE_CRT'); } // If a certificate is found if ($cert) { @@ -757,7 +757,7 @@ class pdf_standard_myobject extends ModelePDFMyObject // Display payment area /* - if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty(getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS'))) + if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && (getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS')=='')) { $posy = $this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } @@ -783,7 +783,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $this->errors = $hookmanager->errors; } - if (!empty(getDolGlobalString('MAIN_UMASK'))) { + if (getDolGlobalString('MAIN_UMASK')) { @chmod($file, octdec(getDolGlobalString('MAIN_UMASK'))); } @@ -848,14 +848,14 @@ class pdf_standard_myobject extends ModelePDFMyObject if (empty($hidetop)) { $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); - if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && is_object($outputlangsbis)) { + if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { $titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency)); } $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - if (!empty(getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))) { + if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -912,7 +912,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetXY($this->marge_gauche, $posy); // Logo - if (empty(getDolGlobalString('PDF_DISABLE_MYCOMPANY_LOGO'))) { + if (getDolGlobalString('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; if (!empty($conf->mycompany->multidir_output[$object->entity])) { @@ -942,7 +942,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $title = $outputlangs->transnoentities("PdfTitle"); - if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && is_object($outputlangsbis)) { + if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { $title .= ' - '; $title .= $outputlangsbis->transnoentities("PdfTitle"); } @@ -996,7 +996,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetTextColor(0, 0, 60); $title = $outputlangs->transnoentities("Date"); - if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && is_object($outputlangsbis)) { + if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { $title .= ' - '.$outputlangsbis->transnoentities("Date"); } $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R'); diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 968076385c9..2a313d17da8 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -94,7 +94,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty(getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'))); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'))); } $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); From c2e292d1d43c3f1c9f653d6085ce316b3d76b191 Mon Sep 17 00:00:00 2001 From: avolani <31508728+avolani@users.noreply.github.com> Date: Wed, 30 Aug 2023 08:34:09 +0200 Subject: [PATCH 12/54] Return right content type Revert content type to html (no json here, ajax calls fails) --- htdocs/projet/ajax/projects.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/ajax/projects.php b/htdocs/projet/ajax/projects.php index 03d118dc9b9..b0001a2a4b2 100644 --- a/htdocs/projet/ajax/projects.php +++ b/htdocs/projet/ajax/projects.php @@ -62,7 +62,7 @@ dol_syslog("Call ajax projet/ajax/projects.php"); require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -top_httphead('application/json'); +top_httphead(); if (empty($htmlname) && !GETPOST('mode', 'aZ09')) { return; From 1dc0f0a6e0426c56006598c73abca51b8e736c3e Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:47:59 +0200 Subject: [PATCH 13/54] Update htdocs/index.php Suggestion from PR --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index 8dbe7681920..bb7eeac9a85 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -437,7 +437,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop foreach ($valid_dashboardlines as $board) { - if ($board->nbtodolate > 0 && is_numeric($board->nbtodo) && is_numeric($board->nbtodolate)) { + if (is_numeric($board->nbtodo) && is_numeric($board->nbtodolate) && $board->nbtodolate > 0) { $totaltodo += $board->nbtodo; $totallate += $board->nbtodolate; } From 07d821b52caf729cca3c4c2d09fc851b61664c4f Mon Sep 17 00:00:00 2001 From: Andrea Volani Date: Mon, 4 Sep 2023 09:11:57 +0200 Subject: [PATCH 14/54] Return correct content type based on the call used. --- htdocs/projet/ajax/projects.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/ajax/projects.php b/htdocs/projet/ajax/projects.php index 03d118dc9b9..97d2b9daef9 100644 --- a/htdocs/projet/ajax/projects.php +++ b/htdocs/projet/ajax/projects.php @@ -62,7 +62,6 @@ dol_syslog("Call ajax projet/ajax/projects.php"); require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -top_httphead('application/json'); if (empty($htmlname) && !GETPOST('mode', 'aZ09')) { return; @@ -70,21 +69,35 @@ if (empty($htmlname) && !GETPOST('mode', 'aZ09')) { // Mode to get list of projects if (empty($mode) || $mode != 'gettasks') { + + top_httphead('application/json'); + // When used from jQuery, the search term is added as GET param "term". $searchkey = (GETPOSTISSET($htmlname) ? GETPOST($htmlname, 'aZ09') : ''); $formproject = new FormProjets($db); $arrayresult = $formproject->select_projects_list($socid, '', $htmlname, 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey); + + $db->close(); + + print json_encode($arrayresult); + + return; } // Mode to get list of tasks +// THIS MODE RETURNS HTML NOT JSON - THE CALL SHOULD BE UPDATE IN THE FUTURE if ($mode == 'gettasks') { + + top_httphead(); + $formproject = new FormProjets($db); $formproject->selectTasks((!empty($socid) ? $socid : -1), 0, 'taskid', 24, 1, '1', 1, 0, 0, 'maxwidth500', GETPOST('projectid', 'int'), ''); + + $db->close(); + return; } -$db->close(); -print json_encode($arrayresult); From 4de001b43c2bfdf7110477c50516c1249ea5ae64 Mon Sep 17 00:00:00 2001 From: Andrea Volani Date: Mon, 4 Sep 2023 09:40:53 +0200 Subject: [PATCH 15/54] No need to enforce check on param 'htmlname' --- htdocs/projet/ajax/projects.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/projet/ajax/projects.php b/htdocs/projet/ajax/projects.php index 97d2b9daef9..42bacc4a453 100644 --- a/htdocs/projet/ajax/projects.php +++ b/htdocs/projet/ajax/projects.php @@ -53,7 +53,6 @@ $discard_closed = GETPOST('discardclosed', 'int'); // Security check restrictedArea($user, 'projet', 0, 'projet&project'); - /* * View */ @@ -62,11 +61,6 @@ dol_syslog("Call ajax projet/ajax/projects.php"); require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; - -if (empty($htmlname) && !GETPOST('mode', 'aZ09')) { - return; -} - // Mode to get list of projects if (empty($mode) || $mode != 'gettasks') { @@ -76,7 +70,7 @@ if (empty($mode) || $mode != 'gettasks') { $searchkey = (GETPOSTISSET($htmlname) ? GETPOST($htmlname, 'aZ09') : ''); $formproject = new FormProjets($db); - $arrayresult = $formproject->select_projects_list($socid, '', $htmlname, 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey); + $arrayresult = $formproject->select_projects_list($socid, '', '', 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey); $db->close(); From 2a1a855b6a653a457edceb0176598628603c5d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Sep 2023 16:38:27 +0200 Subject: [PATCH 16/54] phpstan --- htdocs/core/class/html.formcontract.class.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index faa8251ad0a..33694e798e6 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -188,15 +188,13 @@ class FormContract * @param int $showempty Show empty line * @param int $showRef Show customer and supplier reference on each contract (when found) * @param int $noouput 1=Return the output instead of display - * @return int Nbr of project if OK, <0 if KO + * @return string|void html string */ public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0) { global $langs; - $ret = ''; - - $ret .= '
'; + $ret = ''; $ret .= ''; $ret .= ''; $ret .= $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty, $showRef, 1); @@ -208,7 +206,5 @@ class FormContract } print $ret; - - return $result; } } From 3a84d84e655c0e38bb7bdb540288a4cccf36fbdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Sep 2023 19:47:38 +0200 Subject: [PATCH 17/54] Fix phpcs --- htdocs/projet/ajax/projects.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/projet/ajax/projects.php b/htdocs/projet/ajax/projects.php index 42bacc4a453..fbb02a60a48 100644 --- a/htdocs/projet/ajax/projects.php +++ b/htdocs/projet/ajax/projects.php @@ -63,7 +63,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; // Mode to get list of projects if (empty($mode) || $mode != 'gettasks') { - top_httphead('application/json'); // When used from jQuery, the search term is added as GET param "term". @@ -82,7 +81,6 @@ if (empty($mode) || $mode != 'gettasks') { // Mode to get list of tasks // THIS MODE RETURNS HTML NOT JSON - THE CALL SHOULD BE UPDATE IN THE FUTURE if ($mode == 'gettasks') { - top_httphead(); $formproject = new FormProjets($db); @@ -92,6 +90,3 @@ if ($mode == 'gettasks') { return; } - - - From cd81c2e18d0f4266296545571f08441256a1ef47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Sep 2023 20:29:33 +0200 Subject: [PATCH 18/54] phpstan --- htdocs/compta/prelevement/class/bonprelevement.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 44cd2437195..455e1c7972c 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -87,6 +87,10 @@ class BonPrelevement extends CommonObject */ public $file; + /* + * @var string filename + */ + public $filename; const STATUS_DRAFT = 0; const STATUS_TRANSFERED = 1; From 56bb72c1af864610b1f0cf9af52b98515df98175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Sep 2023 20:39:00 +0200 Subject: [PATCH 19/54] phpstan --- htdocs/core/class/commondocgenerator.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index bfec5a6c199..ccb379ea531 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -150,6 +150,8 @@ abstract class CommonDocGenerator */ public $result; + public $posxlabel; + public $posxup; public $posxref; public $posxpicture; // For picture public $posxdesc; // For description From 119f6b6a7ff696d49376b5e418e99a436130b307 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Sep 2023 23:48:23 +0200 Subject: [PATCH 20/54] Fix missing deletion of an old file --- htdocs/install/upgrade2.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 10be86d2411..46cff1d2bc6 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4100,6 +4100,7 @@ function migrate_delete_old_files($db, $langs, $conf) // List of files to delete $filetodeletearray = array( + '/core/ajax/ajaxcompanies.php', '/core/triggers/interface_demo.class.php', '/core/menus/barre_left/default.php', '/core/menus/barre_top/default.php', From 0ed6a63fb06be88be5a4f8bcdee83185eee4087e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 00:49:01 +0200 Subject: [PATCH 21/54] FIX #CVE-2023-4197 --- htdocs/core/lib/website.lib.php | 3 +++ test/phpunit/WebsiteTest.php | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index d27c4dac376..30edeac0d32 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -76,6 +76,9 @@ function dolStripPhpCode($str, $replacewith = '') function dolKeepOnlyPhpCode($str) { $str = str_replace('assertEquals($result, 1, 'checkPHPCode did not detect the string was dangerous'); } + + /** + * testDolKeepOnlyPhpCode + * + * @return void + */ + public function testDolKeepOnlyPhpCode() + { + $s = 'HTML content and more HTML content'; + $result = dolKeepOnlyPhpCode($s); + print __METHOD__." result dolKeepOnlyPhpCode=".$result."\n"; + $this->assertEquals('', $result, 'dolKeepOnlyPhpCode did extract the correct string'); + + $s = 'HTML content and more HTML content'; + $result = dolKeepOnlyPhpCode($s); + print __METHOD__." result dolKeepOnlyPhpCode=".$result."\n"; + $this->assertEquals('', $result, 'dolKeepOnlyPhpCode did extract the correct string'); + + $s = 'HTML content and more HTML content'; + $result = dolKeepOnlyPhpCode($s); + print __METHOD__." result dolKeepOnlyPhpCode=".$result."\n"; + $this->assertEquals('', $result, 'dolKeepOnlyPhpCode did extract the correct string'); + } } From c437aecb1fc7bb66492ccdefb1feb875c67a51cc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 5 Sep 2023 10:06:30 +0200 Subject: [PATCH 22/54] FIX multicompany compatibility --- htdocs/master.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 50a03e6fdb3..70c35008c8d 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -191,9 +191,9 @@ if (session_id() && !empty($_SESSION["dol_entity"])) { } elseif (!empty($_ENV["dol_entity"])) { // Entity inside a CLI script $conf->entity = $_ENV["dol_entity"]; -} elseif (GETPOSTISSET("loginfunction") && GETPOST("entity", 'int')) { +} elseif (GETPOSTISSET("loginfunction") && (GETPOST("entity", 'int') || GETPOST("switchentity", 'int'))) { // Just after a login page - $conf->entity = GETPOST("entity", 'int'); + $conf->entity = (GETPOSTISSET("entity") ? GETPOST("entity", 'int') : GETPOST("switchentity", 'int')); } elseif (defined('DOLENTITY') && is_numeric(constant('DOLENTITY'))) { // For public page with MultiCompany module $conf->entity = constant('DOLENTITY'); From c557baffc79298b07cfaba53f7b912ec1a7c8041 Mon Sep 17 00:00:00 2001 From: ATM-Sami Date: Tue, 5 Sep 2023 10:31:51 +0200 Subject: [PATCH 23/54] delete useless condition in massaction_pre --- htdocs/core/tpl/massactions_pre.tpl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 54557539b26..c5c561c5ec5 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -31,7 +31,6 @@ // $sendto // $withmaindocfilemail - if ($massaction == 'predeletedraft') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDraftDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); } @@ -94,7 +93,7 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { } } -if ($massaction == 'preupdateprice' && isModEnabled('category')) { +if ($massaction == 'preupdateprice') { $formquestion = array(); $valuefield = '
'; From c340943f409918ecbc5737739524b19bfe8b1449 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:55:44 +0300 Subject: [PATCH 24/54] Fix translation --- htdocs/langs/en_US/companies.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 19b17a73dff..871d9a72809 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -1,5 +1,5 @@ # Dolibarr language file - Source file is en_US - companies -newSocieteAdded=Your contact has been recorded. We will go back to you soon... +newSocieteAdded=Your contact details have been recorded. We will get back to you soon... ContactUsDesc=This form allows you to send us a message for a first contact. ErrorCompanyNameAlreadyExists=Company name %s already exists. Choose another one. ErrorSetACountryFirst=Set the country first From 8f7d68ac8e49e2d729f75fd546f3e3a7572ce3a5 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 5 Sep 2023 15:43:23 +0200 Subject: [PATCH 25/54] add function for check comments for sections before any actions --- htdocs/core/lib/modulebuilder.lib.php | 27 +++ htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/fr_FR/errors.lang | 1 + htdocs/modulebuilder/index.php | 280 ++++++++++++++++---------- 4 files changed, 198 insertions(+), 111 deletions(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 7281936216a..0d6b3c5fd37 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -448,7 +448,34 @@ function dolGetListOfObjectClasses($destdir) return -1; } +/** + * function for check if comment begin an end exist in modMyModule class + * @param string $file filename or path + * @param int $number 0 = For Menus,1 = For permissions, 2 = For Dictionaries + * @return int 1 if OK , -1 if KO + */ +function checkExistComment($file, $number) +{ + if (!file_exists($file)) { + return -1; + } + $content = file_get_contents($file); + if ($number === 0) { + if (strpos($content, '/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */') !== false && strpos($content, '/* END MODULEBUILDER LEFTMENU MYOBJECT */') !== false) { + return 1; + } + } elseif ($number === 1) { + if (strpos($content, '/* BEGIN MODULEBUILDER PERMISSIONS */') !== false && strpos($content, '/* END MODULEBUILDER PERMISSIONS */') !== false) { + return 1; + } + } elseif ($number == 2) { + if (strpos($content, '/* BEGIN MODULEBUILDER DICTIONARIES */') !== false && strpos($content, '/* END MODULEBUILDER DICTIONARIES */') !== false) { + return 1; + } + } + return -1; +} /** * Delete all permissions * diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a4546054f65..058dc422b81 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -363,6 +363,7 @@ WarningModuleNeedRefrech = Module %s has been disabled. Don't forget to e WarningPermissionAlreadyExist=Existing permissions for this object WarningGoOnAccountancySetupToAddAccounts=If this list is empty, go into menu %s - %s - %s to load or create accounts for your chart of account. WarningCorrectedInvoiceNotFound=Corrected invoice not found +WarningCommentNotFound=Please check placement of start and end comments for %s section in file %s before submitting your action SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. SwissQrCreditorAddressInvalid = Creditor address is invalid (are ZIP and city set? (%s) diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 655c22e31ba..41ca1f5c7f0 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -363,6 +363,7 @@ WarningModuleNeedRefrech = Le module %s a été désactivé. N'oubliez pa WarningPermissionAlreadyExist=Autorisations existantes pour cet objet WarningGoOnAccountancySetupToAddAccounts=Si cette liste est vide, allez dans le menu %s - %s - %s pour charger ou créer des comptes pour votre plan comptable. WarningCorrectedInvoiceNotFound=Facture corrigée introuvable +WarningCommentNotFound=Verifier l'emplacement des commentaires debut et fin pour la section %s dans le fichier %s avant de soumettre votre action SwissQrOnlyVIR = La facture SwissQR ne peut être ajoutée que sur les factures définies pour être payées avec des paiements par virement. SwissQrCreditorAddressInvalid = L'adresse du créancier n'est pas valide (le code postal et la ville sont-ils définis ? (%s) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d3f8ee41052..0dd5b15507b 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1290,10 +1290,14 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { } $rights = $moduleobj->rights; $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; - - $generatePerms = reWriteAllPermissions($moduledescriptorfile, $rights, null, null, $objectname, $module, -2); - if ($generatePerms < 0) { - setEventMessages($langs->trans("WarningPermissionAlreadyExist", $langs->transnoentities($objectname)), null, 'warnings'); + $checkComment = checkExistComment($moduledescriptorfile, 1); + if ($checkComment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); + } else { + $generatePerms = reWriteAllPermissions($moduledescriptorfile, $rights, null, null, $objectname, $module, -2); + if ($generatePerms < 0) { + setEventMessages($langs->trans("WarningPermissionAlreadyExist", $langs->transnoentities($objectname)), null, 'warnings'); + } } } @@ -1459,7 +1463,13 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { } } if (!$counter) { - dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */')); + $checkComment = checkExistComment($moduledescriptorfile, 0); + if ($checkComment < 0) { + $error++; + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); + } else { + dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */')); + } } // Add module descriptor to list of files to replace "MyObject' string with real name of object. $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; @@ -1585,13 +1595,18 @@ if ($dirins && $action == 'initdic' && $module && $dicname) { exit; } $dictionaries = $moduleobj->dictionaries; - createNewDictionnary($module, $moduledescriptorfile, $newdicname, $dictionaries); - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! + $checkComment = checkExistComment($moduledescriptorfile, 2); + if ($checkComment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Dictionaries"), "mod".$module."class.php"), null, 'warnings'); + } else { + createNewDictionnary($module, $moduledescriptorfile, $newdicname, $dictionaries); + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } + clearstatcache(true); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); + exit; } - clearstatcache(true); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); - exit; } } @@ -1895,35 +1910,45 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { // delete menus linked to the object $menus = $moduleobj->menu; - reWriteAllMenus($moduledescriptorfile, $menus, $objectname, null, -1); + $rewriteMenu = checkExistComment($moduledescriptorfile, 0); + + if ($rewriteMenu < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); + } else { + reWriteAllMenus($moduledescriptorfile, $menus, $objectname, null, -1); + } // regenerate permissions and delete them $permissions = $moduleobj->rights; - reWriteAllPermissions($moduledescriptorfile, $permissions, null, null, $objectname, '', -1); - - // check if documentation has been generated - $file_doc = $dirins.'/'.strtolower($module).'/doc/Documentation.asciidoc'; - if (file_exists($file_doc)) { - deletePropsAndPermsFromDoc($file_doc, $objectname); - } - - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! - } - $resultko = 0; - foreach ($filetodelete as $tmpfiletodelete) { - $resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete, 0, 0, 1); - $resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete.'.back', 0, 0, 1); - if (!$resulttmp) { - $resultko++; - } - } - - if ($resultko == 0) { - setEventMessages($langs->trans("FilesDeleted"), null); + $rewritePerms = checkExistComment($moduledescriptorfile, 1); + if ($rewritePerms < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); } else { - setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); + reWriteAllPermissions($moduledescriptorfile, $permissions, null, null, $objectname, '', -1); + } + if ($rewritePerms && $rewriteMenu) { + // check if documentation has been generated + $file_doc = $dirins.'/'.strtolower($module).'/doc/Documentation.asciidoc'; + deletePropsAndPermsFromDoc($file_doc, $objectname); + + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } + $resultko = 0; + foreach ($filetodelete as $tmpfiletodelete) { + $resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete, 0, 0, 1); + $resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete.'.back', 0, 0, 1); + if (!$resulttmp) { + $resultko++; + } + } + + if ($resultko == 0) { + setEventMessages($langs->trans("FilesDeleted"), null); + } else { + setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); + } } } @@ -1978,6 +2003,11 @@ if (($dirins && $action == 'confirm_deletedictionary' && $dicname) || ($dirins & } $dicts = $moduleobj->dictionaries; + $checkComment = checkExistComment($moduledescriptorfile, 2); + if ($checkComment < 0) { + $error++; + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Dictionaries"), "mod".$module."class.php"), null, 'warnings'); + } if (!empty(GETPOST('dictionnarykey'))) { $newdicname = $dicts['tabname'][GETPOST('dictionnarykey')-1]; @@ -2021,13 +2051,16 @@ if (($dirins && $action == 'confirm_deletedictionary' && $dicname) || ($dirins & $result = updateDictionaryInFile($module, $moduledescriptorfile, $dicts); if ($result > 0) { setEventMessages($langs->trans("DictionaryDeleted", ucfirst(substr($newdicname, 2))), null); + } elseif (!$result) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Dictionaries"), "mod".$module."class.php"), null, 'warnings'); + } else { + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } + clearstatcache(true); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); + exit; } - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! - } - clearstatcache(true); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); - exit; } } if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey')) { @@ -2056,16 +2089,21 @@ if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey')) { $dicts = $moduleobj->dictionaries; if (!empty(GETPOST('tablib')) && GETPOST('tablib') !== $dicts['tablib'][$keydict]) { $dicts['tablib'][$keydict] = ucfirst(strtolower(GETPOST('tablib'))); - $updateDict = updateDictionaryInFile($module, $moduledescriptorfile, $dicts); - if ($updateDict > 0) { - setEventMessages($langs->trans("DictionaryNameUpdated", ucfirst(GETPOST('tablib'))), null); + $checkComment = checkExistComment($moduledescriptorfile, 2); + if ($checkComment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Dictionaries"), "mod".$module."class.php"), null, 'warnings'); + } else { + $updateDict = updateDictionaryInFile($module, $moduledescriptorfile, $dicts); + if ($updateDict > 0) { + setEventMessages($langs->trans("DictionaryNameUpdated", ucfirst(GETPOST('tablib'))), null); + } + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } + clearstatcache(true); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); + exit; } - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! - } - clearstatcache(true); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); - exit; } //var_dump(GETPOST('tablib'));exit; } @@ -2215,11 +2253,6 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { 5=>$crud ]; - $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - //rewriting all permissions after add a right - reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightToAdd, '', '', 1); - setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); - if (isModEnabled(strtolower($module))) { $result = unActivateModule(strtolower($module)); dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); @@ -2229,14 +2262,22 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); } } + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + //rewriting all permissions after add a right + $rewrite = checkExistComment($moduledescriptorfile, 1); + if ($rewrite < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); + } else { + reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightToAdd, '', '', 1); + setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + exit; } - - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); - exit; } @@ -2330,17 +2371,19 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; // rewriting all permissions after update permission needed - reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightUpdated, '', '', 2); - - setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null); - - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! + $rewrite = checkExistComment($moduledescriptorfile, 1); + if ($rewrite < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); + } else { + reWriteAllPermissions($moduledescriptorfile, $permissions, $key, $rightUpdated, '', '', 2); + setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null); + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + exit; } - - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); - exit; } } // Delete permission @@ -2363,11 +2406,6 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p $key = (int) GETPOST('permskey', 'int')-1; if (!$error) { - $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - - // rewriting all permissions - reWriteAllPermissions($moduledescriptorfile, $permissions, $key, null, '', '', 0); - // check if module is enabled if (isModEnabled(strtolower($module))) { $result = unActivateModule(strtolower($module)); @@ -2375,12 +2413,18 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p if ($result) { setEventMessages($result, null, 'errors'); } - setEventMessages($langs->trans('PermissionDeletedSuccesfuly'), null); setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); exit; + } + + // rewriting all permissions + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + $rewrite = checkExistComment($moduledescriptorfile, 1); + if ($rewrite < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); } else { + reWriteAllPermissions($moduledescriptorfile, $permissions, $key, null, '', '', 0); setEventMessages($langs->trans('PermissionDeletedSuccesfuly'), null); clearstatcache(true); @@ -2538,24 +2582,29 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) { $key = (int) GETPOST('menukey', 'int'); $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - if ($menus[$key]['fk_menu'] === 'fk_mainmenu='.strtolower($module)) { - if (in_array(strtolower($menus[$key]['leftmenu']), $result)) { - reWriteAllMenus($moduledescriptorfile, $menus, $menus[$key]['leftmenu'], $key, -1); + $checkcomment = checkExistComment($moduledescriptorfile, 0); + if ($checkcomment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); + } else { + if ($menus[$key]['fk_menu'] === 'fk_mainmenu='.strtolower($module)) { + if (in_array(strtolower($menus[$key]['leftmenu']), $result)) { + reWriteAllMenus($moduledescriptorfile, $menus, $menus[$key]['leftmenu'], $key, -1); + } else { + reWriteAllMenus($moduledescriptorfile, $menus, null, $key, 0); + } } else { reWriteAllMenus($moduledescriptorfile, $menus, null, $key, 0); } - } else { - reWriteAllMenus($moduledescriptorfile, $menus, null, $key, 0); - } - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); // remove the include cache hell ! - } + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); // remove the include cache hell ! + } - setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); - exit; + setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + exit; + } } // Add menu in module without initial object @@ -2684,15 +2733,19 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) { $menuToAdd['perms'] = '1'; } - $result = reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd, null, 1); - - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); + $checkcomment = checkExistComment($moduledescriptorfile, 0); + if ($checkcomment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); + } else { + reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd, null, 1); + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + setEventMessages($langs->trans('MenuAddedSuccesfuly'), null); + exit; } - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); - setEventMessages($langs->trans('MenuAddedSuccesfuly'), null); - exit; } } @@ -2771,20 +2824,25 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST( } if (!$error) { //update menu - $result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2); + $checkComment = checkExistComment($moduledescriptorfile, 0); + if ($checkComment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); + } else { + $result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2); - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); - } - if ($result < 0) { - setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors'); - header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1)); + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); + } + if ($result < 0) { + setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1)); + exit; + } + setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); exit; } - setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); - exit; } } else { $_POST['type'] = ''; From 82e7f829b0e2a8e3d42c3408a197fed26a07c3ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 15:54:48 +0200 Subject: [PATCH 26/54] NEW Support of js into the Dolibarr server preview --- htdocs/core/lib/website.lib.php | 9 +- htdocs/core/lib/website2.lib.php | 2 +- htdocs/public/website/javascript.js.php | 171 ++++++++++++++++++++++++ 3 files changed, 178 insertions(+), 4 deletions(-) create mode 100644 htdocs/public/website/javascript.js.php diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index d27c4dac376..0fd313e4cd1 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -163,12 +163,13 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR'; }*/ $content = dolStripPhpCode($content, $replacewith); - //var_dump($content); // Protect the link styles.css.php to any replacement that we make after. $content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content); + $content = str_replace('src="javascript.js.php', 'src="!~!~!~javascript.js.php', $content); $content = str_replace('href="http', 'href="!~!~!~http', $content); $content = str_replace('href="//', 'href="!~!~!~//', $content); + $content = str_replace('src="//', 'src="!~!~!~//', $content); $content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content); $content = str_replace('src="/viewimage.php', 'src="!~!~!~/viewimage.php', $content); $content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content); @@ -301,11 +302,14 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') } } elseif (defined('USEDOLIBARRSERVER')) { // REPLACEMENT OF LINKS When page called from Dolibarr server $content = str_replace('virtualhost) { $content = preg_replace('/^(]*rel="canonical" href=")\//m', '\1'.$website->virtualhost.'/', $content, -1, $nbrep); diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 87a964c9419..1668d640f02 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -248,7 +248,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, // Add js $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; // Add headers $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; diff --git a/htdocs/public/website/javascript.js.php b/htdocs/public/website/javascript.js.php new file mode 100644 index 00000000000..51cecf8c699 --- /dev/null +++ b/htdocs/public/website/javascript.js.php @@ -0,0 +1,171 @@ + + * + * 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/public/website/javascript.js.php + * \ingroup website + * \brief Page to output style page. Called with + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', 1); // Disables token renewal +} +if (!defined('NOLOGIN')) { + define("NOLOGIN", 1); +} +if (!defined('NOCSRFCHECK')) { + define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} + +/** + * Header empty + * + * @return void + */ +function llxHeader() +{ +} +/** + * Footer empty + * + * @return void + */ +function llxFooter() +{ +} + +require '../../master.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + +$error = 0; +$website = GETPOST('website', 'alpha'); +$websiteid = GETPOST('websiteid', 'int'); +$pageid = GETPOST('page', 'alpha') ?GETPOST('page', 'alpha') : GETPOST('pageid', 'alpha'); + +$accessallowed = 1; +$type = ''; + + +/* + * View + */ + +$appli = constant('DOL_APPLICATION_TITLE'); +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + $appli = $conf->global->MAIN_APPLICATION_TITLE; +} + +//print 'Directory with '.$appli.' websites.
'; + +if (empty($pageid)) { + require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; + require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; + + $object = new Website($db); + if ($websiteid) { + $object->fetch($websiteid); + $website = $object->ref; + } else { + $object->fetch(0, $website); + } + + $objectpage = new WebsitePage($db); + /* Not required for CSS file + $array=$objectpage->fetchAll($object->id); + + if (is_array($array) && count($array) > 0) + { + $firstrep=reset($array); + $pageid=$firstrep->id; + } + */ +} +/* Not required for CSS file +if (empty($pageid)) +{ + $langs->load("website"); + print $langs->trans("PreviewOfSiteNotYetAvailable"); + exit; +} +*/ + +// Security: Delete string ../ into $original_file +global $dolibarr_main_data_root; + +$original_file = $dolibarr_main_data_root.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$website.'/javascript.js.php'; + +// Find the subdirectory name as the reference +$refname = basename(dirname($original_file)."/"); + +// Security: +// Limite acces si droits non corrects +if (!$accessallowed) { + accessforbidden(); +} + +// Security: +// On interdit les remontees de repertoire ainsi que les pipe dans +// les noms de fichiers. +if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) { + dol_syslog("Refused to deliver file ".$original_file); + $file = basename($original_file); // Do no show plain path of original_file in shown error message + dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file)); + exit; +} + +clearstatcache(); + +$filename = basename($original_file); + +// Output file on browser +dol_syslog("javascript.js.css.php include $original_file $filename content-type=$type"); +$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset + +// This test if file exists should be useless. We keep it to find bug more easily +if (!file_exists($original_file_osencoded)) { + $langs->load("website"); + print $langs->trans("RequestedPageHasNoContentYet", $pageid); + //dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file)); + exit; +} + + +// Output page content +define('USEDOLIBARRSERVER', 1); +print '/* Page content '.$original_file.' : JS content that was saved into tpl dir */'."\n"; +require_once $original_file_osencoded; + + +if (is_object($db)) { + $db->close(); +} From e922d07a97ddae6a42fe62d4619ee3f0f04479d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Sep 2023 16:19:21 +0200 Subject: [PATCH 27/54] fix tooltip ajax load langs --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e54ef4ff62b..60dc22c5bb2 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5058,7 +5058,7 @@ class Product extends CommonObject { global $conf, $langs; - $langs->load('products', 'other'); + $langs->loadLangs(array('products', 'other')); $datas = array(); $nofetch = !empty($params['nofetch']); From 2701f8a2a8d9b0c888247c8b37840008fcf75ce5 Mon Sep 17 00:00:00 2001 From: Hystepik Date: Tue, 5 Sep 2023 16:32:02 +0200 Subject: [PATCH 28/54] New : Bookcal dev 2 --- htdocs/bookcal/class/availabilities.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 7 ++ htdocs/comm/action/index.php | 73 +++++++++++++-- htdocs/core/ajax/bookcalAjax.php | 10 +-- htdocs/core/modules/modBookCal.class.php | 47 ++++++---- htdocs/langs/en_US/agenda.lang | 3 +- htdocs/public/bookcal/booking.php | 88 ++++++++++++++++--- htdocs/public/bookcal/index.php | 4 +- 8 files changed, 187 insertions(+), 47 deletions(-) diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 40e07b821c5..6da76ad4a80 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -102,7 +102,7 @@ class Availabilities extends CommonObject * @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', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2de8736b39f..836562067f8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -300,6 +300,11 @@ class ActionComm extends CommonObject */ public $elementtype; + /** + * @var int id of availability + */ + public $fk_bookcal_availability; + /** * @var string Ical name */ @@ -539,6 +544,7 @@ class ActionComm extends CommonObject $sql .= "transparency,"; $sql .= "fk_element,"; $sql .= "elementtype,"; + $sql .= "fk_bookcal_availability,"; $sql .= "entity,"; $sql .= "extraparams,"; // Fields emails @@ -581,6 +587,7 @@ class ActionComm extends CommonObject $sql .= "'".$this->db->escape($this->transparency)."', "; $sql .= (!empty($this->fk_element) ? ((int) $this->fk_element) : "null").", "; $sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", "; + $sql .= (!empty($this->fk_bookcal_availability) ? "'".$this->db->escape($this->fk_bookcal_availability)."'" : "null").", "; $sql .= ((int) $conf->entity).","; $sql .= (!empty($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").", "; // Fields emails diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7316ee3daaf..e03b4bd1473 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -557,6 +557,34 @@ if ($user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allac $s = ''; $link = ''; $showextcals = $listofextcals; +$bookcalcalendars = array(); + +// Load Bookcal Calendars +if (isModEnabled("bookcal")) { + $sql = "SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal"; + $sql .= " FROM ".MAIN_DB_PREFIX."bookcal_availabilities as ba"; + $sql .= " JOIN ".MAIN_DB_PREFIX."bookcal_calendar as bc"; + $sql .= " ON bc.rowid = ba.fk_bookcal_calendar"; + $sql .= " WHERE bc.status = 1"; + $sql .= " AND ba.status = 1"; + if (!empty($filtert) && $filtert != -1) { + $sql .= " AND bc.visibility = ".(int) $filtert ; + } + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $objp = $db->fetch_object($resql); + $label = !empty($objp->label) ? $objp->label : $objp->ref; + $bookcalcalendars["calendars"][] = array("id" => $objp->id_cal, "label" => $label); + $bookcalcalendars["availabilitieslink"][$objp->rowid] = $objp->id_cal; + $i++; + } + } else { + dol_print_error($db); + } +} if (!empty($conf->use_javascript_ajax)) { // If javascript on $s .= "\n".''."\n"; @@ -564,6 +592,11 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on $s .= 'jQuery(document).ready(function () {'."\n"; $s .= 'jQuery(".check_birthday").click(function() { console.log("Toggle birthdays"); jQuery(".family_birthday").toggle(); });'."\n"; $s .= 'jQuery(".check_holiday").click(function() { console.log("Toggle holidays"); jQuery(".family_holiday").toggle(); });'."\n"; + if (isModEnabled("bookcal")) { + foreach ($bookcalcalendars["calendars"] as $key => $value) { + $s .= 'jQuery(".check_bookcal_calendar_'.$value['id'].'").click(function() { console.log("Toggle Bookcal Calendar '.$value['id'].'"); jQuery(".family_bookcal_calendar_'.$value['id'].'").toggle(); });'."\n"; + } + } if ($mode == "show_week" || $mode == "show_month" || empty($mode)) { // Code to enable drag and drop $s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'."\n"; @@ -631,6 +664,14 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on // Birthdays $s .= '
 
'; + // Bookcal Calendar + if (isModEnabled("bookcal")) { + foreach ($bookcalcalendars["calendars"] as $key => $value) { + $label = $value['label']; + $s .= '
 
'; + } + } + // Calendars from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); @@ -673,7 +714,7 @@ $sql .= ' a.datep2,'; $sql .= ' a.percent,'; $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,'; -$sql .= ' a.fk_soc, a.fk_contact, a.fk_project,'; +$sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_availability,'; $sql .= ' a.fk_element, a.elementtype,'; $sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; @@ -862,6 +903,10 @@ if ($resql) { $event->socid = $obj->fk_soc; $event->contact_id = $obj->fk_contact; + $event->fk_bookcal_availability = $obj->fk_bookcal_availability; + if (!empty($event->fk_bookcal_availability)) { + $event->type = "bookcal_calendar"; + } // Defined date_start_in_calendar and date_end_in_calendar property // They are date start and end of action but modified to not be outside calendar view. @@ -1505,7 +1550,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month } //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); echo ' '; - show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); + show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars); echo "\n"; } else { /* Show days after the current month (next month) */ @@ -1578,7 +1623,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month } echo ' '; - show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); + show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars); echo " \n"; } echo " \n"; @@ -1668,13 +1713,13 @@ if (empty($mode) || $mode == 'show_month') { // View by month echo '
'; - show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1); + show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars); print '
'; } else { print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0); + show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars); print '
'; } @@ -1703,9 +1748,10 @@ $db->close(); * @param int $showinfo Add extended information (used by day and week view) * @param int $minheight Minimum height for each event. 60px by default. * @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button" + * @param string $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal * @return void */ -function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0) +function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array()) { global $user, $conf, $langs; global $action, $mode, $filter, $filtert, $status, $actioncode, $usergroup; // Filters used into search form @@ -1817,6 +1863,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $colorindex = 2; $cssclass = 'family_birthday '; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); + } elseif ($event->type == 'bookcal_calendar') { + $numbirthday++; + $colorindex = 3; + $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray[$fk_bookcal_availability]) ? $bookcalcalendarsarray[$fk_bookcal_availability][$event->fk_bookcal_availability] : ""); + $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); @@ -1904,6 +1955,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type == 'holiday' && !GETPOST('check_holiday')) { $morecss = 'hidden'; } + if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability])) { + $morecss = 'hidden'; + } if ($morecss != 'hidden') { $itoshow++; } @@ -1911,8 +1965,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $ireallyshown++; } //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow); - - print '
type == 'bookcal_calendar') { + print '
fk_bookcal_availability].' '.$cssclass.($morecss ? ' '.$morecss : '').'"'; + } else { + print '
idate($datetocheckbooking)."'"; - $sql .= " AND b.start < '".$db->idate($datetocheckbooking_end)."'"; + $sql .= " AND b.datep >= '".$db->idate($datetocheckbooking)."'"; + $sql .= " AND b.datep < '".$db->idate($datetocheckbooking_end)."'"; $resql = $db->query($sql); if ($resql) { @@ -94,7 +94,7 @@ if ($action == 'verifyavailability') { $response["content"] = array(); while ($i < $num) { $obj = $db->fetch_object($resql); - $dateobject = $obj->start; + $dateobject = $obj->datep; $dateobject = explode(" ", $dateobject)[1]; $dateobject = explode(":", $dateobject); diff --git a/htdocs/core/modules/modBookCal.class.php b/htdocs/core/modules/modBookCal.class.php index fbbc4180423..07237b63d45 100644 --- a/htdocs/core/modules/modBookCal.class.php +++ b/htdocs/core/modules/modBookCal.class.php @@ -297,7 +297,7 @@ class modBookCal extends DolibarrModules $r = 0; // Add here entries to declare new menus /* BEGIN MODULEBUILDER TOPMENU */ - $this->menu[$r++] = array( + /*$this->menu[$r++] = array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'top', // This is a Top menu entry 'titre'=>'ModuleBookCalName', @@ -311,18 +311,33 @@ class modBookCal extends DolibarrModules 'perms'=>'$user->rights->bookcal->availabilities->read', // Use 'perms'=>'$user->rights->bookcal->availabilities->read' if you want your menu with a permission rules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - ); + );*/ /* END MODULEBUILDER TOPMENU */ /* BEGIN MODULEBUILDER LEFTMENU CALENDAR */ + $this->menu[$r++] = array( + 'fk_menu'=>'fk_mainmenu=agenda', + 'type'=>'left', + 'titre'=> 'MenuBookcalIndex', + 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em92"'), + 'mainmenu'=>'agenda', + 'leftmenu'=> 'bookcal', + 'url'=> '/bookcal/bookcalindex.php', + 'langs'=> 'bookcal', + 'position'=> 1100+$r, + 'enabled'=> '1', + 'perms'=> '$user->rights->bookcal->calendar->read', + 'user'=> 0 + ); + $this->menu[$r++]=array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=bookcal', + 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal', // This is a Left menu entry 'type'=>'left', - 'titre'=>'List Calendar', - 'mainmenu'=>'bookcal', - 'leftmenu'=>'bookcal_calendar', + 'titre'=>'Calendar', + 'mainmenu'=>'agenda', + 'leftmenu'=>'bookcal_calendar_list', 'url'=>'/bookcal/calendar_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'bookcal', @@ -337,12 +352,12 @@ class modBookCal extends DolibarrModules ); $this->menu[$r++]=array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=bookcal,fk_leftmenu=bookcal_calendar', + 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_calendar_list', // This is a Left menu entry 'type'=>'left', - 'titre'=>'New Calendar', - 'mainmenu'=>'bookcal', - 'leftmenu'=>'bookcal_calendar', + 'titre'=>'NewCalendar', + 'mainmenu'=>'agenda', + 'leftmenu'=>'bookcal_new', 'url'=>'/bookcal/calendar_card.php?action=create', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'bookcal', @@ -405,11 +420,11 @@ class modBookCal extends DolibarrModules $this->menu[$r++]=array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=bookcal', + 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal', // This is a Left menu entry 'type'=>'left', - 'titre'=>'List Availabilities', - 'mainmenu'=>'bookcal', + 'titre'=>'Availabilities', + 'mainmenu'=>'agenda', 'leftmenu'=>'bookcal_availabilities', 'url'=>'/bookcal/availabilities_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. @@ -425,11 +440,11 @@ class modBookCal extends DolibarrModules ); $this->menu[$r++]=array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=bookcal,fk_leftmenu=bookcal_availabilities', + 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_availabilities', // This is a Left menu entry 'type'=>'left', - 'titre'=>'New Availabilities', - 'mainmenu'=>'bookcal', + 'titre'=>'NewAvailabilities', + 'mainmenu'=>'agenda', 'leftmenu'=>'bookcal_availabilities', 'url'=>'/bookcal/availabilities_card.php?action=create', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index abdbdbed6a1..07d97bb967f 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -180,4 +180,5 @@ BrowserPush=Browser Popup Notification Reminders=Reminders ActiveByDefault=Enabled by default Until=until -DataFromWasMerged=Data from %s was merged \ No newline at end of file +DataFromWasMerged=Data from %s was merged +AgendaShowBookcalCalendar=Booking calendar: %s \ No newline at end of file diff --git a/htdocs/public/bookcal/booking.php b/htdocs/public/bookcal/booking.php index 74972cfc8f0..0ddc53ebd6f 100644 --- a/htdocs/public/bookcal/booking.php +++ b/htdocs/public/bookcal/booking.php @@ -44,6 +44,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php'; require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $langs->loadLangs(array("main", "other", "dict", "agenda", "errors", "companies")); @@ -169,13 +171,21 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ if ($action == 'add') { $error = 0; - $urlback = ''; + $idcontact = 0; + $calendar = new Calendar($db); + $contact = new Contact($db); + $actioncomm = new ActionComm($db); + + $res = $calendar->fetch($fk_calendar); + if ($res < 0) { + $error++; + $errmsg .= $calendar->error." ".join(',', $calendar->errors); + } + if (!is_object($user)) { $user = new User($db); } - $booking = new ActionComm($db); - $db->begin(); if (!GETPOST("lastname")) { $error++; @@ -191,21 +201,71 @@ if ($action == 'add') { } if (!$error) { - $booking->ref = $booking->getNextNumRef(); - $booking->lastname = GETPOST("lastname"); - $booking->firstname = GETPOST("firstname"); - $booking->email = GETPOST("email"); - $booking->description = GETPOST("description"); - $booking->duration = GETPOST("duration"); - $booking->start = GETPOST("datetimebooking", 'int'); - $booking->fk_bookcal_availability = GETPOST("id", 'int'); + $sql = "SELECT s.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as s"; + $sql .= " WHERE s.lastname = '".GETPOST("lastname")."'"; + $sql .= " AND s.firstname = '".GETPOST("firstname")."'"; + $sql .= " AND s.email = '".GETPOST("email")."'"; + $resql = $db->query($sql); - $result = $booking->create($user); - if ($result <= 0) { + if ($resql) { + $num = $db->num_rows($resql); + if ($num > 0) { + $obj = $db->fetch_object($resql); + $idcontact = $obj->rowid; + $contact->fetch($idcontact); + } else { + $contact->lastname = GETPOST("lastname"); + $contact->firstname = GETPOST("firstname"); + $contact->email = GETPOST("email"); + $result = $contact->create($user); + if ($result < 0) { + $error++; + $errmsg .= $contact->error." ".join(',', $contact->errors); + } + } + } else { $error++; - $errmsg = ($booking->error ? $booking->error.'
' : '').join('
', $booking->errors); + $errmsg .= $db->lasterror(); } } + + if (!$error) { + $dateend = dol_time_plus_duree(GETPOST("datetimebooking", 'int'), GETPOST("duration"), 'i'); + + $actioncomm->label = "test"; + $actioncomm->type = 'AC_RDV'; + $actioncomm->type_id = 5; + $actioncomm->datep = GETPOST("datetimebooking", 'int'); + $actioncomm->datef = $dateend; + $actioncomm->note_private = GETPOST("description"); + $actioncomm->percentage = -1; + $actioncomm->fk_bookcal_availability = GETPOST("id", 'int'); + $actioncomm->userownerid = $calendar->visibility; + $actioncomm->contact_id = $contact->id; + $actioncomm->socpeopleassigned = $contact->id; + $result = $actioncomm->create($user); + if ($result < 0) { + $error++; + $errmsg .= $actioncomm->error." ".join(',', $actioncomm->errors); + } + + if (!$error) { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources"; + $sql .= "(fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; + $sql .= ") VALUES ("; + $sql .= (int) $actioncomm->id; + $sql .= ", 'socpeople'"; + $sql .= ", ". (int) $contact->id; + $sql .= ", 0, 0, 0)"; + $resql = $db->query($sql); + if (!$resql) { + $error++; + $errmsg .= $db->lasterror(); + } + } + } + if (!$error) { $db->commit(); $action = 'afteradd'; diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index cd4db57da4d..39d6b1f84da 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -180,7 +180,7 @@ print '
'; From 36c1c6be6a3b9b2011e53fa4c8dbb51442e7cf61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 16:33:37 +0200 Subject: [PATCH 29/54] Fix test on entity for project --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4407eae01f3..3508fa865a5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -274,6 +274,9 @@ function getEntity($element, $shared = 1, $currentobject = null) // fix different element names (France to English) switch ($element) { + case 'projet': + $element = 'project'; + break; case 'contrat': $element = 'contract'; break; // "/contrat/class/contrat.class.php" From 6459c862b883e1c3761893fda59b3751407dd8c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 16:50:23 +0200 Subject: [PATCH 30/54] Comment --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index d6bc0027da4..9d38e7fdb3d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -371,7 +371,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft"); /*print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid; print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select; - print ", perm: user->right->".$features.($feature2 ? "->".$feature2 : "")."=".($user->hasRight($features, $feature2, 'lire'))."
"; + print ", perm: user->hasRight(".$features.($feature2 ? ",".$feature2 : "").", lire) = ".($feature2 ? $user->hasRight($features, $feature2, 'lire') : $user->hasRight($features, 'lire'))."
"; */ $parentfortableentity = ''; From 0c17b266d7272c6295e8b4d1ae6cd1cb9bcaae0c Mon Sep 17 00:00:00 2001 From: atm-adrien Date: Tue, 5 Sep 2023 16:51:54 +0200 Subject: [PATCH 31/54] FIX : Can't access to rec supplier invoice card --- htdocs/fourn/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index e22dc721aba..ac74be12309 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -72,7 +72,7 @@ $month_date_when = GETPOST('month_date_when'); if ($user->socid) { $socid = $user->socid; } -$objecttype = 'facturefournisseur_rec'; +$objecttype = 'facture_fourn_rec'; if ($action == "create" || $action == "add") { $objecttype = ''; } From c95c006810e3ad76ff7a64a890c58d0a8bb29d37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 17:01:04 +0200 Subject: [PATCH 32/54] Fix regression --- htdocs/product/list.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 4028726096a..9c9f3e5f274 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -413,7 +413,9 @@ if (empty($reshook)) { */ $product_static = new Product($db); -$static_ws = new Workstation($db); +if (isModEnabled('workstation')) { + $workstation_static = new Workstation($db); +} $product_fourn = new ProductFournisseur($db); $title = $langs->trans("ProductsAndServices"); @@ -1844,12 +1846,12 @@ while ($i < $imaxinloop) { // Default Workstation if (!empty($arrayfields['p.fk_default_workstation']['checked'])) { print ''; - if (!empty($obj->fk_default_workstation)) { - $static_ws->id = $obj->fk_default_workstation; - $static_ws->ref = $obj->ref_workstation; - $static_ws->status = $obj->status_workstation; + if (isModEnabled('workstation') && !empty($obj->fk_default_workstation)) { + $workstation_static->id = $obj->fk_default_workstation; + $workstation_static->ref = $obj->ref_workstation; + $workstation_static->status = $obj->status_workstation; - print $static_ws->getNomUrl(1); + print $workstation_static->getNomUrl(1); } print ''; if (!$i) { From e9cb81ded83565d7e71100e301b69c1ffbb70acc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 17:40:09 +0200 Subject: [PATCH 33/54] Code comment --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a984ef485c7..87fd9041207 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7561,6 +7561,7 @@ function dol_html_entity_decode($a, $b, $c = 'UTF-8', $keepsomeentities = 0) * @param string $encoding Encoding page code * @param bool $double_encode When double_encode is turned off, PHP will not encode existing html entities * @return string $ret Encoded string + * @see dol_htmlentitiesbr() */ function dol_htmlentities($string, $flags = ENT_QUOTES|ENT_SUBSTITUTE, $encoding = 'UTF-8', $double_encode = false) { From 6b2a8ae744885e89e668fbfd6857a0f194352d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Sep 2023 18:27:30 +0200 Subject: [PATCH 34/54] phpstan --- htdocs/core/class/rssparser.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index fc3a8753a59..28da9f9a72d 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -52,6 +52,11 @@ class RssParser private $_rssarray = array(); private $current_namespace; + public $items = array(); + public $current_item = array(); + public $channel = array(); + public $textinput = array(); + public $image = array(); private $initem; private $intextinput; From b739b5b76d490b0300ce259b7482b73f32867729 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 5 Sep 2023 18:50:04 +0200 Subject: [PATCH 35/54] add badge for each tabs --- htdocs/core/lib/modulebuilder.lib.php | 28 +++++++++++++++++++++ htdocs/modulebuilder/index.php | 35 ++++++++++++++++++--------- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 7281936216a..9d1e7ebec97 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -1290,3 +1290,31 @@ function writeApiUrlsInDoc($file_api, $file_doc) } return -1; } + + +/** + * count directories or files in modulebuilder folder + * @param string $path path of directory + * @param int $type type of file 1= file,2=directory + * @return int|bool + */ +function countItemsInDirectory($path, $type = 1) +{ + if (!is_dir($path)) { + return false; + } + + $allFilesAndDirs = scandir($path); + $count = 0; + + foreach ($allFilesAndDirs as $item) { + if ($item != '.' && $item != '..') { + if ($type == 1 && is_file($path . DIRECTORY_SEPARATOR . $item) && strpos($item, '.back') === false) { + $count++; + } elseif ($type == 2 && is_dir($path . DIRECTORY_SEPARATOR . $item)) { + $count++; + } + } + } + return $count; +} diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d3f8ee41052..17b0d51d67f 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3203,6 +3203,19 @@ if ($module == 'initmodule') { // Tabs for module if (!$error) { $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; + $destdir = $dirread.'/'.strtolower($module); + $objects = dolGetListOfObjectClasses($destdir); + $diroflang = dol_buildpath($modulelowercase, 0)."/langs"; + $countLangs = countItemsInDirectory($diroflang, 2); + $countDictionaries = count($moduleobj->dictionaries['tabname']); + $countRights = count($moduleobj->rights); + $countMenus = count($moduleobj->menu); + $countTriggers = countItemsInDirectory(dol_buildpath($modulelowercase, 0)."/core/triggers"); + $countWidgets = countItemsInDirectory(dol_buildpath($modulelowercase, 0)."/core/boxes"); + $countCss = countItemsInDirectory(dol_buildpath($modulelowercase, 0)."/css"); + $countJs = countItemsInDirectory(dol_buildpath($modulelowercase, 0)."/js"); + $countCLI = countItemsInDirectory(dol_buildpath($modulelowercase, 0)."/scripts"); + $hasDoc = countItemsInDirectory(dol_buildpath($modulelowercase, 0)."/doc"); $head2 = array(); $h = 0; @@ -3213,22 +3226,22 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Objects"); + $head2[$h][1] = (count($objects) <= 0 ? $langs->trans("Objects") : $langs->trans("Objects")." (".count($objects).")"); $head2[$h][2] = 'objects'; $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Languages"); + $head2[$h][1] = ($countLangs <= 0 ? $langs->trans("Languages") : $langs->trans("Languages")." (".$countLangs.") "); $head2[$h][2] = 'languages'; $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Dictionaries"); + $head2[$h][1] = ($countDictionaries <= 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries')." (".$countDictionaries.")"); $head2[$h][2] = 'dictionaries'; $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Permissions"); + $head2[$h][1] = ($countRights <= 0 ? $langs->trans("Permissions") : $langs->trans("Permissions")." (".$countRights.")"); $head2[$h][2] = 'permissions'; $h++; @@ -3238,7 +3251,7 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Menus"); + $head2[$h][1] = ($countMenus <= 0 ? $langs->trans("Menus") : $langs->trans("Menus")." (".$countMenus.")"); $head2[$h][2] = 'menus'; $h++; @@ -3248,12 +3261,12 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Triggers"); + $head2[$h][1] = ($countTriggers <= 0 ? $langs->trans("Triggers") : $langs->trans("Triggers")." (".$countTriggers.")"); $head2[$h][2] = 'triggers'; $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Widgets"); + $head2[$h][1] = ($countWidgets <= 0 ? $langs->trans("Widgets") : $langs->trans("Widgets")." (".$countWidgets.")"); $head2[$h][2] = 'widgets'; $h++; @@ -3263,17 +3276,17 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=css&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("CSS"); + $head2[$h][1] = ($countCss <= 0 ? $langs->trans("CSS") : $langs->trans("CSS")." (".$countCss.")"); $head2[$h][2] = 'css'; $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=js&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("JS"); + $head2[$h][1] = ($countJs <= 0 ? $langs->trans("JS") : $langs->trans("JS")." (".$countJs.")"); $head2[$h][2] = 'js'; $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cli&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("CLI"); + $head2[$h][1] = ($countCLI <= 0 ? $langs->trans("CLI") : $langs->trans("CLI")." (".$countCLI.")"); $head2[$h][2] = 'cli'; $h++; @@ -3283,7 +3296,7 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Documentation"); + $head2[$h][1] = ($hasDoc <= 0 ? $langs->trans("Documentation") : $langs->trans("Documentation")." (".$hasDoc.")"); $head2[$h][2] = 'specifications'; $h++; From d8c51cb311f3c7e9bfe60ee77ae3a44338a70fe8 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 5 Sep 2023 18:54:08 +0200 Subject: [PATCH 36/54] check before each actions --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 0dd5b15507b..b2d1350932d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1290,7 +1290,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { } $rights = $moduleobj->rights; $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; - $checkComment = checkExistComment($moduledescriptorfile, 1); + $checkComment=checkExistComment($moduledescriptorfile, 1); if ($checkComment < 0) { setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); } else { From e2de78d9b477f9ec851ace7d31813b82cad76caa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 19:13:51 +0200 Subject: [PATCH 37/54] Fix permission on recurring invoice --- htdocs/core/lib/security.lib.php | 4 ++++ htdocs/fourn/facture/card-rec.php | 3 ++- htdocs/fourn/facture/list-rec.php | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 0d4ae46a5dd..7092da65884 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -372,6 +372,10 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($features == 'facturerec') { $features = 'facture'; } + if ($features == 'supplier_invoicerec') { + $features = 'fournisseur'; + $feature2 = 'facture'; + } if ($features == 'mo') { $features = 'mrp'; } diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index ac74be12309..525b5e9123a 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -126,7 +126,8 @@ $now = dol_now(); $error = 0; -$result = restrictedArea($user, 'facture', $object->id, $objecttype); +$result = restrictedArea($user, 'supplier_invoicerec', $object->id, $objecttype); + /* * Actions diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index e77000b45d3..b23d411977a 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -66,7 +66,6 @@ $objecttype = 'facture_fourn_rec'; if ($action == "create" || $action == "add") { $objecttype = ''; } -$result = restrictedArea($user, 'facture', $id, $objecttype); $search_ref = GETPOST('search_ref'); $search_societe = GETPOST('search_societe'); @@ -169,7 +168,7 @@ if ($socid > 0) { } $objecttype = 'facture_fourn_rec'; -$result = restrictedArea($user, 'facture', $object->id, $objecttype); +$result = restrictedArea($user, 'supplier_invoicerec', $object->id, $objecttype); /* From 9e617abd43352221eec5af59b2712cb0df18154c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 21:37:53 +0200 Subject: [PATCH 38/54] Fix warning --- htdocs/projet/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index aa40ba4bc5a..c781fb49e17 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -53,7 +53,7 @@ if ($search_project_user == $user->id) { // Security check $socid = 0; //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. -if (!$user->rights->projet->lire) { +if (!$user->hasRight('projet', 'lire')) { accessforbidden(); } From baa386333449e5207734d389a6e46253fab87f01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Sep 2023 22:41:17 +0200 Subject: [PATCH 39/54] css --- dev/tools/apstats.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 271bd264270..7b6b1f08cda 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -246,11 +246,11 @@ th,td { margin-left: 10px; } .back1 { - background-color: #888800; + background-color: #884466; color: #FFF; } -.back1 { - background-color: #880088; +.back2 { + background-color: #664488; color: #FFF; } '; From e2bf0315c39d75e0591d0a1d1b05467acaa53407 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 01:42:35 +0200 Subject: [PATCH 40/54] Fix fatal error on mod_contrat_olive. Missing getExample() --- .../core/modules/contract/mod_contract_magre.php | 2 +- .../core/modules/contract/mod_contract_olive.php | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index fd476eb2bc5..8deebdcffb5 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -102,7 +102,7 @@ class mod_contract_magre extends ModelNumRefContracts */ public function getExample() { - global $conf, $langs, $mysoc; + global $langs, $mysoc; $old_code_client = $mysoc->code_client; $mysoc->code_client = 'CCCCCCCCCC'; diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index 4051ac7c779..2737899a65c 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -78,6 +78,16 @@ class mod_contract_olive extends ModelNumRefContracts return $langs->trans("LeopardNumRefModelDesc"); } + /** + * Return numbering example + * + * @return string Example + */ + public function getExample() + { + return ''; + } + /** * Return an example of result returned by getNextValue * @@ -87,7 +97,6 @@ class mod_contract_olive extends ModelNumRefContracts */ public function getNextValue($objsoc, $contract) { - global $langs; return ''; } @@ -112,9 +121,9 @@ class mod_contract_olive extends ModelNumRefContracts $result = 0; $code = strtoupper(trim($code)); - if (empty($code) && $this->code_null && empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED)) { + if (empty($code) && $this->code_null && empty($conf->global->MAIN_CONTRACT_CODE_ALWAYS_REQUIRED)) { $result = 0; - } elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED))) { + } elseif (empty($code) && (!$this->code_null || !empty($conf->global->MAIN_CONTRACT_CODE_ALWAYS_REQUIRED))) { $result = -2; } From 84d12cf591fe6bde9e2af47146c1b8b14e95b656 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 02:38:08 +0200 Subject: [PATCH 41/54] NEW Add option TAKEPOS_HIDE_PRODUCT_PRICES to hide prices in TakePOS --- htdocs/takepos/index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 32d7301b6fe..3be9730e9cd 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1455,10 +1455,12 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) { //echo ''; print ''; } else { - if (getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) { - echo ''; - } else { + if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_PRICES')) { print '
'; + } + if (getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) { + print ''; + } else { print ''; } } From 0d76c492446f9b96827fb54dda7b0f18a0193ee4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 03:19:38 +0200 Subject: [PATCH 42/54] Trans --- htdocs/langs/en_US/ecm.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index c10f3a088b7..941977b3e40 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -45,7 +45,7 @@ ExtraFieldsEcmFiles=Extrafields Ecm Files ExtraFieldsEcmDirectories=Extrafields Ecm Directories ECMSetup=ECM Setup GenerateImgWebp=Duplicate all images with another version with .webp format -ConfirmGenerateImgWebp=If you confirm, you will generate an image in .webp format for all images currently into this folder (subfolders are not included)... +ConfirmGenerateImgWebp=If you confirm, you will generate an image in .webp format for all images currently into this folder (subfolders are not included, webp images will not be generated if size is greater than original)... ConfirmImgWebpCreation=Confirm all images duplication GenerateChosenImgWebp=Duplicate chosen image with another version with .webp format ConfirmGenerateChosenImgWebp=If you confirm, you will generate an image in .webp format for the image %s From b65b8d7bcbe75235a0981bc964991c26eb0d5f83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 14:56:51 +0200 Subject: [PATCH 43/54] FIX Navigation to/from a project from page of projects of a thirdparty --- htdocs/core/lib/company.lib.php | 2 +- htdocs/main.inc.php | 12 ++++++++++++ htdocs/projet/agenda.php | 8 +++++++- htdocs/projet/card.php | 19 +++++++++++++++++-- htdocs/projet/class/project.class.php | 7 ++++++- htdocs/projet/comment.php | 8 +++++++- htdocs/projet/contact.php | 8 +++++++- htdocs/projet/document.php | 8 +++++++- htdocs/projet/element.php | 8 +++++++- htdocs/projet/ganttview.php | 8 +++++++- htdocs/projet/list.php | 2 ++ htdocs/projet/messaging.php | 8 +++++++- htdocs/projet/note.php | 8 +++++++- htdocs/projet/tasks.php | 8 +++++++- htdocs/projet/tasks/time.php | 8 +++++++- htdocs/societe/project.php | 10 +++++----- 16 files changed, 113 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e1344e8f94f..a2ae0e8f7a2 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -869,7 +869,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel // Ref print ''; - print $projecttmp->getNomUrl(1); + print $projecttmp->getNomUrl(1, '', 0, '', '-', 0, 1, '', 'project:'.$_SERVER["PHP_SELF"].'?socid=__SOCID__'); print ''; // Label diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a91dc43adbd..3236c637828 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1082,6 +1082,18 @@ if (!defined('NOLOGIN')) { unset($_SESSION['lastsearch_mode_tmp_'.$relativepathstring]); } } + if (!empty($_GET['save_pageforbacktolist']) && !empty($_SERVER["HTTP_REFERER"])) { // We must use $_GET here + if (empty($_SESSION['pageforbacktolist'])) { + $pageforbacktolistarray = array(); + } else { + $pageforbacktolistarray = $_SESSION['pageforbacktolist']; + } + $tmparray = explode(':', $_GET['save_pageforbacktolist'], 2); + if (!empty($tmparray[0]) && !empty($tmparray[1])) { + $pageforbacktolistarray[$tmparray[0]] = $tmparray[1]; + $_SESSION['pageforbacktolist'] = $pageforbacktolistarray; + } + } $action = ''; $parameters = array(); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 5e8f0dfafbf..84a204a2e6a 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -127,7 +127,13 @@ print dol_get_fiche_head($head, 'agenda', $langs->trans("Project"), -1, ($object // Project card -$linkback = '
'.$langs->trans("BackToList").''; +if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; +} else { + $linkback = ''.$langs->trans("BackToList").''; +} $morehtmlref = '
'; // Title diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 806d73f225e..dc7eaa538f3 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -463,7 +463,16 @@ if (empty($reshook)) { $result = $object->delete($user); if ($result > 0) { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - header("Location: list.php?restore_lastsearch_values=1"); + + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1'; + } else { + $urlback = DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1'; + } + + header("Location: ".$urlback); exit; } else { dol_syslog($object->error, LOG_DEBUG); @@ -1221,7 +1230,13 @@ if ($action == 'create' && $user->rights->projet->creer) { // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6267c370eb3..94b213cf17d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1313,9 +1313,10 @@ class Project extends CommonObject * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param string $morecss More css on a link + * @param string $save_pageforbacktolist Back to this page 'context:url' * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1, $morecss = '') + public function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1, $morecss = '', $save_pageforbacktolist = '') { global $conf, $langs, $user, $hookmanager; @@ -1364,6 +1365,10 @@ class Project extends CommonObject if ($add_save_lastsearch_values) { $url .= '&save_lastsearch_values=1'; } + $add_save_backpagefor = ($save_pageforbacktolist ? 1 : 0); + if ($add_save_backpagefor) { + $url .= "&save_pageforbacktolist=".urlencode($save_pageforbacktolist); + } } $linkclose = ''; diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 7103916cdb4..0b2cc2681f1 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -98,7 +98,13 @@ $param = ($mode == 'mine' ? '&mode=mine' : ''); // Project card -$linkback = ''.$langs->trans("BackToList").''; +if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; +} else { + $linkback = ''.$langs->trans("BackToList").''; +} $morehtmlref = '
'; // Title diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index b0fece54827..17fb0cd10ef 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -294,7 +294,13 @@ if ($id > 0 || !empty($ref)) { // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 19ecebb2214..0f2733daec9 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -131,7 +131,13 @@ if ($object->id > 0) { // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 3b8393c402d..aa8c0182c58 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -211,7 +211,13 @@ print dol_get_fiche_head($head, 'element', $langs->trans("Project"), -1, ($objec // Project card -$linkback = ''.$langs->trans("BackToList").''; +if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; +} else { + $linkback = ''.$langs->trans("BackToList").''; +} $morehtmlref = '
'; // Title diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 47f7cb0a9ef..6e284b5dd0e 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -110,7 +110,13 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 985be60b138..d75602e76b5 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -375,6 +375,8 @@ if (empty($reshook)) { * View */ +unset($_SESSION['pageforbacktolist']['project']); + $form = new Form($db); $formcompany = new FormCompany($db); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index e0290d984a4..2b50f32f3d4 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -126,7 +126,13 @@ print dol_get_fiche_head($head, 'agenda', $langs->trans("Project"), -1, ($object // Project card -$linkback = ''.$langs->trans("BackToList").''; +if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; +} else { + $linkback = ''.$langs->trans("BackToList").''; +} $morehtmlref = '
'; // Title diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 20392059916..5f11bf20282 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -96,7 +96,13 @@ if ($id > 0 || !empty($ref)) { // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 196bc2d4582..b044b2a2a48 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -566,7 +566,13 @@ if ($id > 0 || !empty($ref)) { // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 52f68b11b08..ffc67f6e2cb 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -943,7 +943,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Project card - $linkback = ''.$langs->trans("BackToList").''; + if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { + $tmpurl = $_SESSION['pageforbacktolist']['project']; + $tmpurl = preg_replace('/__SOCID__/', $projectstatic->socid, $tmpurl); + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Title diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 5a8ba6a46b2..4bb657bee2b 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'projects')); +$action = GETPOST('action', 'aZ09'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { @@ -47,6 +49,8 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('projectthirdparty')); +$object = new Societe($db); + /* * Actions @@ -64,9 +68,7 @@ if ($reshook < 0) { * View */ -$contactstatic = new Contact($db); - -$form = new Form($db); +unset($_SESSION['pageforbacktolist']['project']); if ($socid) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -74,8 +76,6 @@ if ($socid) { $langs->load("companies"); - - $object = new Societe($db); $result = $object->fetch($socid); $title = $langs->trans("Projects"); From 20162a6d1116eda7e3da371a3c24841e63c68c34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 17:11:30 +0200 Subject: [PATCH 44/54] Fix support of xlink:href links in website module. --- htdocs/core/lib/website.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 7f01c1f3902..ee77e7dd316 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -171,6 +171,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c $content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content); $content = str_replace('src="javascript.js.php', 'src="!~!~!~javascript.js.php', $content); $content = str_replace('href="http', 'href="!~!~!~http', $content); + $content = str_replace('xlink:href="', 'xlink:href="!~!~!~', $content); $content = str_replace('href="//', 'href="!~!~!~//', $content); $content = str_replace('src="//', 'src="!~!~!~//', $content); $content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content); @@ -311,6 +312,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content); $content = str_replace('src="javascript.css.php', 'src="!~!~!~javascript.css.php', $content); $content = str_replace('href="http', 'href="!~!~!~http', $content); + $content = str_replace('xlink:href="', 'xlink:href="!~!~!~', $content); $content = str_replace('href="//', 'href="!~!~!~//', $content); $content = str_replace('src="//', 'src="!~!~!~//', $content); $content = str_replace(array('src="viewimage.php', 'src="/viewimage.php'), 'src="!~!~!~/viewimage.php', $content); From 94758009dd3afcfd2ffebf4bb2d4da4872b3b7b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Sep 2023 18:35:40 +0200 Subject: [PATCH 45/54] NEW Can see the favicon file into setup of properties of a website --- htdocs/viewimage.php | 5 ++++- htdocs/website/index.php | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index c531dbc09e0..e2adaa6700f 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -56,6 +56,8 @@ if (!defined('NOREQUIREAJAX')) { // Note that only directory logo is free to access without login. $needlogin = 1; if (isset($_GET["modulepart"])) { + // Some value of modulepart can be used to get resources that are public so no login are required. + // For logo of company if ($_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file'])) { $needlogin = 0; @@ -64,10 +66,11 @@ if (isset($_GET["modulepart"])) { if ($_GET["modulepart"] == 'barcode') { $needlogin = 0; } - // Some value of modulepart can be used to get resources that are public so no login are required. + // Medias files if ($_GET["modulepart"] == 'medias') { $needlogin = 0; } + // User photo if ($_GET["modulepart"] == 'userphotopublic') { $needlogin = 0; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e0b4d4c6c84..997af5d8f2f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3731,6 +3731,13 @@ if ($action == 'editcss') { print ''; // MAX_FILE_SIZE must precede the field type=file } print ''; + + $uploadfolder = $conf->website->dir_output.'/'.$websitekey; + if (dol_is_file($uploadfolder.'/favicon.png')) { + print '
'; + print ''; + print '
'; + } print ''; // CSS file From 05b067283ab23cda2a7011261fb4010fd8fec3a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Sep 2023 03:27:39 +0200 Subject: [PATCH 46/54] Removed useless file --- htdocs/langs/en_US/link.lang | 11 ----------- htdocs/langs/en_US/main.lang | 10 ++++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 htdocs/langs/en_US/link.lang diff --git a/htdocs/langs/en_US/link.lang b/htdocs/langs/en_US/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/en_US/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index d6f21c973a1..b20aee98e69 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1239,3 +1239,13 @@ DateOfPrinting=Date of printing ClickFullScreenEscapeToLeave=Click here to switch in Full screen mode. Press ESCAPE to leave Full screen mode. UserNotYetValid=Not yet valid UserExpired=Expired +LinkANewFile=Link a new file/document +LinkedFiles=Linked files and documents +NoLinkFound=No registered links +LinkComplete=The file has been linked successfully +ErrorFileNotLinked=The file could not be linked +LinkRemoved=The link %s has been removed +ErrorFailedToDeleteLink= Failed to remove link '%s' +ErrorFailedToUpdateLink= Failed to update link '%s' +URLToLink=URL to link +OverwriteIfExists=Overwrite if file exists From 0a853fe794e37e40be641e2ff0c6e8ebaa9d12f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Sep 2023 03:30:41 +0200 Subject: [PATCH 47/54] Removed files links.lang --- htdocs/core/actions_linkedfiles.inc.php | 2 +- htdocs/core/lib/files.lib.php | 2 +- htdocs/langs/am_ET/link.lang | 11 ----------- htdocs/langs/ar_DZ/link.lang | 11 ----------- htdocs/langs/ar_JO/link.lang | 11 ----------- htdocs/langs/ar_SA/link.lang | 11 ----------- htdocs/langs/ar_SY/link.lang | 11 ----------- htdocs/langs/az_AZ/link.lang | 11 ----------- htdocs/langs/bg_BG/link.lang | 11 ----------- htdocs/langs/bn_BD/link.lang | 11 ----------- htdocs/langs/bn_IN/link.lang | 11 ----------- htdocs/langs/bs_BA/link.lang | 11 ----------- htdocs/langs/ca_ES/link.lang | 11 ----------- htdocs/langs/cs_CZ/link.lang | 11 ----------- htdocs/langs/cy_GB/link.lang | 11 ----------- htdocs/langs/da_DK/link.lang | 11 ----------- htdocs/langs/de_CH/link.lang | 5 ----- htdocs/langs/de_DE/link.lang | 11 ----------- htdocs/langs/el_GR/link.lang | 11 ----------- htdocs/langs/es_AR/link.lang | 10 ---------- htdocs/langs/es_CL/link.lang | 10 ---------- htdocs/langs/es_CO/link.lang | 9 --------- htdocs/langs/es_CR/link.lang | 8 -------- htdocs/langs/es_CU/link.lang | 7 ------- htdocs/langs/es_EC/link.lang | 8 -------- htdocs/langs/es_ES/link.lang | 11 ----------- htdocs/langs/es_MX/link.lang | 10 ---------- htdocs/langs/et_EE/link.lang | 11 ----------- htdocs/langs/eu_ES/link.lang | 11 ----------- htdocs/langs/fa_IR/link.lang | 11 ----------- htdocs/langs/fi_FI/link.lang | 11 ----------- htdocs/langs/fr_CA/link.lang | 6 ------ htdocs/langs/fr_FR/link.lang | 11 ----------- htdocs/langs/gl_ES/link.lang | 11 ----------- htdocs/langs/he_IL/link.lang | 11 ----------- htdocs/langs/hi_IN/link.lang | 11 ----------- htdocs/langs/hr_HR/link.lang | 11 ----------- htdocs/langs/hu_HU/link.lang | 11 ----------- htdocs/langs/id_ID/link.lang | 11 ----------- htdocs/langs/is_IS/link.lang | 11 ----------- htdocs/langs/it_IT/link.lang | 11 ----------- htdocs/langs/ja_JP/link.lang | 11 ----------- htdocs/langs/ka_GE/link.lang | 11 ----------- htdocs/langs/kk_KZ/link.lang | 11 ----------- htdocs/langs/km_KH/link.lang | 11 ----------- htdocs/langs/kn_IN/link.lang | 11 ----------- htdocs/langs/ko_KR/link.lang | 11 ----------- htdocs/langs/lo_LA/link.lang | 11 ----------- htdocs/langs/lt_LT/link.lang | 11 ----------- htdocs/langs/lv_LV/link.lang | 11 ----------- htdocs/langs/mk_MK/link.lang | 11 ----------- htdocs/langs/mn_MN/link.lang | 11 ----------- htdocs/langs/ms_MY/link.lang | 11 ----------- htdocs/langs/my_MM/link.lang | 11 ----------- htdocs/langs/nb_NO/link.lang | 11 ----------- htdocs/langs/ne_NP/link.lang | 11 ----------- htdocs/langs/nl_NL/link.lang | 11 ----------- htdocs/langs/pl_PL/link.lang | 11 ----------- htdocs/langs/pt_BR/link.lang | 10 ---------- htdocs/langs/pt_MZ/link.lang | 10 ---------- htdocs/langs/pt_PT/link.lang | 11 ----------- htdocs/langs/ro_RO/link.lang | 11 ----------- htdocs/langs/ru_RU/link.lang | 11 ----------- htdocs/langs/sk_SK/link.lang | 11 ----------- htdocs/langs/sl_SI/link.lang | 11 ----------- htdocs/langs/sq_AL/link.lang | 11 ----------- htdocs/langs/sr_RS/link.lang | 11 ----------- htdocs/langs/sv_SE/link.lang | 11 ----------- htdocs/langs/sw_SW/link.lang | 11 ----------- htdocs/langs/ta_IN/link.lang | 11 ----------- htdocs/langs/tg_TJ/link.lang | 11 ----------- htdocs/langs/th_TH/link.lang | 11 ----------- htdocs/langs/tr_TR/link.lang | 11 ----------- htdocs/langs/uk_UA/link.lang | 11 ----------- htdocs/langs/ur_PK/link.lang | 11 ----------- htdocs/langs/uz_UZ/link.lang | 11 ----------- htdocs/langs/vi_VN/link.lang | 11 ----------- htdocs/langs/zh_CN/link.lang | 11 ----------- htdocs/langs/zh_HK/link.lang | 11 ----------- htdocs/langs/zh_TW/link.lang | 11 ----------- 80 files changed, 2 insertions(+), 832 deletions(-) delete mode 100644 htdocs/langs/am_ET/link.lang delete mode 100644 htdocs/langs/ar_DZ/link.lang delete mode 100644 htdocs/langs/ar_JO/link.lang delete mode 100644 htdocs/langs/ar_SA/link.lang delete mode 100644 htdocs/langs/ar_SY/link.lang delete mode 100644 htdocs/langs/az_AZ/link.lang delete mode 100644 htdocs/langs/bg_BG/link.lang delete mode 100644 htdocs/langs/bn_BD/link.lang delete mode 100644 htdocs/langs/bn_IN/link.lang delete mode 100644 htdocs/langs/bs_BA/link.lang delete mode 100644 htdocs/langs/ca_ES/link.lang delete mode 100644 htdocs/langs/cs_CZ/link.lang delete mode 100644 htdocs/langs/cy_GB/link.lang delete mode 100644 htdocs/langs/da_DK/link.lang delete mode 100644 htdocs/langs/de_CH/link.lang delete mode 100644 htdocs/langs/de_DE/link.lang delete mode 100644 htdocs/langs/el_GR/link.lang delete mode 100644 htdocs/langs/es_AR/link.lang delete mode 100644 htdocs/langs/es_CL/link.lang delete mode 100644 htdocs/langs/es_CO/link.lang delete mode 100644 htdocs/langs/es_CR/link.lang delete mode 100644 htdocs/langs/es_CU/link.lang delete mode 100644 htdocs/langs/es_EC/link.lang delete mode 100644 htdocs/langs/es_ES/link.lang delete mode 100644 htdocs/langs/es_MX/link.lang delete mode 100644 htdocs/langs/et_EE/link.lang delete mode 100644 htdocs/langs/eu_ES/link.lang delete mode 100644 htdocs/langs/fa_IR/link.lang delete mode 100644 htdocs/langs/fi_FI/link.lang delete mode 100644 htdocs/langs/fr_CA/link.lang delete mode 100644 htdocs/langs/fr_FR/link.lang delete mode 100644 htdocs/langs/gl_ES/link.lang delete mode 100644 htdocs/langs/he_IL/link.lang delete mode 100644 htdocs/langs/hi_IN/link.lang delete mode 100644 htdocs/langs/hr_HR/link.lang delete mode 100644 htdocs/langs/hu_HU/link.lang delete mode 100644 htdocs/langs/id_ID/link.lang delete mode 100644 htdocs/langs/is_IS/link.lang delete mode 100644 htdocs/langs/it_IT/link.lang delete mode 100644 htdocs/langs/ja_JP/link.lang delete mode 100644 htdocs/langs/ka_GE/link.lang delete mode 100644 htdocs/langs/kk_KZ/link.lang delete mode 100644 htdocs/langs/km_KH/link.lang delete mode 100644 htdocs/langs/kn_IN/link.lang delete mode 100644 htdocs/langs/ko_KR/link.lang delete mode 100644 htdocs/langs/lo_LA/link.lang delete mode 100644 htdocs/langs/lt_LT/link.lang delete mode 100644 htdocs/langs/lv_LV/link.lang delete mode 100644 htdocs/langs/mk_MK/link.lang delete mode 100644 htdocs/langs/mn_MN/link.lang delete mode 100644 htdocs/langs/ms_MY/link.lang delete mode 100644 htdocs/langs/my_MM/link.lang delete mode 100644 htdocs/langs/nb_NO/link.lang delete mode 100644 htdocs/langs/ne_NP/link.lang delete mode 100644 htdocs/langs/nl_NL/link.lang delete mode 100644 htdocs/langs/pl_PL/link.lang delete mode 100644 htdocs/langs/pt_BR/link.lang delete mode 100644 htdocs/langs/pt_MZ/link.lang delete mode 100644 htdocs/langs/pt_PT/link.lang delete mode 100644 htdocs/langs/ro_RO/link.lang delete mode 100644 htdocs/langs/ru_RU/link.lang delete mode 100644 htdocs/langs/sk_SK/link.lang delete mode 100644 htdocs/langs/sl_SI/link.lang delete mode 100644 htdocs/langs/sq_AL/link.lang delete mode 100644 htdocs/langs/sr_RS/link.lang delete mode 100644 htdocs/langs/sv_SE/link.lang delete mode 100644 htdocs/langs/sw_SW/link.lang delete mode 100644 htdocs/langs/ta_IN/link.lang delete mode 100644 htdocs/langs/tg_TJ/link.lang delete mode 100644 htdocs/langs/th_TH/link.lang delete mode 100644 htdocs/langs/tr_TR/link.lang delete mode 100644 htdocs/langs/uk_UA/link.lang delete mode 100644 htdocs/langs/ur_PK/link.lang delete mode 100644 htdocs/langs/uz_UZ/link.lang delete mode 100644 htdocs/langs/vi_VN/link.lang delete mode 100644 htdocs/langs/zh_CN/link.lang delete mode 100644 htdocs/langs/zh_HK/link.lang delete mode 100644 htdocs/langs/zh_TW/link.lang diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index b599480f583..de30b356b03 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -191,7 +191,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto } } elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha') && !empty($permissiontoadd)) { require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $langs->load('link'); + $link = new Link($db); $f = $link->fetch(GETPOST('linkid', 'int')); if ($f) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 69ce183cc0d..44cbe0ec1e2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1885,7 +1885,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $linkObject->objectid = GETPOST('objectid', 'int'); $linkObject->label = GETPOST('label', 'alpha'); $res = $linkObject->create($user); - $langs->load('link'); + if ($res > 0) { setEventMessages($langs->trans("LinkComplete"), null, 'mesgs'); } else { diff --git a/htdocs/langs/am_ET/link.lang b/htdocs/langs/am_ET/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/am_ET/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ar_DZ/link.lang b/htdocs/langs/ar_DZ/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ar_DZ/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ar_JO/link.lang b/htdocs/langs/ar_JO/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ar_JO/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ar_SA/link.lang b/htdocs/langs/ar_SA/link.lang deleted file mode 100644 index 2e0aa65c6f3..00000000000 --- a/htdocs/langs/ar_SA/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=ربط ملف جديد/ وثيقة -LinkedFiles=الملفات والمستندات المرتبطة -NoLinkFound=لا يوجد روابط مسجلة -LinkComplete=تم ربط الملف بنجاح -ErrorFileNotLinked=لا يمكن ربط الملف -LinkRemoved= الرابط%sتم إزالتة -ErrorFailedToDeleteLink= فشل في إزالة الرابط ' %s ' -ErrorFailedToUpdateLink= فشل تحديث الرابط ' %s ' -URLToLink=عنوان URL للربط -OverwriteIfExists=إستبدال محتوى الملف إذا كان موجوداً diff --git a/htdocs/langs/ar_SY/link.lang b/htdocs/langs/ar_SY/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ar_SY/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/az_AZ/link.lang b/htdocs/langs/az_AZ/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/az_AZ/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/bg_BG/link.lang b/htdocs/langs/bg_BG/link.lang deleted file mode 100644 index c513bbfbbbe..00000000000 --- a/htdocs/langs/bg_BG/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Свързване на нов файл / документ -LinkedFiles=Свързани файлове и документи -NoLinkFound=Няма регистрирани връзки -LinkComplete=Файлът е успешно свързан -ErrorFileNotLinked=Файлът не може да бъде свързан -LinkRemoved=Връзката %s е премахната -ErrorFailedToDeleteLink= Премахването на връзката '%s' не е успешно -ErrorFailedToUpdateLink= Актуализацията на връзката '%s' не е успешна -URLToLink=URL адрес -OverwriteIfExists=Презаписване на файл, ако съществува diff --git a/htdocs/langs/bn_BD/link.lang b/htdocs/langs/bn_BD/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/bn_BD/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/bn_IN/link.lang b/htdocs/langs/bn_IN/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/bn_IN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/bs_BA/link.lang b/htdocs/langs/bs_BA/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/bs_BA/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ca_ES/link.lang b/htdocs/langs/ca_ES/link.lang deleted file mode 100644 index 60bb39b3786..00000000000 --- a/htdocs/langs/ca_ES/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Enllaça un nou arxiu/document -LinkedFiles=Arxius i documents enllaçats -NoLinkFound=No hi ha enllaços registrats -LinkComplete=L'arxiu s'ha enllaçat correctament -ErrorFileNotLinked=L'arxiu no s'ha enllaçat -LinkRemoved=L'enllaç %s s'ha eliminat -ErrorFailedToDeleteLink= Error en eliminar l'enllaç '%s' -ErrorFailedToUpdateLink= Error en actualitzar l'enllaç '%s' -URLToLink=URL a enllaçar -OverwriteIfExists=Sobreescriu el fitxer si existeix diff --git a/htdocs/langs/cs_CZ/link.lang b/htdocs/langs/cs_CZ/link.lang deleted file mode 100644 index 310b3935630..00000000000 --- a/htdocs/langs/cs_CZ/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Připojit nový soubor/dokument -LinkedFiles=Připojené soubory a dokumenty -NoLinkFound=Žádné odkazy -LinkComplete=Soubor byl úspěšně připojen -ErrorFileNotLinked=Soubor nemohl být připojen -LinkRemoved=Odkaz %s byl odstraněn -ErrorFailedToDeleteLink= Nepodařilo se odstranit odkaz '%s' -ErrorFailedToUpdateLink= Nepodařilo se aktualizovat odkaz '%s' -URLToLink=Připojit URL -OverwriteIfExists=Pokud existuje, přepište soubor diff --git a/htdocs/langs/cy_GB/link.lang b/htdocs/langs/cy_GB/link.lang deleted file mode 100644 index 2cdbc0e3d5b..00000000000 --- a/htdocs/langs/cy_GB/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Cysylltwch ffeil/dogfen newydd -LinkedFiles=Ffeiliau a dogfennau cysylltiedig -NoLinkFound=Dim dolenni cofrestredig -LinkComplete=Mae'r ffeil wedi'i chysylltu'n llwyddiannus -ErrorFileNotLinked=Nid oedd modd cysylltu'r ffeil -LinkRemoved=Mae'r cyswllt %s wedi'i ddileu -ErrorFailedToDeleteLink= Wedi methu tynnu dolen ' %s ' -ErrorFailedToUpdateLink= Wedi methu diweddaru'r ddolen ' %s ' -URLToLink=URL i'r ddolen -OverwriteIfExists=Trosysgrifo ffeil os yw'n bodoli diff --git a/htdocs/langs/da_DK/link.lang b/htdocs/langs/da_DK/link.lang deleted file mode 100644 index 8f538298baf..00000000000 --- a/htdocs/langs/da_DK/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link en ny fil / et dokument -LinkedFiles=Sammenkædede filer og dokumenter -NoLinkFound=Ingen registrerede links -LinkComplete=Filen er blevet linket korrekt -ErrorFileNotLinked=Filen kunne ikke forbindes -LinkRemoved=Linket %s er blevet fjernet -ErrorFailedToDeleteLink= Kunne ikke fjerne linket ' %s ' -ErrorFailedToUpdateLink= Kunne ikke opdatere linket ' %s ' -URLToLink=URL til link -OverwriteIfExists=Overskriv fil, hvis den findes diff --git a/htdocs/langs/de_CH/link.lang b/htdocs/langs/de_CH/link.lang deleted file mode 100644 index db7e1395400..00000000000 --- a/htdocs/langs/de_CH/link.lang +++ /dev/null @@ -1,5 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Verknüpfe eine neue Datei /Dokument -LinkComplete=Die Datei wurde erfolgreich verlinkt -ErrorFileNotLinked=Die Datei konnte nicht verlinkt werden -URLToLink=URL zum Verlinken diff --git a/htdocs/langs/de_DE/link.lang b/htdocs/langs/de_DE/link.lang deleted file mode 100644 index e66eb1bdf6f..00000000000 --- a/htdocs/langs/de_DE/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Neue Verknüpfung erstellen -LinkedFiles=Verknüpfte Dateien -NoLinkFound=Keine verknüpften Links -LinkComplete=Die Datei wurde erfolgreich verlinkt. -ErrorFileNotLinked=Die Datei konnte nicht verlinkt werden. -LinkRemoved=Der Link %s wurde entfernt -ErrorFailedToDeleteLink= Fehler beim entfernen des Links '%s' -ErrorFailedToUpdateLink= Fehler beim aktualisieren des Link '%s' -URLToLink=zu verlinkende URL -OverwriteIfExists=Datei überschreiben, falls vorhanden diff --git a/htdocs/langs/el_GR/link.lang b/htdocs/langs/el_GR/link.lang deleted file mode 100644 index 1057e624b10..00000000000 --- a/htdocs/langs/el_GR/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Συνδέστε ένα νέο αρχείο / έγγραφο -LinkedFiles=Συνδεδεμένα αρχεία και έγγραφα -NoLinkFound=Δεν υπάρχουν εγγεγραμμένοι σύνδεσμοι -LinkComplete=Το αρχείο έχει συνδεθεί με επιτυχία -ErrorFileNotLinked=Το αρχείο δεν μπορεί να συνδεθεί -LinkRemoved=Ο σύνδεσμος %s έχει αφαιρεθεί -ErrorFailedToDeleteLink= Απέτυχε η αφαίρεση του συνδέσμου '%s' -ErrorFailedToUpdateLink= Απέτυχε η ενημέρωση του σύνδεσμο '%s' -URLToLink=Διεύθυνση URL για σύνδεση -OverwriteIfExists=Επανεγγραφή αρχείου εάν υπάρχει diff --git a/htdocs/langs/es_AR/link.lang b/htdocs/langs/es_AR/link.lang deleted file mode 100644 index 3dbd72adba5..00000000000 --- a/htdocs/langs/es_AR/link.lang +++ /dev/null @@ -1,10 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Enlazar a un nuevo archivo/documento -LinkedFiles=Archivos y documentos enlazados -NoLinkFound=No hay enlaces registrados -LinkComplete=El archivo se ha enlazado correctamente -ErrorFileNotLinked=El archivo no pudo ser enlazado -LinkRemoved=El enlace %s ha sido eliminado -ErrorFailedToDeleteLink=Error al eliminar el enlace '%s' -ErrorFailedToUpdateLink=Error al actualizar enlace '%s' -URLToLink=URL del enlace diff --git a/htdocs/langs/es_CL/link.lang b/htdocs/langs/es_CL/link.lang deleted file mode 100644 index b3f562fac79..00000000000 --- a/htdocs/langs/es_CL/link.lang +++ /dev/null @@ -1,10 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Enlace un nuevo archivo / documento -LinkedFiles=Links archivos y documentos -NoLinkFound=No hay enlaces registrados -LinkComplete=El archivo ha sido vinculado exitosamente -ErrorFileNotLinked=El archivo no pudo ser vinculado -LinkRemoved=El enlace %s ha sido eliminado -ErrorFailedToDeleteLink=Error al eliminar el enlace '%s' -ErrorFailedToUpdateLink=Error al actualizar el enlace '%s' -URLToLink=URL para enlazar diff --git a/htdocs/langs/es_CO/link.lang b/htdocs/langs/es_CO/link.lang deleted file mode 100644 index 3f1aa9375e2..00000000000 --- a/htdocs/langs/es_CO/link.lang +++ /dev/null @@ -1,9 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Vincular un nuevo archivo / documento -NoLinkFound=No hay enlaces registrados -LinkComplete=El archivo se ha vinculado correctamente -ErrorFileNotLinked=El archivo no se pudo vincular -LinkRemoved=El enlace %s ha sido eliminado -ErrorFailedToDeleteLink=Error al eliminar el enlace ' %s ' -ErrorFailedToUpdateLink=Error al actualizar el enlace ' %s ' -URLToLink=URL para vincular diff --git a/htdocs/langs/es_CR/link.lang b/htdocs/langs/es_CR/link.lang deleted file mode 100644 index 1c76a193ca7..00000000000 --- a/htdocs/langs/es_CR/link.lang +++ /dev/null @@ -1,8 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -NoLinkFound=No hay enlaces registrados -LinkComplete=El archivo se ha vinculado con éxito. -ErrorFileNotLinked=No se pudo vincular el archivo -LinkRemoved=El enlace %s ha sido eliminado -ErrorFailedToDeleteLink=Error al eliminar el enlace ' %s ' -ErrorFailedToUpdateLink=Error al actualizar el enlace ' %s ' -URLToLink=URL para vincular diff --git a/htdocs/langs/es_CU/link.lang b/htdocs/langs/es_CU/link.lang deleted file mode 100644 index 7740f83bf62..00000000000 --- a/htdocs/langs/es_CU/link.lang +++ /dev/null @@ -1,7 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkComplete=El archivo se ha vinculado con éxito. -ErrorFileNotLinked=No se pudo vincular el archivo -LinkRemoved=El enlace %s ha sido eliminado -ErrorFailedToDeleteLink=Error al eliminar el enlace ' %s ' -ErrorFailedToUpdateLink=Error al actualizar el enlace ' %s ' -URLToLink=URL para vincular diff --git a/htdocs/langs/es_EC/link.lang b/htdocs/langs/es_EC/link.lang deleted file mode 100644 index 0ad5de1e897..00000000000 --- a/htdocs/langs/es_EC/link.lang +++ /dev/null @@ -1,8 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkedFiles=Archivos enlazados y documentos -NoLinkFound=No hay enlaces registrados -LinkComplete=El archivo se ha vinculado correctamente -ErrorFileNotLinked=No se pudo vincular el archivo. -LinkRemoved=Se ha eliminado el enlace %s -ErrorFailedToDeleteLink=No se pudo eliminar el vínculo '%s' -URLToLink=URL para vincular diff --git a/htdocs/langs/es_ES/link.lang b/htdocs/langs/es_ES/link.lang deleted file mode 100644 index feb76151fde..00000000000 --- a/htdocs/langs/es_ES/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Vincular un nuevo archivo/documento -LinkedFiles=Archivos y documentos vinculados -NoLinkFound=Sin enlaces registrados -LinkComplete=El archivo ha sido vinculado correctamente -ErrorFileNotLinked=El archivo no ha podido ser vinculado -LinkRemoved=El vínculo %s ha sido eliminado -ErrorFailedToDeleteLink= Error al eliminar el vínculo '%s' -ErrorFailedToUpdateLink= Error al actualizar el vínculo '%s' -URLToLink=URL a enlazar -OverwriteIfExists=Sobrescribir archivo si existe diff --git a/htdocs/langs/es_MX/link.lang b/htdocs/langs/es_MX/link.lang deleted file mode 100644 index b97dcbc1a69..00000000000 --- a/htdocs/langs/es_MX/link.lang +++ /dev/null @@ -1,10 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Vincular un nuevo archivo / documento -LinkedFiles=Archivos enlazados y documentos -NoLinkFound=No hay enlaces registrados -LinkComplete=El archivo se ha vinculado correctamente -ErrorFileNotLinked=No se pudo vincular el archivo. -LinkRemoved=Se ha eliminado el enlace %s -ErrorFailedToDeleteLink=No se pudo eliminar el vínculo ' %s ' -ErrorFailedToUpdateLink=Error al actualizar el vínculo ' %s ' -URLToLink=URL para vincular diff --git a/htdocs/langs/et_EE/link.lang b/htdocs/langs/et_EE/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/et_EE/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/eu_ES/link.lang b/htdocs/langs/eu_ES/link.lang deleted file mode 100644 index d3a0fc9370e..00000000000 --- a/htdocs/langs/eu_ES/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Fitxategi/dokumentu berria estekatu -LinkedFiles=Estekatutako fitxategi eta dokumentuak -NoLinkFound=Ez dago gordetako estekarik -LinkComplete=Fitxategia ondo estekatu da -ErrorFileNotLinked=Ezin izan da fitxategia estekatu -LinkRemoved=%s esteka ezabatua izan da -ErrorFailedToDeleteLink= Ezin izan da '%s' esteka ezabatu -ErrorFailedToUpdateLink= Ezin izan da '%s' esteka berritu -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/fa_IR/link.lang b/htdocs/langs/fa_IR/link.lang deleted file mode 100644 index 012040c2baa..00000000000 --- a/htdocs/langs/fa_IR/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=پیوند یک فایل/سند -LinkedFiles=اسناد و فایل‌های مرتبط -NoLinkFound=پیوند ثبت‌شده‌ای وجود ندارد -LinkComplete=فایل با موفقیت پیوند شد -ErrorFileNotLinked=امکان پیوند فایل وجود ندارد -LinkRemoved=پیوند %s برداشته شد -ErrorFailedToDeleteLink= امکان حذف پیوند '%s' نبود -ErrorFailedToUpdateLink= امکان روزآمدسازی پیوند '%s' نبود -URLToLink=نشانی برای پیوند کردن -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/fi_FI/link.lang b/htdocs/langs/fi_FI/link.lang deleted file mode 100644 index 62802ede960..00000000000 --- a/htdocs/langs/fi_FI/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Luo uusi linkki tiedostoon/dokumenttiin -LinkedFiles=Linkitetyt tiedostot ja dokumentit -NoLinkFound=Rekisteröityjä linkkejä ei ole -LinkComplete=Tiedosto on linkitetty onnistuneesti -ErrorFileNotLinked=Tiedostoa ei voitu linkittää -LinkRemoved=%s linkki on poistettu -ErrorFailedToDeleteLink= Linkin '%s' poisto ei onnistunut -ErrorFailedToUpdateLink= Linkin '%s' päivitys ei onnistunut -URLToLink=URL linkiksi -OverwriteIfExists=Korvaa tiedosto jos olemassa diff --git a/htdocs/langs/fr_CA/link.lang b/htdocs/langs/fr_CA/link.lang deleted file mode 100644 index 8acd890c9a0..00000000000 --- a/htdocs/langs/fr_CA/link.lang +++ /dev/null @@ -1,6 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Relier un nouveau fichier / document -NoLinkFound=Pas de liens enregistrés -LinkComplete=Le fichier a été lié avec succès -ErrorFailedToDeleteLink=Impossible d'enlever le lien '%s' -ErrorFailedToUpdateLink=Impossible de mettre à jour le lien '%s' diff --git a/htdocs/langs/fr_FR/link.lang b/htdocs/langs/fr_FR/link.lang deleted file mode 100644 index 4534b8420e7..00000000000 --- a/htdocs/langs/fr_FR/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Lier un nouveau fichier/document -LinkedFiles=Fichiers et documents liés -NoLinkFound=Aucun lien associé -LinkComplete=Le fichier a été correctement lié -ErrorFileNotLinked=Le fichier n'a pas pu être lié -LinkRemoved=Le lien %s a été supprimé -ErrorFailedToDeleteLink= Impossible de supprimer le lien '%s' -ErrorFailedToUpdateLink= Impossible de modifier le lien '%s' -URLToLink=URL à lier -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/gl_ES/link.lang b/htdocs/langs/gl_ES/link.lang deleted file mode 100644 index 4815cf15e64..00000000000 --- a/htdocs/langs/gl_ES/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Ligar un novo ficheiro/documento -LinkedFiles=Ficheiros e documentos ligados -NoLinkFound=Sen ligazóns registrados -LinkComplete=O ficheiro foi ligado correctamente -ErrorFileNotLinked=O ficheiro non puido ser ligado -LinkRemoved=A ligazón %s foi eliminada -ErrorFailedToDeleteLink= Erro ao eliminar a ligazón '%s' -ErrorFailedToUpdateLink= Erro ao actualizar a ligazón '%s' -URLToLink=URL a ligar -OverwriteIfExists=Sobrescribir ficheiro se existe diff --git a/htdocs/langs/he_IL/link.lang b/htdocs/langs/he_IL/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/he_IL/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/hi_IN/link.lang b/htdocs/langs/hi_IN/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/hi_IN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/hr_HR/link.lang b/htdocs/langs/hr_HR/link.lang deleted file mode 100644 index ee140b37440..00000000000 --- a/htdocs/langs/hr_HR/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Poveži novu datoteku/dokument -LinkedFiles=Povezane datoteke i dokumenti -NoLinkFound=Nema registriranih veza -LinkComplete=Datoteka je uspješno povezana -ErrorFileNotLinked=Datoteku je nemoguće povezati -LinkRemoved=Veza %s je obrisana -ErrorFailedToDeleteLink= Neuspješno brisanje veze '%s' -ErrorFailedToUpdateLink= Neuspješna promjena veze '%s' -URLToLink=URL prema vezi -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/hu_HU/link.lang b/htdocs/langs/hu_HU/link.lang deleted file mode 100644 index 05653373fbd..00000000000 --- a/htdocs/langs/hu_HU/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Új fájl/dokumentum hivatkozása -LinkedFiles=Hivatkozott fájlok és dokumentumok -NoLinkFound=Nincs mentett hivatkozás -LinkComplete=A fájlra történt hivatkozás sikerült -ErrorFileNotLinked=A fájlra nem lehet hivatkozni -LinkRemoved=A %s hivatkozás törölve -ErrorFailedToDeleteLink= A '%s' hivakozás törlése sikertelen -ErrorFailedToUpdateLink= A '%s' hivakozás frissítése sikertelen -URLToLink=A hivatkozás címe -OverwriteIfExists=Fájl felülírása, ha létezik diff --git a/htdocs/langs/id_ID/link.lang b/htdocs/langs/id_ID/link.lang deleted file mode 100644 index 4b6d73e7c52..00000000000 --- a/htdocs/langs/id_ID/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Tautan untuk berkas/dokumen baru -LinkedFiles=Tautan berkas dan dokumen -NoLinkFound=Link tidak terdaftar -LinkComplete=Berkas telah berhasil ditautkan -ErrorFileNotLinked=Berkas tidak dapat ditautkan -LinkRemoved=Tautan %s telah dihapus -ErrorFailedToDeleteLink= gagal untuk menghapus tautan '%s' -ErrorFailedToUpdateLink= Gagal untuk memperbaharui tautan '%s' -URLToLink=URL untuk ditautkan -OverwriteIfExists=Timpa file jika ada diff --git a/htdocs/langs/is_IS/link.lang b/htdocs/langs/is_IS/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/is_IS/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/it_IT/link.lang b/htdocs/langs/it_IT/link.lang deleted file mode 100644 index 551802192d1..00000000000 --- a/htdocs/langs/it_IT/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Collega un nuovo file/documento -LinkedFiles=File e documenti collegati -NoLinkFound=Nessun collegamento registrato -LinkComplete=Il file è stato correttamente collegato -ErrorFileNotLinked=Il file non può essere collegato -LinkRemoved=Il collegamento %s è stato rimosso -ErrorFailedToDeleteLink= Impossibile rimuovere il collegamento '%s' -ErrorFailedToUpdateLink= Impossibile caricare il collegamento '%s' -URLToLink=Indirizzo del link -OverwriteIfExists=Sovrascrivi file se esiste diff --git a/htdocs/langs/ja_JP/link.lang b/htdocs/langs/ja_JP/link.lang deleted file mode 100644 index 71b9e42f923..00000000000 --- a/htdocs/langs/ja_JP/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=新規ファイル/ドキュメントをリンクする -LinkedFiles=ファイルとドキュメントをリンクした -NoLinkFound=リンクは登録されていない -LinkComplete=ファイルを正常にリンクした -ErrorFileNotLinked=ファイルをリンクできなかった -LinkRemoved=リンク %s が削除された -ErrorFailedToDeleteLink= リンク '%s' を削除できなかった -ErrorFailedToUpdateLink= リンク '%s' を更新できなかった -URLToLink=リンクの URL -OverwriteIfExists=存在する場合はファイルを上書きする diff --git a/htdocs/langs/ka_GE/link.lang b/htdocs/langs/ka_GE/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ka_GE/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/kk_KZ/link.lang b/htdocs/langs/kk_KZ/link.lang deleted file mode 100644 index 5ef5de861ec..00000000000 --- a/htdocs/langs/kk_KZ/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Жаңа файлды/құжатты байланыстырыңыз -LinkedFiles=Байланысты файлдар мен құжаттар -NoLinkFound=Тіркелген сілтемелер жоқ -LinkComplete=Файл сәтті байланыстырылды -ErrorFileNotLinked=Файлды байланыстыру мүмкін болмады -LinkRemoved=%s сілтемесі жойылды -ErrorFailedToDeleteLink= ' %s ' сілтемесі жойылмады -ErrorFailedToUpdateLink= ' %s ' сілтемесі жаңартылмады -URLToLink=Сілтеме үшін URL -OverwriteIfExists=Егер бар болса, файлды қайта жазыңыз diff --git a/htdocs/langs/km_KH/link.lang b/htdocs/langs/km_KH/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/km_KH/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/kn_IN/link.lang b/htdocs/langs/kn_IN/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/kn_IN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ko_KR/link.lang b/htdocs/langs/ko_KR/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ko_KR/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/lo_LA/link.lang b/htdocs/langs/lo_LA/link.lang deleted file mode 100644 index 80f013d66bd..00000000000 --- a/htdocs/langs/lo_LA/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=ເຊື່ອມໂຍງໄຟລ//ເອກະສານໃ່ -LinkedFiles=ໄຟລ Linked ແລະເອກະສານທີ່ເຊື່ອມໂຍງ -NoLinkFound=ບໍ່ມີລິ້ງເຊື່ອມຕໍ່ທີ່ລົງທະບຽນ -LinkComplete=ໄຟລ has ໄດ້ຖືກເຊື່ອມຕໍ່ ສຳ ເລັດແລ້ວ -ErrorFileNotLinked=ບໍ່ສາມາດເຊື່ອມໂຍງໄຟລໄດ້ -LinkRemoved=ລິ້ງ %s ໄດ້ຖືກລຶບອອກແລ້ວ -ErrorFailedToDeleteLink= ລຶບລິ້ງ ' %s ບໍ່ ສຳ ເລັດ' -ErrorFailedToUpdateLink= ອັບເດດລິ້ງ ' %s ບໍ່ ສຳ ເລັດ' -URLToLink=URL ເພື່ອເຊື່ອມຕໍ່ -OverwriteIfExists=ຂຽນທັບໄຟລ if ຖ້າມີ diff --git a/htdocs/langs/lt_LT/link.lang b/htdocs/langs/lt_LT/link.lang deleted file mode 100644 index c9e19c70173..00000000000 --- a/htdocs/langs/lt_LT/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Susieti naują filą / dokumentą -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Nesėkmingas sąsajos '%s' atnaujinimas -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/lv_LV/link.lang b/htdocs/langs/lv_LV/link.lang deleted file mode 100644 index e649eb2874b..00000000000 --- a/htdocs/langs/lv_LV/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Salinkot jaunu failu/dokumentu -LinkedFiles=Salinkotie faili un dokumenti -NoLinkFound=Nav reģistrētas saites -LinkComplete=Fails veiksmīgi salinkots -ErrorFileNotLinked=Failu nevar salinkot -LinkRemoved=Saite %s tika dzēsta -ErrorFailedToDeleteLink= Kļūda dzēšot saiti '%s' -ErrorFailedToUpdateLink= Kļūda atjaunojot saiti '%s' -URLToLink=Saites uz URL -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/mk_MK/link.lang b/htdocs/langs/mk_MK/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/mk_MK/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/mn_MN/link.lang b/htdocs/langs/mn_MN/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/mn_MN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ms_MY/link.lang b/htdocs/langs/ms_MY/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ms_MY/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/my_MM/link.lang b/htdocs/langs/my_MM/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/my_MM/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/nb_NO/link.lang b/htdocs/langs/nb_NO/link.lang deleted file mode 100644 index d8f4d669605..00000000000 --- a/htdocs/langs/nb_NO/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Koble en ny fil/dokument -LinkedFiles=Koblede filer og dokumenter -NoLinkFound=Ingen registrerte koblinger -LinkComplete=Filkoblingen ble opprettet -ErrorFileNotLinked=Filen kunne ikke kobles -LinkRemoved=Koblingen til %s ble fjernet -ErrorFailedToDeleteLink= Klarte ikke å fjerne kobling'%s' -ErrorFailedToUpdateLink= Klarte ikke å oppdatere koblingen til '%s' -URLToLink=URL til link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ne_NP/link.lang b/htdocs/langs/ne_NP/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/ne_NP/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/nl_NL/link.lang b/htdocs/langs/nl_NL/link.lang deleted file mode 100644 index 3b82167aab4..00000000000 --- a/htdocs/langs/nl_NL/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Koppel een nieuw bestand/document -LinkedFiles=Gekoppelde bestanden en documenten -NoLinkFound=Geen geregistreerde koppelingen -LinkComplete=Het bestand is succesvol gekoppeld -ErrorFileNotLinked=Het bestand kon niet gekoppeld worden -LinkRemoved=De koppeling %s is verwijderd -ErrorFailedToDeleteLink= Kon de verbinding '%s' niet verwijderen -ErrorFailedToUpdateLink= Kon verbinding '%s' niet bijwerken -URLToLink=URL naar link -OverwriteIfExists=Overschrijf bestand indien aanwezig diff --git a/htdocs/langs/pl_PL/link.lang b/htdocs/langs/pl_PL/link.lang deleted file mode 100644 index f067994f757..00000000000 --- a/htdocs/langs/pl_PL/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Podepnij nowy plik/dokument -LinkedFiles=Podpięte pliki i dokumenty -NoLinkFound=Brak zarejestrowanych linków -LinkComplete=Plik został podlinkowany poprawnie -ErrorFileNotLinked=Plik nie mógł zostać podlinkowany -LinkRemoved=Link %s został usunięty -ErrorFailedToDeleteLink= Niemożna usunąc linku '%s' -ErrorFailedToUpdateLink= Niemożna uaktualnić linku '%s' -URLToLink=Adres URL linka -OverwriteIfExists=Zastąp plik, jeśli istnieje diff --git a/htdocs/langs/pt_BR/link.lang b/htdocs/langs/pt_BR/link.lang deleted file mode 100644 index f86a13d83c3..00000000000 --- a/htdocs/langs/pt_BR/link.lang +++ /dev/null @@ -1,10 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Vincular um novo arquivo/documento -LinkedFiles=Arquivos vinculados e documentos -NoLinkFound=Não há links registrados -LinkComplete=O arquivo foi associada com sucesso -ErrorFileNotLinked=O arquivo não pôde ser vinculado -LinkRemoved=A ligação %s foi removida -ErrorFailedToDeleteLink=Falha ao remover link '%s' -ErrorFailedToUpdateLink=Falha ao atualizar link '%s' -URLToLink=URL para link diff --git a/htdocs/langs/pt_MZ/link.lang b/htdocs/langs/pt_MZ/link.lang deleted file mode 100644 index f86a13d83c3..00000000000 --- a/htdocs/langs/pt_MZ/link.lang +++ /dev/null @@ -1,10 +0,0 @@ -# Dolibarr language file - Source file is en_US - link -LinkANewFile=Vincular um novo arquivo/documento -LinkedFiles=Arquivos vinculados e documentos -NoLinkFound=Não há links registrados -LinkComplete=O arquivo foi associada com sucesso -ErrorFileNotLinked=O arquivo não pôde ser vinculado -LinkRemoved=A ligação %s foi removida -ErrorFailedToDeleteLink=Falha ao remover link '%s' -ErrorFailedToUpdateLink=Falha ao atualizar link '%s' -URLToLink=URL para link diff --git a/htdocs/langs/pt_PT/link.lang b/htdocs/langs/pt_PT/link.lang deleted file mode 100644 index 49a5aaaef43..00000000000 --- a/htdocs/langs/pt_PT/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Associar um novo ficheiro/documento -LinkedFiles=Ficheiros e documentos associados -NoLinkFound=Nenhumas ligações registadas -LinkComplete=Os ficheiros foram ligados com sucesso -ErrorFileNotLinked=Os ficheiros não puderam ser ligados -LinkRemoved=A hiperligação %s foi removida -ErrorFailedToDeleteLink= falhou a remoção da ligação '%s' -ErrorFailedToUpdateLink= Falha na atualização de ligação '%s' -URLToLink=URL para hiperligação -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/ro_RO/link.lang b/htdocs/langs/ro_RO/link.lang deleted file mode 100644 index 12147377aea..00000000000 --- a/htdocs/langs/ro_RO/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link fişier/document nou -LinkedFiles=Fişiere şi documente ataşate -NoLinkFound=Niciun link inregistrat -LinkComplete=Fişierul a fost ataşat cu succes -ErrorFileNotLinked=Fişierul nu a putut fi ataşat -LinkRemoved=Linkul %s a fost înlăturat -ErrorFailedToDeleteLink= Eşec la înlăturarea linkului '%s' -ErrorFailedToUpdateLink= Eşec la modificarea linkului '%s' -URLToLink=URL la link -OverwriteIfExists=Suprascrie dacă fişierul există diff --git a/htdocs/langs/ru_RU/link.lang b/htdocs/langs/ru_RU/link.lang deleted file mode 100644 index edfddc8994b..00000000000 --- a/htdocs/langs/ru_RU/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Создать ссылку на файл или документ -LinkedFiles=Ссылки на файлы и документы -NoLinkFound=Нет зарегистрированных ссылок -LinkComplete=Создана ссылка на файл -ErrorFileNotLinked=Не возможно создать ссылку на файл -LinkRemoved=Ссылка на файл %s удалена -ErrorFailedToDeleteLink= При удалении ссылки на файл '%s' возникла ошибка -ErrorFailedToUpdateLink= При обновлении ссылки на файл '%s' возникла ошибка -URLToLink=URL для ссылки -OverwriteIfExists=Перезаписать файл, если он существует diff --git a/htdocs/langs/sk_SK/link.lang b/htdocs/langs/sk_SK/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/sk_SK/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/sl_SI/link.lang b/htdocs/langs/sl_SI/link.lang deleted file mode 100644 index 8ec7ff7d758..00000000000 --- a/htdocs/langs/sl_SI/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Poveži novo datoteko/dokument -LinkedFiles=Povezane datoteke in dokumenti -NoLinkFound=Ni registriranih povezav -LinkComplete=Datoteka je bila uspešno povezana -ErrorFileNotLinked=Datoteke ni možno povezati -LinkRemoved=Povezava %s je bila odstranjena -ErrorFailedToDeleteLink= Napaka pri odstranitvi povezave '%s'. -ErrorFailedToUpdateLink= Napaka pri posodobitvi povezave '%s'. -URLToLink=URL za povezavo -OverwriteIfExists=Prepiši datoteko, če obstaja diff --git a/htdocs/langs/sq_AL/link.lang b/htdocs/langs/sq_AL/link.lang deleted file mode 100644 index 1ffcd41a18b..00000000000 --- a/htdocs/langs/sq_AL/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link a new file/document -LinkedFiles=Linked files and documents -NoLinkFound=No registered links -LinkComplete=The file has been linked successfully -ErrorFileNotLinked=The file could not be linked -LinkRemoved=The link %s has been removed -ErrorFailedToDeleteLink= Failed to remove link '%s' -ErrorFailedToUpdateLink= Failed to update link '%s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/sr_RS/link.lang b/htdocs/langs/sr_RS/link.lang deleted file mode 100644 index 36e3aaf6aea..00000000000 --- a/htdocs/langs/sr_RS/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Link ka novom fajlu/dokumentu -LinkedFiles=Linkovani fajlovi i dokumenti -NoLinkFound=Nema registrovanih linkova -LinkComplete=Fajl je uspešno linkovan -ErrorFileNotLinked=Fajl nije mogao biti linkovan -LinkRemoved=Link %s je uklonjen -ErrorFailedToDeleteLink= Greška prilikom uklanjanja linka '%s' -ErrorFailedToUpdateLink= Greška prilikom ažuriranja linka '%s' -URLToLink=URL za link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/sv_SE/link.lang b/htdocs/langs/sv_SE/link.lang deleted file mode 100644 index da38186f5b8..00000000000 --- a/htdocs/langs/sv_SE/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Länka en ny fil/dokument -LinkedFiles=Länkade filer och dokument -NoLinkFound=Inga registrerade länkar -LinkComplete=Filen har länkats -ErrorFileNotLinked=Filen kunde inte länkas -LinkRemoved=Länken %s har tagits bort -ErrorFailedToDeleteLink= Det gick inte att ta bort länk %s -ErrorFailedToUpdateLink= Det gick inte att uppdatera länken %s -URLToLink=URL för länk -OverwriteIfExists=Skriv över fil om den existerar diff --git a/htdocs/langs/sw_SW/link.lang b/htdocs/langs/sw_SW/link.lang deleted file mode 100644 index 4a4c19cb49c..00000000000 --- a/htdocs/langs/sw_SW/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Unganisha faili/hati mpya -LinkedFiles=Faili na hati zilizounganishwa -NoLinkFound=Hakuna viungo vilivyosajiliwa -LinkComplete=Faili imeunganishwa kwa mafanikio -ErrorFileNotLinked=Faili haikuweza kuunganishwa -LinkRemoved=Kiungo %s imeondolewa -ErrorFailedToDeleteLink= Imeshindwa kuondoa kiungo ' %s ' -ErrorFailedToUpdateLink= Imeshindwa kusasisha kiungo ' %s ' -URLToLink=URL ya kuunganisha -OverwriteIfExists=Batilisha faili ikiwa ipo diff --git a/htdocs/langs/ta_IN/link.lang b/htdocs/langs/ta_IN/link.lang deleted file mode 100644 index 177caf7ef14..00000000000 --- a/htdocs/langs/ta_IN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=புதிய கோப்பு/ஆவணத்தை இணைக்கவும் -LinkedFiles=இணைக்கப்பட்ட கோப்புகள் மற்றும் ஆவணங்கள் -NoLinkFound=பதிவு செய்யப்பட்ட இணைப்புகள் இல்லை -LinkComplete=கோப்பு வெற்றிகரமாக இணைக்கப்பட்டது -ErrorFileNotLinked=கோப்பை இணைக்க முடியவில்லை -LinkRemoved=%s இணைப்பு அகற்றப்பட்டது -ErrorFailedToDeleteLink= ' %s ' இணைப்பை அகற்ற முடியவில்லை -ErrorFailedToUpdateLink= ' %s ' இணைப்பைப் புதுப்பிக்க முடியவில்லை -URLToLink=இணைக்க வேண்டிய URL -OverwriteIfExists=கோப்பு இருந்தால் மேலெழுதவும் diff --git a/htdocs/langs/tg_TJ/link.lang b/htdocs/langs/tg_TJ/link.lang deleted file mode 100644 index d9f2ddbfd93..00000000000 --- a/htdocs/langs/tg_TJ/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Файл/ҳуҷҷати навро пайванд кунед -LinkedFiles=Ҳуҷҷатҳо ва файлҳои алоқаманд -NoLinkFound=Истинодҳои ба қайд гирифташуда вуҷуд надоранд -LinkComplete=Файл бомуваффақият пайваст карда шуд -ErrorFileNotLinked=Файлро пайванд кардан ғайриимкон буд -LinkRemoved=Истиноди %s хориҷ карда шуд -ErrorFailedToDeleteLink= Истиноди ' %s ' хориҷ карда нашуд -ErrorFailedToUpdateLink= Истиноди ' %s ' навсозӣ карда нашуд -URLToLink=URL барои пайванд -OverwriteIfExists=Агар мавҷуд бошад, файлро аз нав сабт кунед diff --git a/htdocs/langs/th_TH/link.lang b/htdocs/langs/th_TH/link.lang deleted file mode 100644 index 7a1e16ba362..00000000000 --- a/htdocs/langs/th_TH/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=เชื่อมโยงไฟล์ใหม่ / เอกสาร -LinkedFiles=แฟ้มที่เชื่อมโยงและเอกสาร -NoLinkFound=ไม่มีการเชื่อมโยงลงทะเบียน -LinkComplete=ไฟล์ที่ได้รับการประสบความสำเร็จในการเชื่อมโยง -ErrorFileNotLinked=ไฟล์ไม่สามารถเชื่อมโยง -LinkRemoved=การเชื่อมโยง% s ได้ถูกลบออก -ErrorFailedToDeleteLink= ล้มเหลวในการลบการเชื่อมโยง '% s' -ErrorFailedToUpdateLink= ล้มเหลวในการปรับปรุงการเชื่อมโยง '% s' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/tr_TR/link.lang b/htdocs/langs/tr_TR/link.lang deleted file mode 100644 index 646d610a408..00000000000 --- a/htdocs/langs/tr_TR/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Yeni bir dosya/belge bağlantıla -LinkedFiles=Bağlantılı dosyalar ve belgeler -NoLinkFound=Kayıtlı bağlantı yok -LinkComplete=Dosya bağlantısı başarılı -ErrorFileNotLinked=Dosya bağlantılanamadı -LinkRemoved=%s bağlantısı kaldırıldı -ErrorFailedToDeleteLink= '%s' bağlantısı kaldırılamadı -ErrorFailedToUpdateLink= '%s' bağlantısı güncellenemedi -URLToLink=Bağlantılanalıcak URL -OverwriteIfExists=Dosya varsa üzerine yaz diff --git a/htdocs/langs/uk_UA/link.lang b/htdocs/langs/uk_UA/link.lang deleted file mode 100644 index 8fde3beae63..00000000000 --- a/htdocs/langs/uk_UA/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Зв’язати новий файл/документ -LinkedFiles=Пов’язані файли та документи -NoLinkFound=Немає зареєстрованих посилань -LinkComplete=Файл успішно пов’язано -ErrorFileNotLinked=Не вдалося зв’язати файл -LinkRemoved=Посилання %s видалено -ErrorFailedToDeleteLink= Не вдалося видалити посилання " %s " -ErrorFailedToUpdateLink= Не вдалося оновити посилання " %s " -URLToLink=URL для посилання -OverwriteIfExists=Перезаписати файл, якщо він існує diff --git a/htdocs/langs/ur_PK/link.lang b/htdocs/langs/ur_PK/link.lang deleted file mode 100644 index 256f4dc462b..00000000000 --- a/htdocs/langs/ur_PK/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=ایک نئی فائل/دستاویز سے لنک کریں۔ -LinkedFiles=منسلک فائلیں اور دستاویزات -NoLinkFound=کوئی رجسٹرڈ لنکس نہیں۔ -LinkComplete=فائل کو کامیابی سے جوڑ دیا گیا ہے۔ -ErrorFileNotLinked=فائل کو لنک نہیں کیا جا سکا -LinkRemoved=لنک %s ہٹا دیا گیا ہے۔ -ErrorFailedToDeleteLink= لنک ' %s ' کو ہٹانے میں ناکام -ErrorFailedToUpdateLink= لنک ' %s ' کو اپ ڈیٹ کرنے میں ناکام -URLToLink=لنک کرنے کے لیے URL -OverwriteIfExists=اگر موجود ہو تو فائل کو اوور رائٹ کریں۔ diff --git a/htdocs/langs/uz_UZ/link.lang b/htdocs/langs/uz_UZ/link.lang deleted file mode 100644 index e37e7f0be18..00000000000 --- a/htdocs/langs/uz_UZ/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Yangi fayl / hujjatni bog'lang -LinkedFiles=Bog'langan fayllar va hujjatlar -NoLinkFound=Ro'yxatdan o'tgan havolalar yo'q -LinkComplete=Fayl muvaffaqiyatli ulandi -ErrorFileNotLinked=Faylni ulab bo‘lmadi -LinkRemoved=%s havolasi o'chirildi -ErrorFailedToDeleteLink= ' %s ' havolasi o'chirilmadi -ErrorFailedToUpdateLink= ' %s ' havolasi yangilanmadi -URLToLink=Ulanish uchun URL -OverwriteIfExists=Agar mavjud bo'lsa, faylni qayta yozing diff --git a/htdocs/langs/vi_VN/link.lang b/htdocs/langs/vi_VN/link.lang deleted file mode 100644 index bacbeaf98e2..00000000000 --- a/htdocs/langs/vi_VN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=Liên kết một tập tin / tài liệu mới -LinkedFiles=Các tập tin và tài liệu được liên kết -NoLinkFound=Không có liên kết đã đăng ký -LinkComplete=Các tập tin đã được liên kết thành công -ErrorFileNotLinked=Các tập tin không thể được liên kết -LinkRemoved=Liên kết %s đã bị xóa -ErrorFailedToDeleteLink= Không thể xóa liên kết ' %s ' -ErrorFailedToUpdateLink= Không thể cập nhật liên kết ' %s ' -URLToLink=URL để liên kết -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/zh_CN/link.lang b/htdocs/langs/zh_CN/link.lang deleted file mode 100644 index 00f14808c56..00000000000 --- a/htdocs/langs/zh_CN/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=链接一份新文件/文档 -LinkedFiles=链接文件和文档 -NoLinkFound=无注册链接 -LinkComplete=文件链接成功 -ErrorFileNotLinked=文件无法链接 -LinkRemoved=链接 %s 已移除 -ErrorFailedToDeleteLink= 移除链接失败 '%s' -ErrorFailedToUpdateLink= 更新链接失败 '%s' -URLToLink=URL网址超链接 -OverwriteIfExists=如果存在就覆盖文件 diff --git a/htdocs/langs/zh_HK/link.lang b/htdocs/langs/zh_HK/link.lang deleted file mode 100644 index 3205abcd1be..00000000000 --- a/htdocs/langs/zh_HK/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=鏈接新文件/文檔 -LinkedFiles=鏈接的文件和文檔 -NoLinkFound=沒有註冊鏈接 -LinkComplete=文件已鏈接成功 -ErrorFileNotLinked=該文件無法鏈接 -LinkRemoved=鏈接%s 已被刪除 -ErrorFailedToDeleteLink= 無法刪除鏈接“”\n %s ' -ErrorFailedToUpdateLink= 無法更新鏈接“”\n %s ' -URLToLink=URL to link -OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/zh_TW/link.lang b/htdocs/langs/zh_TW/link.lang deleted file mode 100644 index 23949b86a29..00000000000 --- a/htdocs/langs/zh_TW/link.lang +++ /dev/null @@ -1,11 +0,0 @@ -# Dolibarr language file - Source file is en_US - languages -LinkANewFile=連接新文件/檔案 -LinkedFiles=連接新文件/檔案(複數) -NoLinkFound=沒有註冊連線 -LinkComplete=此文件已成功連接 -ErrorFileNotLinked=此文件無法連接 -LinkRemoved=此連線%s已被刪除 -ErrorFailedToDeleteLink= 無法刪除連線“ %s ” -ErrorFailedToUpdateLink= 無法更新連線' %s' -URLToLink=連線網址 -OverwriteIfExists=Overwrite file if exists From b61998ec4b476904b3df11a20a790eb49700e383 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Sep 2023 12:13:10 +0200 Subject: [PATCH 48/54] Log --- htdocs/emailcollector/class/emailcollector.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index f20d21463af..8a3e2634699 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3225,6 +3225,7 @@ class EmailCollector extends CommonObject } else { $langs->load("admin"); $output = $langs->trans('NoNewEmailToProcess'); + $output .= ' (defaultlang='.$langs->defaultlang.')'; } // Disconnect From 862f10f7fdda3f0eb750a007c16c7bad485589f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Sep 2023 17:28:51 +0200 Subject: [PATCH 49/54] Fix error management --- htdocs/compta/prelevement/class/bonprelevement.class.php | 7 +++++-- htdocs/compta/prelevement/create.php | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 455e1c7972c..da35df53876 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -895,6 +895,8 @@ class BonPrelevement extends CommonObject $factures_errors = array(); if (!$error) { + dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG); + $sql = "SELECT f.rowid, pd.rowid as pfdrowid, f.fk_soc"; $sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib"; $sql .= ", pfd.amount"; @@ -919,7 +921,6 @@ class BonPrelevement extends CommonObject if ($did > 0) { $sql .= " AND pd.rowid = ".((int) $did); } - dol_syslog(__METHOD__." Read invoices,", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -941,7 +942,9 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__." Read invoices, ".$i." invoices to withdraw", LOG_DEBUG); } else { $error++; - dol_syslog(__METHOD__." Read invoices error ".$this->db->error(), LOG_ERR); + $this->error = $this->db->lasterror(); + dol_syslog(__METHOD__." Read invoices error ".$this->db->lasterror(), LOG_ERR); + return -1; } } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 62d84cd444c..2555ab9d37e 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -128,6 +128,7 @@ if (empty($reshook)) { if (!$error) { // getDolGlobalString('PRELEVEMENT_CODE_BANQUE') and getDolGlobalString('PRELEVEMENT_CODE_GUICHET') should be empty (we don't use them anymore) $result = $bprev->create(getDolGlobalString('PRELEVEMENT_CODE_BANQUE'), getDolGlobalString('PRELEVEMENT_CODE_GUICHET'), $mode, $format, $executiondate, 0, $type); + if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); } elseif ($result == 0) { From 66a4433896d001bc461f82a0ba2b45d999f7b6ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Sep 2023 17:39:54 +0200 Subject: [PATCH 50/54] Fix regression --- htdocs/compta/prelevement/class/bonprelevement.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index da35df53876..724cf5ff8fc 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -898,8 +898,8 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG); $sql = "SELECT f.rowid, pd.rowid as pfdrowid, f.fk_soc"; - $sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib"; - $sql .= ", pfd.amount"; + $sql .= ", pd.code_banque, pd.code_guichet, pd.number, pd.cle_rib"; + $sql .= ", pd.amount"; $sql .= ", s.nom as name"; $sql .= ", f.ref, sr.bic, sr.iban_prefix, sr.frstrecur"; if ($type != 'bank-transfer') { @@ -968,7 +968,7 @@ class BonPrelevement extends CommonObject if ($resfetch >= 0) { // Field 0 of $fac is rowid of invoice */ - // Check if $fac[8] s.nom is null + // Check if $fac[8] s.nom is null if ($fac[8] != null) { //$bac = new CompanyBankAccount($this->db); //$bac->fetch(0, $soc->id); From 9ed7bb77cd8f28931182993efcf56592f5aa5ff1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 01:36:26 +0200 Subject: [PATCH 51/54] Sec: Increase list of not allowed function in dol_eval --- htdocs/core/lib/functions.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dbd31e984cf..43c6747300a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9255,8 +9255,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array('$$'); $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST')); - $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI", "verifCond", "base64_decode"); + $forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval"); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode")); // decode string functions $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func")); $forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b'; From 684c0b88b524ad4580fb68a83f9122538dc09fd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 01:57:47 +0200 Subject: [PATCH 52/54] Sec: More robust call for dol_eval (with param '2') for computed fields --- htdocs/core/class/commonobject.class.php | 10 +++++----- htdocs/core/lib/functions.lib.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 56fe182f10b..16df81f610b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6165,7 +6165,7 @@ abstract class CommonObject if (empty($conf->disable_compute)) { global $objectoffield; // We set a global variable to $objectoffield so $objectoffield = $this; // we can use it inside computed formula - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); + $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); } } } @@ -6294,8 +6294,8 @@ abstract class CommonObject if (!empty($attrfieldcomputed)) { if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { - $value = dol_eval($attrfieldcomputed, 1, 0, ''); - dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG); + $value = dol_eval($attrfieldcomputed, 1, 0, '2'); + dol_syslog($langs->trans("Extrafieldcomputed")." on ".$attributeLabel."(".$value.")", LOG_DEBUG); $new_array_options[$key] = $value; } else { $new_array_options[$key] = null; @@ -6675,7 +6675,7 @@ abstract class CommonObject if (!empty($attrfieldcomputed)) { if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { - $value = dol_eval($attrfieldcomputed, 1, 0, ''); + $value = dol_eval($attrfieldcomputed, 1, 0, '2'); dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG); $this->array_options["options_".$key] = $value; } else { @@ -7597,7 +7597,7 @@ abstract class CommonObject if ($computed) { // Make the eval of compute string //var_dump($computed); - $value = dol_eval($computed, 1, 0, ''); + $value = dol_eval($computed, 1, 0, '2'); } if (empty($morecss)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 43c6747300a..74ca8626850 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9196,8 +9196,8 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' // Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing if ($onlysimplestring == '1') { // We must accept: '1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL' - // We must accept: '$conf->barcode->enabled || preg_match(\'/^AAA/\',$leftmenu)' - // We must accept: '$user->rights->cabinetmed->read && !$object->canvas=="patient@cabinetmed"' + // We must accept: 'isModEnabled("barcode") || preg_match(\'/^AAA/\',$leftmenu)' + // We must accept: '$user->hasRight("cabinetmed", "read") && !$object->canvas=="patient@cabinetmed"' if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@', '/').']/i', $s)) { if ($returnvalue) { return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; @@ -9219,7 +9219,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' return ''; } // TODO - // We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled(' + // We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled(' and 'hasRight(' // ... } } From c2f8c4f47c7520d196101ecef1e9abe338e699e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 02:29:20 +0200 Subject: [PATCH 53/54] Sec: param onlysimplestring is always 1 or 2 --- htdocs/core/boxes/box_scheduled_jobs.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +++++- htdocs/core/tpl/extrafields_list_print_fields.tpl.php | 2 +- htdocs/public/ticket/list.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index f0868036e9d..7073e886301 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -103,7 +103,7 @@ class box_scheduled_jobs extends ModeleBoxes while ($i < $num) { $objp = $this->db->fetch_object($result); - if (dol_eval($objp->test, 1, 1, '')) { + if (dol_eval($objp->test, 1, 1, '2')) { $nextrun = $this->db->jdate($objp->datenextrun); if (empty($nextrun)) { $nextrun = $this->db->jdate($objp->datestart); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 74ca8626850..6d5073aae58 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9175,7 +9175,7 @@ function verifCond($strToEvaluate) * @param string $s String to evaluate * @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)). * @param int $hideerrors 1=Hide errors - * @param string $onlysimplestring '0' (used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (rarely used)=Accept also '[]' + * @param string $onlysimplestring '0' (deprecated, used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (rarely used)=Accept also '[]' * @return mixed Nothing or return result of eval */ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1') @@ -9192,6 +9192,10 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object global $soc; // For backward compatibility + if (!in_array($onlysimplestring, array('0', '1', '2'))) { + return 'Bad call of dol_eval. Parameter onlysimplestring must be 0, 1 or 2'; + } + try { // Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing if ($onlysimplestring == '1') { diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index cf6a3b35648..0f0add8e9ae 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -35,7 +35,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield // If field is a computed field, we make computation to get value if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) { $objectoffield = $object; //For compatibily with the computed formula - $value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '0'); + $value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2'); if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) { $obj->$tmpkey = price2num($value); } diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 954e2428cfe..ccf0b992e29 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -266,7 +266,7 @@ if ($action == "view_ticketlist") { if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate') { - $enabled = abs(dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1, 1, 0)); + $enabled = abs(dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1, 1, '2')); $enabled = (($enabled == 0 || $enabled == 3) ? 0 : $enabled); $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => ($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1, 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $enabled && $extrafields->attributes[$object->table_element]['perms'][$key]); } From e9787451a82bd89727939a4f39e54a8faedffd28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2023 05:51:06 +0200 Subject: [PATCH 54/54] Disallow more use of parenthesis into dol_eval --- ChangeLog | 1 + htdocs/core/lib/functions.lib.php | 86 ++++++++++++++++++++++------ htdocs/core/lib/security.lib.php | 22 +++---- htdocs/core/modules/modApi.class.php | 1 - test/phpunit/SecurityTest.php | 18 +++++- 5 files changed, 96 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82771d980ab..0e57d0be48a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ Following changes may create regressions for some external modules, but were nec * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead. * Recheck setup of your module workflow to see if you need to enable the new setting to have shipment set to billed automatically when an invoice from a shipment is validated (and if your process is to make invoice on shipment and not on order). +* It was possible to use a variable $soc or $right inside a php code condition of some extrafields properties, this is no more true (this vars are no more defined globaly). ***** ChangeLog for 18.0.1 compared to 18.0.0 ***** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6d5073aae58..2ae73a96a64 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9145,6 +9145,33 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = } } +/** + * Check if a variable with name $var start with $text. + * Can be used to forge dol_eval() conditions. + * + * @param $var string Variable + * @param $regextext string Text that must be a valid regex string + * @param $matchrule int 1=Test if start with, 0=Test if equal + * @return boolean|string True or False, text if bad use. + */ +function isStringVarMatching($var, $regextext, $matchrule = 1) +{ + if ($matchrule == 1) { + if ($var == 'mainmenu') { + global $mainmenu; + return (preg_match('/^'.$regextext.'/', $mainmenu)); + } elseif ($var == 'leftmenu') { + global $leftmenu; + return (preg_match('/^'.$regextext.'/', $leftmenu)); + } else { + return 'This variable is not accessible with dol_eval'; + } + } else { + return 'This value for matchrule is not implemented'; + } +} + + /** * Verify if condition in string is ok or not * @@ -9153,15 +9180,15 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = */ function verifCond($strToEvaluate) { - global $user, $conf, $langs; + global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example + global $user, $langs; global $leftmenu; - global $rights; // To export to dol_eval function //print $strToEvaluate."
\n"; $rights = true; if (isset($strToEvaluate) && $strToEvaluate !== '') { //var_dump($strToEvaluate); - $rep = dol_eval($strToEvaluate, 1, 1, '1'); // The dol_eval must contains all the global $xxx for all variables $xxx found into the string condition + $rep = dol_eval($strToEvaluate, 1, 1, '1'); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition $rights = $rep && (!is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false); //var_dump($rights); } @@ -9175,32 +9202,35 @@ function verifCond($strToEvaluate) * @param string $s String to evaluate * @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)). * @param int $hideerrors 1=Hide errors - * @param string $onlysimplestring '0' (deprecated, used for computed property of extrafields)=Accept all chars, '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', '2' (rarely used)=Accept also '[]' + * @param string $onlysimplestring '0' (deprecated, used for computed property of extrafields)=Accept all chars, + * '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', + * '2' (rarely used)=Accept also '[]' * @return mixed Nothing or return result of eval + * @see verifCond() */ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1') { - // Only global variables can be changed by eval function and returned to caller - global $db, $langs, $user, $conf, $website, $websitepage; + // Only this global variables can be read by eval function and returned to caller + global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example + global $db, $langs, $user, $website, $websitepage; global $action, $mainmenu, $leftmenu; global $mysoc; - global $objectoffield; + global $objectoffield; // To allow the use of $objectoffield in computed fields // Old variables used - global $rights; global $object; - global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object - global $soc; // For backward compatibility + global $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object + //global $rights; + //global $soc; // For backward compatibility if (!in_array($onlysimplestring, array('0', '1', '2'))) { - return 'Bad call of dol_eval. Parameter onlysimplestring must be 0, 1 or 2'; + return "Bad call of dol_eval. Parameter onlysimplestring must be '0' (deprecated), '1' or '2'"; } try { // Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing if ($onlysimplestring == '1') { - // We must accept: '1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL' - // We must accept: 'isModEnabled("barcode") || preg_match(\'/^AAA/\',$leftmenu)' + // We must accept: '1 && getDolGlobalInt("doesnotexist1") && getDolGlobalString("MAIN_FEATURES_LEVEL")' // We must accept: '$user->hasRight("cabinetmed", "read") && !$object->canvas=="patient@cabinetmed"' if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@', '/').']/i', $s)) { if ($returnvalue) { @@ -9209,10 +9239,21 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s); return ''; } - // TODO - // We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled(' - // ... } + $scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $s); + $scheck = preg_replace('/\s[a-zA-Z0-9_]+\(/', ' __FUNCTION__', $scheck); + $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)') + //print 'scheck='.$scheck." : ".strpos($scheck, '(')."\n"; + if (strpos($scheck, '(') !== false) { + if ($returnvalue) { + return 'Bad string syntax to evaluate (found call of a function or method without using direct name): '.$s; + } else { + dol_syslog('Bad string syntax to evaluate (found call of a function or method without using direct name): '.$s); + return ''; + } + } + // TODO + // We can exclude $ char that are not: $db, $langs, $leftmenu, $topmenu, $user, $langs, $objectoffield, $object..., } elseif ($onlysimplestring == '2') { // We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found" if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@[]', '/').']/i', $s)) { @@ -9222,10 +9263,17 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s); return ''; } - // TODO - // We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled(' and 'hasRight(' - // ... } + if (strpos($scheck, '(') !== false) { + if ($returnvalue) { + return 'Bad string syntax to evaluate (found call of a function or method without using direct name): '.$s; + } else { + dol_syslog('Bad string syntax to evaluate (found call of a function or method without using direct name): '.$s); + return ''; + } + } + // TODO + // We can exclude $ char that are not: $db, $leftmenu, $topmenu, $user, $langs, $object..., } if (is_array($s) || $s === 'Array') { return 'Bad string syntax to evaluate (value is Array) '.var_export($s, true); diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 7818b9d2e7e..0a2d2572889 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -434,19 +434,21 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', // Get more permissions checks from hooks $parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft); - $reshook = $hookmanager->executeHooks('restrictedArea', $parameters); + if (!empty($hookmanager)) { + $reshook = $hookmanager->executeHooks('restrictedArea', $parameters); - if (isset($hookmanager->resArray['result'])) { - if ($hookmanager->resArray['result'] == 0) { - if ($mode) { - return 0; - } else { - accessforbidden(); // Module returns 0, so access forbidden + if (isset($hookmanager->resArray['result'])) { + if ($hookmanager->resArray['result'] == 0) { + if ($mode) { + return 0; + } else { + accessforbidden(); // Module returns 0, so access forbidden + } } } - } - if ($reshook > 0) { // No other test done. - return 1; + if ($reshook > 0) { // No other test done. + return 1; + } } // Features/modules to check diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index acceaa822d1..9621904ebe6 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -163,7 +163,6 @@ class modApi extends DolibarrModules 'langs'=>'modulebuilder', 'position'=>100, 'perms'=>'1', - //'enabled'=>'isModEnabled("api") && preg_match(\'/^(devtools)/\',$leftmenu)', 'enabled'=>'isModEnabled("api")', 'target'=>'_apiexplorer', 'user'=>0); diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 545306f5734..cf9e223d737 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -960,7 +960,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase print "result = ".$result."\n"; $this->assertEquals('Parent project not found', $result); - $result=dol_eval('$a=function() { }; $a;', 1, 1, ''); + $result=dol_eval('$a=function() { }; $a;', 1, 1, '0'); print "result = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); @@ -999,12 +999,22 @@ class SecurityTest extends PHPUnit\Framework\TestCase print "result = ".$result."\n"; $this->assertTrue($result); - // Same with syntax error + // Same with a value that does not match $leftmenu = 'XXX'; $result=dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); print "result = ".$result."\n"; $this->assertFalse($result); + $leftmenu = 'AAA'; + $result=dol_eval('$conf->currency && isStringVarMatching(\'leftmenu\', \'(AAA|BBB)\')', 1, 1, '1'); + print "result = ".$result."\n"; + $this->assertTrue($result); + + $leftmenu = 'XXX'; + $result=dol_eval('$conf->currency && isStringVarMatching(\'leftmenu\', \'(AAA|BBB)\')', 1, 1, '1'); + print "result = ".$result."\n"; + $this->assertFalse($result); + // Case with param onlysimplestring = 1 @@ -1015,6 +1025,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=dol_eval("(\$a.'aa')", 1, 0); print "result = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); + + $result=dol_eval('$a="abs" && $a(5)', 1, 0); + print "result = a".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); }