Merge remote-tracking branch 'upstream/develop' into free_email

This commit is contained in:
Frédéric FRANCE 2020-05-20 18:28:55 +02:00
commit 365f85dcea
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
11 changed files with 125 additions and 16 deletions

View File

@ -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'

View File

@ -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('<link rel="stylesheet" href="/styles.css', '<link rel="stylesheet" href="styles.css', $content);
// Protect the link styles.css.php to any replacement that we make after.
@ -304,6 +303,11 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
else // REPLACEMENT OF LINKS When page called from virtual host
{
$symlinktomediaexists = 1;
if ($website->virtualhost) {
$content = preg_replace('/^(<link[^>]*rel="canonical" href=")\//m', '\1'.$website->virtualhost.'/', $content, -1, $nbrep);
}
//print 'rrrrrrrrr'.$website->virtualhost.$content;
// Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />

View File

@ -197,7 +197,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
}
// Add canonical reference
if ($object->virtualhost) {
$tplcontent .= '<link rel="canonical" href="'.$object->virtualhost.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
}
// Add manifest.json on homepage
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";

View File

@ -2356,6 +2356,9 @@ class FactureFournisseur extends CommonInvoice
if ($this->type == self::TYPE_DEPOSIT) $picto .= 'd'; // Deposit invoice
$label = '<u>'.$langs->trans("SupplierInvoice").'</u>';
if ($this->type == self::TYPE_REPLACEMENT) $label = '<u>'.$langs->transnoentitiesnoconv("InvoiceReplace").'</u>';
elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u>'.$langs->transnoentitiesnoconv("CreditNote").'</u>';
elseif ($this->type == self::TYPE_DEPOSIT) $label = '<u>'.$langs->transnoentitiesnoconv("Deposit").'</u>';
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_supplier))
@ -2370,9 +2373,6 @@ class FactureFournisseur extends CommonInvoice
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc))
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.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 .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5, $this->alreadypaid);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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++;
}
}

View File

@ -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.
*

View File

@ -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 '<a href="'.$_SERVER["PHP_SEFL"].'?action=replacesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"><span></a>';
if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) {
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>';
}
}
print '</span>';