diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c2cad773af6..e3059ade21e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3162,7 +3162,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_other', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', - 'object_shipment', 'object_supplier_invoice', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', + 'object_shipment', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'off', 'on', 'order', @@ -3189,7 +3189,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotofa = array( 'account'=>'university', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'address'=> 'address-book', - 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billd'=>'file-medical', 'bom'=>'cubes', + 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', @@ -3263,7 +3263,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ // Add CSS $arrayconvpictotomorcess = array( 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'accountancy'=>'bg-infobox-bank_account', - 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'bg-infobox-commande', 'billa'=>'bg-infobox-commande', 'billd'=>'bg-infobox-commande', + 'bank_account'=>'bg-infobox-bank_account', + 'bill'=>'bg-infobox-commande', 'billa'=>'bg-infobox-commande', 'billd'=>'bg-infobox-commande', 'cash-register'=>'bg-infobox-bank_account', 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'conversation'=>'bg-infobox-contrat', 'donation'=>'bg-infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat', @@ -3275,7 +3276,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'holiday'=>'bg-infobox-holiday', 'invoice'=>'bg-infobox-commande', 'payment'=>'bg-infobox-bank_account', 'poll'=>'bg-infobox-adherent', 'project'=>'bg-infobox-project', 'projecttask'=>'bg-infobox-project', 'propal'=>'bg-infobox-propal', 'resource'=>'bg-infobox-action', - 'supplier_invoice'=>'bg-infobox-order_supplier', 'supplier_order'=>'bg-infobox-order_supplier', 'supplier_proposal'=>'bg-infobox-supplier_proposal', + 'supplier_invoice'=>'bg-infobox-order_supplier', 'supplier_invoicea'=>'bg-infobox-order_supplier', 'supplier_invoiced'=>'bg-infobox-order_supplier', + 'supplier_order'=>'bg-infobox-order_supplier', 'supplier_proposal'=>'bg-infobox-supplier_proposal', 'ticket'=>'bg-infobox-contrat', 'title_accountancy'=>'bg-infobox-bank_account', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action', //'title_setup'=>'bg-infobox-action', 'tools'=>'bg-infobox-action', 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 1075a91ebc0..1864ca27bea 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -219,6 +219,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') { global $db, $langs, $conf, $user; global $dolibarr_main_url_root, $dolibarr_main_data_root; + global $website; global $includehtmlcontentopened; $nbrep = 0; @@ -244,8 +245,6 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') } elseif (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server { - global $website; - $content = str_replace(' diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index ce1f27b49fc..33093fb953c 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -197,7 +197,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) } // Add canonical reference if ($object->virtualhost) { - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } // Add manifest.json on homepage $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 52d1b9bf326..37dbc2752ca 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2356,6 +2356,9 @@ class FactureFournisseur extends CommonInvoice if ($this->type == self::TYPE_DEPOSIT) $picto .= 'd'; // Deposit invoice $label = ''.$langs->trans("SupplierInvoice").''; + if ($this->type == self::TYPE_REPLACEMENT) $label = ''.$langs->transnoentitiesnoconv("InvoiceReplace").''; + elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = ''.$langs->transnoentitiesnoconv("CreditNote").''; + elseif ($this->type == self::TYPE_DEPOSIT) $label = ''.$langs->transnoentitiesnoconv("Deposit").''; if (!empty($this->ref)) $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($this->ref_supplier)) @@ -2370,9 +2373,6 @@ class FactureFournisseur extends CommonInvoice $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ttc)) $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - if ($this->type == self::TYPE_REPLACEMENT) $label = $langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; - elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = $langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; - elseif ($this->type == self::TYPE_DEPOSIT) $label = $langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; if ($moretitle) $label .= ' - '.$moretitle; if (isset($this->statut) && isset($this->alreadypaid)) { $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5, $this->alreadypaid); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index e3f331757ba..164255d4a61 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -955,6 +955,9 @@ if ($resql) $multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay); $facturestatic->alreadypaid = ($paiement ? $paiement : 0); + $facturestatic->paye = $obj->paye; + $facturestatic->statut = $obj->fk_statut; + $facturestatic->type = $obj->type; //If invoice has been converted and the conversion has been used, we dont have remain to pay on invoice 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 7daf41a05d3..b20d3d9c782 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 @@ -64,6 +64,9 @@ create table llx_facturedet_rec_extrafields ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object); +-- This var is per entity now, so we remove const if global if exists +delete from llx_const where name = 'PROJECT_HIDE_TASKS' and entity = 0; + -- For v12 diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index bb42bff3c87..e145647baa4 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -115,7 +115,7 @@ ChildOfTask=Child of task TaskHasChild=Task has child NotOwnerOfProject=Not owner of this private project AffectedTo=Allocated to -CantRemoveProject=This project can't be removed as it is referenced by some other objects (invoice, orders or other). See referers tab. +CantRemoveProject=This project can't be removed as it is referenced by some other objects (invoice, orders or other). See tab '%s'. ValidateProject=Validate projet ConfirmValidateProject=Are you sure you want to validate this project? CloseAProject=Close project diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6af779a2295..c9007dc6d8a 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -106,7 +106,7 @@ if (empty($reshook)) else { dol_syslog($object->error, LOG_DEBUG); - setEventMessages($langs->trans("CantRemoveProject"), null, 'errors'); + setEventMessages($langs->trans("CantRemoveProject", $langs->transnoentitiesnoconv("ProjectOverview")), null, 'errors'); } } if ($backtopage) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 417a825a77d..449050d94c5 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -764,7 +764,7 @@ class Project extends CommonObject $resql = $this->db->query($sql); if (!$resql) { - $this->errors[] = $langs->trans("CantRemoveProject"); + $this->errors[] = $langs->trans("CantRemoveProject", $langs->transnoentitiesnoconv("ProjectOverview")); $error++; } } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index be91f6640a1..d579a8b3153 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1206,12 +1206,12 @@ class Website extends CommonObject $newid = ($reg[2] + $maxrowid); $aliasesarray = explode(',', $reg[3]); - $objectpagestatic->fetch($newid); - dol_syslog("Found ID ".$oldid." to replace with ID ".$newid." and shortcut aliases to create: ".$reg[3]); dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0); + $objectpagestatic->fetch($newid); + // The move is not enough, so we regenerate page $filetpl = $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php'; $result = dolSavePageContent($filetpl, $object, $objectpagestatic); @@ -1270,6 +1270,84 @@ class Website extends CommonObject } } + /** + * Rebuild all files of a containers of a website. TODO Add other files too. + * Note: Files are already regenerated during importWebSite so this function is useless when importing a website. + * + * @return int <0 if KO, >0 if OK + */ + public function rebuildWebSiteFiles() + { + global $conf; + + $error = 0; + + $object = $this; + if (empty($object->ref)) + { + $this->error = 'Function importWebSite called on object not loaded (object->ref is empty)'; + return -1; + } + + $objectpagestatic = new WebsitePage($this->db); + + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page WHERE fk_website = '.$this->id; + + $resql = $this->db->query($sql); + if (! $resql) { + $this->error = $this->db->lasterror(); + return -1; + } + + $num = $this->db->num_rows($resql); + + $i=0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $newid = $obj->rowid; + + $objectpagestatic->fetch($newid); + + $aliasesarray = explode(',', $objectpagestatic->aliasalt); + + $filetpl = $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php'; + $result = dolSavePageContent($filetpl, $object, $objectpagestatic); + if (!$result) { + $this->errors[] = 'Failed to write file '.basename($filetpl); + $error++; + } + + // Regenerate alternative aliases pages + if (is_array($aliasesarray)) + { + foreach ($aliasesarray as $aliasshortcuttocreate) + { + if (trim($aliasshortcuttocreate)) + { + $filealias = $conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php'; + $result = dolSavePageAlias($filealias, $object, $objectpagestatic); + if (!$result) { + $this->errors[] = 'Failed to write file '.basename($filealias); + $error++; + } + } + } + } + + $i++; + } + + if ($error) + { + return -1; + } + else + { + return 1; + } + } + /** * Return if web site is a multilanguage web site. Return false if there is only 0 or 1 language. * diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 1786cfbf078..ba539ccb653 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1946,7 +1946,23 @@ if ($action == 'exportsite') else { setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; + $action = 'preview'; + } +} + +// Regenerate site +if ($action == 'regeneratesite') +{ + $result = $object->rebuildWebSiteFiles(); + if ($result > 0) + { + setEventMessages($langs->trans("PagesRegenerated"), null, 'mesgs'); + $action = 'preview'; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'preview'; } } @@ -2254,6 +2270,9 @@ if (!GETPOST('hide_websitemenu')) */ print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; + if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) { + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; + } } print '';