From f518bafda9e83acba2f42d61312ad234ee0afe33 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 19 May 2020 15:17:06 +0200 Subject: [PATCH 01/33] 11.0 - Add Hook "SelectWarehouses" --- htdocs/product/class/html.formproduct.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index af78ab5b59d..3f95a5fdaff 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -237,13 +237,23 @@ class FormProduct */ public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') { - global $conf,$langs,$user; + global $conf,$langs,$user, $hookmanager; dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG); $out=''; if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; if (!empty($fk_product)) $this->cache_warehouses = array(); + if(empty($exclude)) $exclude = array(); + + $parameters = array( + 'exclude' =>& $exclude, + 'htmlname' =>& $htmlname + ); + + $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy); $nbofwarehouses=count($this->cache_warehouses); From 987fb806c67b3931bafcc2aefc069428cde104cb Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 19 May 2020 15:24:53 +0200 Subject: [PATCH 02/33] Exclude array param --- htdocs/product/class/html.formproduct.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 3f95a5fdaff..75dbf5d1176 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -235,7 +235,7 @@ class FormProduct * * @throws Exception */ - public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') + public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') { global $conf,$langs,$user, $hookmanager; @@ -244,7 +244,6 @@ class FormProduct $out=''; if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; if (!empty($fk_product)) $this->cache_warehouses = array(); - if(empty($exclude)) $exclude = array(); $parameters = array( 'exclude' =>& $exclude, From 3f28c9a4610dbfb356efd8a72af19511e05f979f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 19 May 2020 15:31:37 +0200 Subject: [PATCH 03/33] Add parameters to hook --- htdocs/product/class/html.formproduct.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 75dbf5d1176..19abade42ae 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -246,8 +246,21 @@ class FormProduct if (!empty($fk_product)) $this->cache_warehouses = array(); $parameters = array( + 'selected' => & $selected, + 'htmlname' =>& $htmlname, + 'filterstatus' =>& $filterstatus, + 'empty' =>& $empty, + 'disabled ' =>& $disabled, + 'fk_product' =>& $fk_product, + 'empty_label' =>& $empty_label, + 'showstock' =>& $showstock, + 'forcecombo' =>& $forcecombo, + 'events' =>& $events, + 'morecss' =>& $morecss, 'exclude' =>& $exclude, - 'htmlname' =>& $htmlname + 'showfullpath' =>& $showfullpath, + 'stockMin' =>& $stockMin, + 'orderBy' =>& $orderBy ); $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters); From e042807b3245c2b1ad3331b1fe7e1122a4fb6fd9 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 19 May 2020 15:58:16 +0200 Subject: [PATCH 04/33] Add $this to parameters --- htdocs/product/class/html.formproduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 19abade42ae..8dc86f394a3 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -263,7 +263,7 @@ class FormProduct 'orderBy' =>& $orderBy ); - $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters); + $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters, $this); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy); From a33f503a0d45d17d19dddbeb3f8d25d9e8a4f93d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 31 May 2020 14:28:41 +0200 Subject: [PATCH 05/33] FIX php error Fatal error: Uncaught Error: Call to undefined function getCountry() in /volume2/web/dolibarr/htdocs/core/class/html.form.class.php on line 2583 Error: Call to undefined function getCountry() in /volume2/web/dolibarr/htdocs/core/class/html.form.class.php on line 2583 Call Stack: 0.0001 409544 1. {main}() /volume2/web/dolibarr/htdocs/adherents/admin/adherent.php:0 0.1935 3017200 2. Form->select_produits() /volume2/web/dolibarr/htdocs/adherents/admin/adherent.php:215 0.1935 3017200 3. Form->select_produits_list() /volume2/web/dolibarr/htdocs/core/class/html.form.class.php:2134 0.1983 3439880 4. Form->constructProductListOption() /volume2/web/dolibarr/htdocs/core/class/html.form.class.php:2451 --- htdocs/core/class/html.form.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7496de72ec2..5d7e008e062 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2523,6 +2523,8 @@ class Form $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; $outdurationunit = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, -1) : ''; + if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + // Units $outvalUnits = ''; if (!empty($conf->global->PRODUCT_USE_UNITS)) { From 38001a4e89f19acd3f8f0f6514709a90a8e84224 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 14:52:26 +0200 Subject: [PATCH 06/33] Fix perms --- htdocs/modulebuilder/template/class/myobject.class.php | 4 ++-- htdocs/modulebuilder/template/myobject_card.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 7dc98dbf1e7..057a2aab615 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -530,8 +530,8 @@ class MyObject extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->myobject->create)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->myobject->myobject_advance->validate)))) + /*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)))) { $this->error='NotEnoughPermissions'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 07850c17491..41a679b6292 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -569,7 +569,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->mymodule->myobject->create; // If you can create/edit, you can remove a file on card + $delallowed = $user->rights->mymodule->myobject->write; // If you can create/edit, you can remove a file on card print $formfile->showdocuments('mymodule:myobject', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } From 2324834b73936629feb73fe22f930c2fb986f8fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 16:44:22 +0200 Subject: [PATCH 07/33] Debug modulebuilder for doc generation Conflicts: htdocs/core/class/html.formfile.class.php htdocs/modulebuilder/template/admin/setup.php --- htdocs/core/class/html.formfile.class.php | 12 ++-- .../install/mysql/migration/11.0.0-12.0.0.sql | 2 + .../mysql/tables/llx_document_model.sql | 2 +- htdocs/modulebuilder/index.php | 5 +- htdocs/modulebuilder/template/admin/setup.php | 3 +- .../core/modules/modMyModule.class.php | 51 ++++++++------ .../doc/pdf_standard_myobject.modules.php | 68 ++----------------- .../modules/mymodule/modules_myobject.php | 2 +- .../modulebuilder/template/myobject_card.php | 2 +- 9 files changed, 51 insertions(+), 96 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 32deb0667e8..0da4b2ca390 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -672,7 +672,7 @@ class FormFile { $submodulepart = $modulepart; - // modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule' + // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject' $tmp = explode(':', $modulepart); if (!empty($tmp[1])) { $modulepart = $tmp[0]; @@ -680,18 +680,18 @@ class FormFile } // For normalized standard modules - $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0); + $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); if (file_exists($file)) { $res = include_once $file; } // For normalized external modules. - else - { - $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0); + else { + $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); $res = include_once $file; } - $class = 'ModelePDF'.ucfirst($submodulepart); + + $class = 'ModelePDF'.$submodulepart; if (class_exists($class)) { diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index dd448ccdb39..bbf25a40a77 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -75,6 +75,8 @@ ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-orde ALTER TABLE llx_ecm_files MODIFY COLUMN src_object_type varchar(64); +ALTER TABLE llx_document_model MODIFY COLUMN type varchar(64); + -- Delete an old index that is duplicated -- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch; diff --git a/htdocs/install/mysql/tables/llx_document_model.sql b/htdocs/install/mysql/tables/llx_document_model.sql index 6fe6913fa68..66b1f3db88f 100644 --- a/htdocs/install/mysql/tables/llx_document_model.sql +++ b/htdocs/install/mysql/tables/llx_document_model.sql @@ -25,7 +25,7 @@ create table llx_document_model rowid integer AUTO_INCREMENT PRIMARY KEY, nom varchar(50), entity integer DEFAULT 1 NOT NULL, -- multi company id - type varchar(20) NOT NULL, + type varchar(64) NOT NULL, libelle varchar(255), description text )ENGINE=innodb; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 2a01a282a90..89a1d20628e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -926,6 +926,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname) dolReplaceInFile($destdir.'/core/modules/mod'.$module.'.class.php', $arrayreplacement, '', 0, 0, 1); } + // TODO Update entries '$myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0);' + + // Scan for object class files $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); @@ -1057,7 +1060,7 @@ if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') && $objectname = $tabobj; $arrayoftables = array(); - if ($action == 'droptable') $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).'_'.strtolower($tabobj); + if ($action == 'droptable') $arrayoftables[] = MAIN_DB_PREFIX.strtoslower($module).'_'.strtolower($tabobj); if ($action == 'droptableextrafields') $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).'_'.strtolower($tabobj).'_extrafields'; foreach ($arrayoftables as $tabletodrop) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 8a116783637..d66ede05696 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -257,7 +257,8 @@ $myTmpObjects = array(); $myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0); -foreach($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { +foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { + if ($myTmpObjectKey == 'MyObject') continue; if ($myTmpObjectArray['includerefgeneration']) { /* * Orders Numbering model diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 74dbac7b870..3deba218b59 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -407,31 +407,40 @@ class modMyModule extends DolibarrModules $sql = array(); - // ODT template - /* - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule'; - $dest=$dirodt.'/template_myobjects.odt'; + // Document templates + $moduledir = 'mymodule'; + $myTmpObjects = array(); + $myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0); - if (file_exists($src) && ! file_exists($dest)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); - if ($result < 0) - { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); - return 0; + foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { + if ($myTmpObjectKey == 'MyObject') continue; + if ($myTmpObjectArray['includerefgeneration']) { + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; + $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule'; + $dest=$dirodt.'/template_myobjects.odt'; + + if (file_exists($src) && ! file_exists($dest)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_mkdir($dirodt); + $result=dol_copy($src, $dest, 0, 0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + return 0; + } + } + + $sql = array_merge($sql, array( + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")", + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")" + )); } } - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'mymodule' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','mymodule',".$conf->entity.")" - ); - */ - return $this->_init($sql, $options); } 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 4c0ff154a04..7c242c26444 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 @@ -358,10 +358,10 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); + $pdf->SetSubject($outputlangs->transnoentities("PdfTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); // Set certificate @@ -633,22 +633,6 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut - // VAT Rate - if ($this->getColumnStatus('vat')) - { - $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); - $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate); - $nexY = max($pdf->GetY(), $nexY); - } - - // Unit price before discount - if ($this->getColumnStatus('subprice')) - { - $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); - $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax); - $nexY = max($pdf->GetY(), $nexY); - } - // Quantity // Enough for 6 chars if ($this->getColumnStatus('qty')) @@ -658,38 +642,6 @@ class pdf_standard_myobject extends ModelePDFMyObject $nexY = max($pdf->GetY(), $nexY); } - // Situation progress - if ($this->getColumnStatus('progress')) - { - $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); - $this->printStdColumnContent($pdf, $curY, 'progress', $progress); - $nexY = max($pdf->GetY(), $nexY); - } - - // Unit - if ($this->getColumnStatus('unit')) - { - $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); - $this->printStdColumnContent($pdf, $curY, 'unit', $unit); - $nexY = max($pdf->GetY(), $nexY); - } - - // Discount on line - if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent) - { - $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); - $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent); - $nexY = max($pdf->GetY(), $nexY); - } - - // Total HT line - if ($this->getColumnStatus('totalexcltax')) - { - $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); - $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax); - $nexY = max($pdf->GetY(), $nexY); - } - // Extrafields if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { @@ -716,7 +668,6 @@ class pdf_standard_myobject extends ModelePDFMyObject $sign = 1; - if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) // Compute progress from previous situation @@ -1006,21 +957,10 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $title = $outputlangs->transnoentities("PdfInvoiceTitle"); - if ($object->type == 1) $title = $outputlangs->transnoentities("InvoiceReplacement"); - if ($object->type == 2) $title = $outputlangs->transnoentities("InvoiceAvoir"); - if ($object->type == 3) $title = $outputlangs->transnoentities("InvoiceDeposit"); - if ($object->type == 4) $title = $outputlangs->transnoentities("InvoiceProForma"); - if ($this->situationinvoice) $title = $outputlangs->transnoentities("InvoiceSituation"); + $title = $outputlangs->transnoentities("PdfTitle"); if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) { $title .= ' - '; - if ($object->type == 0) { - if ($this->situationinvoice) $title .= $outputlangsbis->transnoentities("InvoiceSituation"); - $title .= $outputlangsbis->transnoentities("PdfInvoiceTitle"); - } elseif ($object->type == 1) $title .= $outputlangsbis->transnoentities("InvoiceReplacement"); - elseif ($object->type == 2) $title .= $outputlangsbis->transnoentities("InvoiceAvoir"); - elseif ($object->type == 3) $title .= $outputlangsbis->transnoentities("InvoiceDeposit"); - elseif ($object->type == 4) $title .= $outputlangsbis->transnoentities("InvoiceProForma"); + $title .= $outputlangsbis->transnoentities("PdfTitle"); } $pdf->MultiCell($w, 3, $title, '', 'R'); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php index a16f56e137c..78711e33a4d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php @@ -51,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator // phpcs:enable global $conf; - $type = 'mymodule_myobject'; + $type = 'myobject'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 41a679b6292..ceeb30d5d3e 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -570,7 +570,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content $delallowed = $user->rights->mymodule->myobject->write; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('mymodule:myobject', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + print $formfile->showdocuments('mymodule:MyObject', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } // Show links to link elements From c60982ce609688d4dcd6f02a410ce88455656e57 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 16:58:05 +0200 Subject: [PATCH 08/33] Update langs --- htdocs/langs/en_US/cashdesk.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 52c2004c1c7..8d1f50007ea 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -107,4 +107,6 @@ OrderPrinterToUse=Order printer to use MainTemplateToUse=Main template to use OrderTemplateToUse=Order template to use BarRestaurant=Bar Restaurant -AutoOrder=Customer auto order \ No newline at end of file +AutoOrder=Customer auto order +RestaurantMenu=Menu +CustomerMenu=Customer menu \ No newline at end of file From 5325971517d62bc15e5e93a178ce4862b3e7ae6b Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:02:11 +0200 Subject: [PATCH 09/33] Update settings --- htdocs/takepos/admin/bar.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 2508ab56040..0f47990cb4a 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -52,9 +52,7 @@ if (GETPOST('action', 'alpha') == 'set') { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { + } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -129,11 +127,17 @@ if ($conf->global->TAKEPOS_SUPPLEMENTS) } print ''; -print $langs->trans("AutoOrder"); +print 'QR - '.$langs->trans("AutoOrder"); print ''; print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); print ''; +print ''; +print 'QR - '.$langs->trans("CustomerMenu"); +print ''; +print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); +print ''; + print ''; @@ -157,13 +161,30 @@ if ($conf->global->TAKEPOS_AUTO_ORDER) print ''; print "".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).""; print ''; - print ""; + print ""; print ''; } print ''; } +if ($conf->global->TAKEPOS_QR_MENU) +{ + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + print '
'; + print ''; + print ''; + print ''; + print "\n"; + print ''; + print '
'.$langs->trans("URL").''.$langs->trans("QR").'
'; + print "".$urlwithroot."/takepos/public/menu.php"; + print ''; + print ""; + print '
'; +} + print ''; print '
'; From 3cc249a887538f4acc013aa369f7252a2c453651 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:04:23 +0200 Subject: [PATCH 10/33] Update QR --- htdocs/takepos/genimg/qr.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index 3aca3b22ebf..452eb7023e2 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -27,10 +27,15 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../../main.inc.php'; // Load $user and permissions require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; -$key = GETPOST('key'); - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -$module = new modTcpdfbarcode(); -$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); +if (GETPOSTISSET("key")) { + $key = GETPOST('key'); + $module = new modTcpdfbarcode(); + $result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".$key, 'QRCODE', 'Y'); +} +else { + $module = new modTcpdfbarcode(); + $result = $module->buildBarCode($urlwithroot."/takepos/public/menu.php", 'QRCODE', 'Y'); +} From 8abe60db0b821ff7faa50aa9580c36830893ccb3 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:05:22 +0200 Subject: [PATCH 11/33] Add Restaurant QR menu --- htdocs/takepos/public/css/style.css | 144 ++++++++++++++++++++++++++++ htdocs/takepos/public/js/script.js | 1 + htdocs/takepos/public/menu.php | 117 ++++++++++++++++++++++ 3 files changed, 262 insertions(+) create mode 100644 htdocs/takepos/public/css/style.css create mode 100644 htdocs/takepos/public/js/script.js create mode 100644 htdocs/takepos/public/menu.php diff --git a/htdocs/takepos/public/css/style.css b/htdocs/takepos/public/css/style.css new file mode 100644 index 00000000000..418945cf5f5 --- /dev/null +++ b/htdocs/takepos/public/css/style.css @@ -0,0 +1,144 @@ +/* -- footer -- */ +html { + position: relative; + min-height: 100%; +} +body { + margin-bottom: 60px; + font-family: 'Khand', sans-serif; +} +.footer { + position: absolute; + bottom: 0; + width: 100%; + height: 60px; + background-color: #f5f5f5; +} +.container .text-muted { + margin: 20px 0; +} +.footer > .container { + padding-right: 15px; + padding-left: 15px; +} +/* -- -- */ +h3 { + display:inline-block; + font-size: 32px; + line-height: 36px; + position: relative; + margin-top:28px; + margin-bottom:15px; +} +h3:before{ + left: -40px; + height: 0; + height:1px; +} +h3:before, h3:after { + content: ""; + position: absolute; + bottom: 10px; + height: 1px; + width: 40px; + margin: 0 -15px; + background-color: #533834; +} +h3:after{ + right: -40px; +} +h5 { + font-size: 16px; + line-height: 22px; + margin: 0 0 15px; + font-weight: 400; +} +.item { + position: relative; + overflow: hidden; + margin-bottom:20px; +} +.item h4, .price { + z-index: 0; + position: relative; + background-color: #fff; + right: 0; + position: absolute; +} +.item .price { + padding-left: 8px; +} +.item h4, .item p { + display: block; + clear: both; + color: #533834; +} +.item p { + clear: both; + color: #938372; + margin-left:10px; +} +.dots { + background-image: linear-gradient(to right,rgba(56,47,47,.5) 33%,rgba(0,0,0,0) 0%); + background-position: bottom; + background-size: 3px 1px; + background-repeat: repeat-x; + height: 1px; + width: 100%; + position: absolute; + top: 22px; +} +/* Dots in IE */ +@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + .dots { + background: transparent url('/img/dot.gif') repeat-x bottom left; + } +} +.badge { + display: inline-block; + padding: 0 10px; + background: #d2c82a; + font-size: 12px; + font-weight: 300; + line-height: 26px; + color: #fff; + text-align: center; + vertical-align: middle; + text-transform: uppercase; + border: 1px solid rgba(0,0,0,.05); + letter-spacing: 1px; + border-radius: 3px; + margin: -5px 5px 0 0; +} +.note { + padding: 0 6px; + min-width: 23px; + background: rgba(0,0,0,0); + border: 1px solid #382f2f; + color: #382f2f; + box-sizing: border-box; + border-radius: 500px; + line-height: 21px; +} +.veggie { + color:#82b440; + border-color:#82b440; +} +.spicy { + color:#ec4e00; + border-color:#ec4e00; +} +.price { + position: absolute; + font-size:22px; + font-weight:400; + right: 0; +} +.item h4 { + display: inline-block; + padding-right: 8px; + max-width: 80%; + text-transform: capitalize; + margin-bottom:4px; + position: relative; +} \ No newline at end of file diff --git a/htdocs/takepos/public/js/script.js b/htdocs/takepos/public/js/script.js new file mode 100644 index 00000000000..c3c8817354f --- /dev/null +++ b/htdocs/takepos/public/js/script.js @@ -0,0 +1 @@ +$(document).foundation(); \ No newline at end of file diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php new file mode 100644 index 00000000000..c15df6d1b9c --- /dev/null +++ b/htdocs/takepos/public/menu.php @@ -0,0 +1,117 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/public/menu.php + * \ingroup takepos + * \brief Public menu for customers + */ + +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip + +require '../../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + +if (!$conf->global->TAKEPOS_QR_MENU) accessforbidden(); // If Restaurant Menu is disabled never allow NO LOGIN access +?> + + + + + <?php echo $mysoc->name; ?> + + + + + + + +
+ +
+
+
+

name; ?>

+
+
+ + + + + + + From 3213148d8717b5e8f6410b2da1225c059532927a Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Mon, 1 Jun 2020 17:12:02 +0200 Subject: [PATCH 12/33] FIX 11.0 - when using pdftk as per hidden conf USE_PDFTK_FOR_PDF_CONCAT, check that the file exists before displaying a success message --- htdocs/core/actions_massactions.inc.php | 16 ++++++++++------ htdocs/langs/en_US/main.lang | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b86e7bd692c..dc5b02286eb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1030,14 +1030,18 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $input_files .= ' '.escapeshellarg($f); } - $cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file); + $cmd = 'pdftk ' . $input_files . ' cat output '.escapeshellarg($file); exec($cmd); - if (!empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); - - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); + // check if pdftk is installed + if (file_exists($file)) { + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); + } else { + setEventMessages($langs->trans('ErrorPDFTkOutputFileNotFound'), null, 'errors'); + } } else { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 31e0d5a1c8d..051dde11ff7 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -837,6 +837,7 @@ Sincerely=Sincerely ConfirmDeleteObject=Are you sure you want to delete this object? DeleteLine=Delete line ConfirmDeleteLine=Are you sure you want to delete this line? +ErrorPDFTkOutputFileNotFound=Error: the file was not generated. Please check that the 'pdftk' command is installed in a directory included in the $PATH environment variable (linux/unix only) or contact your system administrator. NoPDFAvailableForDocGenAmongChecked=No PDF were available for the document generation among checked record TooManyRecordForMassAction=Too many records selected for mass action. The action is restricted to a list of %s records. NoRecordSelected=No record selected @@ -1017,4 +1018,4 @@ ContactDefault_ticket=Ticket ContactAddedAutomatically=Contact added from contact thirdparty roles More=More ShowDetails=Show details -CustomReports=Custom reports \ No newline at end of file +CustomReports=Custom reports From b0f904508afb1b1864c1196a87e9b9487fdfc796 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:52:38 +0200 Subject: [PATCH 13/33] Fix travis --- htdocs/takepos/public/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php index c15df6d1b9c..c051ae4d673 100644 --- a/htdocs/takepos/public/menu.php +++ b/htdocs/takepos/public/menu.php @@ -83,7 +83,7 @@ foreach ($maincategories as $cat){

'.$cat['label'].'

'; - + $object = new Categorie($db); $result = $object->fetch($cat['id']); $prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC'); @@ -93,12 +93,12 @@ foreach ($maincategories as $cat){

'.$pro->label.'

- '.price($pro->price_ttc,1).' + '.price($pro->price_ttc, 1).'
'; } print ''; -} +} ?> From 2984edc752de5b9f719228ee941d8d9f903dc675 Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Tue, 12 May 2020 15:39:17 +0100 Subject: [PATCH 14/33] fix:bad database quotation for booleans --- htdocs/core/class/commonobject.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fd5e70c3669..8bec3f79099 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7915,6 +7915,10 @@ abstract class CommonObject { if (is_null($value)) return 'NULL'; elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value"); + elseif($fieldsentry['type']=='boolean'){ + if($value) return 'true'; + else return 'false'; + } else return "'".$this->db->escape($value)."'"; } From 0f5eed60a2cd8ed355aeee2d69df2fea210fe7b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 20:39:49 +0200 Subject: [PATCH 15/33] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8bec3f79099..f2b669d4e92 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7915,8 +7915,8 @@ abstract class CommonObject { if (is_null($value)) return 'NULL'; elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value"); - elseif($fieldsentry['type']=='boolean'){ - if($value) return 'true'; + elseif ($fieldsentry['type'] == 'boolean') { + if ($value) return 'true'; else return 'false'; } else return "'".$this->db->escape($value)."'"; From cb551cfd5a070c4e19fa63346fcac6b7e922dbaa Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Mon, 11 May 2020 14:55:37 +0100 Subject: [PATCH 16/33] fix:non editable fields must not be editable in creation either --- htdocs/core/tpl/commonfields_add.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index a31cd3eb778..0bf2a60d0fe 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -56,7 +56,8 @@ foreach ($object->fields as $key => $val) if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); else $value = GETPOST($key, 'alpha'); - print $object->showInputField($val, $key, $value, '', '', '', 0); + if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0); + else print $object->showInputField($val, $key, $value, '', '', '', 0); print ''; print ''; } From f2c7db63cfd5643d1703d7653bbc73a4eb37541c Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Sun, 10 May 2020 19:30:28 +0100 Subject: [PATCH 17/33] =?UTF-8?q?fix:le=20r=C3=A9sultat=20de=20explode=20e?= =?UTF-8?q?st=20troujours=20un=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f2b669d4e92..8aad7b864b3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6316,7 +6316,7 @@ abstract class CommonObject // Several field into label (eq table:code|libelle:rowid) $notrans = false; $fields_label = explode('|', $InfoFieldList[1]); - if (is_array($fields_label)) + if (count($fields_label)>1) { $notrans = true; foreach ($fields_label as $field_toshow) @@ -6488,7 +6488,7 @@ abstract class CommonObject $notrans = false; // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|', $InfoFieldList[1]); - if (is_array($fields_label)) { + if (count($fields_label)>1) { $notrans = true; foreach ($fields_label as $field_toshow) { $labeltoshow .= $obj->$field_toshow.' '; From 6ddabd51c083e7c88c05ce374b214d726e02d0e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 21:02:05 +0200 Subject: [PATCH 18/33] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8aad7b864b3..fd6a11998ed 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6316,7 +6316,7 @@ abstract class CommonObject // Several field into label (eq table:code|libelle:rowid) $notrans = false; $fields_label = explode('|', $InfoFieldList[1]); - if (count($fields_label)>1) + if (count($fields_label) > 1) { $notrans = true; foreach ($fields_label as $field_toshow) @@ -6488,7 +6488,7 @@ abstract class CommonObject $notrans = false; // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|', $InfoFieldList[1]); - if (count($fields_label)>1) { + if (count($fields_label) > 1) { $notrans = true; foreach ($fields_label as $field_toshow) { $labeltoshow .= $obj->$field_toshow.' '; From 99b4bfc91e1a149285b9439e63f5464399c36fd9 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 2 Jun 2020 09:53:30 +0200 Subject: [PATCH 19/33] Movement of hook "selectwarehouse" --- .../product/class/html.formproduct.class.php | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 8dc86f394a3..f033e91ceff 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -245,27 +245,6 @@ class FormProduct if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; if (!empty($fk_product)) $this->cache_warehouses = array(); - $parameters = array( - 'selected' => & $selected, - 'htmlname' =>& $htmlname, - 'filterstatus' =>& $filterstatus, - 'empty' =>& $empty, - 'disabled ' =>& $disabled, - 'fk_product' =>& $fk_product, - 'empty_label' =>& $empty_label, - 'showstock' =>& $showstock, - 'forcecombo' =>& $forcecombo, - 'events' =>& $events, - 'morecss' =>& $morecss, - 'exclude' =>& $exclude, - 'showfullpath' =>& $showfullpath, - 'stockMin' =>& $stockMin, - 'orderBy' =>& $orderBy - ); - - $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters, $this); - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy); $nbofwarehouses=count($this->cache_warehouses); @@ -304,6 +283,27 @@ class FormProduct $out.=''; if ($disabled) $out.=''; + $parameters = array( + 'selected' => $selected, + 'htmlname' => $htmlname, + 'filterstatus' => $filterstatus, + 'empty' => $empty, + 'disabled ' => $disabled, + 'fk_product' => $fk_product, + 'empty_label' => $empty_label, + 'showstock' => $showstock, + 'forcecombo' => $forcecombo, + 'events' => $events, + 'morecss' => $morecss, + 'exclude' => $exclude, + 'showfullpath' => $showfullpath, + 'stockMin' => $stockMin, + 'orderBy' => $orderBy + ); + + $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters, $this); + if ($reshook > 0) $out = $hookmanager->resPrint; + return $out; } From 7189e060e02908243cfc31ca64ff8cfca541579d Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Tue, 2 Jun 2020 11:17:37 +0200 Subject: [PATCH 20/33] Fix line heiht overflow for blochet template Fixed if by adding dynamic line height calculation. Now line height depend on bank field content or transmitter field content. You can use long text in this fields. --- .../modules/cheque/doc/pdf_blochet.class.php | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 57a94baae9f..b31b9c25a4b 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -342,26 +342,17 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $num = count($this->lines); for ($j = 0; $j < $num; $j++) { - $lineinpage++; + // Dynamic max line heigh calculation + $dynamic_line_height = array(); + $dynamic_line_height[] = $pdf->getStringHeight(60, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq)); + $dynamic_line_height[] = $pdf->getStringHeight(80, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq)); + $max_line_height = max($dynamic_line_height); + // Calculate number of line used function of estimated line size + if ($max_line_height > $this->line_height) $nb_lines = floor($max_line_height / $this->line_height) + 1; + else $nb_lines = 1; - $pdf->SetXY(1, $this->tab_top + 10 + $yp); - $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0); - - $pdf->SetXY(10, $this->tab_top + 10 + $yp); - $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : '', 0, 'L', 0); - - $pdf->SetXY(40, $this->tab_top + 10 + $yp); - $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq), 44), 0, 'L', 0); - - $pdf->SetXY(100, $this->tab_top + 10 + $yp); - $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq), 50), 0, 'L', 0); - - $pdf->SetXY(180, $this->tab_top + 10 + $yp); - $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); - - $yp = $yp + $this->line_height; - - if ($lineinpage >= $this->line_per_page && $j < (count($this->lines) - 1)) + // Add page break if we do not have space to add current line + if ($lineinpage >= ($this->line_per_page - 1)) { $lineinpage = 0; $yp = 0; @@ -373,6 +364,25 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); } + + $lineinpage += $nb_lines; + + $pdf->SetXY(1, $this->tab_top + 10 + $yp); + $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0); + + $pdf->SetXY(10, $this->tab_top + 10 + $yp); + $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : '', 0, 'L', 0); + + $pdf->SetXY(40, $this->tab_top + 10 + $yp); + $pdf->MultiCell(60, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq, 44), 0, 'L', 0); + + $pdf->SetXY(100, $this->tab_top + 10 + $yp); + $pdf->MultiCell(80, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq, 50), 0, 'L', 0); + + $pdf->SetXY(180, $this->tab_top + 10 + $yp); + $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); + + $yp = $yp + ($this->line_height * $nb_lines); } } From c6a53d9b3d65aa14ff8373fe8d32c038ec82c23b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 12:09:11 +0200 Subject: [PATCH 21/33] Update pdf_blochet.class.php --- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index b31b9c25a4b..ec6f52dfec7 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -345,7 +345,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // Dynamic max line heigh calculation $dynamic_line_height = array(); $dynamic_line_height[] = $pdf->getStringHeight(60, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq)); - $dynamic_line_height[] = $pdf->getStringHeight(80, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq)); + $dynamic_line_height[] = $pdf->getStringHeight(80, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq)); $max_line_height = max($dynamic_line_height); // Calculate number of line used function of estimated line size if ($max_line_height > $this->line_height) $nb_lines = floor($max_line_height / $this->line_height) + 1; From 88a831c05abba711908df2b17e28dade35b9f1b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 12:12:07 +0200 Subject: [PATCH 22/33] Update html.formproduct.class.php --- htdocs/product/class/html.formproduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index f033e91ceff..56601accebe 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -235,7 +235,7 @@ class FormProduct * * @throws Exception */ - public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') + public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') { global $conf,$langs,$user, $hookmanager; From 009780b895d4dfb8c7b22e76250f86df368763a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 12:13:55 +0200 Subject: [PATCH 23/33] Update html.formproduct.class.php --- htdocs/product/class/html.formproduct.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 56601accebe..5030722bb73 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -303,6 +303,7 @@ class FormProduct $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters, $this); if ($reshook > 0) $out = $hookmanager->resPrint; + elseif ($reshook == 0) $out .= $hookmanager->resPrint; return $out; } From a9973ad60eba9d5cd97ca8a3dc2c33a221440fd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 15:30:07 +0200 Subject: [PATCH 24/33] Fix language key and css --- htdocs/barcode/codeinit.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/theme/eldy/global.inc.php | 6 ++++-- htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index d2afa5e6871..1bfb1836a39 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -211,7 +211,7 @@ if ($conf->societe->enabled) { $nbno = $nbtotal = 0; - print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'title_companies'); + print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company'); print '
'."\n"; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a7fa6d2aa55..b42195c02f7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -452,7 +452,7 @@ SetAsDefault=Set as default ValueOverwrittenByUserSetup=Warning, this value may be overwritten by user specific setup (each user can set his own clicktodial url) ExternalModule=External module InstalledInto=Installed into directory %s -BarcodeInitForthird-parties=Mass barcode init for third-parties +BarcodeInitForThirdparties=Mass barcode init for third-parties BarcodeInitForProductsOrServices=Mass barcode init or reset for products or services CurrentlyNWithoutBarCode=Currently, you have %s record on %s %s without barcode defined. InitEmptyBarCode=Init value for next %s empty records diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 19c513dff28..7a92b97e446 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3995,8 +3995,10 @@ div.titre { .tertiary { color: var(--colortexttitlenotab2); } -table.table-fiche-title:first-of-type div { - color: var(--colortexttitlenotab); +div.fiche > table.table-fiche-title:first-of-type div { + /* color: var(--colortexttitlenotab); */ + color: #606060; + font-weight: 600; } table.table-fiche-title .col-title div.titre{ diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 0677c8e4918..e76f0bcf56c 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -67,8 +67,8 @@ $colorbacklinepairhover = '230,237,244'; // line hover $colorbacklinepairchecked = '230,237,244'; // line checked $colorbacklinebreak = '248,247,244'; // line break $colorbackbody = '255,255,255'; -$colortexttitlenotab = '0,123,140'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,113,120, violet: 0,50,120 -$colortexttitlenotab2 = '100,0,100'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,113,120, violet: 0,50,120 +$colortexttitlenotab = '0,123,140'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,123,140, violet: 0,50,120 +$colortexttitlenotab2 = '100,0,100'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,123,140, violet: 0,50,120 $colortexttitle = '0,0,0'; $colortexttitlelink = '10, 20, 100'; $colortext = '0,0,0'; From 054d5c5f4c2e4c7d08a7657df8fb95fc659397fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 17:00:08 +0200 Subject: [PATCH 25/33] css --- htdocs/theme/eldy/global.inc.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7a92b97e446..15a58295949 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3989,17 +3989,20 @@ div.titre { padding-top: 5px; padding-bottom: 5px; } -.secondary, div.titre { +div.fiche > table.table-fiche-title:first-of-type div { + color: var(--colortexttitlenotab); + /* font-weight: 600; */ +} +div.titre { + color: var(--colortexttitlenotab); +} + +.secondary { color: var(--colortexttitlenotab); } .tertiary { color: var(--colortexttitlenotab2); } -div.fiche > table.table-fiche-title:first-of-type div { - /* color: var(--colortexttitlenotab); */ - color: #606060; - font-weight: 600; -} table.table-fiche-title .col-title div.titre{ line-height: 40px; From 9e6bb6f784c69749ce56f378c6f86a87c077f917 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 20:19:45 +0200 Subject: [PATCH 26/33] Sanitize params --- htdocs/commande/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 21f558219eb..795602cd95d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1160,7 +1160,7 @@ if (empty($reshook)) elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { - $idwarehouse = GETPOST('idwarehouse'); + $idwarehouse = GETPOST('idwarehouse', 'int'); $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) @@ -1269,7 +1269,7 @@ if (empty($reshook)) elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) { - $idwarehouse = GETPOST('idwarehouse'); + $idwarehouse = GETPOST('idwarehouse', 'int'); $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) From 71cb17b58b8cf07710bd90851a9f0d6293bf39b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 20:58:18 +0200 Subject: [PATCH 27/33] css --- htdocs/admin/company.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f33a3ea6f93..d7761557f22 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -495,7 +495,9 @@ if (!empty($mysoc->logo_mini)) { } print ''; } else { + print '
'; print ''; + print '
'; } print ''; print ''; @@ -513,7 +515,9 @@ if (!empty($mysoc->logo_squarred_mini)) { } print ''; } else { + print '
'; print ''; + print '
'; } print ''; print ''; From a37a4031e9878abf3f1ce884e569b701dcfb3fff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Jun 2020 00:46:09 +0200 Subject: [PATCH 28/33] FIX Delete of website page need permission. Conflict with mass action. Conflicts: htdocs/core/actions_massactions.inc.php htdocs/website/index.php --- htdocs/core/actions_massactions.inc.php | 5 +- htdocs/core/class/html.form.class.php | 28 +++--- htdocs/core/lib/website2.lib.php | 4 +- htdocs/website/index.php | 123 ++++++++++++++++++------ 4 files changed, 116 insertions(+), 44 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index e19530ec209..40e6849d494 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -913,9 +913,10 @@ if (!$error && $massaction == 'cancelorders') setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); $error++; break; - } - else + } else { + // TODO We do not provide warehouse so no stock change here for the moment. $result = $cmd->cancel(); + } if ($result < 0) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5d7e008e062..9540c9eef84 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4194,18 +4194,18 @@ class Form * print '});'."\n"; * print ''."\n"; * - * @param string $page Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformated) - * @param string $title Title - * @param string $question Question - * @param string $action Action - * @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) - * type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ... - * @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0' - * @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx - * @param int $height Force height of box (0 = auto) - * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. - * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
section. - * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form + * @param string $page Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformated) + * @param string $title Title + * @param string $question Question + * @param string $action Action + * @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) + * type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ... + * @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0' + * @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx + * @param int $height Force height of box (0 = auto) + * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. + * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a section. + * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form */ public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0) { @@ -4359,7 +4359,7 @@ class Form } // Show JQuery confirm box. $formconfirm .= ''; // Close current websitebar to open a new one @@ -2915,7 +2973,10 @@ if ($action == 'editcss') // JS file print ''; - print $langs->trans('WEBSITE_JS_INLINE'); + $textwithhelp = $langs->trans('WEBSITE_JS_INLINE'); + $htmlhelp2 = $langs->trans("LinkAndScriptsHereAreNotLoadedInEditor").'
'; + print $form->textwithpicto($textwithhelp, $htmlhelp2, 1, 'warning', '', 0, 2, 'htmljstooltip2'); + print ''; $doleditor = new DolEditor('WEBSITE_JS_INLINE', $jscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); @@ -3210,6 +3271,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pageauthorid = $objectpage->fk_user_creat; $pageusermodifid = $objectpage->fk_user_modif; $pageauthoralias = $objectpage->author_alias; + $pagestatus = $objectpage->status; } else { @@ -3218,6 +3280,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pageauthorid = $user->id; $pageusermodifid = 0; $pageauthoralias = ''; + $pagestatus = 1; } if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha'); if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); @@ -3228,20 +3291,6 @@ if ($action == 'editmeta' || $action == 'createcontainer') if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09'); if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none'); - // Title - print ''; - print $langs->trans('WEBSITE_TITLE'); - print ''; - print ''; - print ''; - - // Alias - print ''; - print $langs->trans('WEBSITE_PAGENAME'); - print ''; - print ''; - print ''; - // Type of container print ''; print $langs->trans('WEBSITE_TYPE_CONTAINER'); @@ -3258,6 +3307,20 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; } + // Title + print ''; + print $langs->trans('WEBSITE_TITLE'); + print ''; + print ''; + print ''; + + // Alias + print ''; + print $langs->trans('WEBSITE_PAGENAME'); + print ''; + print ''; + print ''; + print ''; print $langs->trans('WEBSITE_DESCRIPTION'); print ''; @@ -3548,7 +3611,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print ''; - print ''."\n"; + print ''."\n"; print '

'; print load_fiche_titre($langs->trans("ReplaceWebsiteContent"), '', 'search'); @@ -3556,7 +3619,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print '
'; print '
'; - print '
'; + print '
'; print $langs->trans("SearchReplaceInto"); print '
'; print '
'; @@ -3593,15 +3656,15 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = $param = ''; $nbtotalofrecords = count($listofpages['list']); $num = $limit; - $permissiontodelete = 0; + $permissiontodelete = $user->rights->website->delete; // List of mass actions available $arrayofmassactions = array(); - if ($user->rights->website->writephp) $arrayofmassactions['replace'] = $langs->trans("Replace"); - if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + if ($user->rights->website->writephp && $searchkey) $arrayofmassactions['replace'] = $langs->trans("Replace"); + //if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $massactionbutton .= '