Merge branch 'develop' of github.com:Dolibarr/dolibarr into 12.0_add_class_unitstools

This commit is contained in:
ATM john 2020-04-27 17:46:22 +02:00
commit 41e597e739
271 changed files with 2112 additions and 1775 deletions

View File

@ -6,6 +6,10 @@ This directory contains ruleset files to use to develop Dolibarr EPR & CRM.
To install/upgrade phpcs: To install/upgrade phpcs:
> sudo pear upgrade PHP_CodeSniffer > sudo pear upgrade PHP_CodeSniffer
To run phpcs:
> cd dolibarrgitrepo
> phpcs --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 .
Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with:
* tab value to 4 * tab value to 4
* path of code sniffer standard to dev/codesniffer * path of code sniffer standard to dev/codesniffer

View File

@ -36,8 +36,6 @@
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedElseif"/> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedElseif"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedForeach"/> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedForeach"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.NotAllowed"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.NotAllowedWarning"/>
</rule> </rule>
<!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> --> <!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->
@ -70,9 +68,6 @@
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod">
<severity>0</severity>
</rule>
<!-- <!--
<rule ref="Generic.Commenting.Todo" /> <rule ref="Generic.Commenting.Todo" />
@ -125,13 +120,6 @@
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" /> <rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity>
</rule>
<!-- Disallow several spaces after comma --> <!-- Disallow several spaces after comma -->
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines --> <!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"> <rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
@ -141,7 +129,7 @@
<!-- Tweaks to metrics --> <!-- Tweaks to metrics -->
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="120" /> <property name="complexity" value="150" />
<property name="absoluteComplexity" value="300" /> <property name="absoluteComplexity" value="300" />
</properties> </properties>
</rule> </rule>
@ -179,7 +167,6 @@
<rule ref="Generic.Strings.UnnecessaryStringConcat" /> <rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.Strings.UnnecessaryStringConcat.Found"> <rule ref="Generic.Strings.UnnecessaryStringConcat.Found">
<severity>0</severity>
</rule> </rule>
<!-- Disallow usage of tab --> <!-- Disallow usage of tab -->

View File

@ -488,11 +488,11 @@ if ($resql)
// Action // Action
print '<td class="center">'; print '<td class="center">';
if ($user->rights->accounting->chartofaccount) { if ($user->rights->accounting->chartofaccount) {
print '<a href="./card.php?action=update&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">'; print '<a class="editfielda" href="./card.php?action=update&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '&nbsp;'; print '&nbsp;';
print '<a href="./card.php?action=delete&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">'; print '<a class="marginleftonly" href="./card.php?action=delete&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
} }

View File

@ -696,7 +696,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -408,7 +408,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
$titre = $langs->trans($tablib[$id]); $titre = $langs->trans($tablib[$id]);
$linkback = ''; $linkback = '';
$titlepicto = 'title_setup'; $titlepicto = 'title_accountancy';
print load_fiche_titre($titre, $linkback, $titlepicto); print load_fiche_titre($titre, $linkback, $titlepicto);
@ -806,7 +806,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -236,6 +236,7 @@ if (!empty($user->admin))
} }
print '</tr>'; print '</tr>';
/* Set this option as a hidden option but keep it for some needs.
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>'; print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
@ -248,6 +249,7 @@ if (!empty($user->admin))
print '</a></td>'; print '</a></td>';
} }
print '</tr>'; print '</tr>';
*/
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>'; print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';

View File

@ -657,7 +657,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -362,7 +362,6 @@ if ($result)
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print '<br>'; print '<br>';
@ -412,7 +411,7 @@ if ($result)
//print '<br><div class="center">'.$buttonsave.'</div>'; //print '<br><div class="center">'.$buttonsave.'</div>';
$texte = $langs->trans("ListOfProductsServices"); $texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">'; print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';

View File

@ -704,7 +704,7 @@ class BookKeeping extends CommonObject
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (".getEntity('accountancy').")"; $sql .= " AND entity IN (".getEntity('accountancy').")";
if (null !== $ref) { if (null !== $ref) {
$sql .= ' AND t.ref = '.'\''.$ref.'\''; $sql .= " AND t.ref = '".$this->db->escape($ref)."'";
} else { } else {
$sql .= ' AND t.rowid = '.$id; $sql .= ' AND t.rowid = '.$id;
} }

View File

@ -567,12 +567,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
// Found accounts // Found accounts
print '<td style="'.$code_sell_p_notset.'">'; print '<td>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
$s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("NotDefined")); $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
@ -583,7 +583,7 @@ if ($result) {
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p)); $s .= (empty($objp->code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '</td>'; print '</td>';

View File

@ -88,7 +88,7 @@ if ($conf->accounting->enabled)
} }
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial);
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n"; print "<br>\n";
@ -101,13 +101,13 @@ if ($conf->accounting->enabled)
// STEPS // STEPS
$step++; $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>'); 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>');
print "<br>\n"; print "<br>\n";
$step++; $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>'); 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>');
print "<br>\n"; print "<br>\n";
$step++; $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>'); 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>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -116,20 +116,20 @@ if ($conf->accounting->enabled)
print "<br>\n"; print "<br>\n";
$step++; $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>'); 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>');
print "<br>\n"; print "<br>\n";
$step++; $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"; 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";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'.'</a>'; $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); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n"; print "<br>\n";
if (!empty($conf->tax->enabled)) 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>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
@ -145,7 +145,7 @@ if ($conf->accounting->enabled)
if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. 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++; $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>'); 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>');
print "<br>\n"; print "<br>\n";
} }
/* /*
@ -169,7 +169,7 @@ if ($conf->accounting->enabled)
}*/ }*/
$step++; $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>'); 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>');
print "<br>\n"; print "<br>\n";
@ -186,17 +186,17 @@ if ($conf->accounting->enabled)
$langs->loadLangs(array('bills', 'trips')); $langs->loadLangs(array('bills', 'trips'));
$step++; $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"; 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";
print "<br>\n"; print "<br>\n";
$step++; $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"; 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";
print "<br>\n"; print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
{ {
$step++; $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"; 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";
print "<br>\n"; print "<br>\n";
} }

View File

@ -994,7 +994,7 @@ if (empty($action) || $action == 'view') {
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {

View File

@ -508,7 +508,7 @@ if (empty($action) || $action == 'view') {
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }

View File

@ -740,7 +740,7 @@ if (empty($action) || $action == 'view') {
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }
@ -936,7 +936,7 @@ if (empty($action) || $action == 'view') {
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') if (($accountoshow == "") || $accountoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'.'</span>'; print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')</span>';
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";
@ -959,15 +959,15 @@ if (empty($action) || $action == 'view') {
foreach ($tabother[$key] as $k => $mt) { foreach ($tabother[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- VAT counterpart NPR -->"; print '<!-- VAT counterpart NPR -->';
print "<td>".$date."</td>"; print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>"; print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account // Account
print "<td>"; print '<td>';
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') if ($accountoshow == '' || $accountoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'.'</span>'; print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account</span>';
} }
else print $accountoshow; else print $accountoshow;
print '</td>'; print '</td>';

View File

@ -677,7 +677,7 @@ if (empty($action) || $action == 'view') {
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }
@ -874,7 +874,7 @@ if (empty($action) || $action == 'view') {
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') if (($accountoshow == "") || $accountoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.'</span>'; print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')</span>';
} }
else print $accountoshow; else print $accountoshow;
print "</td>"; print "</td>";

View File

@ -553,12 +553,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
// Found accounts // Found accounts
print '<td style="'.$code_buy_p_notset.'">'; print '<td>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
$s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("NotDefined")); $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
@ -567,7 +567,7 @@ if ($result) {
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_buy_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_buy_p)); $s .= (empty($objp->code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_buy_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '</td>'; print '</td>';

View File

@ -60,6 +60,9 @@ class Adherent extends CommonObject
*/ */
public $ismultientitymanaged = 1; public $ismultientitymanaged = 1;
public $picto = 'member';
public $mesgs; public $mesgs;
/** /**
@ -657,7 +660,7 @@ class Adherent extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) { if ($result < 0) {
@ -927,8 +930,6 @@ class Adherent extends CommonObject
// Removed extrafields // Removed extrafields
if (!$error) { if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
if ($result < 0) { if ($result < 0) {
$error++; $error++;
@ -936,7 +937,6 @@ class Adherent extends CommonObject
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
} }
}
// Remove adherent // Remove adherent
if (!$error) { if (!$error) {

View File

@ -183,20 +183,14 @@ class AdherentType extends CommonObject
$sql2 .= " SET "; $sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->label)."',"; $sql2 .= " label='".$this->db->escape($this->label)."',";
$sql2 .= " description='".$this->db->escape($this->description)."'"; $sql2 .= " description='".$this->db->escape($this->description)."'";
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->other)."'";
}
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
} }
else else
{ {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email";
}
$sql2 .= ")"; $sql2 .= ")";
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',";
$sql2 .= " '".$this->db->escape($this->description)."'"; $sql2 .= " '".$this->db->escape($this->description)."'";
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->other)."'";
}
$sql2 .= ")"; $sql2 .= ")";
} }
dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key); dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key);
@ -219,20 +213,14 @@ class AdherentType extends CommonObject
$sql2 .= " SET "; $sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'";
}
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
} }
else else
{ {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email";
}
$sql2 .= ")"; $sql2 .= ")";
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'"; $sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'";
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'";
}
$sql2 .= ")"; $sql2 .= ")";
} }
@ -409,7 +397,7 @@ class AdherentType extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -1718,7 +1718,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -213,19 +213,17 @@ class Dolistore
{ {
$cat = $this->categories[$i]; $cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) { if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" ' $html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" ';
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'"' $html .= 'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'">'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
.'>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id); $html .= self::get_categories($cat->id);
$html .= "</li>\n"; $html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : ''; $select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"' $html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"';
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ' $html .= ' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ';
.'>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a>'; $html .= '>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id); $html .= self::get_categories($cat->id);
$html .= "</li>\n"; $html .= "</li>\n";
} else {
} }
} }
@ -269,8 +267,8 @@ class Dolistore
// add image or default ? // add image or default ?
if ($product->id_default_image != '') { if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version.'">'. $images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version.'">';
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>'; $images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else { } else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />'; $images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
} }

View File

@ -271,19 +271,19 @@ if ($resql)
print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">'; print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">';
print '<input type="hidden" name="norss" value="'.$idrss.'">'; print '<input type="hidden" name="norss" value="'.$idrss.'">';
print '</td>'; print '</td>';
print "</tr>"."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td width=\"100px\">".$langs->trans("Title")."</td>"; print "<td width=\"100px\">".$langs->trans("Title")."</td>";
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_title_".$idrss."\" value=\"".dol_escape_htmltag($conf->global->$keyrsstitle)."\"></td>"; print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_title_".$idrss."\" value=\"".dol_escape_htmltag($conf->global->$keyrsstitle)."\"></td>";
print "</tr>"."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$langs->trans("URL")."</td>"; print "<td>".$langs->trans("URL")."</td>";
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_urlrss_".$idrss."\" value=\"".dol_escape_htmltag($conf->global->$keyrssurl)."\"></td>"; print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_urlrss_".$idrss."\" value=\"".dol_escape_htmltag($conf->global->$keyrssurl)."\"></td>";
print "</tr>"."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -301,7 +301,7 @@ if ($resql)
print '</div>'; print '</div>';
} }
print "</td>"; print "</td>";
print "</tr>"."\n"; print '</tr>'."\n";
// Logo // Logo
if ($result > 0 && empty($rss->error)) if ($result > 0 && empty($rss->error))
@ -315,7 +315,7 @@ if ($resql)
if ($imageurl) print '<img height="32" src="'.$imageurl.'">'; if ($imageurl) print '<img height="32" src="'.$imageurl.'">';
else print $langs->trans("None"); else print $langs->trans("None");
print '</td>'; print '</td>';
print "</tr>"."\n"; print '</tr>'."\n";
} }
// Active // Active
@ -323,11 +323,11 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans('WidgetEnabled').'</td>'; print '<td>'.$langs->trans('WidgetEnabled').'</td>';
print '<td>'.yn($active).'</td>'; print '<td>'.yn($active).'</td>';
print "</tr>"."\n"; print '</tr>'."\n";
print '</table>'."\n"; print '</table>'."\n";
print "</form>"."\n"; print "</form>\n";
$i++; $i++;
} }

View File

@ -160,7 +160,6 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
@ -278,8 +277,10 @@ print '</tr>';
// Disable javascript and ajax // Disable javascript and ajax
print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0);
print ' <span class="opacitymedium"> &nbsp; &nbsp; '.$langs->trans("DisableJavascriptNote").'</span>';
print '</td>';
print '<td>';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Max size of lists // Max size of lists
@ -392,6 +393,13 @@ print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("LoginPage
print '<th width="20">&nbsp;</th>'; print '<th width="20">&nbsp;</th>';
print '</tr>'; print '</tr>';
// Hide helpcenter link on login page
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Message on login page // Message on login page
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
@ -407,13 +415,6 @@ $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Hide helpcenter link on login page
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK) ? $conf->global->MAIN_HELPCENTER_DISABLELINK : 0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Background // Background
print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">'; print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">'; print '<div class="centpercent inline-block">';

View File

@ -536,7 +536,7 @@ $errors = $hookmanager->errors;
// Line to enter new values (input fields) // Line to enter new values (input fields)
print "<tr ".$bcnd[$var].">"; print '<tr class="oddeven">';
if (empty($reshook)) if (empty($reshook))
{ {
@ -976,12 +976,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
{ {
global $conf, $langs, $user, $db; global $conf, $langs, $user, $db;
global $form; global $form;
global $region_id; global $elementList, $sourceList;
global $elementList, $sourceList, $localtax_typeList;
global $bc;
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {

View File

@ -325,6 +325,22 @@ if ($conf->use_javascript_ajax)
if (!empty($menu['langs'])) $langs->load($menu['langs']); if (!empty($menu['langs'])) $langs->load($menu['langs']);
$titre = $langs->trans($menu['titre']); $titre = $langs->trans($menu['titre']);
$entry = '<table class="nobordernopadding centpercent"><tr><td>';
$entry .= '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>';
$entry .= '</td><td class="right">';
$entry .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
$entry .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
$entry .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
$entry .= '&nbsp; &nbsp; &nbsp;';
$entry .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
$entry .= '</td></tr></table>';
$buttons = '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
$buttons .= '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
$buttons .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
$buttons .= '&nbsp; &nbsp; &nbsp;';
$buttons .= '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
$data[] = array( $data[] = array(
'rowid'=>$menu['rowid'], 'rowid'=>$menu['rowid'],
'module'=>$menu['module'], 'module'=>$menu['module'],
@ -335,20 +351,8 @@ if ($conf->use_javascript_ajax)
'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'], 'position'=>$menu['position'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'. 'entry'=>$entry,
'<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'. 'buttons'=>$buttons
'</td><td class="right">'.
'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> '.
'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
'&nbsp; &nbsp; &nbsp;'.
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>'.
'</td></tr></table>',
'buttons'=>'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> '.
'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
'&nbsp; &nbsp; &nbsp;'.
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>'
); );
$i++; $i++;
} }

View File

@ -387,7 +387,7 @@ if ($mode == 'feature')
$filedata = dol_buildpath($moduledir.'/sql/data.sql'); $filedata = dol_buildpath($moduledir.'/sql/data.sql');
if (dol_is_file($filedata)) if (dol_is_file($filedata))
{ {
$text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql'.')'; $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)';
} }
else $text .= $langs->trans("No"); else $text .= $langs->trans("No");

View File

@ -265,7 +265,7 @@ print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("FixedEmailTarget").'</td>'; print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
print '<td>'.$langs->trans("Threshold").'</td>'; print '<td>'.$langs->trans("Threshold").'</td>';
print '<td>'.'</td>'; print '<td></td>';
print "</tr>\n"; print "</tr>\n";
foreach ($listofnotifiedevents as $notifiedevent) foreach ($listofnotifiedevents as $notifiedevent)

View File

@ -66,7 +66,7 @@ if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
else else
{ {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
} }
print '<br>'; print '<br>';
@ -123,7 +123,7 @@ if (!$foundcache && $test)
{ {
$foundcache++; $foundcache++;
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "XCache"); print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "XCache");
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>'; print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php">Xcache admin page</a>';
} }
$test = function_exists('eaccelerator_info'); $test = function_exists('eaccelerator_info');
if (!$foundcache && $test) if (!$foundcache && $test)

View File

@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<br>'; print '<br>';
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>'; print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
print '<input type="checkbox" name="nobin_drop"'.((!isset($_GET["nobin_drop"]) && !isset($_POST["nobin_drop"])) || GETPOST('nobin_drop')) ? ' checked' : ''.' id="checkbox_dump_drop" />'; print '<input type="checkbox" name="nobin_drop"'.((! GETPOSTISSET("nobin_drop") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>'; print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>'; print '<br>';
print '</fieldset>'; print '</fieldset>';

View File

@ -85,11 +85,11 @@ $workflowcodes = array(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order', 'warning'=>''), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order', 'warning'=>''), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
'separator2'=>array('family'=>'separator', 'position'=>50), 'separator2'=>array('family'=>'separator', 'position'=>50),
// Automatic classification supplier proposal // Automatic classification supplier proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'propal', 'warning'=>''), 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 'picto'=>'propal', 'warning'=>''),
// Automatic classification supplier order // Automatic classification supplier order
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'! empty($conf->fournisseur->enabled)', 'picto'=>'order', 'warning'=>''), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)', 'picto'=>'order', 'warning'=>''),
//Automatic classification reception //Automatic classification reception
'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>64, 'enabled'=>'! empty($conf->reception->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'bill'), 'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>64, 'enabled'=>'! empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 'picto'=>'bill'),
); );
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))

View File

@ -153,7 +153,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
// Show message // Show message
$message = ''; $message = '';
$url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]'; $url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
$message .= $langs->trans("UrlToGetKeyToUseAPIs").':<br>'; $message .= '<span class="opacitymedium">'.$langs->trans("UrlToGetKeyToUseAPIs").':</span><br>';
$message .= img_picto('', 'globe').' '.$url; $message .= img_picto('', 'globe').' '.$url;
print $message; print $message;
print '<br>'; print '<br>';

View File

@ -137,6 +137,15 @@ class DolibarrApi
unset($object->labelStatus); unset($object->labelStatus);
unset($object->labelStatusShort); unset($object->labelStatusShort);
unset($object->stats_propale);
unset($object->stats_commande);
unset($object->stats_contrat);
unset($object->stats_facture);
unset($object->stats_commande_fournisseur);
unset($object->stats_reception);
unset($object->stats_mrptoconsume);
unset($object->stats_mrptoproduce);
unset($object->element); unset($object->element);
unset($object->fk_element); unset($object->fk_element);
unset($object->table_element); unset($object->table_element);

View File

@ -1409,15 +1409,15 @@ class Setup extends DolibarrApi
* *
* Note that conf variables that stores security key or password hashes can't be loaded with API. * Note that conf variables that stores security key or password hashes can't be loaded with API.
* *
* @url GET /conf * @param string $constantname Name of conf variable to get
*
* @param string $confname Name of conf variable to get
* @return array|mixed Data without useless information * @return array|mixed Data without useless information
* *
* @url GET conf/{constantname}
*
* @throws RestException 403 Forbidden * @throws RestException 403 Forbidden
* @throws RestException 500 Error Bad or unknown value for constname * @throws RestException 500 Error Bad or unknown value for constantname
*/ */
public function getConf($confname) public function getConf($constantname)
{ {
global $conf; global $conf;
@ -1426,14 +1426,14 @@ class Setup extends DolibarrApi
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
} }
if (!preg_match('/^[a-zA-Z0-9_]+$/', $confname) || !isset($conf->global->$confname)) { if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
throw new RestException(500, 'Error Bad or unknown value for constname'); throw new RestException(500, 'Error Bad or unknown value for constantname');
} }
if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) { if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) {
throw new RestException(403, 'Forbidden'); throw new RestException(403, 'Forbidden');
} }
return $conf->global->$confname; return $conf->global->$constantname;
} }
/** /**

View File

@ -34,15 +34,18 @@ $langs->loadLangs(array("asset"));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
// Initialize technical objects // Initialize technical objects
$object = new Asset($db); $object = new Asset($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('assetcard')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('assetcard', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
@ -59,23 +62,20 @@ foreach ($object->fields as $key => $val)
if (empty($action) && empty($id) && empty($ref)) $action = 'view'; if (empty($action) && empty($id) && empty($ref)) $action = 'view';
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$permissiontoread = $user->rights->asset->read;
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->asset->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1];
/* /*
* Actions * Actions
*
* Put here all code to do according to value of "action" parameter
*/ */
$parameters = array(); $parameters = array();
@ -86,16 +86,35 @@ if (empty($reshook))
{ {
$error = 0; $error = 0;
$permissiontoadd = $user->rights->asset->create;
$permissiontodelete = $user->rights->asset->delete;
$backurlforlist = dol_buildpath('/asset/list.php', 1); $backurlforlist = dol_buildpath('/asset/list.php', 1);
// Actions cancel, add, update or delete // Actions cancel, add, update or delete
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
// Actions when printing a doc from card // Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Action to move up and down lines of object
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
// Action to build doc
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
if ($action == 'set_thirdparty' && $permissiontoadd)
{
$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY');
}
if ($action == 'classin' && $permissiontoadd)
{
$object->setProject(GETPOST('projectid', 'int'));
}
// Actions to send emails // Actions to send emails
$triggersendname = 'ASSET_SENTBYMAIL'; $triggersendname = 'ASSET_SENTBYMAIL';
$autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO'; $autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO';
@ -143,11 +162,12 @@ if ($action == 'create')
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
dol_fiche_head(array(), ''); dol_fiche_head(array(), '');
print '<table class="border centpercent">'."\n"; print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes // Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
@ -166,6 +186,8 @@ if ($action == 'create')
print '</div>'; print '</div>';
print '</form>'; print '</form>';
//dol_set_focus('input[name="ref"]');
} }
// Part to edit record // Part to edit record
@ -178,10 +200,12 @@ if (($id || $ref) && $action == 'edit')
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
dol_fiche_head(); dol_fiche_head();
print '<table class="border centpercent">'."\n"; print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes // Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
@ -206,7 +230,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$res = $object->fetch_optionals(); $res = $object->fetch_optionals();
$head = asset_prepare_head($object); $head = asset_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, 'generic'); dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, $object->picto);
$formconfirm = ''; $formconfirm = '';
@ -255,10 +279,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<table class="border centpercent">'."\n"; print '<table class="border centpercent">'."\n";
// Common attributes // Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn'; //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just after this field
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_soc']); // Hide field already shown in banner
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// Other attributes // Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
@ -266,7 +292,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();
@ -349,14 +375,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
//Select mail models is same action as presend //Select mail models is same action as presend
/*
if (GETPOST('modelselected')) $action = 'presend'; if (GETPOST('modelselected')) $action = 'presend';
// Presend form // Presend form
$modelmail='inventory'; /*
$modelmail='asset';
$defaulttopic='InformationMessage'; $defaulttopic='InformationMessage';
$diroutput = $conf->product->dir_output.'/inventory'; $diroutput = $conf->asset->dir_output.'/asset';
$trackid = 'stockinv'.$object->id; $trackid = 'asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/ */

View File

@ -77,12 +77,12 @@ class Asset extends CommonObject
*/ */
public $fields = array( public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",), 'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>1),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1),
'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), 'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), 'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",), 'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),

View File

@ -202,7 +202,7 @@ class AssetType extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -223,20 +223,20 @@ if ($action === 'downloadblockchain') {
{ {
$statusofrecordnote = $langs->trans("PreviousFingerprint").': '.$previoushash.($statusofrecordnote ? ' - '.$statusofrecordnote : ''); $statusofrecordnote = $langs->trans("PreviousFingerprint").': '.$previoushash.($statusofrecordnote ? ' - '.$statusofrecordnote : '');
} }
print $obj->rowid print $obj->rowid;
.';'.$obj->date_creation print ';'.$obj->date_creation;
.';"'.$obj->user_fullname.'"' print ';"'.str_replace('"', '""', $obj->user_fullname).'"';
.';'.$obj->action print ';'.$obj->action;
.';'.$obj->element print ';'.$obj->element;
.';'.$obj->amounts print ';'.$obj->amounts;
.';'.$obj->fk_object print ';'.$obj->fk_object;
.';'.$obj->date_object print ';'.$obj->date_object;
.';"'.$obj->ref_object.'"' print ';"'.str_replace('"', '""', $obj->ref_object).'"';
.';'.$obj->signature print ';'.$obj->signature;
.';'.$statusofrecord print ';'.$statusofrecord;
.';'.$statusofrecordnote print ';'.$statusofrecordnote;
.';"'.str_replace('"', '""', $obj->object_data).'"' print ';"'.str_replace('"', '""', $obj->object_data).'"';
."\n"; print "\n";
// Set new previous hash for next fetch // Set new previous hash for next fetch
$previoushash = $obj->signature; $previoushash = $obj->signature;

View File

@ -74,7 +74,7 @@ if ($nolinesbefore) {
print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>'; print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>';
print '</tr>'; print '</tr>';
} }
print '<tr class="pair nodrag nodrop nohoverpair'.($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create'.'">'; print '<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create').'">';
$coldisplay = 0; $coldisplay = 0;
// Adds a line numbering column // Adds a line numbering column

View File

@ -461,7 +461,7 @@ class Categorie extends CommonObject
$action = 'create'; $action = 'create';
// Actions on extra fields // Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -553,7 +553,7 @@ class Categorie extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -646,7 +646,7 @@ class Categorie extends CommonObject
} }
// Removed extrafields // Removed extrafields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -184,9 +184,7 @@ foreach ($fulltree as $key => $val)
'rowid'=>$val['rowid'], 'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'], 'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'.$counter. 'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'.$counter.
//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'. '<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td></tr></table>'
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
'</tr></table>'
); );
} }

View File

@ -317,7 +317,7 @@ if (empty($reshook) && $action == 'add')
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby", "int"); if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby", "int");
} }
$object->note = trim(GETPOST("note")); $object->note_private = trim(GETPOST("note"));
if (isset($_POST["contactid"])) $object->contact = $contact; if (isset($_POST["contactid"])) $object->contact = $contact;
@ -465,7 +465,6 @@ if (empty($reshook) && $action == 'update')
$object->contactid = key($object->socpeopleassigned); $object->contactid = key($object->socpeopleassigned);
} }
$object->fk_project = GETPOST("projectid", 'int'); $object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", "none"); // deprecated
$object->note_private = GETPOST("note", "none"); $object->note_private = GETPOST("note", "none");
$object->fk_element = GETPOST("fk_element", "int"); $object->fk_element = GETPOST("fk_element", "int");
$object->elementtype = GETPOST("elementtype", "alphanohtml"); $object->elementtype = GETPOST("elementtype", "alphanohtml");
@ -1122,7 +1121,7 @@ if ($action == 'create')
// Description // Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); $doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
@ -1188,7 +1187,7 @@ if ($id > 0)
$object->contactid = GETPOST("contactid", 'int'); $object->contactid = GETPOST("contactid", 'int');
$object->fk_project = GETPOST("projectid", 'int'); $object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", 'none'); $object_private = GETPOST("note", 'none');
} }
if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
@ -1540,7 +1539,7 @@ if ($id > 0)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';

View File

@ -380,7 +380,7 @@ class ActionComm extends CommonObject
// Clean parameters // Clean parameters
$this->label = dol_trunc(trim($this->label), 128); $this->label = dol_trunc(trim($this->label), 128);
$this->location = dol_trunc(trim($this->location), 128); $this->location = dol_trunc(trim($this->location), 128);
$this->note = dol_htmlcleanlastbr(trim($this->note)); $this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private));
if (empty($this->percentage)) $this->percentage = 0; if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
if (empty($this->fulldayevent)) $this->fulldayevent = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0;
@ -488,7 +488,7 @@ class ActionComm extends CommonObject
$sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", "; $sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", ";
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
$sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', "; $sql .= " '".$this->db->escape($this->note_private)."', ";
$sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", "; $sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", ";
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
$sql .= ($userownerid > 0 ? $userownerid : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", ";
@ -567,15 +567,12 @@ class ActionComm extends CommonObject
if (!$error) if (!$error)
{ {
// Actions on extra fields // Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
} }
} }
}
if (!$error && !$notrigger) if (!$error && !$notrigger)
{ {
@ -740,7 +737,7 @@ class ActionComm extends CommonObject
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem);
$this->note = $obj->note; $this->note = $obj->note; // deprecated
$this->note_private = $obj->note; $this->note_private = $obj->note;
$this->percentage = $obj->percentage; $this->percentage = $obj->percentage;
@ -993,7 +990,7 @@ class ActionComm extends CommonObject
// Clean parameters // Clean parameters
$this->label = trim($this->label); $this->label = trim($this->label);
$this->note = trim($this->note); $this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private));
if (empty($this->percentage)) $this->percentage = 0; if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
if (empty($this->transparency)) $this->transparency = 0; if (empty($this->transparency)) $this->transparency = 0;
@ -1027,7 +1024,7 @@ class ActionComm extends CommonObject
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
$sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated
$sql .= ", note = '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."'"; $sql .= ", note = '".$this->db->escape($this->note_private)."'";
$sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null");
$sql .= ", fk_soc =".($socid > 0 ? $socid : "null"); $sql .= ", fk_soc =".($socid > 0 ? $socid : "null");
$sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null"); $sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null");
@ -1048,7 +1045,7 @@ class ActionComm extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1406,8 +1403,8 @@ class ActionComm extends CommonObject
$tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype; $tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype;
if (!empty($this->location)) if (!empty($this->location))
$tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location; $tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location;
if (!empty($this->note)) if (!empty($this->note_private))
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note) ? str_replace(array("\r", "\n"), "", $this->note) : str_replace(array("\r", "\n"), '<br>', $this->note)); $tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '<br>', $this->note_private));
$linkclose = ''; $linkclose = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
$linkclose = ' style="background-color:#'.$this->type_color.'"'; $linkclose = ' style="background-color:#'.$this->type_color.'"';
@ -1940,8 +1937,7 @@ class ActionComm extends CommonObject
$this->location = 'Location'; $this->location = 'Location';
$this->transparency = 1; // 1 means opaque $this->transparency = 1; // 1 means opaque
$this->priority = 1; $this->priority = 1;
$this->note = "This is a 'public' note"; //$this->note_public = "This is a 'public' note.";
$this->note_public = "This is a 'public' note.";
$this->note_private = "This is a 'private' note."; $this->note_private = "This is a 'private' note.";
$this->userownerid = $user->id; $this->userownerid = $user->id;

View File

@ -169,8 +169,8 @@ class CActionComm
if ($obj->module == 'invoice' && !$conf->facture->enabled) $qualified=0; if ($obj->module == 'invoice' && !$conf->facture->enabled) $qualified=0;
if ($obj->module == 'order' && !$conf->commande->enabled) $qualified=0; if ($obj->module == 'order' && !$conf->commande->enabled) $qualified=0;
if ($obj->module == 'propal' && !$conf->propal->enabled) $qualified=0; if ($obj->module == 'propal' && !$conf->propal->enabled) $qualified=0;
if ($obj->module == 'invoice_supplier' && !$conf->fournisseur->enabled) $qualified = 0; if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ! $conf->supplier_invoice->enabled)) $qualified=0;
if ($obj->module == 'order_supplier' && !$conf->fournisseur->enabled) $qualified = 0; if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ! $conf->supplier_order->enabled)) $qualified=0;
if ($obj->module == 'shipping' && !$conf->expedition->enabled) $qualified=0; if ($obj->module == 'shipping' && !$conf->expedition->enabled) $qualified=0;
} }

View File

@ -553,8 +553,7 @@ if ($resql)
$actionstatic->type_picto = $obj->type_picto; $actionstatic->type_picto = $obj->type_picto;
$actionstatic->label = $obj->label; $actionstatic->label = $obj->label;
$actionstatic->location = $obj->location; $actionstatic->location = $obj->location;
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated $actionstatic->note_private = dol_htmlentitiesbr($obj->note);
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
$actionstatic->fetchResources(); $actionstatic->fetchResources();
@ -613,8 +612,8 @@ if ($resql)
// Description // Description
if (!empty($arrayfields['a.note']['checked'])) { if (!empty($arrayfields['a.note']['checked'])) {
print '<td class="tdoverflowonsmartphone">'; print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note, 0)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note); print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
print '</td>'; print '</td>';
} }

View File

@ -35,7 +35,7 @@ if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/cl
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (!empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; if (!empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (!$user->rights->societe->lire) accessforbidden(); if (!$user->rights->societe->lire) accessforbidden();
@ -76,7 +76,7 @@ $companystatic = new Societe($db);
if (!empty($conf->propal->enabled)) $propalstatic = new Propal($db); if (!empty($conf->propal->enabled)) $propalstatic = new Propal($db);
if (!empty($conf->supplier_proposal->enabled)) $supplierproposalstatic = new SupplierProposal($db); if (!empty($conf->supplier_proposal->enabled)) $supplierproposalstatic = new SupplierProposal($db);
if (!empty($conf->commande->enabled)) $orderstatic = new Commande($db); if (!empty($conf->commande->enabled)) $orderstatic = new Commande($db);
if (!empty($conf->fournisseur->enabled)) $supplierorderstatic = new CommandeFournisseur($db); if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) $supplierorderstatic = new CommandeFournisseur($db);
llxHeader("", $langs->trans("CommercialArea")); llxHeader("", $langs->trans("CommercialArea"));
@ -102,7 +102,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
$listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort'); $listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort');
} }
// Search supplier order // Search supplier order
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire)
{ {
$listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder'); $listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder');
} }
@ -414,7 +414,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
/* /*
* Draft suppliers orders * Draft suppliers orders
*/ */
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire)
{ {
$langs->load("orders"); $langs->load("orders");
@ -581,7 +581,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
} }
// Last suppliers // Last suppliers
if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire)
{ {
$langs->load("boxes"); $langs->load("boxes");

View File

@ -147,15 +147,15 @@ if ($action == 'add') {
if (preg_match("/st_dt/", $key)) { if (preg_match("/st_dt/", $key)) {
$dtarr = array(); $dtarr = array();
$dtarr = explode('_', $key); $dtarr = explode('_', $key);
if (!array_key_exists('options_'.$dtarr[1].'_st_dt'.'_cnct', $array_query)) { if (!array_key_exists('options_'.$dtarr[1].'_st_dt_cnct', $array_query)) {
$array_query['options_'.$dtarr[1].'_st_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear'.'_cnct', 'int')); $array_query['options_'.$dtarr[1].'_st_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear_cnct', 'int'));
} }
} elseif (preg_match("/end_dt/", $key)) { } elseif (preg_match("/end_dt/", $key)) {
// Special case for end date come with 3 inputs day, month, year // Special case for end date come with 3 inputs day, month, year
$dtarr = array(); $dtarr = array();
$dtarr = explode('_', $key); $dtarr = explode('_', $key);
if (!array_key_exists('options_'.$dtarr[1].'_end_dt'.'_cnct', $array_query)) { if (!array_key_exists('options_'.$dtarr[1].'_end_dt_cnct', $array_query)) {
$array_query['options_'.$dtarr[1].'_end_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear'.'_cnct', 'int')); $array_query['options_'.$dtarr[1].'_end_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear_cnct', 'int'));
} }
} else { } else {
$array_query[$key] = GETPOST($key); $array_query[$key] = GETPOST($key);
@ -299,15 +299,15 @@ if ($action == 'savefilter' || $action == 'createfilter') {
if (preg_match("/st_dt/", $key)) { if (preg_match("/st_dt/", $key)) {
$dtarr = array(); $dtarr = array();
$dtarr = explode('_', $key); $dtarr = explode('_', $key);
if (!array_key_exists('options_'.$dtarr[1].'_st_dt'.'_cnct', $array_query)) { if (!array_key_exists('options_'.$dtarr[1].'_st_dt_cnct', $array_query)) {
$array_query['options_'.$dtarr[1].'_st_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear'.'_cnct', 'int')); $array_query['options_'.$dtarr[1].'_st_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear_cnct', 'int'));
} }
} elseif (preg_match("/end_dt/", $key)) { } elseif (preg_match("/end_dt/", $key)) {
// Special case for end date come with 3 inputs day, month, year // Special case for end date come with 3 inputs day, month, year
$dtarr = array(); $dtarr = array();
$dtarr = explode('_', $key); $dtarr = explode('_', $key);
if (!array_key_exists('options_'.$dtarr[1].'_end_dt'.'_cnct', $array_query)) { if (!array_key_exists('options_'.$dtarr[1].'_end_dt_cnct', $array_query)) {
$array_query['options_'.$dtarr[1].'_end_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear'.'_cnct', 'int')); $array_query['options_'.$dtarr[1].'_end_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear_cnct', 'int'));
// print $array_query['cnct_options_'.$dtarr[1].'_end_dt']; // print $array_query['cnct_options_'.$dtarr[1].'_end_dt'];
// 01/02/1013=1361228400 // 01/02/1013=1361228400
} }

View File

@ -724,13 +724,13 @@ class AdvanceTargetingMailing extends CommonObject
} }
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') ||
($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
if (!empty($arrayquery['options_'.$key.'_max'.'_cnct'])) { if (!empty($arrayquery['options_'.$key.'_max_cnct'])) {
$sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max'.'_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'.'_cnct'].")"; $sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min_cnct'].")";
} }
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') ||
($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])) { if (!empty($arrayquery['options_'.$key.'_end_dt_cnct'])) {
$sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')"; $sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt_cnct'])."')";
} }
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') { } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') {
if ($arrayquery['options_'.$key.'_cnct'] != '') { if ($arrayquery['options_'.$key.'_cnct'] != '') {

View File

@ -511,7 +511,7 @@ if (empty($reshook))
} }
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals(); $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
@ -1448,8 +1448,6 @@ if (empty($reshook))
* View * View
*/ */
llxHeader('', $langs->trans('Proposal'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
@ -1458,6 +1456,9 @@ $formmargin = new FormMargin($db);
$companystatic = new Societe($db); $companystatic = new Societe($db);
if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $langs->trans('Proposal'), $help_url);
$now = dol_now(); $now = dol_now();
// Add new proposal // Add new proposal
@ -1465,7 +1466,7 @@ if ($action == 'create')
{ {
$currency_code = $conf->currency; $currency_code = $conf->currency;
print load_fiche_titre($langs->trans("NewProp")); print load_fiche_titre($langs->trans("NewProp"), '', 'propal');
$soc = new Societe($db); $soc = new Societe($db);
if ($socid > 0) if ($socid > 0)

View File

@ -1252,8 +1252,6 @@ class Propal extends CommonObject
// Actions on extra fields // Actions on extra fields
if (!$error) if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1261,7 +1259,6 @@ class Propal extends CommonObject
$error++; $error++;
} }
} }
}
if (!$error && !$notrigger) if (!$error && !$notrigger)
{ {
@ -1683,7 +1680,7 @@ class Propal extends CommonObject
$error++; $this->errors[] = "Error ".$this->db->lasterror(); $error++; $this->errors[] = "Error ".$this->db->lasterror();
} }
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -3002,8 +2999,11 @@ class Propal extends CommonObject
if (!$error) if (!$error)
{ {
$main = MAIN_DB_PREFIX . 'propaldet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sqlef) && $this->db->query($sql))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -3052,8 +3052,6 @@ class Propal extends CommonObject
// Removed extrafields // Removed extrafields
if (!$error) if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
if ($result < 0) if ($result < 0)
@ -3063,7 +3061,6 @@ class Propal extends CommonObject
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
} }
} }
}
if (!$error) if (!$error)
{ {
@ -4152,7 +4149,7 @@ class PropaleLigne extends CommonObjectLine
{ {
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet'); $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$this->id = $this->rowid; $this->id = $this->rowid;
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
@ -4204,7 +4201,7 @@ class PropaleLigne extends CommonObjectLine
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// Remove extrafields // Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if (!$error)
{ {
$this->id = $this->rowid; $this->id = $this->rowid;
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
@ -4334,7 +4331,7 @@ class PropaleLigne extends CommonObjectLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$this->id = $this->rowid; $this->id = $this->rowid;
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();

View File

@ -58,7 +58,7 @@ $help_url = "EN:Module_Commercial_Proposals|FR:Module_Propositions_commerciales|
llxHeader("", $langs->trans("ProspectionArea"), $help_url); llxHeader("", $langs->trans("ProspectionArea"), $help_url);
print load_fiche_titre($langs->trans("ProspectionArea"), '', 'commercial'); print load_fiche_titre($langs->trans("ProspectionArea"), '', 'propal');
//print '<table width="100%" class="notopnoleftnoright">'; //print '<table width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">'; //print '<tr><td valign="top" width="30%" class="notopnoleft">';

View File

@ -496,7 +496,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "SendPropalRef"; $topicmail = "SendPropalRef";
$modelmail = "proposal_send"; $modelmail = "proposal_send";

View File

@ -67,20 +67,19 @@ $formpropal = new FormPropal($db);
$langs->loadLangs(array('propal', 'other', 'companies')); $langs->loadLangs(array('propal', 'other', 'companies'));
if ($mode == 'customer') $picto = 'propal';
{
$title = $langs->trans("ProposalsStatistics"); $title = $langs->trans("ProposalsStatistics");
$dir = $conf->propale->dir_temp; $dir = $conf->propale->dir_temp;
}
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$picto = 'supplier_proposal';
$title = $langs->trans("ProposalsStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")"; $title = $langs->trans("ProposalsStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")";
$dir = $conf->supplier_proposal->dir_temp; $dir = $conf->supplier_proposal->dir_temp;
} }
llxHeader('', $title); llxHeader('', $title);
print load_fiche_titre($title, '', 'commercial'); print load_fiche_titre($title, '', $picto);
dol_mkdir($dir); dol_mkdir($dir);

View File

@ -384,7 +384,7 @@ if (empty($reshook))
} }
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
{ {
$lines[$i]->fetch_optionals(); $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
@ -1493,7 +1493,7 @@ if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
// Mode creation // Mode creation
if ($action == 'create' && $usercancreate) if ($action == 'create' && $usercancreate)
{ {
print load_fiche_titre($langs->trans('CreateOrder'), '', 'commercial'); print load_fiche_titre($langs->trans('CreateOrder'), '', 'order');
$soc = new Societe($db); $soc = new Societe($db);
if ($socid > 0) if ($socid > 0)

View File

@ -33,7 +33,8 @@ class Orders extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'socid' 'socid',
'date'
); );
/** /**
@ -233,7 +234,9 @@ class Orders extends DolibarrApi
} }
/** /**
* Create order object * Create a sale order
*
* Exemple: { "socid": 2, "date": 1595196000, "type": 0, "lines": [{ "fk_product": 2, "qty": 1 }] }
* *
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of order * @return int ID of order

View File

@ -3342,7 +3342,7 @@ class Commande extends CommonOrder
$error++; $this->errors[] = "Error ".$this->db->lasterror(); $error++; $this->errors[] = "Error ".$this->db->lasterror();
} }
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -3409,6 +3409,19 @@ class Commande extends CommonOrder
$error++; $error++;
} }
if (!$error)
{
// Delete extrafields of order details
$main = MAIN_DB_PREFIX . 'commandedet';
$ef = $main . "_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = " . $this->id . ")";
if (!$this->db->query($sql))
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
if (!$error) if (!$error)
{ {
// Delete order details // Delete order details
@ -3437,8 +3450,6 @@ class Commande extends CommonOrder
if (!$error) if (!$error)
{ {
// Remove extrafields // Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
if ($result < 0) if ($result < 0)
{ {
@ -3446,7 +3457,6 @@ class Commande extends CommonOrder
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
} }
} }
}
if (!$error) if (!$error)
{ {
@ -4255,7 +4265,7 @@ class OrderLine extends CommonOrderLine
if ($resql) if ($resql)
{ {
// Remove extrafields // Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if (!$error)
{ {
$this->id = $this->rowid; $this->id = $this->rowid;
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
@ -4401,7 +4411,7 @@ class OrderLine extends CommonOrderLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet'); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet');
$this->rowid = $this->id; $this->rowid = $this->id;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -4534,7 +4544,7 @@ class OrderLine extends CommonOrderLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$this->id = $this->rowid; $this->id = $this->rowid;
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();

View File

@ -64,7 +64,7 @@ $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_P
llxHeader("", $langs->trans("Orders"), $help_url); llxHeader("", $langs->trans("Orders"), $help_url);
print load_fiche_titre($langs->trans("OrdersArea"), '', 'commercial'); print load_fiche_titre($langs->trans("OrdersArea"), '', 'order');
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
@ -106,6 +106,7 @@ if ($resql)
$total = 0; $total = 0;
$totalinprocess = 0; $totalinprocess = 0;
$dataseries = array(); $dataseries = array();
$colorseries = array();
$vals = array(); $vals = array();
// -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not)
while ($i < $num) while ($i < $num)

View File

@ -502,7 +502,7 @@ if ($resql)
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "SendOrderRef"; $topicmail = "SendOrderRef";
$modelmail = "order_send"; $modelmail = "order_send";

View File

@ -285,7 +285,7 @@ if (($action == 'create' || $action == 'add') && !$error)
} }
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals(); $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }

View File

@ -66,20 +66,20 @@ $langs->loadLangs(array('orders', 'companies', 'other', 'suppliers'));
$form = new Form($db); $form = new Form($db);
$formorder = new FormOrder($db); $formorder = new FormOrder($db);
if ($mode == 'customer') $picto = 'order';
{
$title = $langs->trans("OrdersStatistics"); $title = $langs->trans("OrdersStatistics");
$dir = $conf->commande->dir_temp; $dir = $conf->commande->dir_temp;
}
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$picto = 'supplier_order';
$title = $langs->trans("OrdersStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")"; $title = $langs->trans("OrdersStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")";
$dir = $conf->fournisseur->commande->dir_temp; $dir = $conf->fournisseur->commande->dir_temp;
} }
llxHeader('', $title); llxHeader('', $title);
print load_fiche_titre($title, '', 'commercial'); print load_fiche_titre($title, '', $picto);
dol_mkdir($dir); dol_mkdir($dir);

View File

@ -23,7 +23,7 @@
* \brief Page to show portoflio and files of a thirdparty and download it * \brief Page to show portoflio and files of a thirdparty and download it
*/ */
if ($_GET['action'] == 'dl' || $_POST['action'] == 'dl') { // To not replace token when downloading file if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
} }

View File

@ -823,14 +823,11 @@ class Account extends CommonObject
if ($result) if ($result)
{ {
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (!$error) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) $error++; if ($result < 0) $error++;
} }
}
if (!$error && !$notrigger) if (!$error && !$notrigger)
{ {
@ -1107,7 +1104,7 @@ class Account extends CommonObject
if ($result) if ($result)
{ {
// Remove extrafields // Remove extrafields
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -346,7 +346,7 @@ if ($result)
$paymenttmp->fetch($links[$key]['url_id']); $paymenttmp->fetch($links[$key]['url_id']);
$paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref; $paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
/*print '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$links[$key]['url_id'].'">'; /*print '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' '; print img_object($langs->trans('Payment'),'payment').' ';
print $langs->trans("Payment"); print $langs->trans("Payment");
print '</a>';*/ print '</a>';*/
print $paymenttmp->getNomUrl(1); print $paymenttmp->getNomUrl(1);
@ -357,7 +357,7 @@ if ($result)
$paymenttmp->fetch($links[$key]['url_id']); $paymenttmp->fetch($links[$key]['url_id']);
$paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref; $paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
/*print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$links[$key]['url_id'].'">'; /*print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'),'payment').' '; print img_object($langs->trans('Payment'),'payment').' ';
print $langs->trans("Payment"); print $langs->trans("Payment");
print '</a>';*/ print '</a>';*/
print $paymenttmp->getNomUrl(1); print $paymenttmp->getNomUrl(1);
@ -369,67 +369,67 @@ if ($result)
} }
elseif ($links[$key]['type'] == 'sc') { elseif ($links[$key]['type'] == 'sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowSocialContribution'), 'bill').' '; print img_object($langs->trans('SocialContribution'), 'bill').' ';
print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : ''); print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : '');
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'payment_sc') { elseif ($links[$key]['type'] == 'payment_sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPayment'), 'payment').' '; print img_object($langs->trans('Payment'), 'payment').' ';
print $langs->trans("SocialContributionPayment"); print $langs->trans("SocialContributionPayment");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'payment_vat') { elseif ($links[$key]['type'] == 'payment_vat') {
print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowVAT'), 'payment').' '; print img_object($langs->trans('VAT'), 'payment').' ';
print $langs->trans("VATPayment"); print $langs->trans("VATPayment");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'payment_salary') { elseif ($links[$key]['type'] == 'payment_salary') {
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowPaymentSalary'), 'payment').' '; print img_object($langs->trans('PaymentSalary'), 'payment').' ';
print $langs->trans("SalaryPayment"); print $langs->trans("SalaryPayment");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'payment_loan') { elseif ($links[$key]['type'] == 'payment_loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoanPayment'), 'payment').' '; print img_object($langs->trans('LoanPayment'), 'payment').' ';
print $langs->trans("PaymentLoan"); print $langs->trans("PaymentLoan");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'loan') { elseif ($links[$key]['type'] == 'loan') {
print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowLoan'), 'bill').' '; print img_object($langs->trans('Loan'), 'bill').' ';
print $langs->trans("Loan"); print $langs->trans("Loan");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'member') { elseif ($links[$key]['type'] == 'member') {
print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowMember'), 'user').' '; print img_object($langs->trans('Member'), 'user').' ';
print $links[$key]['label']; print $links[$key]['label'];
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'payment_donation') { elseif ($links[$key]['type'] == 'payment_donation') {
print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowDonation'), 'payment').' '; print img_object($langs->trans('Donation'), 'payment').' ';
print $langs->trans("DonationPayment"); print $langs->trans("DonationPayment");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'banktransfert') { elseif ($links[$key]['type'] == 'banktransfert') {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowTransaction'), 'payment').' '; print img_object($langs->trans('Transaction'), 'payment').' ';
print $langs->trans("TransactionOnTheOtherAccount"); print $langs->trans("TransactionOnTheOtherAccount");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'user') { elseif ($links[$key]['type'] == 'user') {
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowUser'), 'user').' '; print img_object($langs->trans('User'), 'user').' ';
print $langs->trans("User"); print $langs->trans("User");
print '</a>'; print '</a>';
} }
elseif ($links[$key]['type'] == 'payment_various') { elseif ($links[$key]['type'] == 'payment_various') {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$links[$key]['url_id'].'">'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('ShowVariousPayment'), 'payment').' '; print img_object($langs->trans('VariousPayment'), 'payment').' ';
print $langs->trans("VariousPayment"); print $langs->trans("VariousPayment");
print '</a>'; print '</a>';
} }

View File

@ -979,7 +979,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
*/ */
if ($action == 'create') if ($action == 'create')
{ {
print load_fiche_titre($langs->trans("CreateRepeatableInvoice"), '', 'invoicing'); print load_fiche_titre($langs->trans("CreateRepeatableInvoice"), '', 'bill');
$object = new Facture($db); // Source invoice $object = new Facture($db); // Source invoice
$product_static = new Product($db); $product_static = new Product($db);

View File

@ -1146,7 +1146,7 @@ if (empty($reshook))
foreach ($facture_source->lines as $line) foreach ($facture_source->lines as $line)
{ {
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) { if (method_exists($line, 'fetch_optionals')) {
// load extrafields // load extrafields
$line->fetch_optionals(); $line->fetch_optionals();
} }
@ -1644,7 +1644,7 @@ if (empty($reshook))
} }
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals(); $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
@ -1768,6 +1768,8 @@ if (empty($reshook))
if (!empty($origin) && !empty($originid)) if (!empty($origin) && !empty($originid))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$object->origin = $origin; $object->origin = $origin;
$object->origin_id = $originid; $object->origin_id = $originid;
@ -1800,6 +1802,17 @@ if (empty($reshook))
$line->fetch_optionals(); $line->fetch_optionals();
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
// The $line->situation_percent has been modified, so we must recalculate all amounts
$tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $line->situation_percent);
$line->total_ht = $tabprice[0];
$line->total_tva = $tabprice[1];
$line->total_ttc = $tabprice[2];
$line->total_localtax1 = $tabprice[9];
$line->total_localtax2 = $tabprice[10];
$line->multicurrency_total_ht = $tabprice[16];
$line->multicurrency_total_tva = $tabprice[17];
$line->multicurrency_total_ttc = $tabprice[18];
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée // Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
if ($line->fk_remise_except) if ($line->fk_remise_except)
{ {
@ -1844,6 +1857,7 @@ if (empty($reshook))
{ {
$nextSituationInvoice = new Facture($db); $nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id); $nextSituationInvoice->fetch($id);
// create extrafields with data from create form // create extrafields with data from create form
$extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element); $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost(null, $nextSituationInvoice); $ret = $extrafields->setOptionalsFromPost(null, $nextSituationInvoice);
@ -2770,7 +2784,7 @@ if ($action == 'create')
$facturestatic = new Facture($db); $facturestatic = new Facture($db);
$extrafields->fetch_name_optionals_label($facturestatic->table_element); $extrafields->fetch_name_optionals_label($facturestatic->table_element);
print load_fiche_titre($langs->trans('NewBill'), '', 'invoicing'); print load_fiche_titre($langs->trans('NewBill'), '', 'bill');
if ($socid > 0) if ($socid > 0)
$res = $soc->fetch($socid); $res = $soc->fetch($socid);

View File

@ -342,7 +342,7 @@ class FactureRec extends CommonInvoice
if ($objectline->fetch($result_insert)) if ($objectline->fetch($result_insert))
{ {
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($facsrc->lines[$i], 'fetch_optionals')) { if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
$objectline->array_options = $facsrc->lines[$i]->array_options; $objectline->array_options = $facsrc->lines[$i]->array_options;
} }
@ -438,7 +438,7 @@ class FactureRec extends CommonInvoice
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -748,9 +748,13 @@ class FactureRec extends CommonInvoice
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
$main = MAIN_DB_PREFIX . 'facturedet_rec';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)";
dol_syslog($sqlef);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid;
dol_syslog($sql); dol_syslog($sql);
if ($this->db->query($sql)) if ($this->db->query($sqlef) && $this->db->query($sql))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
dol_syslog($sql); dol_syslog($sql);
@ -759,6 +763,9 @@ class FactureRec extends CommonInvoice
// Delete linked object // Delete linked object
$res = $this->deleteObjectLinked(); $res = $this->deleteObjectLinked();
if ($res < 0) $error = -3; if ($res < 0) $error = -3;
// Delete extrafields
$res = $this->deleteExtraFields();
if ($res < 0) $error = -4;
} }
else else
{ {
@ -1966,6 +1973,14 @@ class FactureLigneRec extends CommonInvoiceLine
} }
} }
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
}
}
if (!$error) if (!$error)
{ {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
@ -2112,7 +2127,7 @@ class FactureLigneRec extends CommonInvoiceLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -1394,11 +1394,11 @@ class Facture extends CommonInvoice
$label = ''; $label = '';
if ($user->rights->facture->lire) { if ($user->rights->facture->lire) {
$label = '<u>'.$langs->trans("ShowInvoice").'</u>'; $label = '<u>'.$langs->trans("Invoice").'</u>';
if ($this->type == self::TYPE_REPLACEMENT) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceReplace").'</u>'; if ($this->type == self::TYPE_REPLACEMENT) $label = '<u>'.$langs->transnoentitiesnoconv("ReplacementInvoice").'</u>';
if ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceAvoir").'</u>'; if ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u>'.$langs->transnoentitiesnoconv("CreditNote").'</u>';
if ($this->type == self::TYPE_DEPOSIT) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceDeposit").'</u>'; if ($this->type == self::TYPE_DEPOSIT) $label = '<u>'.$langs->transnoentitiesnoconv("Deposit").'</u>';
if ($this->type == self::TYPE_SITUATION) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceSituation").'</u>'; if ($this->type == self::TYPE_SITUATION) $label = '<u>'.$langs->transnoentitiesnoconv("InvoiceSituation").'</u>';
if (!empty($this->ref)) if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_client)) if (!empty($this->ref_client))
@ -1426,7 +1426,7 @@ class Facture extends CommonInvoice
{ {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label = $langs->trans("ShowInvoice"); $label = $langs->trans("Invoice");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
@ -1452,9 +1452,10 @@ class Facture extends CommonInvoice
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
if ($txttoshow) if ($txttoshow)
{ {
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1); //$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
$result .= ' <span class="note inline-block">'; $result .= ' <span class="note inline-block">';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">'; $result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow, 1, 1).'">';
$result .= img_picto('', 'note'); $result .= img_picto('', 'note');
$result .= '</a>'; $result .= '</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic'); //$result.=img_picto($langs->trans("ViewNote"),'object_generic');
@ -1881,7 +1882,7 @@ class Facture extends CommonInvoice
$error++; $this->errors[] = "Error ".$this->db->lasterror(); $error++; $this->errors[] = "Error ".$this->db->lasterror();
} }
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -2185,13 +2186,16 @@ class Facture extends CommonInvoice
} }
} }
// Invoice line extrafileds
$main = MAIN_DB_PREFIX . 'facturedet';
$ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)";
// Delete invoice line // Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sql) && $this->delete_linked_contact()) if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact())
{ {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid;
@ -5237,7 +5241,7 @@ class FactureLigne extends CommonInvoiceLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet'); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
$this->rowid = $this->id; // For backward compatibility $this->rowid = $this->id; // For backward compatibility
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -5423,7 +5427,7 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$this->id = $this->rowid; $this->id = $this->rowid;
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
@ -5476,6 +5480,13 @@ class FactureLigne extends CommonInvoiceLine
} }
// End call triggers // End call triggers
// extrafields
$result = $this->deleteExtraFields();
if ($result < 0)
{
$this->db->rollback();
return -1;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
@ -5568,7 +5579,7 @@ class FactureLigne extends CommonInvoiceLine
$sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd'; $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd';
$sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON (f.rowid = fd.fk_facture) '; $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON (f.rowid = fd.fk_facture) ';
$sql .= ' WHERE fd.fk_prev_id ='.$this->fk_prev_id; $sql .= ' WHERE fd.fk_prev_id ='.$this->fk_prev_id;
$sql .= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed $sql .= ' AND f.situation_cycle_ref = '.$invoicecache[$invoiceid]->situation_cycle_ref; // Prevent cycle outed
$sql .= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE; $sql .= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE;
$res = $this->db->query($sql); $res = $this->db->query($sql);
@ -5576,6 +5587,8 @@ class FactureLigne extends CommonInvoiceLine
while ($obj = $this->db->fetch_object($res)) { while ($obj = $this->db->fetch_object($res)) {
$returnPercent = $returnPercent + floatval($obj->situation_percent); $returnPercent = $returnPercent + floatval($obj->situation_percent);
} }
} else {
dol_print_error($this->db);
} }
} }

View File

@ -333,7 +333,7 @@ if ($resql)
$title = $langs->trans("RepeatableInvoices"); $title = $langs->trans("RepeatableInvoices");
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
print '<span class="opacitymedium">'.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'</span><br><br>'; print '<span class="opacitymedium">'.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'</span><br><br>';

View File

@ -691,7 +691,7 @@ if ($resql)
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans('BillsCustomers').' '.($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans('BillsCustomers').' '.($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "SendBillRef"; $topicmail = "SendBillRef";
$modelmail = "facture_send"; $modelmail = "facture_send";

View File

@ -32,6 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
// Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'other'));
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer'; $mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
if ($mode == 'customer' && !$user->rights->facture->lire) accessforbidden(); if ($mode == 'customer' && !$user->rights->facture->lire) accessforbidden();
if ($mode == 'supplier' && !$user->rights->fournisseur->facture->lire) accessforbidden(); if ($mode == 'supplier' && !$user->rights->fournisseur->facture->lire) accessforbidden();
@ -57,25 +60,24 @@ $endyear = $year;
/* /*
* View * View
*/ */
// Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'other'));
$form = new Form($db); $form = new Form($db);
llxHeader(); llxHeader();
if ($mode == 'customer') $picto = 'bill';
{
$title = $langs->trans("BillsStatistics"); $title = $langs->trans("BillsStatistics");
$dir = $conf->facture->dir_temp; $dir = $conf->facture->dir_temp;
}
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$picto = 'supplier_invoice';
$title = $langs->trans("BillsStatisticsSuppliers"); $title = $langs->trans("BillsStatisticsSuppliers");
$dir = $conf->fournisseur->facture->dir_temp; $dir = $conf->fournisseur->facture->dir_temp;
} }
print load_fiche_titre($title, '', 'invoicing');
print load_fiche_titre($title, '', $picto);
dol_mkdir($dir); dol_mkdir($dir);

View File

@ -87,7 +87,7 @@ $thirdpartystatic = new Societe($db);
llxHeader("", $langs->trans("AccountancyTreasuryArea")); llxHeader("", $langs->trans("AccountancyTreasuryArea"));
print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'invoicing'); print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill');
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
@ -101,7 +101,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
$listofsearchfields['search_invoice'] = array('text'=>'CustomerInvoice'); $listofsearchfields['search_invoice'] = array('text'=>'CustomerInvoice');
} }
// Search supplier invoices // Search supplier invoices
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire)
{ {
$listofsearchfields['search_supplier_invoice'] = array('text'=>'SupplierInvoice'); $listofsearchfields['search_supplier_invoice'] = array('text'=>'SupplierInvoice');
} }
@ -231,7 +231,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
/** /**
* Draft suppliers invoices * Draft suppliers invoices
*/ */
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier"; $sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier";
$sql .= ", s.nom as name"; $sql .= ", s.nom as name";
@ -447,7 +447,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
// Last modified supplier invoices // Last modified supplier invoices
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{ {
$langs->load("boxes"); $langs->load("boxes");
$facstatic = new FactureFournisseur($db); $facstatic = new FactureFournisseur($db);
@ -958,7 +958,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
/* /*
* Unpayed supplier invoices * Unpayed supplier invoices
*/ */
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{ {
$facstatic = new FactureFournisseur($db); $facstatic = new FactureFournisseur($db);

View File

@ -250,7 +250,7 @@ llxHeader('', $name);
//$textprevyear="<a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current-1) . "\">".img_previous()."</a>"; //$textprevyear="<a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current-1) . "\">".img_previous()."</a>";
//$textnextyear=" <a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current+1) . "\">".img_next()."</a>"; //$textnextyear=" <a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current+1) . "\">".img_next()."</a>";
//print load_fiche_titre($langs->transcountry($LT,$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear", 'invoicing'); //print load_fiche_titre($langs->transcountry($LT,$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear", 'bill');
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
//report_header($name,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode); //report_header($name,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode);

View File

@ -48,7 +48,7 @@ if ($user->rights->tax->charges->creer)
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt); $newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt);
} }
print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'invoicing'); print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy');
$sql = "SELECT rowid, amount, label, f.datev, f.datep"; $sql = "SELECT rowid, amount, label, f.datev, f.datep";
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as f "; $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f ";

View File

@ -185,7 +185,7 @@ class Cpaiement
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if (null !== $ref) { if (null !== $ref) {
$sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')'; $sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')';
$sql .= ' AND t.code = '.'\''.$ref.'\''; $sql .= " AND t.code = '".$this->db->escape($ref)."'";
} else { } else {
$sql .= ' WHERE t.id = '.$id; $sql .= ' WHERE t.id = '.$id;
} }

View File

@ -217,7 +217,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit, 0, 0, 1); print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";

View File

@ -88,7 +88,7 @@ $formother = new FormOther($db);
llxHeader(); llxHeader();
$titre = ($year ? $langs->trans("PaymentsReportsForYear", $year) : $langs->trans("PaymentsReports")); $titre = ($year ? $langs->trans("PaymentsReportsForYear", $year) : $langs->trans("PaymentsReports"));
print load_fiche_titre($titre, '', 'invoicing'); print load_fiche_titre($titre, '', 'bill');
// Formulaire de generation // Formulaire de generation
print '<form method="post" action="rapport.php?year='.$year.'">'; print '<form method="post" action="rapport.php?year='.$year.'">';
@ -154,9 +154,11 @@ if ($year)
{ {
$tfile = $dir.'/'.$year.'/'.$file; $tfile = $dir.'/'.$year.'/'.$file;
$relativepath = $year.'/'.$file; $relativepath = $year.'/'.$file;
print '<tr class="oddeven">'.'<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>'; print '<tr class="oddeven">';
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td class="right">'.dol_print_size(dol_filesize($tfile)).'</td>'; print '<td class="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td></tr>'; print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td>';
print '</tr>';
} }
} }
closedir($handle); closedir($handle);

View File

@ -252,7 +252,7 @@ if ($resql)
print '<input type="hidden" name="limit" value="'.$limit.'"/>'; print '<input type="hidden" name="limit" value="'.$limit.'"/>';
} }
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -227,17 +227,15 @@ print "</tr>\n";
if ($modecompta == 'BOOKKEEPING') if ($modecompta == 'BOOKKEEPING')
{ {
$predefinedgroupwhere = "("; $predefinedgroupwhere = "(";
//$predefinedgroupwhere.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
$predefinedgroupwhere .= " (pcg_type = 'EXPENSE')"; $predefinedgroupwhere .= " (pcg_type = 'EXPENSE')";
$predefinedgroupwhere .= " OR "; $predefinedgroupwhere .= " OR ";
//$predefinedgroupwhere.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
$predefinedgroupwhere .= " (pcg_type = 'INCOME')"; $predefinedgroupwhere .= " (pcg_type = 'INCOME')";
$predefinedgroupwhere .= ")"; $predefinedgroupwhere .= ")";
$charofaccountstring = $conf->global->CHARTOFACCOUNTS; $charofaccountstring = $conf->global->CHARTOFACCOUNTS;
$charofaccountstring = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); $charofaccountstring = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$sql = "SELECT f.thirdparty_code as name, -1 as socid, aa.pcg_type, aa.pcg_subtype, sum(f.credit - f.debit) as amount"; $sql = "SELECT f.thirdparty_code as name, -1 as socid, aa.pcg_type, SUM(f.credit - f.debit) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f";
$sql .= ", ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= ", ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " WHERE f.numero_compte = aa.account_number"; $sql .= " WHERE f.numero_compte = aa.account_number";
@ -271,7 +269,7 @@ if ($modecompta == 'BOOKKEEPING')
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>'.$objp->pcg_type.($objp->pcg_subtype != 'XXXXXX' ? ' - '.$objp->pcg_subtype : '').($objp->name ? ' ('.$objp->name.')' : '')."</td>\n"; print '<td>'.$objp->pcg_type.($objp->name ? ' ('.$objp->name.')' : '')."</td>\n";
print '<td class="right">'.price($objp->amount)."</td>\n"; print '<td class="right">'.price($objp->amount)."</td>\n";
print "</tr>\n"; print "</tr>\n";
@ -282,7 +280,7 @@ if ($modecompta == 'BOOKKEEPING')
// This make 14 calls for each detail of account (NP, N and month m) // This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail != 'no') if ($showaccountdetail != 'no')
{ {
$tmppredefinedgroupwhere = "pcg_type = '".$db->escape($objp->pcg_type)."' AND pcg_subtype = '".$db->escape($objp->pcg_subtype)."'"; $tmppredefinedgroupwhere = "pcg_type = '".$db->escape($objp->pcg_type)."'";
$tmppredefinedgroupwhere .= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'"; $tmppredefinedgroupwhere .= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'";
//$tmppredefinedgroupwhere.= " AND thirdparty_code = '".$db->escape($objp->name)."'"; //$tmppredefinedgroupwhere.= " AND thirdparty_code = '".$db->escape($objp->name)."'";

View File

@ -556,7 +556,7 @@ class ChargeSociales extends CommonObject
if (empty($this->ref)) $this->ref = $this->label; if (empty($this->ref)) $this->ref = $this->label;
$label = '<u>'.$langs->trans("ShowSocialContribution").'</u>'; $label = '<u>'.$langs->trans("SocialContribution").'</u>';
if (!empty($this->ref)) if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->label)) if (!empty($this->label))
@ -569,7 +569,7 @@ class ChargeSociales extends CommonObject
{ {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label = $langs->trans("ShowSocialContribution"); $label = $langs->trans("SocialContribution");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -199,7 +199,7 @@ if ($resql)
$center = ($year ? "<a href='list.php?year=".($year - 1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='list.php?year=".($year + 1)."'>".img_next()."</a>" : ""); $center = ($year ? "<a href='list.php?year=".($year - 1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='list.php?year=".($year + 1)."'>".img_next()."</a>" : "");
} }
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
if (empty($mysoc->country_id) && empty($mysoc->country_code)) if (empty($mysoc->country_id) && empty($mysoc->country_code))
{ {

View File

@ -462,7 +462,7 @@ if (count($amount)) {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>'; print '<td>'.$langs->trans("Total").'</td>';
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>'; print '<td></td>';
} else { } else {
print '<td class="right">'.price($catotal_ht).'</td>'; print '<td class="right">'.price($catotal_ht).'</td>';
} }

View File

@ -625,7 +625,7 @@ if (count($amount)) {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>'; print '<td></td>';
} else { } else {
print '<td class="right">'.price($catotal_ht).'</td>'; print '<td class="right">'.price($catotal_ht).'</td>';
} }

View File

@ -574,7 +574,7 @@ if (count($amount)) {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>'; print '<td></td>';
} else { } else {
print '<td class="right">'.price($catotal_ht).'</td>'; print '<td class="right">'.price($catotal_ht).'</td>';
} }

View File

@ -191,15 +191,15 @@ if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description .= '<br>'.$langs
$description .= ($description ? '<br>' : '').$fsearch; $description .= ($description ? '<br>' : '').$fsearch;
if (!empty($conf->global->TAX_REPORT_EXTRA_REPORT)) if (!empty($conf->global->TAX_REPORT_EXTRA_REPORT))
{ {
$description .= '<br>' $description .= '<br>';
. '<input type="radio" name="extra_report" value="0" '.($special_report ? '' : 'checked="checked"').'> ' $description .= '<input type="radio" name="extra_report" value="0" '.($special_report ? '' : 'checked="checked"').'> ';
. $langs->trans('SimpleReport') $description .= $langs->trans('SimpleReport');
. '</input>' $description .= '</input>';
. '<br>' $description .= '<br>';
. '<input type="radio" name="extra_report" value="1" '.($special_report ? 'checked="checked"' : '').'> ' $description .= '<input type="radio" name="extra_report" value="1" '.($special_report ? 'checked="checked"' : '').'> ';
. $langs->trans('AddExtraReport') $description .= $langs->trans('AddExtraReport');
. '</input>' $description .= '</input>';
. '<br>'; $description .= '<br>';
} }
$elementcust = $langs->trans("CustomersInvoices"); $elementcust = $langs->trans("CustomersInvoices");

View File

@ -255,7 +255,7 @@ llxHeader('', $name);
//$textprevyear="<a href=\"index.php?year=" . ($year_current-1) . "\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>"; //$textprevyear="<a href=\"index.php?year=" . ($year_current-1) . "\">".img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a>";
//$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>"; //$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>";
//print load_fiche_titre($langs->transcountry("VAT", $mysoc->country_code), $textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, 'invoicing'); //print load_fiche_titre($langs->transcountry("VAT", $mysoc->country_code), $textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, 'bill');
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
//report_header($name,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode); //report_header($name,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode);

View File

@ -489,7 +489,7 @@ class Contact extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1168,7 +1168,7 @@ class Contact extends CommonObject
} }
// Removed extrafields // Removed extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { if (!$error) {
// For avoid conflicts if trigger used // For avoid conflicts if trigger used
$result = $this->deleteExtraFields(); $result = $this->deleteExtraFields();
if ($result < 0) $error++; if ($result < 0) $error++;

View File

@ -147,11 +147,11 @@ if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeA
if ($object->thirdparty->fournisseur) if ($object->thirdparty->fournisseur)
{ {
$thirdTypeArray['supplier'] = $langs->trans("supplier"); $thirdTypeArray['supplier'] = $langs->trans("supplier");
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices'); if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders'); if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']= $langs->transnoentitiesnoconv('SuppliersOrders');
// There no contact type for supplier proposals // There no contact type for supplier proposals
// if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); // if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
} }
print '</table>'; print '</table>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -57,19 +58,21 @@ $v = new vCard();
$v->setProdId('Dolibarr '.DOL_VERSION); $v->setProdId('Dolibarr '.DOL_VERSION);
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id); $v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
$v->setName($contact->lastname, $contact->firstname, "", "", ""); $v->setName($contact->lastname, $contact->firstname, "", $contact->civility, "");
$v->setFormattedName($contact->getFullName($langs)); $v->setFormattedName($contact->getFullName($langs, 1));
// By default, all informations are for work (except phone_perso and phone_mobile)
$v->setPhoneNumber($contact->phone_pro, "TYPE=WORK;VOICE"); $v->setPhoneNumber($contact->phone_pro, "TYPE=WORK;VOICE");
//$v->setPhoneNumber($contact->phone_perso,"TYPE=HOME;VOICE");
$v->setPhoneNumber($contact->phone_mobile, "TYPE=CELL;VOICE"); $v->setPhoneNumber($contact->phone_mobile, "TYPE=CELL;VOICE");
$v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX"); $v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX");
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code ? $contact->country : ''), "TYPE=WORK;POSTAL"); $country = $contact->country_code ? $contact->country : '' ;
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code ? $contact->country : ''), "TYPE=WORK");
$v->setEmail($contact->email, 'TYPE=PREF,INTERNET');
$v->setNote($contact->note);
$v->setAddress("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK;POSTAL");
$v->setLabel("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK");
$v->setEmail($contact->email);
$v->setNote($contact->note);
$v->setTitle($contact->poste); $v->setTitle($contact->poste);
// Data from linked company // Data from linked company
@ -78,8 +81,35 @@ if ($company->id)
$v->setURL($company->url, "TYPE=WORK"); $v->setURL($company->url, "TYPE=WORK");
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
if (! $contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); if (! $contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
if (!$contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country, "TYPE=WORK;POSTAL"); if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
if (empty($contact->email)) $v->setEmail($company->email, 'TYPE=PREF,INTERNET');
// when company e-mail is empty, use only contact e-mail
if (empty(trim($company->email)))
{
// was set before, don't set twice
}
// when contact e-mail is empty, use only company e-mail
elseif (empty(trim($contact->email)))
{
$v->setEmail($company->email);
}
// when e-mail domain of contact and company are the same, use contact e-mail at first (and company e-mail at second)
elseif (strtolower(end(explode("@", $contact->email))) == strtolower(end(explode("@", $company->email))))
{
$v->setEmail($contact->email);
// support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($company->email, 'INTERNET');
}
// when e-mail of contact and company complete different use company e-mail at first (and contact e-mail at second)
else
{
$v->setEmail($company->email);
// support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($contact->email, 'INTERNET');
}
// Si contact lie a un tiers non de type "particulier" // Si contact lie a un tiers non de type "particulier"
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name); if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name);
} }

View File

@ -146,14 +146,16 @@ if ($id > 0)
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2); $morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
} }
$permtoedit = 0;
$morehtmlref .= '<div class="refidno">'; $morehtmlref .= '<div class="refidno">';
// Ref customer // Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
// Ref supplier // Ref supplier
$morehtmlref .= '<br>'; $morehtmlref .= '<br>';
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
@ -165,7 +167,8 @@ if ($id > 0)
if ($user->rights->contrat->creer) if ($user->rights->contrat->creer)
{ {
if ($action != 'classify') { if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; //$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
$morehtmlref .= ' : ';
} }
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);

View File

@ -316,7 +316,7 @@ if (empty($reshook))
// Extrafields // Extrafields
$array_options = array(); $array_options = array();
// For avoid conflicts if trigger used // For avoid conflicts if trigger used
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals(); $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
@ -1098,7 +1098,7 @@ if ($result > 0)
// Create // Create
if ($action == 'create') if ($action == 'create')
{ {
print load_fiche_titre($langs->trans('AddContract'), '', 'commercial'); print load_fiche_titre($langs->trans('AddContract'), '', 'contract');
$soc = new Societe($db); $soc = new Societe($db);
if ($socid > 0) $soc->fetch($socid); if ($socid > 0) $soc->fetch($socid);

View File

@ -1035,7 +1035,7 @@ class Contrat extends CommonObject
} }
} }
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1252,6 +1252,22 @@ class Contrat extends CommonObject
} }
} }
if (!$error)
{
// Delete contratdet extrafields
$main = MAIN_DB_PREFIX . 'contratdet';
$ef = $main . "_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_contrat = " . $this->id . ")";
dol_syslog(get_class($this)."::delete contratdet_extrafields", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->error();
$error++;
}
}
if (!$error) if (!$error)
{ {
// Delete contratdet // Delete contratdet
@ -1383,7 +1399,7 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1588,7 +1604,7 @@ class Contrat extends CommonObject
{ {
$contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet"); $contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet");
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used if (!$error)
{ {
$contractline = new ContratLigne($this->db); $contractline = new ContratLigne($this->db);
$contractline->array_options = $array_options; $contractline->array_options = $array_options;
@ -1777,7 +1793,7 @@ class Contrat extends CommonObject
$result = $this->update_statut($user); $result = $this->update_statut($user);
if ($result >= 0) if ($result >= 0)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used if (is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
{ {
$contractline = new ContratLigne($this->db); $contractline = new ContratLigne($this->db);
$contractline->fetch($rowid); $contractline->fetch($rowid);
@ -1859,10 +1875,8 @@ class Contrat extends CommonObject
$error++; $error++;
} }
if (empty($error)) { if (!$error) {
// Remove extrafields // Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db); $contractline = new ContratLigne($this->db);
$contractline->id = $idline; $contractline->id = $idline;
$result = $contractline->deleteExtraFields(); $result = $contractline->deleteExtraFields();
@ -1872,7 +1886,6 @@ class Contrat extends CommonObject
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error; $this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
} }
} }
}
if (empty($error)) { if (empty($error)) {
$this->db->commit(); $this->db->commit();
@ -3092,7 +3105,7 @@ class ContratLigne extends CommonObjectLine
$error++; $error++;
} }
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used if (!$error) // For avoid conflicts if trigger used
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -3202,6 +3215,8 @@ class ContratLigne extends CommonObjectLine
{ {
global $conf, $user; global $conf, $user;
$error = 0;
// Insertion dans la base // Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
$sql .= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,"; $sql .= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,";
@ -3240,7 +3255,7 @@ class ContratLigne extends CommonObjectLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet'); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet');
// Insert of extrafields // Insert of extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -136,6 +136,7 @@ if ($object->id)
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
{ {

View File

@ -70,7 +70,7 @@ $now = dol_now();
llxHeader(); llxHeader();
print load_fiche_titre($langs->trans("ContractsArea"), '', 'commercial'); print load_fiche_titre($langs->trans("ContractsArea"), '', 'contract');
//print '<table border="0" width="100%" class="notopnoleftnoright">'; //print '<table border="0" width="100%" class="notopnoleftnoright">';

View File

@ -384,7 +384,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "SendContractRef"; $topicmail = "SendContractRef";
$modelmail = "contract"; $modelmail = "contract";

View File

@ -349,7 +349,8 @@ if ($mode == "0") $title = $langs->trans("ListOfInactiveServices"); // Must use
if ($mode == "4" && $filter != "expired") $title = $langs->trans("ListOfRunningServices"); if ($mode == "4" && $filter != "expired") $title = $langs->trans("ListOfRunningServices");
if ($mode == "4" && $filter == "expired") $title = $langs->trans("ListOfExpiredServices"); if ($mode == "4" && $filter == "expired") $title = $langs->trans("ListOfExpiredServices");
if ($mode == "5") $title = $langs->trans("ListOfClosedServices"); if ($mode == "5") $title = $langs->trans("ListOfClosedServices");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit);
if ($sall) if ($sall)
{ {

View File

@ -751,7 +751,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
} }
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals(); $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }

View File

@ -105,11 +105,11 @@ if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARC
{ {
$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
} }
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire) if ((! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) || ! empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire)
{ {
$arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
} }
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire) if ((! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || ! empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{ {
$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
} }

View File

@ -170,12 +170,13 @@ abstract class CommonDocGenerator
* *
* @param Societe $object Object * @param Societe $object Object
* @param Translate $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @param string $array_key Name of the key for return array
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
public function get_substitutionarray_thirdparty($object, $outputlangs) public function get_substitutionarray_thirdparty($object, $outputlangs, $array_key = 'company')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf, $extrafields;
if (empty($object->country) && !empty($object->country_code)) if (empty($object->country) && !empty($object->country_code))
{ {
@ -224,23 +225,9 @@ abstract class CommonDocGenerator
// Retrieve extrafields // Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) if (is_array($object->array_options) && count($object->array_options))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals(); $object->fetch_optionals();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key=>$label) $array_thirdparty = $this->fill_substitutionarray_with_extrafields($object, $array_thirdparty, $extrafields, $array_key, $outputlangs);
{
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
}
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
{
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
}
$array_thirdparty = array_merge($array_thirdparty, array('company_options_'.$key => $object->array_options ['options_'.$key]));
}
} }
return $array_thirdparty; return $array_thirdparty;
} }
@ -251,13 +238,13 @@ abstract class CommonDocGenerator
* *
* @param Contact $object contact * @param Contact $object contact
* @param Translate $outputlangs object for output * @param Translate $outputlangs object for output
* @param array $array_key Name of the key for return array * @param string $array_key Name of the key for return array
* @return array Array of substitution key->code * @return array Array of substitution key->code
*/ */
public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf, $extrafields;
if (empty($object->country) && !empty($object->country_code)) if (empty($object->country) && !empty($object->country_code))
{ {
@ -299,22 +286,11 @@ abstract class CommonDocGenerator
); );
// Retrieve extrafields // Retrieve extrafields
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (is_array($object->array_options) && count($object->array_options))
$extrafields = new ExtraFields($this->db); {
$extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals(); $object->fetch_optionals();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) $array_contact = $this->fill_substitutionarray_with_extrafields($object, $array_contact, $extrafields, $array_key, $outputlangs);
{
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_'.$key] = price($object->array_options ['options_'.$key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
}
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
{
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
}
$array_contact = array_merge($array_contact, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
} }
return $array_contact; return $array_contact;
} }
@ -370,7 +346,7 @@ abstract class CommonDocGenerator
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf, $extrafields;
$sumpayed = $sumdeposit = $sumcreditnote = ''; $sumpayed = $sumdeposit = $sumcreditnote = '';
$already_payed_all = 0; $already_payed_all = 0;
@ -528,11 +504,6 @@ abstract class CommonDocGenerator
// Retrieve extrafields // Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) if (is_array($object->array_options) && count($object->array_options))
{ {
$extrafieldkey = $object->element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
$object->fetch_optionals(); $object->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
@ -605,7 +576,7 @@ abstract class CommonDocGenerator
} }
// Retrieve extrafields // Retrieve extrafields
$extrafieldkey = $line->element; $extrafieldkey = $line->table_element;
$array_key = "line"; $array_key = "line";
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
@ -672,7 +643,7 @@ abstract class CommonDocGenerator
public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf, $extrafields;
dol_include_once('/core/lib/product.lib.php'); dol_include_once('/core/lib/product.lib.php');
$object->list_delivery_methods($object->shipping_method_id); $object->list_delivery_methods($object->shipping_method_id);
$calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
@ -711,9 +682,6 @@ abstract class CommonDocGenerator
// Retrieve extrafields // Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) if (is_array($object->array_options) && count($object->array_options))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label('expedition', true);
$object->fetch_optionals(); $object->fetch_optionals();
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);

View File

@ -1359,7 +1359,7 @@ abstract class CommonObject
} }
if ($conf->{$modulename}->enabled) { if ($conf->{$modulename}->enabled) {
$libelle_element = $langs->trans('ContactDefault_'.$obj->element); $libelle_element = $langs->trans('ContactDefault_'.$obj->element);
$transkey = "TypeContact_".$this->element."_".$source."_".$obj->code; $transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code;
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
if (empty($option)) if (empty($option))
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
@ -2974,6 +2974,14 @@ abstract class CommonObject
// phpcs:enable // phpcs:enable
global $conf, $hookmanager, $action; global $conf, $hookmanager, $action;
$parameters = array('exclspec' => $exclspec, 'roundingadjust' => $roundingadjust, 'nodatabaseupdate' => $nodatabaseupdate, 'seller' => $seller);
$reshook = $hookmanager->executeHooks('updateTotalPrice', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
return 1; // replacement code
} elseif ($reshook < 0) {
return -1; // failure
} // reshook = 0 => execute normal code
// Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield) // Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield)
$MODULE = ""; $MODULE = "";
if ($this->element == 'propal') if ($this->element == 'propal')
@ -3068,18 +3076,23 @@ abstract class CommonObject
if (empty($reshook) && $forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto' if (empty($reshook) && $forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto'
{ {
// This part of code is to fix data. We should not call it too often.
$localtax_array = array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx); $localtax_array = array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
$tmpcal = calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array, (isset($obj->situation_percent) ? $obj->situation_percent : 100), $multicurrency_tx); $tmpcal = calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array, (isset($obj->situation_percent) ? $obj->situation_percent : 100), $multicurrency_tx);
$diff = price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
if ($diff) $diff_when_using_price_ht = price2num($tmpcal[1] - $obj->total_tva, 'MT', 1); // If price was set with tax price adn unit price HT has a low number of digits, then we may have a diff on recalculation from unit price HT.
$diff_on_current_total = price2num($obj->total_ttc - $obj->total_ht - $obj->total_tva - $obj->total_localtax1 - $obj->total_localtax2, 'MT', 1);
//var_dump($obj->total_ht.' '.$obj->total_tva.' '.$obj->total_localtax1.' '.$obj->total_localtax2.' =? '.$obj->total_ttc);
//var_dump($diff_when_using_price_ht.' '.$diff_on_current_total);
if ($diff_when_using_price_ht && $diff_on_current_total)
{ {
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".$tmpcal[1].", total_ttc = ".$tmpcal[2]." WHERE rowid = ".$obj->rowid; $sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".$tmpcal[1].", total_ttc = ".$tmpcal[2]." WHERE rowid = ".$obj->rowid;
dol_syslog('We found unconsistent data into detailed line (difference of '.$diff.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix); dol_syslog('We found unconsistent data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
$resqlfix = $this->db->query($sqlfix); $resqlfix = $this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db, 'Failed to update line'); if (! $resqlfix) dol_print_error($this->db, 'Failed to update line');
$obj->total_tva = $tmpcal[1]; $obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2]; $obj->total_ttc = $tmpcal[2];
//
} }
} }
@ -5351,9 +5364,14 @@ abstract class CommonObject
* Delete all extra fields values for the current object. * Delete all extra fields values for the current object.
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @see deleteExtraLanguages(), insertExtraField(), updateExtraField(), setValueFrom()
*/ */
public function deleteExtraFields() public function deleteExtraFields()
{ {
global $conf;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
$this->db->begin(); $this->db->begin();
$table_element = $this->table_element; $table_element = $this->table_element;
@ -5383,18 +5401,18 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY) * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user * @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK * @return int -1=error, O=did nothing, 1=OK
* @see insertExtraLanguages(), updateExtraField(), setValueFrom() * @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom()
*/ */
public function insertExtraFields($trigger = '', $userused = null) public function insertExtraFields($trigger = '', $userused = null)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
if (empty($userused)) $userused = $user; if (empty($userused)) $userused = $user;
$error = 0; $error = 0;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
if (!empty($this->array_options)) if (!empty($this->array_options))
{ {
// Check parameters // Check parameters
@ -5792,18 +5810,18 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY) * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user * @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK * @return int -1=error, O=did nothing, 1=OK
* @see updateExtraLanguages(), setValueFrom(), insertExtraFields() * @see updateExtraLanguages(), insertExtraFields(), deleteExtraFields(), setValueFrom()
*/ */
public function updateExtraField($key, $trigger = null, $userused = null) public function updateExtraField($key, $trigger = null, $userused = null)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
if (empty($userused)) $userused = $user; if (empty($userused)) $userused = $user;
$error = 0; $error = 0;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
if (!empty($this->array_options) && isset($this->array_options["options_".$key])) if (!empty($this->array_options) && isset($this->array_options["options_".$key]))
{ {
// Check parameters // Check parameters
@ -8174,7 +8192,7 @@ abstract class CommonObject
} }
// Update extrafield // Update extrafield
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -8335,7 +8353,7 @@ abstract class CommonObject
if (empty($error)) { if (empty($error)) {
// Remove extrafields // Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$tmpobjectline = new $tmpforobjectlineclass($this->db); $tmpobjectline = new $tmpforobjectlineclass($this->db);
$tmpobjectline->id = $idline; $tmpobjectline->id = $idline;

View File

@ -147,7 +147,7 @@ class CUnits // extends CommonObject
/** /**
* Load object in memory from database * Load object in memory from database
* *
* @param int $id Id object * @param int $id Id of CUnit object to fetch (rowid)
* @param string $code Code * @param string $code Code
* @param string $short_label Short Label ('g', 'kg', ...) * @param string $short_label Short Label ('g', 'kg', ...)
* @param string $unit_type Unit type ('size', 'surface', 'volume', 'weight', ...) * @param string $unit_type Unit type ('size', 'surface', 'volume', 'weight', ...)
@ -168,7 +168,7 @@ class CUnits // extends CommonObject
$sql .= " t.active"; $sql .= " t.active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_units as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_units as t";
$sql_where = array(); $sql_where = array();
if ($id) $sql_where[] = " t.id = ".$id; if ($id) $sql_where[] = " t.rowid = ".$id;
if ($unit_type) $sql_where[] = " t.unit_type = '".$this->db->escape($unit_type)."'"; if ($unit_type) $sql_where[] = " t.unit_type = '".$this->db->escape($unit_type)."'";
if ($code) $sql_where[] = " t.code = '".$this->db->escape($code)."'"; if ($code) $sql_where[] = " t.code = '".$this->db->escape($code)."'";
if ($short_label) $sql_where[] = " t.short_label = '".$this->db->escape($short_label)."'"; if ($short_label) $sql_where[] = " t.short_label = '".$this->db->escape($short_label)."'";

View File

@ -69,7 +69,9 @@ class ExtraLanguages
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load array this->attributes * Load array this->attributes with list of fields per object that need an alternate translation.
* You can set variable MAIN_USE_ALTERNATE_TRANSLATION_FOR=elementA:fieldname,fieldname2;elementB:...
* Example: MAIN_USE_ALTERNATE_TRANSLATION_FOR=societe:name,town;contact:firstname,lastname
* *
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache. * @param boolean $forceload Force load of extra fields whatever is status of cache.
@ -86,11 +88,25 @@ class ExtraLanguages
if ($elementtype == 'contact') $elementtype = 'socpeople'; if ($elementtype == 'contact') $elementtype = 'socpeople';
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur'; if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
$array_name_label = array(
'societe' => array('name'=>'Name'),
'contact' => array('firstname' => 'Firstname', 'lastname' => 'Lastname')
);
$array_name_label = array();
if (!empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) {
$tmpelement = explode(';', $conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR);
foreach ($tmpelement as $elementstring) {
$reg = array();
preg_match('/^(.*):(.*)$/', $elementstring, $reg);
$element = $reg[1];
$array_name_label[$element] = array();
$tmpfields = explode(',', $reg[2]);
foreach ($tmpfields as $field) {
//var_dump($fields);
//$tmpkeyvar = explode(':', $fields);
//$array_name_label[$element][$tmpkeyvar[0]] = $tmpkeyvar[1];
$array_name_label[$element][$field] = $field;
}
}
}
//var_dump($array_name_label);
$this->attributes = $array_name_label; $this->attributes = $array_name_label;
return $array_name_label; return $array_name_label;

View File

@ -6642,8 +6642,7 @@ class Form
$out .= 'function formatResult(record) {'."\n"; $out .= 'function formatResult(record) {'."\n";
if ($elemtype == 'category') if ($elemtype == 'category')
{ {
$out .= ' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
} }
else else
{ {
@ -6653,8 +6652,7 @@ class Form
$out .= 'function formatSelection(record) {'."\n"; $out .= 'function formatSelection(record) {'."\n";
if ($elemtype == 'category') if ($elemtype == 'category')
{ {
$out .= ' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
} }
else else
{ {

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