Merge branch 'develop' into develop#3

This commit is contained in:
Hystepik 2020-12-07 09:03:59 +01:00 committed by GitHub
commit 2ac98d06f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
134 changed files with 2237 additions and 2020 deletions

View File

@ -216,6 +216,7 @@ NEW: add a message in error_log after detection of SQL or script injection
NEW: add __TYPE__ substitution key
NEW: add validation of MX domain for emails
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Graphics can be horizontal bars.
HOOKs
NEW: Hook on propal card

View File

@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "10.1.1"
"zapier-platform-core": "10.1.2"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@ -1,25 +0,0 @@
comparison of terms
Dolibarr SAP ERP Odoo
-------------------------------------------------------------------------
Thirdparty Contact partner Partner/Contact (company)
Contact/address Contact person Partner/Contact (individual)
Financial Finance (FI) Accounting
Accounting
Income / Expense ?? Profit / Loss
Balance ?? Net profit
Subledger account Subledger account ??
CRM Sales & Distribution Sales
Proposal ?? Quotation
Proposal is ok but proposition looks better (proposal is for a detailed proposition).
We can say also "business proposition or business proposal".
In India they are using "Quotation".

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2016-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
@ -103,13 +103,19 @@ if ($conf->accounting->enabled)
// STEPS
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
print "<br>\n";
@ -118,60 +124,45 @@ if ($conf->accounting->enabled)
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
if (!empty($conf->tax->enabled))
{
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
}
/*if (! empty($conf->salaries->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php
print "<br>\n";
print "<br>\n";
}*/
if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
}
/*
if (! empty($conf->loan->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->don->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->adherents->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}*/
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
print $s;
print "<br>\n";
@ -188,26 +179,34 @@ if ($conf->accounting->enabled)
$langs->loadLangs(array('bills', 'trips'));
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
print $s;
print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
print $s;
print "<br>\n";
}
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
print $s;
print "<br>\n";
print '<br>';

View File

@ -103,6 +103,7 @@ class Adherent extends CommonObject
* @var int Thirdparty ID
*/
public $fk_soc;
public $socid;
/**
* @var string Address
@ -1262,14 +1263,15 @@ class Adherent extends CommonObject
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
$sql .= " WHERE d.fk_adherent_type = t.rowid";
if ($rowid)
$sql .= " AND d.rowid=".$rowid;
elseif ($ref || $fk_soc) {
if ($rowid) {
$sql .= " AND d.rowid=".((int) $rowid);
} elseif ($ref || $fk_soc) {
$sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($ref)
if ($ref) {
$sql .= " AND d.rowid='".$this->db->escape($ref)."'";
elseif ($fk_soc > 0)
$sql .= " AND d.fk_soc=".$fk_soc;
} elseif ($fk_soc > 0) {
$sql .= " AND d.fk_soc=".((int) $fk_soc);
}
} elseif ($ref_ext) {
$sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'";
}

View File

@ -292,7 +292,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>';
print "</tr>\n";

View File

@ -391,7 +391,7 @@ foreach ($dirmodels as $reldir) {
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -484,7 +484,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -728,7 +728,7 @@ if ($mysoc->useLocalTax(1))
print '<div class="nobordernopadding">';
$tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
print "<label for=\"lt1\">".$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
print '<label for="lt1">'.$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
if (!isOnlyOneLocalTax(1))
{
print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
@ -751,9 +751,9 @@ if ($mysoc->useLocalTax(1))
} else {
if (empty($mysoc->country_code))
{
print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else {
print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>';
print '<tr class="oddeven nohover"><td class="" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>';
}
}
@ -773,7 +773,7 @@ if ($mysoc->useLocalTax(2))
print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>";
print '<td colspan="2">';
print '<div class="nobordernopadding">';
print "<label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
$tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
if (!isOnlyOneLocalTax(2))
@ -797,9 +797,9 @@ if ($mysoc->useLocalTax(2))
} else {
if (empty($mysoc->country_code))
{
print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else {
print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>';
print '<tr class="oddeven nohover"><td class="" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>';
}
}
@ -825,9 +825,9 @@ if ($mysoc->useRevenueStamp())
} else {
if (empty($mysoc->country_code))
{
print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else {
print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>';
print '<tr class="oddeven nohover"><td class="" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>';
}
}

View File

@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -682,7 +682,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
// Discard check of mandatory fields for country for some tables
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
// Discard check of mandatory fiedls for other fields
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;

View File

@ -223,21 +223,6 @@ $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électro
llxHeader('', 'EmailCollector', $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
// Part to create
if ($action == 'create') {
print load_fiche_titre($langs->trans("NewEmailCollector", $langs->transnoentitiesnoconv("EmailCollector")));
@ -433,6 +418,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!$connection)
{
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
$morehtml .= '<br>'.imap_last_error();
//var_dump(imap_errors())
} else {
$morehtml .= imap_num_msg($connection);
}

View File

@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -549,7 +549,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -467,7 +467,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -426,7 +426,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

File diff suppressed because it is too large Load Diff

View File

@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -340,7 +340,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
}
else
{

View File

@ -347,7 +347,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
}
else
{

View File

@ -444,7 +444,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -424,7 +424,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -638,7 +638,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -426,7 +426,7 @@ foreach ($dirmodels as $reldir)
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>';
print "</tr>\n";

View File

@ -439,7 +439,7 @@ foreach ($dirmodels as $reldir)
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>';
print "</tr>\n";

View File

@ -412,7 +412,7 @@ foreach ($dirmodels as $reldir)
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>';
print "</tr>\n";

View File

@ -437,7 +437,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -85,31 +85,37 @@ if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE));
}
$version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
$newversion = '';
if (function_exists('curl_init'))
{
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
if ($action == 'getlastversion')
{
if ($sfurl)
{
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
{
$title = $sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
{
$newversion = $reg[1];
$newversionarray = explode('.', $newversion);
$versionarray = explode('.', $version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version = $newversion;
}
$i++;
}
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
if ($action == 'getlastversion') {
if ($sfurl) {
$i = 0;
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
$title = $sfurl->channel[0]->item[$i]->title;
$reg = array();
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) {
$newversion = $reg[1];
$newversionarray = explode('.', $newversion);
$versionarray = explode('.', $version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version = $newversion;
}
$i++;
}
// Show version
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>';
} else {
if ($version != '0.0') {
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
}
} else {
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';
}
} else {
@ -118,12 +124,11 @@ if (function_exists('curl_init'))
}
// Now show link to the changelog
print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
//print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
$version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
print '<a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";

View File

@ -90,18 +90,18 @@ print '<table class="border centpercent">';
print '<tr class="border"><td style="padding: 4px">';
if (!empty($conf->syslog->enabled))
{
if (!empty($conf->syslog->enabled)) {
print '<input type="radio" name="choice" value="logfile"';
print ($choice && $choice == 'logfile') ? ' checked' : '';
$filelogparam = $filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
{
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) {
$filelogparam = '<a class="wordbreak" href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam .= basename($filelog);
$filelogparam .= '">'.$filelog.'</a>';
}
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
$desc = $langs->trans("PurgeDeleteLogFile", '{filelogparam}');
$desc = str_replace('{filelogparam}', $filelogparam, $desc);
print '> '.$desc;
print '<br><br>';
}
@ -123,8 +123,7 @@ print '</td></tr></table>';
print '</form>';
if (preg_match('/^confirm/i', $choice))
{
if (preg_match('/^confirm/i', $choice)) {
print '<br>';
$formquestion = array();
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2);

View File

@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -241,7 +241,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}

View File

@ -113,6 +113,7 @@ class DolibarrApi
unset($object->error);
unset($object->errors);
unset($object->errorhidden);
unset($object->ref_previous);
unset($object->ref_next);

View File

@ -1608,6 +1608,14 @@ class Setup extends DolibarrApi
{
global $mysoc;
unset($mysoc->skype);
unset($mysoc->twitter);
unset($mysoc->facebook);
unset($mysoc->linkedin);
unset($mysoc->note);
unset($mysoc->lines);
return $this->_cleanObjectDatas($mysoc);
}

View File

@ -39,6 +39,8 @@ $block = new BlockedLog($db);
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
$langs->loadLangs(array("admin"));
/*
* View

View File

@ -1104,7 +1104,7 @@ if ($action == 'create')
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent', 0, 0);
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
@ -1578,7 +1578,7 @@ if ($id > 0)
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}

View File

@ -1492,19 +1492,19 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($nonew <= 0)
{
print '<div class="tagtr"><div class="nowrap tagtd">';
print '<div class="tagtr"><div class="nowrap tagtd"><div class="left inline-block">';
print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">';
if ($showinfo) print dol_print_date($curtime, 'daytextshort');
else print dol_print_date($curtime, '%d');
print '</a>';
print '</div><div class="nowrap tagtd right">';
print '</div><div class="nowrap floatright inline-block marginrightonly">';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
print '<a class="cursoradd" href="'.$urltocreate.'">'; // Explicit link, usefull for nojs interfaces
print img_picto($langs->trans("NewAction"), 'edit_add.png');
print '</a>';
}
print '</div></div>'."\n";
print '</div></div></div>'."\n";
}
if ($nonew < 0)

View File

@ -86,6 +86,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartycomm', 'globalcard'));
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
if ($object->id > 0) {
if (!($object->client > 0) || empty($user->rights->societe->lire)) {
accessforbidden();
}
}
$now = dol_now();

View File

@ -800,8 +800,7 @@ if ($action == 'create')
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
$_GET["action"] = '';
} elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
} elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) {
if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
@ -818,7 +817,7 @@ if ($action == 'create')
if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
$text = '';
if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
{
$text .= $langs->trans("MailingNeedCommand");
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
@ -826,7 +825,7 @@ if ($action == 'create')
}
$text .= $langs->trans('ConfirmSendingEmailing').'<br>';
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600);
}
}

View File

@ -919,6 +919,7 @@ if (empty($reshook))
if ($result > 0) {
$ret = $object->fetch($object->id); // Reload to get new records
$object->fetch_thirdparty();
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language

View File

@ -3273,6 +3273,7 @@ class Commande extends CommonOrder
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
$sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").",";
$sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";

View File

@ -109,7 +109,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -407,7 +407,7 @@ if ($action == 'create')
$arrayselected[] = $cat->id;
}
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}
@ -904,7 +904,7 @@ if ($action == 'create')
$arrayselected[] = $cat->id;
}
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>";
}

View File

@ -3126,8 +3126,8 @@ class Facture extends CommonInvoice
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0);
$this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->localtax1_type = isset($localtaxes_type[0]) ? $localtaxes_type[0] : '';
$this->line->localtax2_type = isset($localtaxes_type[2]) ? $localtaxes_type[2] : '';
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative

View File

@ -192,10 +192,10 @@ function getPieChart($socid = 0)
{
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']);
$dolgraph->setWidth('100%');
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphthirdparties');
$result .= '<tr>';

View File

@ -128,7 +128,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page;
if (!$sortorder && !empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
if (!$sortorder) $sortorder = 'DESC';

View File

@ -805,19 +805,16 @@ class Contact extends CommonObject
}
// Mis a jour alerte birthday
if ($this->birthday_alert)
{
if (!empty($this->birthday_alert)) {
//check existing
$sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$result_check = $this->db->query($sql_check);
if (!$result_check || ($this->db->num_rows($result_check) < 1))
{
if (!$result_check || ($this->db->num_rows($result_check) < 1)) {
//insert
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) ";
$sql .= "VALUES (1,".$this->db->escape($id).",".$user->id.")";
$result = $this->db->query($sql);
if (!$result)
{
if (!$result) {
$error++;
$this->error = $this->db->lasterror();
}
@ -828,23 +825,20 @@ class Contact extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert ";
$sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$result = $this->db->query($sql);
if (!$result)
{
if (!$result) {
$error++;
$this->error = $this->db->lasterror();
}
}
if (!$error && !$notrigger)
{
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error)
{
if (!$error) {
$this->db->commit();
return 1;
} else {
@ -1342,9 +1336,10 @@ class Contact extends CommonObject
if (!empty($this->poste)) $label .= '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste;
$label .= '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
$phonelist = array();
if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $this->country_code, $this->id, 0, '', '&nbsp;', 'phone');
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $this->country_code, $this->id, 0, '', '&nbsp;', 'mobile');
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $this->country_code, $this->id, 0, '', '&nbsp;', 'phone');
$country_code = empty($this->country_code) ? '': $this->country_code;
if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', '&nbsp;', 'phone');
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', '&nbsp;', 'mobile');
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', '&nbsp;', 'phone');
$label .= '<br><b>'.$langs->trans("Phone").':</b> '.implode('&nbsp;', $phonelist);
$label .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);

View File

@ -1032,21 +1032,19 @@ class Contrat extends CommonObject
}
// Insert business contacts ('SALESREPFOLL','contrat')
if (!$error)
{
if (!$error) {
$result = $this->add_contact($this->commercial_suivi_id, 'SALESREPFOLL', 'internal');
if ($result < 0) $error++;
}
if (!$error)
{
if (!$error) {
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
// Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects))
{
foreach ($this->linked_objects as $origin => $tmp_origin_id)
{
@ -1144,10 +1142,10 @@ class Contrat extends CommonObject
/**
* Supprime l'objet de la base
* Delete object
*
* @param User $user Utilisateur qui supprime
* @return int < 0 si erreur, > 0 si ok
* @param User $user User that deletes
* @return int < 0 if KO, > 0 if OK
*/
public function delete($user)
{

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2015 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2011-2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -356,6 +356,9 @@ if ($action == 'update')
$visibility = GETPOST('list', 'alpha');
if ($type == 'separate') $visibility = 3;
// Example: is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : 'objnotdefined'
$computedvalue = GETPOST('computed_value', 'nohtml');
$result = $extrafields->update(
GETPOST('attrname', 'aZ09'),
GETPOST('label', 'alpha'),
@ -371,7 +374,7 @@ if ($action == 'update')
$visibility,
GETPOST('help', 'alpha'),
GETPOST('default_value', 'alpha'),
GETPOST('computed_value', 'alpha'),
$computedvalue,
(GETPOST('entitycurrentorall', 'alpha') ? 0 : ''),
GETPOST('langfile'),
GETPOST('enabled', 'alpha'),

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014-2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2014-2020 Frederic France <frederic.france@netlogic.fr>
*
* 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
@ -107,7 +107,7 @@ class box_lastlogin extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{

View File

@ -87,6 +87,11 @@ class box_produits extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire)
{
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql .= ", p.accountancy_code_sell";
$sql .= ", p.accountancy_code_sell_intra";
$sql .= ", p.accountancy_code_sell_export";
$sql .= ", p.accountancy_code_buy";
$sql .= ', p.barcode';
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
if (empty($user->rights->produit->lire)) $sql .= ' AND p.fk_product_type != 0';
@ -133,6 +138,13 @@ class box_produits extends ModeleBoxes
$productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label;
$productstatic->entity = $objp->entity;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->barcode = $objp->barcode;
$productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
$productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',

View File

@ -743,6 +743,12 @@ abstract class CommonDocGenerator
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
}
// Add infor from $object->xxx where xxx has been loaded by fetch_origin() of shipment
if (!empty($object->commande) && is_object($object->commande)) {
$array_shipment['order_ref'] = $object->commande->ref;
$array_shipment['order_ref_customer'] = $object->commande->ref_customer;
}
return $array_shipment;
}

View File

@ -537,6 +537,8 @@ class Conf
if (!empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM;
if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1;
if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1;
// Format for date (used by default when not found or not searched in lang)
$this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
$this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags

View File

@ -39,9 +39,9 @@
*/
class DolGraph
{
public $type = array(); // Array with type of each series. Example: array('bars', 'lines', ...)
public $type = array(); // Array with type of each series. Example: array('bars', 'horizontalbars', 'lines', 'pies', 'piesemicircle', 'polar'...)
public $mode = 'side'; // Mode bars graph: side, depth
private $_library = 'jflot'; // Graphic library to use (jflot, artichow)
private $_library = 'chart'; // Graphic library to use (jflot, chart, artichow)
//! Array of data
public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
@ -115,7 +115,7 @@ class DolGraph
$this->_library = $library;
if ($this->_library == 'auto') {
$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'jflot' : $conf->global->MAIN_JS_GRAPH);
$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'chart' : $conf->global->MAIN_JS_GRAPH);
}
}
@ -261,7 +261,7 @@ class DolGraph
* Set type
*
* @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be:
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', ...
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', 'horirontalbars'...
* @return void
*/
public function SetType($type)
@ -1156,6 +1156,7 @@ class DolGraph
else {
$type = 'bar';
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar';
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') $type = 'horizontalBar';
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';

View File

@ -1937,10 +1937,10 @@ class ExtraFields
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function(){';
if ($collapse_display === false) {
$out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer fa fa-plus-square\"></span>&nbsp;");'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer far fa-plus-square\"></span>&nbsp;");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
} else {
$out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer fa fa-minus-square\"></span>&nbsp;");'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer far fa-minus-square\"></span>&nbsp;");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
}
$out .= ' jQuery("#trextrafieldseparator'.$key.'").click(function(){'."\n";

View File

@ -1447,9 +1447,10 @@ class Form
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param string $htmlid Html id to use instead of htmlname
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param integer $disableifempty Set tag 'disabled' on select if there is no choice
* @return int <0 if KO, Nb of contact in list if OK
*/
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false)
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0)
{
global $conf, $langs, $hookmanager, $action;
@ -1490,7 +1491,10 @@ class Form
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
}
if ($htmlname != 'none' && !$options_only) $out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'"'.($num ? '' : ' disabled').' id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
if ($htmlname != 'none' && !$options_only) {
$out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
}
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
if ($showempty == 2) $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
@ -1724,7 +1728,7 @@ class Form
$out .= ajax_combobox($htmlname);
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
$out .= '<select class="flat'.($morecss ? ' minwidth100imp '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
if ($show_empty && !$multiple) $out .= '<option value="-1"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>&nbsp;</option>'."\n";
if ($show_every) $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
@ -4217,7 +4221,7 @@ class Form
* @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'=> , ))
* @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>))
* 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

View File

@ -51,14 +51,14 @@ class FormAdmin
* @param string $htmlname Name of HTML select
* @param int $showauto Show 'auto' choice
* @param array $filter Array of keys to exclude in list (opposite of $onlykeys)
* @param string $showempty '1'=Add empty value or string to show
* @param string $showempty '1'=Add empty value or 'string to show'
* @param int $showwarning Show a warning if language is not complete
* @param int $disabled Disable edit of select
* @param string $morecss Add more css styles
* @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end
* @param int $forcecombo Force to use combo box (so no ajax beautify effect)
* @param int $multiselect Make the combo a multiselect
* @param array $onlykeys Show only the following keys (opposite of $filter). Example array('fr', 'es', ...)
* @param array $onlykeys Array of language keys to restrict list with the following keys (opposite of $filter). Example array('fr', 'es', ...)
* @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...)
* @return string Return HTML select string with list of languages
*/
@ -95,9 +95,12 @@ class FormAdmin
foreach ($langs_available as $key => $value)
{
$valuetoshow = $value;
if ($showcode == 1) $valuetoshow = $key.' - '.$value;
if ($showcode == 1) {
if ($mainlangonly) $valuetoshow = '<span class="opacitymedium">'.preg_replace('/[_-].*$/', '', $key).'</span> - '.$value;
else $valuetoshow = '<span class="opacitymedium">'.$key.'</span> - '.$value;
}
if ($showcode == 2) {
if ($mainlangonly) $valuetoshow = $value.' ('.preg_replace('/[_-].*$/', '', $key).')';
if ($mainlangonly) $valuetoshow = $value.' <span class="opacitymedium">('.preg_replace('/[_-].*$/', '', $key).')</span>';
else $valuetoshow = $value.' <span class="opacitymedium">('.$key.')</span>';
}

View File

@ -918,9 +918,10 @@ class FormOther
* @param int $useempty Show empty in list
* @param int $longlabel Show long label
* @param string $morecss More Css
* @param bool $addjscombo Add js combo
* @return string
*/
public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'maxwidth50imp valignmiddle')
public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'minwidth50 maxwidth75imp valignmiddle', $addjscombo = false)
{
// phpcs:enable
global $langs;
@ -947,6 +948,15 @@ class FormOther
$select_month .= '</option>';
}
$select_month .= '</select>';
// Add code for jquery to use multiselect
if ($addjscombo)
{
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$select_month .= ajax_combobox($htmlname);
}
return $select_month;
}
@ -986,18 +996,10 @@ class FormOther
* @param bool $addjscombo Add js combo
* @return string
*/
public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp', $addjscombo = false)
public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle width75', $addjscombo = false)
{
$out = '';
// Add code for jquery to use multiselect
if ($addjscombo)
{
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
$currentyear = date("Y") + $offset;
$max_year = $currentyear + $max_year;
$min_year = $currentyear - $min_year;
@ -1028,6 +1030,14 @@ class FormOther
}
$out .= "</select>\n";
// Add code for jquery to use multiselect
if ($addjscombo)
{
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
return $out;
}

View File

@ -624,7 +624,7 @@ class Translate
// we want to keep '"' '<b>' '</b>' '<strong' '</strong>' '<a ' '</a>' '<br>' '< ' '<span' '</span>' that are reliable HTML tags inside translation strings.
$str = str_replace(
array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<strong>', '</strong>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '>'), // We accept '< ' but not '<'. We can accept however '>'
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__tagb__', '__tagbend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__lt__', '__gt__'),
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__tagb__', '__tagbend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__ltspace__', '__gt__'),
$str
);
@ -638,8 +638,8 @@ class Translate
// Restore reliable HTML tags into original translation string
$str = str_replace(
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__lt__', '__gt__'),
array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '> '),
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__ltspace__', '__gt__'),
array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '>'),
$str
);
@ -794,29 +794,33 @@ class Translate
if ($mainlangonly) {
$arrayofspecialmainlanguages = array(
'en'=>'en_US',
'sq'=>'sq_AL',
'am'=>'am_ET',
'ar'=>'ar_SA',
'eu'=>'eu_ES',
'bn'=>'bn_DB',
'bs'=>'bs_BA',
'ca'=>'ca_ES',
'zh'=>'zh_TW',
'cs'=>'cs_CZ',
'da'=>'da_DK',
'et'=>'et_EE',
'ka'=>'ka_GE',
'el'=>'el_GR',
'eu'=>'eu_ES',
'fa'=>'fa_IR',
'he'=>'he_IL',
'kn'=>'kn_IN',
'ka'=>'ka_GE',
'km'=>'km_KH',
'kn'=>'kn_IN',
'ko'=>'ko_KR',
'ja'=>'ja_JP',
'lo'=>'lo_LA',
'nb'=>'nb_NO',
'fa'=>'fa_IR',
'sq'=>'sq_AL',
'sr'=>'sr_RS',
'sv'=>'sv_SE',
'sl'=>'sl_SI',
'uk'=>'uk_UA',
'vi'=>'vi_VN'
'vi'=>'vi_VN',
'zh'=>'zh_CN'
);
if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages)) continue;
}

File diff suppressed because it is too large Load Diff

View File

@ -597,10 +597,25 @@ function dol_get_first_day_week($day, $month, $year, $gm = false)
return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
}
/**
* Return the easter day in GMT time.
* This function replaces easter_date() that returns a date in local TZ.
*
* @param int $year Year
* @return int GMT Date of easter day
*/
function getGMTEasterDatetime($year)
{
$base = new DateTime("$year-03-21");
$days = easter_days($year); // Return number of days between 21 march and easter day.
$tmp = $base->add(new DateInterval("P{$days}D"));
return $tmp->getTimestamp();
}
/**
* Return the number of non working days including saturday and sunday (or not) between 2 dates in timestamp.
* Dates must be UTC with hour, day, min to 0.
* Called by function num_open_day
* Called by function num_open_day()
*
* @param int $timestampStart Timestamp de debut
* @param int $timestampEnd Timestamp de fin
@ -616,7 +631,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
global $db, $conf, $mysoc;
$nbFerie = 0;
$specialdayrule = array();
// Check to ensure we use correct parameters
if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'Error Dates must use same hours and must be GMT dates';
@ -626,20 +640,23 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
if ($includesaturday < 0) $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
if ($includesunday < 0) $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
$country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid');
$i = 0;
while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd))
&& ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop)
{
$ferie = false;
$specialdayrule = array();
$jour = date("d", $timestampStart);
$mois = date("m", $timestampStart);
$annee = date("Y", $timestampStart);
$jour = gmdate("d", $timestampStart);
$mois = gmdate("m", $timestampStart);
$annee = gmdate("Y", $timestampStart);
$country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid');
//print "jour=".$jour." month=".$mois." year=".$annee." includesaturday=".$includesaturday." includesunday=".$includesunday."\n";
// Loop on public holiday defined into hrm_public_holiday
// Loop on public holiday defined into hrm_public_holiday for the day, month and year analyzed
// TODO Execute this request first and store results into an array, then reuse this array.
$sql = "SELECT code, entity, fk_country, dayrule, year, month, day, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday";
$sql .= " WHERE active = 1 and fk_country IN (0".($country_id > 0 ? ", ".$country_id : 0).")";
@ -671,139 +688,147 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
dol_syslog($db->lasterror(), LOG_ERR);
return 'Error sql '.$db->lasterror();
}
//var_dump($specialdayrule)."\n";
//print "ferie=".$ferie."\n";
// Special dayrules
if (in_array('easter', $specialdayrule))
{
// Calculation for easter date
$date_paques = easter_date($annee);
$jour_paques = date("d", $date_paques);
$mois_paques = date("m", $date_paques);
if ($jour_paques == $jour && $mois_paques == $mois) $ferie = true;
// Easter (sunday)
}
if (!$ferie) {
// Special dayrules
if (in_array('easter', $specialdayrule))
{
// Calculation for easter date
$date_paques = getGMTEasterDatetime($annee);
$jour_paques = gmdate("d", $date_paques);
$mois_paques = gmdate("m", $date_paques);
if ($jour_paques == $jour && $mois_paques == $mois) $ferie = true;
// Easter (sunday)
}
if (in_array('eastermonday', $specialdayrule))
{
// Calculation for the monday of easter date
$date_paques = easter_date($annee);
$date_lundi_paques = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 1,
date("Y", $date_paques)
);
$jour_lundi_ascension = date("d", $date_lundi_paques);
$mois_lundi_ascension = date("m", $date_lundi_paques);
if ($jour_lundi_ascension == $jour && $mois_lundi_ascension == $mois) $ferie = true;
// Easter (monday)
}
if (in_array('ascension', $specialdayrule))
{
// Calcul du jour de l'ascension (39 days after easter day)
$date_paques = easter_date($annee);
$date_ascension = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 39,
date("Y", $date_paques)
);
$jour_ascension = date("d", $date_ascension);
$mois_ascension = date("m", $date_ascension);
if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true;
// Ascension (thursday)
}
if (in_array('pentecote', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = easter_date($annee);
$date_pentecote = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 49,
date("Y", $date_paques)
);
$jour_pentecote = date("d", $date_pentecote);
$mois_pentecote = date("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (sunday)
}
if (in_array('pentecotemonday', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = easter_date($annee);
$date_pentecote = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 50,
date("Y", $date_paques)
if (in_array('eastermonday', $specialdayrule))
{
// Calculation for the monday of easter date
$date_paques = getGMTEasterDatetime($annee);
$date_lundi_paques = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 1,
gmdate("Y", $date_paques)
);
$jour_pentecote = date("d", $date_pentecote);
$mois_pentecote = date("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (monday)
}
$jour_lundi_paques = gmdate("d", $date_lundi_paques);
$mois_lundi_paques = gmdate("m", $date_lundi_paques);
if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) $ferie = true;
// Easter (monday)
}
if (in_array('viernessanto', $specialdayrule))
{
// Viernes Santo
$date_paques = easter_date($annee);
$date_viernes = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) - 2,
date("Y", $date_paques)
);
$jour_viernes = date("d", $date_viernes);
$mois_viernes = date("m", $date_viernes);
if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true;
//Viernes Santo
}
if (in_array('fronleichnam', $specialdayrule))
{
// Fronleichnam (60 days after easter sunday)
$date_paques = easter_date($annee);
$date_fronleichnam = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 60,
date("Y", $date_paques)
if (in_array('ascension', $specialdayrule))
{
// Calcul du jour de l'ascension (39 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_ascension = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 39,
gmdate("Y", $date_paques)
);
$jour_fronleichnam = date("d", $date_fronleichnam);
$mois_fronleichnam = date("m", $date_fronleichnam);
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true;
// Fronleichnam
$jour_ascension = gmdate("d", $date_ascension);
$mois_ascension = gmdate("m", $date_ascension);
if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true;
// Ascension (thursday)
}
if (in_array('pentecote', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 49,
gmdate("Y", $date_paques)
);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (sunday)
}
if (in_array('pentecotemonday', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 50,
gmdate("Y", $date_paques)
);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (monday)
}
if (in_array('viernessanto', $specialdayrule))
{
// Viernes Santo
$date_paques = getGMTEasterDatetime($annee);
$date_viernes = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) - 2,
gmdate("Y", $date_paques)
);
$jour_viernes = gmdate("d", $date_viernes);
$mois_viernes = gmdate("m", $date_viernes);
if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true;
//Viernes Santo
}
if (in_array('fronleichnam', $specialdayrule))
{
// Fronleichnam (60 days after easter sunday)
$date_paques = getGMTEasterDatetime($annee);
$date_fronleichnam = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 60,
gmdate("Y", $date_paques)
);
$jour_fronleichnam = gmdate("d", $date_fronleichnam);
$mois_fronleichnam = gmdate("m", $date_fronleichnam);
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true;
// Fronleichnam
}
}
//print "ferie=".$ferie."\n";
// If we have to include saturday and sunday
if ($includesaturday || $includesunday)
{
$jour_julien = unixtojd($timestampStart);
$jour_semaine = jddayofweek($jour_julien, 0);
if ($includesaturday) //Saturday (6) and Sunday (0)
if (!$ferie) {
if ($includesaturday || $includesunday)
{
if ($jour_semaine == 6) $ferie = true;
}
if ($includesunday) //Saturday (6) and Sunday (0)
{
if ($jour_semaine == 0) $ferie = true;
$jour_julien = unixtojd($timestampStart);
$jour_semaine = jddayofweek($jour_julien, 0);
if ($includesaturday) //Saturday (6) and Sunday (0)
{
if ($jour_semaine == 6) $ferie = true;
}
if ($includesunday) //Saturday (6) and Sunday (0)
{
if ($jour_semaine == 0) $ferie = true;
}
}
}
//print "ferie=".$ferie."\n";
// We increase the counter of non working day
if ($ferie) $nbFerie++;
@ -815,6 +840,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
$i++;
}
//print "nbFerie=".$nbFerie."\n";
return $nbFerie;
}

View File

@ -154,6 +154,8 @@ function getBrowserInfo($user_agent)
$os = 'unknown';
$phone = '';
$user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent
$detectmobile = new Mobile_Detect(null, $user_agent);
$tablet = $detectmobile->isTablet();
@ -709,11 +711,11 @@ if (!function_exists('dol_getprefix'))
*/
function dol_getprefix($mode = '')
{
global $conf;
// If prefix is for email
// If prefix is for email (we need to have $conf alreayd loaded for this case)
if ($mode == 'email')
{
global $conf;
if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
{
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
@ -727,12 +729,17 @@ if (!function_exists('dol_getprefix'))
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
}
// If prefix is for session (no need to have $conf loaded)
global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php
$tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
// The recommended value (may be not defined for old versions)
if (!empty($conf->file->instance_unique_id)) return $conf->file->instance_unique_id;
if (!empty($tmp_instance_unique_id)) {
return $tmp_instance_unique_id;
}
// For backward compatibility
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
{
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
}
@ -1881,54 +1888,44 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address);
}
// Zip/Town/State
if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) // US: title firstname name \n address lines \n town, state, zip \n country
{
if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town;
if ($object->state)
{
if (!empty($object->state)) {
$ret .= ($ret ? ", " : '').$object->state;
}
if ($object->zip) $ret .= ($ret ? ", " : '').$object->zip;
} elseif (in_array($object->country_code, array('GB', 'UK'))) // UK: title firstname name \n address lines \n town state \n zip \n country
{
} elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town;
if ($object->state)
{
if (!empty($object->state)) {
$ret .= ($ret ? ", " : '').$object->state;
}
if ($object->zip) $ret .= ($ret ? $sep : '').$object->zip;
} elseif (in_array($object->country_code, array('ES', 'TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country
{
} elseif (isset($object->country_code) && in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
$ret .= ($ret ? $sep : '').$object->zip;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
if ($object->state)
{
if (!empty($object->state)) {
$ret .= "\n".$object->state;
}
} elseif (in_array($object->country_code, array('IT'))) // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
{
} elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
$ret .= ($ret ? $sep : '').$object->zip;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
$ret .= ($object->state_code ? (' '.($object->state_code)) : '');
} else // Other: title firstname name \n address lines \n zip town \n country
{
$ret .= (empty($object->state_code) ? '' : (' '.$object->state_code));
} else { // Other: title firstname name \n address lines \n zip town \n country
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
$ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : '');
if ($object->state && in_array($object->country_code, $countriesusingstate))
{
if (!empty($object->state) && in_array($object->country_code, $countriesusingstate)) {
$ret .= ($ret ? ", " : '').$object->state;
}
}
if (!is_object($outputlangs)) $outputlangs = $langs;
if ($withcountry)
{
if ($withcountry) {
$langs->load("dict");
$ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : '');
$ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
}
return $ret;
@ -3221,14 +3218,15 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice',
'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label',
'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_lot', 'object_mrp', 'object_other',
'object_payment', 'object_pdf', 'object_product', 'object_propal',
'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_shipment', 'object_share-alt', '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',
'paiment', 'play', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
'paiment', 'play', 'pdf', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
@ -3240,18 +3238,18 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
)
)) {
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
$fakey = $pictowithouttext;
$facolor = ''; $fasize = '';
$fa = 'fas';
if (in_array($pictowithouttext, array('clock', 'object_generic', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
if (in_array($pictowithouttext, array('clock', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
$fa = 'far';
}
if (in_array($pictowithouttext, array('black-tie', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) {
$fa = 'fab';
}
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
$arrayconvpictotofa = array(
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
@ -3271,10 +3269,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'refresh'=>'redo', 'resource'=>'laptop-house',
'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
@ -4803,7 +4801,7 @@ function price2num($amount, $rounding = '', $option = 0)
if ($option != 1) { // If not a PHP number or unknown, we change or clean format
//print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>';
if (!is_numeric($amount)) {
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\-]/', '', $amount);
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount);
}
if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123
@ -5152,17 +5150,17 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid
/**
* Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
* This does not take into account the seller setup if subject to vat or not, only country.
* TODO
* This function is ALSO called to retrieve type for building PDF. Such call of function must be removed.
* Instead this function must be called when adding a line to get the array of localtax and type, and then
* provide it to the function calcul_price_total.
*
* TODO This function is ALSO called to retrieve type for building PDF. Such call of function must be removed.
* Instead this function must be called when adding a line to get the array of possible values for localtax and type, and then
* provide the selected value to the function calcul_price_total.
*
* @param int|string $vatrate VAT ID or Rate+Code. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param Societe $buyer Company object
* @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can)
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp)
* @return array array(localtax_type1(1-6 or 0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp)
* @see getTaxesFromId()
*/
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0)
@ -5174,13 +5172,13 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
// Search local taxes
$sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
if ($firstparamisid) $sql .= " WHERE t.rowid = ".(int) $vatrate;
else {
if ($firstparamisid) {
$sql .= " WHERE t.rowid = ".(int) $vatrate;
} else {
$vatratecleaned = $vatrate;
$vatratecode = '';
$reg = array();
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
{
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "x.x (yy)"
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
@ -5193,20 +5191,19 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
}
$resql = $db->query($sql);
if ($resql)
{
if ($resql) {
$obj = $db->fetch_object($resql);
$vateratestring = $obj->rate.($obj->code ? ' ('.$obj->code.')' : '');
if ($obj) {
$vateratestring = $obj->rate.($obj->code ? ' ('.$obj->code.')' : '');
if ($local == 1)
{
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} elseif ($local == 2)
{
return array($obj->localtax2_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} else {
return array($obj->localtax1_type, get_localtax($vateratestring, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vateratestring, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
if ($local == 1) {
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} elseif ($local == 2) {
return array($obj->localtax2_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} else {
return array($obj->localtax1_type, get_localtax($vateratestring, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vateratestring, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
}
}
@ -5703,9 +5700,11 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean);
$temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
// We remove entities BEFORE stripping (in case of a separator char is encoded and not the other, the strip will fails)
// We remove entities BEFORE stripping (in case of an open separator char that is entity encoded and not the closing other, the strip will fails)
$temp = dol_html_entity_decode($temp, ENT_COMPAT | ENT_HTML5, $pagecodeto);
$temp = str_replace('< ', '__ltspace__', $temp);
if ($strip_tags) {
$temp = strip_tags($temp);
} else {
@ -5729,16 +5728,19 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
}
}
$temp = str_replace('__ltspace__', '< ', $temp);
return trim($temp);
}
/**
* Clean a string to keep only desirable HTML tags.
* WARNING: This also clean HTML comments (used to obfuscate tag name).
*
* @param string $stringtoclean String to clean
* @param int $cleanalsosomestyles Remove absolute/fixed positioning from inline styles
* @param int $removeclassattribute Remove the class attribute from tags
* @param int $cleanalsojavascript Remove also occurence of (javascript:'
* @param int $cleanalsojavascript Remove also occurence of 'javascript:'.
* @return string String cleaned
*
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags()
@ -5756,16 +5758,21 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
$stringtoclean = dol_string_nounprintableascii($stringtoclean, 0);
$stringtoclean = preg_replace('/&colon;/i', ':', $stringtoclean);
$stringtoclean = preg_replace('/<!--[^>]*-->/', '', $stringtoclean);
$stringtoclean = preg_replace('/&#58;|&#0000058|&#x3A/i', '', $stringtoclean); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
$stringtoclean = preg_replace('/javascript\s*:/i', '', $stringtoclean);
$temp = strip_tags($stringtoclean, $allowed_tags_string);
if ($cleanalsosomestyles) { // Clean for remaining html tags
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
$temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
}
if ($removeclassattribute) { // Clean for remaining html tags
$stringtoclean = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $temp);
$temp = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $temp);
}
// Remove 'javascript:' that we should not find into a text with
// Warning: This is not reliable to fight against obfuscated javascript, there is a lot of other solution to include js into a common html tag (only filtered by the GETPOST).
if ($cleanalsojavascript) {
$temp = preg_replace('/javascript\s*:/i', '', $temp);
}

View File

@ -19,7 +19,7 @@
/**
* \file htdocs/core/lib/phpsessionindb.lib.php
* \ingroup core
* \brief Set function handlers for PHP session management in DB
* \brief Set function handlers for PHP session management in DB.
*/
// The session handler file must be included just after the call of the master.inc.php into main.inc.php

View File

@ -129,14 +129,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$localtax1_type = 0;
$localtax2_type = 0;
if (is_array($localtaxes_array))
{
if (is_array($localtaxes_array)) {
$localtax1_type = $localtaxes_array[0];
$localtax1_rate = $localtaxes_array[1];
$localtax2_type = $localtaxes_array[2];
$localtax2_rate = $localtaxes_array[3];
} else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code)
{
} else {
// deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code)
// also, with this method, we may get several possible values (for example with localtax2 in spain), so we take the first one.
dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING);
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
@ -149,11 +149,11 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$obj = $db->fetch_object($resql);
if ($obj)
{
$localtax1_rate = $obj->localtax1;
$localtax2_rate = $obj->localtax2;
$localtax1_rate = (float) $obj->localtax1; // Use float to force to get first numeric value when value is x:y:z
$localtax2_rate = (float) $obj->localtax2; // Use float to force to get first numeric value when value is -19:-15:-9
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
//var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);exit;
//var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);
}
} else dol_print_error($db);
}
@ -417,7 +417,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// initialize result array
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.$conf->global->MAIN_ROUNDING_RULE_TOT.' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.(empty($conf->global->MAIN_ROUNDING_RULE_TOT)?'':$conf->global->MAIN_ROUNDING_RULE_TOT).' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
return $result;
}

View File

@ -639,7 +639,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
* @param int $printheader Show header before
* @param int $printfooter Show footer after
* @param int $showonlymessage Show only message parameter. Otherwise add more information.
* @param array|null $params Send params
* @param array|null $params More parameters provided to hook
* @return void
*/
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)

File diff suppressed because it is too large Load Diff

View File

@ -67,12 +67,15 @@ class MenuManager
global $conf, $user, $langs;
// We save into session the main menu selected
if (GETPOSTISSET("mainmenu")) $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09');
if (GETPOSTISSET("idmenu")) $_SESSION["idmenu"] = GETPOST("idmenu", 'int');
if (GETPOSTISSET("mainmenu")) {
$_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09');
}
if (GETPOSTISSET("idmenu")) {
$_SESSION["idmenu"] = GETPOST("idmenu", 'int');
}
// Read now mainmenu and leftmenu that define which menu to show
if (GETPOSTISSET("mainmenu"))
{
if (GETPOSTISSET("mainmenu")) {
// On sauve en session le menu principal choisi
$mainmenu = GETPOST("mainmenu", 'aZ09');
$_SESSION["mainmenu"] = $mainmenu;
@ -81,16 +84,16 @@ class MenuManager
// On va le chercher en session si non defini par le lien
$mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : '';
}
if (!empty($forcemainmenu)) $mainmenu = $forcemainmenu;
if (!empty($forcemainmenu)) {
$mainmenu = $forcemainmenu;
}
if (GETPOSTISSET("leftmenu"))
{
if (GETPOSTISSET("leftmenu")) {
// On sauve en session le menu principal choisi
$leftmenu = GETPOST("leftmenu", 'aZ09');
$_SESSION["leftmenu"] = $leftmenu;
if ($_SESSION["leftmenuopened"] == $leftmenu) // To collapse
{
if ($_SESSION["leftmenuopened"] == $leftmenu) { // To collapse
//$leftmenu="";
$_SESSION["leftmenuopened"] = "";
} else {
@ -100,7 +103,9 @@ class MenuManager
// On va le chercher en session si non defini par le lien
$leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : '';
}
if (!empty($forceleftmenu)) $leftmenu = $forceleftmenu;
if (!empty($forceleftmenu)) {
$leftmenu = $forceleftmenu;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
$tabMenu = array();
@ -129,8 +134,7 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
if ($this->type_user == 1)
{
if ($this->type_user == 1) {
$conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
$conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
}
@ -138,36 +142,39 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu = new Menu();
if (empty($conf->global->MAIN_MENU_INVERT))
{
if ($mode == 'top') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
if ($mode == 'left') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata);
if (empty($conf->global->MAIN_MENU_INVERT)) {
if ($mode == 'top') {
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
}
if ($mode == 'left') {
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata, $this->type_user);
}
} else {
$conf->global->MAIN_SHOW_LOGO = 0;
if ($mode == 'top') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0);
if ($mode == 'left') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
if ($mode == 'top') {
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata, $this->type_user);
}
if ($mode == 'left') {
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
}
}
if ($mode == 'topnb')
{
if ($mode == 'topnb') {
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // no output
return $this->menu->getNbOfVisibleMenuEntries();
}
if ($mode == 'jmobile') // Used to get menu in xml ul/li
{
if ($mode == 'jmobile') { // Used to get menu in xml ul/li
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // Fill this->menu that is empty with top menu
// $this->menu->liste is top menu
//var_dump($this->menu->liste);exit;
$lastlevel = array();
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach ($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">';
if ($val['enabled'] == 1)
{
if ($val['enabled'] == 1) {
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray['__USERID__'] = $user->id; // For backward compatibility
$val['url'] = make_substitutions($val['url'], $substitarray);
@ -178,7 +185,9 @@ class MenuManager
print '<a class="alilevel0" href="#">';
// Add font-awesome
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
if ($val['level'] == 0 && $val['mainmenu'] == 'home') {
print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
}
print $val['titre'];
print '</a>'."\n";
@ -187,7 +196,7 @@ class MenuManager
$tmpmainmenu = $val['mainmenu'];
$tmpleftmenu = 'all';
$submenu = new Menu();
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu, null, $this->type_user); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
// Note: $submenu contains menu entry with substitution not yet done
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
@ -199,27 +208,27 @@ class MenuManager
//var_dump($canonnexturl);
print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false))
{
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
// We add sub entry
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">';
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
{
if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) print $langs->trans("Access");
else print $langs->trans("Dashboard");
} else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") { // No translation
if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) {
print $langs->trans("Access");
} else {
print $langs->trans("Dashboard");
}
} else {
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
}
print '</a>';
print '</li>'."\n";
}
if ($val['level'] == 0)
{
if ($val['enabled'])
{
if ($val['level'] == 0) {
if ($val['enabled']) {
$lastlevel[0] = 'enabled';
} elseif ($showmenu) // Not enabled but visible (so greyed)
{
} elseif ($showmenu) { // Not enabled but visible (so greyed)
$lastlevel[0] = 'greyed';
} else {
$lastlevel[0] = 'hidden';
@ -227,52 +236,52 @@ class MenuManager
}
$lastlevel2 = array();
foreach ($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
$showmenu = true;
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu = false;
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) {
$showmenu = false;
}
// If at least one parent is not enabled, we do not show any menu of all children
if ($val2['level'] > 0)
{
if ($val2['level'] > 0) {
$levelcursor = $val2['level'] - 1;
while ($levelcursor >= 0)
{
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu = false;
while ($levelcursor >= 0) {
if ($lastlevel2[$levelcursor] != 'enabled') {
$showmenu = false;
}
$levelcursor--;
}
}
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
{
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray['__USERID__'] = $user->id; // For backward compatibility
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
if ($showmenu) { // Visible (option to hide when not allowed is off or allowed)
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray['__USERID__'] = $user->id; // For backward compatibility
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url']))
{
$relurl2 = dol_buildpath($val2['url'], 1);
} else {
$relurl2 = $val2['url'];
}
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url'])) {
$relurl2 = dol_buildpath($val2['url'], 1);
} else {
$relurl2 = $val2['url'];
}
$canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) $relurl2 = '';
if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) {
$relurl2 = '';
}
$disabled = '';
if (!$val2['enabled'])
{
if (!$val2['enabled']) {
$disabled = " vsmenudisabled";
}
print str_pad('', $val2['level'] + 1);
print '<li class="lilevel'.($val2['level'] + 1);
if ($val2['level'] == 0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
if ($val2['level'] == 0) {
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
}
print $disabled.'">'; // ui-btn to highlight on clic
if ($relurl2)
{
if ($val2['enabled']) // Allowed
{
if ($relurl2) {
if ($val2['enabled']) { // Allowed
print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"';
print '>';
@ -283,28 +292,27 @@ class MenuManager
$lastlevel2[$val2['level']] = 'greyed';
}
} else {
if ($val2['enabled']) // Allowed
{
if ($val2['enabled']) { // Allowed
$lastlevel2[$val2['level']] = 'enabled';
} else {
$lastlevel2[$val2['level']] = 'greyed';
}
}
print $val2['titre'];
if ($relurl2)
{
if ($val2['enabled']) // Allowed
if ($relurl2) {
if ($val2['enabled']) { // Allowed
print '</a>';
else print '</a>';
} else {
print '</a>';
}
}
print '</li>'."\n";
}
}
}
}
//var_dump($submenu);
print '</ul>';
}
if ($val['enabled'] == 2)
{
if ($val['enabled'] == 2) {
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
}
print '</li>';

View File

@ -84,20 +84,19 @@ class MenuManager
$noout = 0;
//if ($mode == 'jmobile') $noout=1;
if ($mode == 'topnb')
{
if ($mode == 'topnb') {
return 1;
}
if ($mode == 'top')
{
if (empty($noout)) print_start_menu_array_empty();
if ($mode == 'top') {
if (empty($noout)) {
print_start_menu_array_empty();
}
$usemenuhider = 1;
// Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$showmode = 1;
$classname = 'class="tmenu menuhider"';
$idsel = 'menu';
@ -117,28 +116,37 @@ class MenuManager
$this->menu->liste = dol_sort_array($this->menu->liste, 'position');
// Output menu entries
foreach ($this->menu->liste as $menkey => $menuval)
{
if (empty($noout)) print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
if (empty($noout)) print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget));
if (empty($noout)) print_end_menu_entry_empty($menuval['enabled']);
foreach ($this->menu->liste as $menkey => $menuval) {
if (empty($noout)) {
print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
}
if (empty($noout)) {
print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget));
}
if (empty($noout)) {
print_end_menu_entry_empty($menuval['enabled']);
}
}
$showmode = 1;
if (empty($noout)) print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
if (empty($noout)) print_end_menu_entry_empty($showmode);
if (empty($noout)) {
print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
}
if (empty($noout)) {
print_end_menu_entry_empty($showmode);
}
if (empty($noout)) print_end_menu_array_empty();
if (empty($noout)) {
print_end_menu_array_empty();
}
if ($mode == 'jmobile')
{
if ($mode == 'jmobile') {
$this->topmenu = clone $this->menu;
unset($this->menu->liste);
}
}
if ($mode == 'jmobile') // Used to get menu in xml ul/li
{
if ($mode == 'jmobile') { // Used to get menu in xml ul/li
// Home
$showmode = 1;
$classname = 'class="tmenusel"';
@ -152,22 +160,22 @@ class MenuManager
//var_dump($this->menu->liste);exit;
$lastlevel = array();
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach ($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">';
$val['url'] = make_substitutions($val['url'], $substitarray);
if ($val['enabled'] == 1)
{
if ($val['enabled'] == 1) {
$relurl = dol_buildpath($val['url'], 1);
$canonurl = preg_replace('/\?.*$/', '', $val['url']);
print '<a class="alilevel0" href="#">';
// Add font-awesome
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
if ($val['level'] == 0 && $val['mainmenu'] == 'home') {
print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
}
print $val['titre'];
print '</a>'."\n";
@ -206,27 +214,27 @@ class MenuManager
//var_dump($canonnexturl);
print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false))
{
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
// We add sub entry
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">';
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
{
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access");
else print $langs->trans("Dashboard");
} else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") { // No translation
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) {
print $langs->trans("Access");
} else {
print $langs->trans("Dashboard");
}
} else {
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
}
print '</a>';
print '</li>'."\n";
}
if ($val['level'] == 0)
{
if ($val['enabled'])
{
if ($val['level'] == 0) {
if ($val['enabled']) {
$lastlevel[0] = 'enabled';
} elseif ($showmenu) // Not enabled but visible (so greyed)
{
} elseif ($showmenu) { // Not enabled but visible (so greyed)
$lastlevel[0] = 'greyed';
} else {
$lastlevel[0] = 'hidden';
@ -234,45 +242,46 @@ class MenuManager
}
$lastlevel2 = array();
foreach ($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
$showmenu = true;
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu = false;
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) {
$showmenu = false;
}
// If at least one parent is not enabled, we do not show any menu of all children
if ($val2['level'] > 0)
{
if ($val2['level'] > 0) {
$levelcursor = $val2['level'] - 1;
while ($levelcursor >= 0)
{
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu = false;
while ($levelcursor >= 0) {
if ($lastlevel2[$levelcursor] != 'enabled') {
$showmenu = false;
}
$levelcursor--;
}
}
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
{
if ($showmenu) { // Visible (option to hide when not allowed is off or allowed)
$val2['url'] = make_substitutions($val2['url'], $substitarray);
$relurl2 = dol_buildpath($val2['url'], 1);
$canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) $relurl2 = '';
if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) {
$relurl2 = '';
}
$disabled = '';
if (!$val2['enabled'])
{
if (!$val2['enabled']) {
$disabled = " vsmenudisabled";
}
print str_pad('', $val2['level'] + 1);
print '<li class="lilevel'.($val2['level'] + 1);
if ($val2['level'] == 0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
if ($val2['level'] == 0) {
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
}
print $disabled.'">'; // ui-btn to highlight on clic
if ($relurl2)
{
if ($val2['enabled']) // Allowed
{
if ($relurl2) {
if ($val2['enabled']) { // Allowed
print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"';
print '>';
@ -283,8 +292,7 @@ class MenuManager
$lastlevel2[$val2['level']] = 'greyed';
}
} else {
if ($val2['enabled']) // Allowed
{
if ($val2['enabled']) { // Allowed
$lastlevel2[$val2['level']] = 'enabled';
} else {
$lastlevel2[$val2['level']] = 'greyed';
@ -293,8 +301,7 @@ class MenuManager
//var_dump($val2['level']);
//var_dump($lastlevel2);
print $val2['titre'];
if ($relurl2)
{
if ($relurl2) {
if ($val2['enabled']) {
// Allowed
print '</a>';
@ -308,8 +315,7 @@ class MenuManager
//var_dump($submenu);
print '</ul>';
}
if ($val['enabled'] == 2)
{
if ($val['enabled'] == 2) {
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
}
print '</li>';
@ -317,8 +323,7 @@ class MenuManager
}
}
if ($mode == 'left')
{
if ($mode == 'left') {
// Put here left menu entries
// ***** START *****
@ -345,26 +350,23 @@ class MenuManager
// do not change code after this
if (empty($noout))
{
if (empty($noout)) {
$alt = 0; $altok = 0; $blockvmenuopened = false;
$num = count($this->menu->liste);
for ($i = 0; $i < $num; $i++)
{
for ($i = 0; $i < $num; $i++) {
$alt++;
if (empty($this->menu->liste[$i]['level']))
{
if (empty($this->menu->liste[$i]['level'])) {
$altok++;
$blockvmenuopened = true;
$lastopened = true;
for ($j = ($i + 1); $j < $num; $j++)
{
if (empty($menu_array[$j]['level'])) $lastopened = false;
for ($j = ($i + 1); $j < $num; $j++) {
if (empty($menu_array[$j]['level'])) {
$lastopened = false;
}
}
$alt = 0; // For menu manager "empty", we force to not have blockvmenufirst defined
$lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
if (($alt % 2 == 0))
{
if (($alt % 2 == 0)) {
print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n";
} else {
print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n";
@ -374,17 +376,14 @@ class MenuManager
// Add tabulation
$tabstring = '';
$tabul = ($this->menu->liste[$i]['level'] - 1);
if ($tabul > 0)
{
for ($j = 0; $j < $tabul; $j++)
{
if ($tabul > 0) {
for ($j = 0; $j < $tabul; $j++) {
$tabstring .= '&nbsp; &nbsp;';
}
}
if ($this->menu->liste[$i]['level'] == 0) {
if ($this->menu->liste[$i]['enabled'])
{
if ($this->menu->liste[$i]['enabled']) {
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>'.$this->menu->liste[$i]['titre'].'</a></div>'."\n";
} else {
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu->liste[$i]['titre'].'</font></div>'."\n";
@ -392,42 +391,50 @@ class MenuManager
print '<div class="menu_top"></div>'."\n";
}
if ($this->menu->liste[$i]['level'] > 0)
{
if ($this->menu->liste[$i]['level'] > 0) {
$cssmenu = '';
if ($this->menu->liste[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $this->menu->liste[$i]['url']));
if ($this->menu->liste[$i]['url']) {
$cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $this->menu->liste[$i]['url']));
}
print '<div class="menu_contenu'.$cssmenu.'">';
if ($this->menu->liste[$i]['enabled'])
{
if ($this->menu->liste[$i]['enabled']) {
print $tabstring;
if ($this->menu->liste[$i]['url']) print '<a class="vsmenu" itle="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu" title="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'">';
if ($this->menu->liste[$i]['url']) print $this->menu->liste[$i]['titre'].'</a>';
else print '</span>';
if ($this->menu->liste[$i]['url']) {
print '<a class="vsmenu" itle="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>';
} else {
print '<span class="vsmenu" title="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'">';
}
if ($this->menu->liste[$i]['url']) {
print $this->menu->liste[$i]['titre'].'</a>';
} else {
print '</span>';
}
} else {
print $tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$this->menu->liste[$i]['titre'].'</font>';
}
// If title is not pure text and contains a table, no carriage return added
if (!strstr($this->menu->liste[$i]['titre'], '<table')) print '<br>';
if (!strstr($this->menu->liste[$i]['titre'], '<table')) {
print '<br>';
}
print '</div>'."\n";
}
// If next is a new block or end
if (empty($this->menu->liste[$i + 1]['level']))
{
if (empty($this->menu->liste[$i + 1]['level'])) {
print '<div class="menu_end"></div>'."\n";
print "</div>\n";
}
}
if ($altok) print '<div class="blockvmenuend"></div>';
if ($altok) {
print '<div class="blockvmenuend"></div>';
}
}
if ($mode == 'jmobile')
{
if ($mode == 'jmobile') {
$this->leftmenu = clone $this->menu;
unset($this->menu->liste);
}
@ -442,7 +449,7 @@ class MenuManager
print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">';
$val['url'] = make_substitutions($val['url'], $substitarray);
$val['url'] = make_substitutions($val['url'], $substitarray);
if ($val['enabled'] == 1)
{
@ -453,7 +460,7 @@ class MenuManager
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
//$submenu=new Menu();
//$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
//$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu, null, $this->type_user);
//$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$submenu=$this->leftmenu;
@ -462,14 +469,14 @@ class MenuManager
//var_dump($canonrelurl);
//var_dump($canonnexturl);
print '<ul>';
if ($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('home','tools')))
if ($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('home','tools')))
{
// We add sub entry
print '<li><a href="'.$relurl.'">'.$langs->trans("MainArea").'-'.$val['titre'].'</a></li>'."\n";
}
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
$val2['url'] = make_substitutions($val2['url'], $substitarray);
$val2['url'] = make_substitutions($val2['url'], $substitarray);
$relurl2=dol_buildpath($val2['url'],1);
//var_dump($val2);
@ -488,7 +495,7 @@ class MenuManager
break; // Only first menu entry (so home)
}
}
*/
*/
unset($this->menu);
return $res;
@ -519,8 +526,7 @@ function print_start_menu_array_empty()
*/
function print_start_menu_entry_empty($idsel, $classname, $showmode)
{
if ($showmode)
{
if ($showmode) {
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
//print '<div class="tmenuleft tmenusep"></div>';
print '<div class="tmenucenter">';
@ -543,8 +549,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
{
global $conf, $langs;
if ($showmode == 1)
{
if ($showmode == 1) {
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
@ -554,8 +559,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
print '</span>';
print '</a>';
}
if ($showmode == 2)
{
if ($showmode == 2) {
print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
}
@ -569,8 +573,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
*/
function print_end_menu_entry_empty($showmode)
{
if ($showmode)
{
if ($showmode) {
print '</div></li>';
print "\n";
}

View File

@ -454,6 +454,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Replace tags of object + external modules
$tmparray = $this->get_substitutionarray_shipment($object, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);

View File

@ -166,14 +166,14 @@ class pdf_espadon extends ModelePdfExpedition
if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
$outputlangs->loadLangs(array("main", "bills", "orders", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
global $outputlangsbis;
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
$outputlangsbis = new Translate('', $conf);
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
$outputlangsbis->loadLangs(array("main", "bills", "orders", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
}
$nblines = count($object->lines);

View File

@ -453,7 +453,7 @@ class pdf_merou extends ModelePdfExpedition
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Translations
$langs->loadLangs(array("main", "bills"));
$langs->loadLangs(array("main", "bills", "orders"));
if (empty($hidetop))
{
@ -620,12 +620,12 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetFont('', 'B', $default_font_size - 3);
$pdf->SetTextColor(0, 0, 0);
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, 'day', false, $outputlangs, true), '', 'L');
$pdf->MultiCell(70, 8, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, 'day', false, $outputlangs, true), '', 'L');
$pdf->SetXY($blSocX - 80, $blSocY + 20);
$pdf->SetFont('', 'B', $default_font_size - 3);
$pdf->SetTextColor(0, 0, 0);
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, '', 'L');
$pdf->MultiCell(70, 8, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, '', 'L');
// Deliverer
$pdf->SetXY($blSocX - 80, $blSocY + 23);

View File

@ -142,8 +142,8 @@ class pdf_rouget extends ModelePdfExpedition
// Define position of columns
$this->posxdesc = $this->marge_gauche + 1;
$this->posxweightvol = $this->page_largeur - $this->marge_droite - 78;
$this->posxqtyordered = $this->page_largeur - $this->marge_droite - 56;
$this->posxweightvol = $this->page_largeur - $this->marge_droite - 82;
$this->posxqtyordered = $this->page_largeur - $this->marge_droite - 60;
$this->posxqtytoship = $this->page_largeur - $this->marge_droite - 28;
$this->posxpuht = $this->page_largeur - $this->marge_droite;

View File

@ -374,7 +374,7 @@ class modCategorie extends DolibarrModules
'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description",
'ca.fk_parent' => 'Parent'
);
$this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]');
$this->import_regex_array[$r] = array('ca.type'=>'^\d+$');
$this->import_convertvalue_array[$r] = array(
'ca.fk_parent' => array(
'rule' => 'fetchidfromcodeandlabel',

View File

@ -28,8 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/**
* \class ModeleThirdPartyDoc
* \brief Parent class for third parties models of doc generators
* Parent class for third parties models of doc generators
*/
abstract class ModeleThirdPartyDoc extends CommonDocGenerator
{
@ -62,8 +61,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
}
/**
* \class ModeleThirdPartyCode
* \brief Parent class for third parties code generators
* Parent class for third parties code generators
*/
abstract class ModeleThirdPartyCode
{
@ -72,6 +70,12 @@ abstract class ModeleThirdPartyCode
*/
public $error = '';
/**
* @var array Error code (or message) array
*/
public $errors;
/** Renvoi la description par defaut du modele de numerotation
*
* @param Translate $langs Object langs

View File

@ -717,20 +717,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Load translation files required by the page
if (empty($object->actionmsg2)) {
$langs->loadLangs(array("agenda", "other"));
if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
$object->actionmsg2 = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref));
if ($langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action."InDolibarr") { // specific translation key
$object->actionmsg2 = $langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
} else { // generic translation key
$tmp = explode('_', $action);
$object->actionmsg2 = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", ($object->newref ? $object->newref : $object->ref));
$object->actionmsg2 = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
}
}
if (empty($object->actionmsg)) {
$langs->loadLangs(array("agenda", "other"));
if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
$object->actionmsg = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref));
if ($langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action."InDolibarr") { // specific translation key
$object->actionmsg = $langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
} else { // generic translation key
$tmp = explode('_', $action);
$object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", ($object->newref ? $object->newref : $object->ref));
$object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
}
}
@ -787,8 +787,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
}
// Set societeforaction.
if ($object->socid > 0) $societeforaction->fetch($object->socid);
elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
if (isset($object->socid) && $object->socid > 0) $societeforaction->fetch($object->socid);
elseif (isset($object->fk_soc) && $object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
$projectid = isset($object->fk_project) ? $object->fk_project : 0;
if ($object->element == 'project') $projectid = $object->id;

View File

@ -65,6 +65,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('suppliercard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
if ($object->id > 0) {
if (!($object->fournisseur > 0) || empty($user->rights->fournisseur->lire)) {
accessforbidden();
}
}
/*
* Action

View File

@ -61,11 +61,15 @@ class ProductFournisseur extends Product
* @see $ref_supplier
*/
public $fourn_ref;
public $delivery_time_days;
public $ref_supplier; // ref supplier (can be set by get_buyprice)
public $desc_supplier;
public $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
public $product_id;
public $product_ref;
public $fourn_id; //supplier id
public $fourn_qty; // quantity for price (can be set by get_buyprice)
public $fourn_pu; // unit price for quantity (can be set by get_buyprice)
@ -73,7 +77,9 @@ class ProductFournisseur extends Product
public $fourn_price; // price for quantity
public $fourn_remise_percent; // discount for quantity (percent)
public $fourn_remise; // discount for quantity (amount)
public $product_fourn_id; // product-supplier id
public $product_fourn_entity;
/**
* @var int ID user_id - user who created/updated supplier price
@ -516,10 +522,11 @@ class ProductFournisseur extends Product
$sql .= " pfp.fk_soc, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,";
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
$sql .= " pfp.barcode, pfp.fk_barcode_type";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging,";
$sql .= " p.ref as product_ref";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
$sql .= " AND pfp.fk_product = p.rowid";
dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -530,8 +537,11 @@ class ProductFournisseur extends Product
{
$this->product_fourn_price_id = $rowid;
$this->id = $obj->fk_product;
$this->fk_product = $obj->fk_product;
$this->product_id = $obj->fk_product; // deprecated
$this->product_id = $obj->fk_product;
$this->product_ref = $obj->product_ref;
$this->fourn_id = $obj->fk_soc;
$this->fourn_ref = $obj->ref_fourn; // deprecated
$this->ref_supplier = $obj->ref_fourn;
@ -590,7 +600,7 @@ class ProductFournisseur extends Product
return 0;
}
} else {
$this->error = $this->db->error();
$this->error = $this->db->lasterror();
return -1;
}
}
@ -612,15 +622,15 @@ class ProductFournisseur extends Product
// phpcs:enable
global $conf;
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref,";
$sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
$sql .= " pfp.barcode, pfp.fk_barcode_type";
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
$sql .= " AND pfp.fk_soc = s.rowid";
$sql .= " AND pfp.fk_soc = s.rowid AND pfp.fk_product = p.rowid";
$sql .= " AND s.status=1"; // only enabled company selected
$sql .= " AND pfp.fk_product = ".$prodid;
if (empty($sortfield)) $sql .= " ORDER BY s.nom, pfp.quantity, pfp.price";
@ -638,11 +648,12 @@ class ProductFournisseur extends Product
//define base attribute
$prodfourn = new ProductFournisseur($this->db);
$prodfourn->product_ref = $record["product_ref"];
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
$prodfourn->product_fourn_id = $record["product_fourn_id"];
$prodfourn->product_fourn_entity = $record["entity"];
$prodfourn->fourn_ref = $record["ref_fourn"];
$prodfourn->ref_supplier = $record["ref_fourn"];
$prodfourn->fourn_ref = $record["ref_fourn"];
$prodfourn->desc_supplier = $record["desc_fourn"];
$prodfourn->fourn_price = $record["price"];
$prodfourn->fourn_qty = $record["quantity"];
@ -958,11 +969,13 @@ class ProductFournisseur extends Product
public function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0)
{
$sql = "SELECT";
$sql .= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec, u.lastname,";
$sql .= " pfpl.price, pfpl.quantity";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_log as pfpl";
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql .= ", ".MAIN_DB_PREFIX."user as u";
$sql .= " u.lastname,";
$sql .= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec,";
$sql .= " pfpl.price, pfpl.quantity,";
$sql .= " pfpl.fk_multicurrency, pfpl.multicurrency_code, pfpl.multicurrency_tx, pfpl.multicurrency_price, pfpl.multicurrency_unitprice";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_log as pfpl,";
$sql .= " ".MAIN_DB_PREFIX."product_fournisseur_price as pfp,";
$sql .= " ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE pfp.entity IN (".getEntity('productprice').")";
$sql .= " AND pfpl.fk_user = u.rowid";
$sql .= " AND pfp.rowid = pfpl.fk_product_fournisseur";
@ -986,6 +999,11 @@ class ProductFournisseur extends Product
$tmparray['lastname'] = $obj->lastname;
$tmparray['price'] = $obj->price;
$tmparray['quantity'] = $obj->quantity;
$tmparray['fk_multicurrency'] = $obj->fk_multicurrency;
$tmparray['multicurrency_code'] = $obj->multicurrency_code;
$tmparray['multicurrency_tx'] = $obj->multicurrency_tx;
$tmparray['multicurrency_price'] = $obj->multicurrency_price;
$tmparray['multicurrency_unitprice'] = $obj->multicurrency_unitprice;
$retarray[] = $tmparray;
}
@ -1007,19 +1025,23 @@ class ProductFournisseur extends Product
*/
public function displayPriceProductFournisseurLog($productFournLogList = array())
{
global $langs;
global $conf, $langs;
$out = '';
$langs->load("suppliers");
if (count($productFournLogList) > 0) {
$out .= '<table class="nobordernopadding" width="100%">';
$out .= '<table class="noborder centpercent">';
$out .= '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Date").'</td>';
$out .= '<td class="liste_titre right">'.$langs->trans("Price").'</td>';
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
foreach ($productFournLogList as $productFournLog) {
$out .= '<tr><td class="right">'.dol_print_date($productFournLog['datec'], 'dayhour', 'tzuser').'</td>';
$out .= '<td class="right">'.price($productFournLog['price']).'</td>';
$out .= '<td class="right">'.price($productFournLog['price'], 0, $langs, 1, -1, -1, $conf->currency);
if ($productFournLog['multicurrency_code'] != $conf->currency) {
$out .= ' ('.price($productFournLog['multicurrency_price'], 0, $langs, 1, -1, -1, $productFournLog['multicurrency_code']).')';
}
$out .= '</td>';
//$out.= '<td class="right">'.$productFournLog['quantity'].'</td>';
$out .= '<td>'.$productFournLog['lastname'].'</td></tr>';
}
@ -1050,7 +1072,7 @@ class ProductFournisseur extends Product
$label = '<u>'.$langs->trans("SupplierRef").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Product').':</b> '.$this->ref;
$label .= '<b>'.$langs->trans('Product').':</b> '.$this->product_ref;
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here

View File

@ -763,9 +763,9 @@ if ($id > 0 || !empty($ref)) {
// Select warehouse to force it everywhere
if (count($listwarehouses) > 1) {
print '<br>'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled);
print '<br>'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled, '', 'minwidth100 maxwidth300', 1);
} elseif (count($listwarehouses) == 1) {
print '<br>'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled);
print '<br>'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled, '', 'minwidth100 maxwidth300', 1);
}
print '</td>';

View File

@ -130,7 +130,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'cf.ref'=>'Ref',
'cf.ref_supplier'=>'RefSupplierOrder',
'cf.ref_supplier'=>'RefOrderSupplier',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
's.name_alias'=>"AliasNameShort",

View File

@ -193,10 +193,10 @@ function getPieChart($socid = 0)
{
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']);
$dolgraph->setWidth('100%');
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphthirdparties');
$result .= '<tr>';

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Get parameters
@ -49,7 +49,7 @@ $ref = GETPOST('ref', 'alpha');
$fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id);
// Load translation files required by the page
$langs->loadLangs(array("holiday", "mails"));
$langs->loadLangs(array("other", "holiday", "mails"));
$now = dol_now();
@ -999,10 +999,10 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance))
{
print $form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300');
print img_picto('', 'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500');
//print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
} else {
print $form->select_dolusers(GETPOST('fuserid', 'int') ? GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300');
print img_picto('', 'user').$form->select_dolusers(GETPOST('fuserid', 'int') ? GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500');
}
print '</td>';
print '</tr>';
@ -1019,7 +1019,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')' : '');
$arraytypeleaves[$val['rowid']] = $labeltoshow;
}
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : ''), 1);
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : ''), 1, 0, 0, '', 0, 0, 0, '', '', true);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td>';
print '</tr>';
@ -1048,7 +1048,6 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
print $form->textwithpicto($langs->trans("DateFinCP"), $langs->trans("LastDayOfHoliday"));
print '</td>';
print '<td>';
// Si la demande ne vient pas de l'agenda
if (!GETPOST('date_fin_')) {
print $form->selectDate(-1, 'date_fin_', 0, 0, 0, '', 1, 1);
} else {
@ -1067,13 +1066,14 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
$object = new Holiday($db);
$include_users = $object->fetch_users_approver_holiday();
if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
else {
if (empty($include_users)) {
print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
} else {
$defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator); // Will work only if supervisor has permission to approve so is inside include_users
if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver
if (GETPOST('valideur', 'int') > 0) $defaultselectuser = GETPOST('valideur', 'int');
$s = $form->select_dolusers($defaultselectuser, "valideur", 1, "", 0, $include_users);
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
$s = $form->select_dolusers($defaultselectuser, "valideur", 1, '', 0, $include_users, '', '0,'.$conf->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500');
print img_picto('', 'user').$form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
}
//print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent

View File

@ -1411,7 +1411,7 @@ class Holiday extends CommonObject
// Update each user counter
foreach ($users as $userCounter) {
$nbDaysToAdd = $typeleaves[$userCounter['type']]['newByMonth'];
$nbDaysToAdd = (isset($typeleaves[$userCounter['type']]['newByMonth']) ? $typeleaves[$userCounter['type']]['newByMonth'] : 0);
if (empty($nbDaysToAdd)) continue;
dol_syslog("We update leave type id ".$userCounter['type']." for user id ".$userCounter['rowid'], LOG_DEBUG);

View File

@ -1,42 +0,0 @@
<?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/holiday/common.inc.php
* \ingroup holiday
* \brief Common load of data
*/
require_once realpath(__DIR__).'/../main.inc.php';
if (!class_exists('Holiday')) {
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('user', 'other', 'holiday'));
if (empty($conf->holiday->enabled))
{
llxHeader('', $langs->trans('CPTitreMenu'));
print '<div class="tabBar">';
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
print '</div>';
llxFooter();
exit();
}

View File

@ -28,10 +28,10 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
// Load translation files required by the page
$langs->loadlangs(array('users', 'hrm'));
$langs->loadlangs(array('users', 'other', 'holiday', 'hrm'));
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'defineholidaylist';
@ -56,7 +56,7 @@ if (!$sortorder) $sortorder = "ASC";
if ($user->socid > 0) accessforbidden();
// If the user does not have perm to read the page
if (!$user->rights->holiday->read) accessforbidden();
if (empty($user->rights->holiday->read)) accessforbidden();
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
@ -65,6 +65,17 @@ $extrafields = new ExtraFields($db);
$holiday = new Holiday($db);
if (empty($conf->holiday->enabled))
{
llxHeader('', $langs->trans('CPTitreMenu'));
print '<div class="tabBar">';
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
print '</div>';
llxFooter();
exit();
}
/*
* Actions

View File

@ -32,12 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('users', 'holiday', 'hrm'));
$langs->loadLangs(array('users', 'other', 'holiday', 'hrm'));
// Protection if external user
if ($user->socid > 0) accessforbidden();
@ -152,6 +152,15 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
}
}
if (empty($conf->holiday->enabled))
{
llxHeader('', $langs->trans('CPTitreMenu'));
print '<div class="tabBar">';
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
print '</div>';
llxFooter();
exit();
}
/*

View File

@ -179,8 +179,8 @@ print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm');
// Selection filter
print '<div class="tabBar">';
print $formother->select_month($search_month, 'remonth');
print $formother->select_year($search_year, 'reyear');
print $formother->select_month($search_month, 'remonth', 0, 0, 'minwidth50 maxwidth75imp valignmiddle', true);
print $formother->selectyear($search_year, 'reyear', 0, 10, 5, 0, 0, '', 'valignmiddle width75', true);
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Search")).'" />';
print '</div>';
print '<br>';

View File

@ -34,7 +34,7 @@ if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@ -72,7 +72,7 @@ if (!$sortorder) $sortorder = "DESC";
if (!$user->rights->holiday->readall) accessforbidden();
// Load translation files required by the page
$langs->load('users');
$langs->loadLangs(array('users', 'other', 'holiday'));
// Initialize technical objects
$object = new Holiday($db);
@ -83,6 +83,16 @@ $hookmanager->initHooks(array('leavemovementlist')); // Note that conf->hooks_mo
$arrayfields = array();
$arrayofmassactions = array();
if (empty($conf->holiday->enabled))
{
llxHeader('', $langs->trans('CPTitreMenu'));
print '<div class="tabBar">';
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
print '</div>';
llxFooter();
exit();
}
/*
* Actions
@ -263,9 +273,9 @@ if (!empty($arrayfields['cpl.rowid']['checked'])) {
// Filter: Date
if (!empty($arrayfields['cpl.date_action']['checked'])) {
print '<td class="liste_titre right">';
print '<td class="liste_titre center">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'maxwidth200', true);
print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'valignmiddle width75', true);
print '</td>';
}

View File

@ -424,7 +424,11 @@ if ($step == 2 && $datatoimport)
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<span class="opacitymedium">'.$langs->trans("ChooseFormatOfFileToImport", img_picto('', 'next', '')).'</span><br><br>';
print '<span class="opacitymedium">';
$s = $langs->trans("ChooseFormatOfFileToImport", '{s1}');
$s = str_replace('{s1}', img_picto('', 'next'), $s);
print $s;
print '</span><br><br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
@ -542,14 +546,18 @@ if ($step == 3 && $datatoimport)
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<input type="hidden" value="'.$step.'" name="step">';
print '<input type="hidden" value="'.$format.'" name="format">';
print '<input type="hidden" value="'.dol_escape_htmltag($format).'" name="format">';
print '<input type="hidden" value="'.$excludefirstline.'" name="excludefirstline">';
print '<input type="hidden" value="'.$endatlinenb.'" name="endatlinenb">';
print '<input type="hidden" value="'.dol_escape_htmltag($separator).'" name="separator">';
print '<input type="hidden" value="'.dol_escape_htmltag($enclosure).'" name="enclosure">';
print '<input type="hidden" value="'.$datatoimport.'" name="datatoimport">';
print '<input type="hidden" value="'.dol_escape_htmltag($datatoimport).'" name="datatoimport">';
print '<span class="opacitymedium">'.$langs->trans("ChooseFileToImport", img_picto('', 'next')).'</span><br><br>';
print '<span class="opacitymedium">';
$s = $langs->trans("ChooseFileToImport", '{s1}');
$s = str_replace('{s1}', img_picto('', 'next'), $s);
print $s;
print '</span><br><br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
@ -857,7 +865,11 @@ if ($step == 4 && $datatoimport)
print '<input type="hidden" name="enclosure" value="'.dol_escape_htmltag($enclosure).'">';
print '<div class="marginbottomonly">';
print '<span class="opacitymedium">'.$langs->trans("SelectImportFields", img_picto('', 'grip_title', '', false, 0, 0, '', '', 0)).'</span> ';
print '<span class="opacitymedium">';
$s = $langs->trans("SelectImportFields", '{s1}');
$s = str_replace('{s1}', img_picto('', 'grip_title', '', false, 0, 0, '', '', 0), $s);
print $s;
print '</span> ';
$htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1);
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
print '</div>';

View File

@ -101,8 +101,6 @@ if (!empty($conf->global->MAIN_MOTD))
/*
* Dashboard Dolibarr states (statistics)
* Hidden for external users

View File

@ -37,3 +37,9 @@ INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active)
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','https://gls-group.eu/FR/fr/suivi-colis?match={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (11,'TNT', 'TNT', NULL, 'https://www.tnt.com/express/fr_fr/site/outils-expedition/suivi.html?searchType=con&cons=={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (12,'DHL', 'DHL', NULL, 'https://www.dhl.com/fr-fr/home/tracking/tracking-global-forwarding.html?submit=1&tracking-id={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (13,'DPD', 'DPD', NULL, 'https://www.dpd.fr/trace/{TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (14,'MAINFREIGHT', 'Mainfreight', NULL, 'https://www.mainfreight.com/track?{TRACKID}', 0);

View File

@ -338,3 +338,14 @@ ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0;
-- VMYSQL4.3 ALTER TABLE llx_mrp_mo MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_product (fk_product);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (11,'TNT', 'TNT', NULL, 'https://www.tnt.com/express/fr_fr/site/outils-expedition/suivi.html?searchType=con&cons=={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (12,'DHL', 'DHL', NULL, 'https://www.dhl.com/fr-fr/home/tracking/tracking-global-forwarding.html?submit=1&tracking-id={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (13,'DPD', 'DPD', NULL, 'https://www.dpd.fr/trace/{TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (14,'MAINFREIGHT', 'Mainfreight', NULL, 'https://www.mainfreight.com/track?{TRACKID}', 0);

View File

@ -516,6 +516,9 @@ UPDATE llx_rights_def set perms = 'delivery' WHERE perms = 'livraison' and modul
UPDATE llx_rights_def set perms = 'delivery_advance' WHERE perms = 'livraison_advance' and module = 'expedition';
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_product (fk_product);
CREATE TABLE llx_zapier_hook(
rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -547,3 +550,4 @@ INSERT INTO llx_boxes_def(file,entity) VALUES ('box_funnel_of_prospection.php',1
INSERT INTO llx_boxes_def(file, entity) VALUES ('box_customers_outstanding_bill_reached.php', 1);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);

View File

@ -17,3 +17,6 @@
-- ============================================================================
ALTER TABLE llx_commande_fournisseurdet ADD CONSTRAINT fk_commande_fournisseurdet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_product (fk_product);

View File

@ -50,6 +50,7 @@ create table llx_product_fournisseur_price
import_key varchar(14), -- Import key
delivery_time_days integer,
supplier_reputation varchar(10),
packaging varchar(64),
fk_multicurrency integer,
multicurrency_code varchar(255),

View File

@ -173,8 +173,8 @@ SEPAMandate=SEPA mandate
YourSEPAMandate=Your SEPA mandate
FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Return it signed (scan of the signed document) or send it by mail to
AutoReportLastAccountStatement=Automatically fill the field 'number of bank statement' with last statement number when making reconciliation
CashControl=POS cash fence
NewCashFence=New cash fence
CashControl=POS cash desk control
NewCashFence=New cash desk closing
BankColorizeMovement=Colorize movements
BankColorizeMovementDesc=If this function is enable, you can choose specific background color for debit or credit movements
BankColorizeMovementName1=Background color for debit movement

View File

@ -35,7 +35,7 @@ logDON_DELETE=Donation logical deletion
logMEMBER_SUBSCRIPTION_CREATE=Member subscription created
logMEMBER_SUBSCRIPTION_MODIFY=Member subscription modified
logMEMBER_SUBSCRIPTION_DELETE=Member subscription logical deletion
logCASHCONTROL_VALIDATE=Cash fence recording
logCASHCONTROL_VALIDATE=Cash desk closing recording
BlockedLogBillDownload=Customer invoice download
BlockedLogBillPreview=Customer invoice preview
BlockedlogInfoDialog=Log Details

View File

@ -49,8 +49,8 @@ Footer=Footer
AmountAtEndOfPeriod=Amount at end of period (day, month or year)
TheoricalAmount=Theorical amount
RealAmount=Real amount
CashFence=Cash fence
CashFenceDone=Cash fence done for the period
CashFence=Cash desk closing
CashFenceDone=Cash desk closing done for the period
NbOfInvoices=Nb of invoices
Paymentnumpad=Type of Pad to enter payment
Numberspad=Numbers Pad
@ -99,8 +99,8 @@ CashDeskRefNumberingModules=Numbering module for POS sales
CashDeskGenericMaskCodes6 = <br><b>{TN}</b> tag is used to add the terminal number
TakeposGroupSameProduct=Group same products lines
StartAParallelSale=Start a new parallel sale
ControlCashOpening=Control cash box at opening POS
CloseCashFence=Close cash fence
ControlCashOpening=Control cash desk at opening POS
CloseCashFence=Close cash desk control
CashReport=Cash report
MainPrinterToUse=Main printer to use
OrderPrinterToUse=Order printer to use

View File

@ -135,4 +135,5 @@ RSSFeed=RSS Feed
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL
PagesRegenerated=%s page(s)/container(s) regenerated
RegenerateWebsiteContent=Regenerate web site cache files
AllowedInFrames=Allowed in Frames
AllowedInFrames=Allowed in Frames
DefineListOfAltLanguagesInWebsiteProperties=Define list of all available languages into web site properties.

Some files were not shown because too many files have changed in this diff Show More