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:
> 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:
* tab value to 4
* 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.DetectedCatch"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedForeach"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.NotAllowed"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.NotAllowedWarning"/>
</rule>
<!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->
@ -70,9 +68,6 @@
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod">
<severity>0</severity>
</rule>
<!--
<rule ref="Generic.Commenting.Todo" />
@ -125,13 +120,6 @@
<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 -->
<!-- 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">
@ -141,7 +129,7 @@
<!-- Tweaks to metrics -->
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="120" />
<property name="complexity" value="150" />
<property name="absoluteComplexity" value="300" />
</properties>
</rule>
@ -179,7 +167,6 @@
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.Strings.UnnecessaryStringConcat.Found">
<severity>0</severity>
</rule>
<!-- Disallow usage of tab -->

View File

@ -488,11 +488,11 @@ if ($resql)
// Action
print '<td class="center">';
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 '</a>';
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 '</a>';
}

View File

@ -696,7 +696,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

@ -408,7 +408,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
$titre = $langs->trans($tablib[$id]);
$linkback = '';
$titlepicto = 'title_setup';
$titlepicto = 'title_accountancy';
print load_fiche_titre($titre, $linkback, $titlepicto);
@ -806,7 +806,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

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

View File

@ -657,7 +657,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

@ -362,7 +362,6 @@ if ($result)
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
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 '<br>';
@ -412,7 +411,7 @@ if ($result)
//print '<br><div class="center">'.$buttonsave.'</div>';
$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 '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';

View File

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

View File

@ -567,12 +567,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
// 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>';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
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);
if ($objp->product_id > 0)
{
@ -583,7 +583,7 @@ if ($result) {
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
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 '</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 "<br>\n";
@ -101,13 +101,13 @@ if ($conf->accounting->enabled)
// STEPS
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'.'</a>');
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";
$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";
$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";
@ -116,20 +116,20 @@ if ($conf->accounting->enabled)
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'.'</a>');
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";
$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";
$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 "<br>\n";
if (!empty($conf->tax->enabled))
{
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'.'</a>';
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
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.
{
$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";
}
/*
@ -169,7 +169,7 @@ if ($conf->accounting->enabled)
}*/
$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";
@ -186,17 +186,17 @@ if ($conf->accounting->enabled)
$langs->loadLangs(array('bills', 'trips'));
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>'.'</a>')."\n";
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";
$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";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>'.'</a>')."\n";
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";
}

View File

@ -994,7 +994,7 @@ if (empty($action) || $action == 'view') {
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'
|| ($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">';
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') {
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 '<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') {
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);
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;
print "</td>";
@ -959,15 +959,15 @@ if (empty($action) || $action == 'view') {
foreach ($tabother[$key] as $k => $mt) {
if ($mt) {
print '<tr class="oddeven">';
print "<!-- VAT counterpart NPR -->";
print '<!-- VAT counterpart NPR -->';
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
print '<td>';
$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;
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 '<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') {
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);
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;
print "</td>";

View File

@ -553,12 +553,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
// 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>';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
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);
if ($objp->product_id > 0)
{
@ -567,7 +567,7 @@ if ($result) {
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
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 '</td>';

View File

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

View File

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

View File

@ -1718,7 +1718,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

@ -213,19 +213,17 @@ class Dolistore
{
$cat = $this->categories[$i];
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.'" '
.'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>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" ';
$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>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} 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' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' 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 .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"';
$html .= ' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ';
$html .= '>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
}
}
@ -269,8 +267,8 @@ class Dolistore
// add image or default ?
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;
$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 = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version.'">';
$images .= '<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
}

View File

@ -368,20 +368,20 @@ foreach ($dirmodels as $reldir)
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;

View File

@ -240,9 +240,9 @@ dol_syslog("select rss boxes", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$boxlist = InfoBox::listBoxes($db, 'activated', -1, null);
$num = $db->num_rows($resql);
$i = 0;
$boxlist = InfoBox::listBoxes($db, 'activated', -1, null);
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
@ -271,19 +271,19 @@ if ($resql)
print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">';
print '<input type="hidden" name="norss" value="'.$idrss.'">';
print '</td>';
print "</tr>"."\n";
print '</tr>'."\n";
print '<tr class="oddeven">';
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 "</tr>"."\n";
print '</tr>'."\n";
print '<tr class="oddeven">';
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 "</tr>"."\n";
print '</tr>'."\n";
print '<tr class="oddeven">';
@ -301,7 +301,7 @@ if ($resql)
print '</div>';
}
print "</td>";
print "</tr>"."\n";
print '</tr>'."\n";
// Logo
if ($result > 0 && empty($rss->error))
@ -315,7 +315,7 @@ if ($resql)
if ($imageurl) print '<img height="32" src="'.$imageurl.'">';
else print $langs->trans("None");
print '</td>';
print "</tr>"."\n";
print '</tr>'."\n";
}
// Active
@ -323,11 +323,11 @@ if ($resql)
print '<tr class="oddeven">';
print '<td>'.$langs->trans('WidgetEnabled').'</td>';
print '<td>'.yn($active).'</td>';
print "</tr>"."\n";
print '</tr>'."\n";
print '</table>'."\n";
print "</form>"."\n";
print "</form>\n";
$i++;
}
@ -350,9 +350,9 @@ $db->close();
*/
function _isInBoxList($idrss, array $boxlist)
{
foreach($boxlist as $box)
foreach ($boxlist as $box)
{
if($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false)
if ($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false)
{
return true;
}

View File

@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
if (! $user->admin) accessforbidden();
if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type='invoice';
$type = 'invoice';
/*
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
* View
*/
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(
"", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
);
$form=new Form($db);
$form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
$head = invoice_admin_prepare_head();
@ -106,12 +106,12 @@ $arrayAvailableType = array(
);
$selected = array();
$implodeglue = '+';
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) {
$selected = explode('+', $conf->global->{$confkey});
}
$curentInput = (empty($inputCount)?1:($inputCount+1));
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
$curentInput = (empty($inputCount) ? 1 : ($inputCount + 1));
$formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1);
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
@ -126,7 +126,7 @@ $metas = array(
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
// Conditions paiements
$inputCount = empty($inputCount)?1:($inputCount+1);
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
print '<tr class="oddeven">';
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
print '<td class="center" width="20">&nbsp;</td>';
@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
global $langs;
print '<tr class="oddeven">';
print '<td>'.($title?$title:$langs->trans($confkey));
print '<td>'.($title ? $title : $langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
@ -206,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
{
global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount)?1:($inputCount+1);
$form=new Form($db);
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
if ($type!='textarea') {
if ($type != 'textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
@ -229,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<td>';
if (!empty($help)) {
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else {
print $title?$title:$langs->trans($confkey);
print $title ? $title : $langs->trans($confkey);
}
if (!empty($desc)) {
@ -244,12 +244,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type=='textarea') {
if ($type == 'textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
}elseif($type=='input'){
}elseif ($type == 'input') {
print '<input '.$metascompil.' />';
}
else{
else {
// custom
print $type;
}

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_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_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
@ -278,8 +277,10 @@ print '</tr>';
// Disable javascript and ajax
print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
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 width="20">&nbsp;</td>';
print '</tr>';
// 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 '</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
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
complete_substitutions_array($substitutionarray, $langs);
@ -407,13 +415,6 @@ $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf
$doleditor->Create();
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
print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">';

View File

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

View File

@ -325,6 +325,22 @@ if ($conf->use_javascript_ajax)
if (!empty($menu['langs'])) $langs->load($menu['langs']);
$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(
'rowid'=>$menu['rowid'],
'module'=>$menu['module'],
@ -335,20 +351,8 @@ if ($conf->use_javascript_ajax)
'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.
'<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
'</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>'
'entry'=>$entry,
'buttons'=>$buttons
);
$i++;
}

View File

@ -387,7 +387,7 @@ if ($mode == 'feature')
$filedata = dol_buildpath($moduledir.'/sql/data.sql');
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");

View File

@ -48,19 +48,19 @@ $action = GETPOST('action', 'aZ09');
if ($action == 'update' || $action == 'add')
{
$constlineid = GETPOST('rowid', 'int');
$constname=GETPOST('constname', 'alpha');
$constname = GETPOST('constname', 'alpha');
$constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
$consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
$constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
$consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
$res=dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
if (! $res > 0) $error++;
if (!$res > 0) $error++;
if (! $error)
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@ -183,7 +183,7 @@ $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents();
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
// Editing global variables not related to a specific theme
$constantes=array();
$constantes = array();
foreach ($listofnotifiedevents as $notifiedevent)
{
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
@ -210,7 +210,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label);
}
$helptext='';
$helptext = '';
form_constantes($constantes, 0, $helptext);
} else {
print '<table class="noborder centpercent">';
@ -265,7 +265,7 @@ print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
print '<td>'.$langs->trans("Threshold").'</td>';
print '<td>'.'</td>';
print '<td></td>';
print "</tr>\n";
foreach ($listofnotifiedevents as $notifiedevent)

View File

@ -66,7 +66,7 @@ if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
else
{
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>';
@ -123,7 +123,7 @@ if (!$foundcache && $test)
{
$foundcache++;
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');
if (!$foundcache && $test)

View File

@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<br>';
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 '<br>';
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.
'separator2'=>array('family'=>'separator', 'position'=>50),
// 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
'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
'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']))

View File

@ -153,7 +153,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
// Show message
$message = '';
$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;
print $message;
print '<br>';

View File

@ -137,6 +137,15 @@ class DolibarrApi
unset($object->labelStatus);
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->fk_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.
*
* @url GET /conf
*
* @param string $confname Name of conf variable to get
* @param string $constantname Name of conf variable to get
* @return array|mixed Data without useless information
*
* @url GET conf/{constantname}
*
* @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;
@ -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');
}
if (!preg_match('/^[a-zA-Z0-9_]+$/', $confname) || !isset($conf->global->$confname)) {
throw new RestException(500, 'Error Bad or unknown value for constname');
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
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');
}
return $conf->global->$confname;
return $conf->global->$constantname;
}
/**

View File

@ -34,15 +34,18 @@ $langs->loadLangs(array("asset"));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
// Initialize technical objects
$object = new Asset($db);
$extrafields = new ExtraFields($db);
$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
$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';
// 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
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
$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
*
* Put here all code to do according to value of "action" parameter
*/
$parameters = array();
@ -86,16 +86,35 @@ if (empty($reshook))
{
$error = 0;
$permissiontoadd = $user->rights->asset->create;
$permissiontodelete = $user->rights->asset->delete;
$backurlforlist = dol_buildpath('/asset/list.php', 1);
// Actions cancel, add, update or delete
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
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
$triggersendname = 'ASSET_SENTBYMAIL';
$autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO';
@ -143,11 +162,12 @@ if ($action == 'create')
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
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(), '');
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
@ -166,6 +186,8 @@ if ($action == 'create')
print '</div>';
print '</form>';
//dol_set_focus('input[name="ref"]');
}
// 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="backtopage" value="'.$backtopage.'">';
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();
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
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();
$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 = '';
@ -255,10 +279,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<table class="border centpercent">'."\n";
// 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';
// Other attributes
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
@ -266,7 +292,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>';
print '</div>';
print '<div class="clearboth"></div><br>';
print '<div class="clearboth"></div>';
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
/*
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
$modelmail='inventory';
/*
$modelmail='asset';
$defaulttopic='InformationMessage';
$diroutput = $conf->product->dir_output.'/inventory';
$trackid = 'stockinv'.$object->id;
$diroutput = $conf->asset->dir_output.'/asset';
$trackid = 'asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/

View File

@ -77,12 +77,12 @@ class Asset extends CommonObject
*/
public $fields = array(
'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",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, '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",),
'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'=>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),
'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",),
'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,),
'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,),

View File

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

View File

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

View File

@ -44,26 +44,26 @@ $signature = GETPOST('s');
$newblock = GETPOST('b');
$hash = GETPOST('h');
if($auth->fetch(0, $signature)<=0) {
if ($auth->fetch(0, $signature) <= 0) {
$auth->signature = $signature;
$auth->create($user);
}
if(!empty($hash)) {
if (!empty($hash)) {
echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk';
}
elseif(!empty($newblock)){
if($auth->checkBlock($newblock)) {
elseif (!empty($newblock)) {
if ($auth->checkBlock($newblock)) {
$auth->addBlock($newblock);
$auth->update($user);
echo 'blockadded';
}
else{
else {
echo 'blockalreadyadded';
}
}
else{
else {
echo 'idontunderstandwhatihavetodo';
}

View File

@ -42,7 +42,7 @@ $ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$product_static= new Product($db);
$product_static = new Product($db);
$trclass = 'oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
echo '<tr class="'.$trclass.'" >';

View File

@ -74,7 +74,7 @@ if ($nolinesbefore) {
print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>';
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;
// Adds a line numbering column

View File

@ -32,23 +32,23 @@
* View
*/
$form=new Form($db);
$form = new Form($db);
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if ( GETPOST('filtre', 'alpha') ) {
if (GETPOST('filtre', 'alpha')) {
// Avec filtre
$ret=array(); $i=0;
$ret = array(); $i = 0;
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.entity IN (".getEntity('product').")";
$sql.= " AND p.tosell = 1";
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
$sql.= " AND (";
$sql.= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (! empty($conf->barcode->enabled))
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
if (!$conf->global->CASHDESK_SERVICES) $sql .= " AND p.fk_product_type = 0";
$sql .= " AND (";
$sql .= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (!empty($conf->barcode->enabled))
{
$filtre = GETPOST('filtre', 'alpha');
@ -85,23 +85,23 @@ if ( GETPOST('filtre', 'alpha') ) {
{
dol_print_error($db);
}
$tab_designations=$ret;
$tab_designations = $ret;
} else {
// Sans filtre
$ret=array();
$i=0;
$ret = array();
$i = 0;
$sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql.= " WHERE p.entity IN (".getEntity('product').")";
$sql.= " AND p.tosell = 1";
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
$sql.= " ORDER BY p.label";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
if (!$conf->global->CASHDESK_SERVICES) $sql .= " AND p.fk_product_type = 0";
$sql .= " ORDER BY p.label";
dol_syslog($sql);
$resql=$db->query($sql);
$resql = $db->query($sql);
if ($resql)
{
$nbr_enreg = $db->num_rows($resql);

View File

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

View File

@ -184,9 +184,7 @@ foreach ($fulltree as $key => $val)
'rowid'=>$val['rowid'],
'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.
//'<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");
}
$object->note = trim(GETPOST("note"));
$object->note_private = trim(GETPOST("note"));
if (isset($_POST["contactid"])) $object->contact = $contact;
@ -465,7 +465,6 @@ if (empty($reshook) && $action == 'update')
$object->contactid = key($object->socpeopleassigned);
}
$object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", "none"); // deprecated
$object->note_private = GETPOST("note", "none");
$object->fk_element = GETPOST("fk_element", "int");
$object->elementtype = GETPOST("elementtype", "alphanohtml");
@ -1122,7 +1121,7 @@ if ($action == 'create')
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
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();
print '</td></tr>';
@ -1188,7 +1187,7 @@ if ($id > 0)
$object->contactid = GETPOST("contactid", '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)
@ -1540,7 +1539,7 @@ if ($id > 0)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Editeur wysiwyg
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();
print '</td></tr>';

View File

@ -380,7 +380,7 @@ class ActionComm extends CommonObject
// Clean parameters
$this->label = dol_trunc(trim($this->label), 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->priority) || !is_numeric($this->priority)) $this->priority = 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 .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "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($user->id) && $user->id > 0 ? $user->id : "null").", ";
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
@ -567,14 +567,11 @@ class ActionComm extends CommonObject
if (!$error)
{
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (!$error && !$notrigger)
@ -733,14 +730,14 @@ class ActionComm extends CommonObject
$this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : '');
$this->code = $obj->code;
$this->label = $obj->label;
$this->datep = $this->db->jdate($obj->datep);
$this->datef = $this->db->jdate($obj->datep2);
$this->label = $obj->label;
$this->datep = $this->db->jdate($obj->datep);
$this->datef = $this->db->jdate($obj->datep2);
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->note = $obj->note;
$this->note = $obj->note; // deprecated
$this->note_private = $obj->note;
$this->percentage = $obj->percentage;
@ -993,7 +990,7 @@ class ActionComm extends CommonObject
// Clean parameters
$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->priority) || !is_numeric($this->priority)) $this->priority = 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 .= ", 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 .= ", 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_soc =".($socid > 0 ? $socid : "null");
$sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null");
@ -1048,7 +1045,7 @@ class ActionComm extends CommonObject
$action = 'update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1406,8 +1403,8 @@ class ActionComm extends CommonObject
$tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype;
if (!empty($this->location))
$tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location;
if (!empty($this->note))
$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));
if (!empty($this->note_private))
$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 = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
$linkclose = ' style="background-color:#'.$this->type_color.'"';
@ -1940,8 +1937,7 @@ class ActionComm extends CommonObject
$this->location = 'Location';
$this->transparency = 1; // 1 means opaque
$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->userownerid = $user->id;

View File

@ -166,12 +166,12 @@ class CActionComm
if ($qualified && $obj->module)
{
if ($obj->module == 'invoice' && !$conf->facture->enabled) $qualified = 0;
if ($obj->module == 'order' && !$conf->commande->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 == 'order_supplier' && !$conf->fournisseur->enabled) $qualified = 0;
if ($obj->module == 'shipping' && !$conf->expedition->enabled) $qualified = 0;
if ($obj->module == 'invoice' && !$conf->facture->enabled) $qualified=0;
if ($obj->module == 'order' && !$conf->commande->enabled) $qualified=0;
if ($obj->module == 'propal' && !$conf->propal->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' && ((!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 ($qualified)

View File

@ -553,8 +553,7 @@ if ($resql)
$actionstatic->type_picto = $obj->type_picto;
$actionstatic->label = $obj->label;
$actionstatic->location = $obj->location;
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
$actionstatic->fetchResources();
@ -613,8 +612,8 @@ if ($resql)
// Description
if (!empty($arrayfields['a.note']['checked'])) {
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note, 0));
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note);
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
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->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->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();
@ -76,7 +76,7 @@ $companystatic = new Societe($db);
if (!empty($conf->propal->enabled)) $propalstatic = new Propal($db);
if (!empty($conf->supplier_proposal->enabled)) $supplierproposalstatic = new SupplierProposal($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"));
@ -102,7 +102,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
$listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort');
}
// 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');
}
@ -414,7 +414,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
/*
* 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");
@ -581,7 +581,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
}
// 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");

View File

@ -147,15 +147,15 @@ if ($action == 'add') {
if (preg_match("/st_dt/", $key)) {
$dtarr = array();
$dtarr = explode('_', $key);
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'));
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'));
}
} elseif (preg_match("/end_dt/", $key)) {
// Special case for end date come with 3 inputs day, month, year
$dtarr = array();
$dtarr = explode('_', $key);
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'));
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'));
}
} else {
$array_query[$key] = GETPOST($key);
@ -299,15 +299,15 @@ if ($action == 'savefilter' || $action == 'createfilter') {
if (preg_match("/st_dt/", $key)) {
$dtarr = array();
$dtarr = explode('_', $key);
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'));
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'));
}
} elseif (preg_match("/end_dt/", $key)) {
// Special case for end date come with 3 inputs day, month, year
$dtarr = array();
$dtarr = explode('_', $key);
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'));
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'));
// print $array_query['cnct_options_'.$dtarr[1].'_end_dt'];
// 01/02/1013=1361228400
}

View File

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

View File

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

View File

@ -1253,13 +1253,10 @@ class Propal extends CommonObject
// Actions on extra fields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0)
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
@ -1683,7 +1680,7 @@ class Propal extends CommonObject
$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();
if ($result < 0)
@ -3002,8 +2999,11 @@ class Propal extends CommonObject
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;
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;
if ($this->db->query($sql))
@ -3053,15 +3053,12 @@ class Propal extends CommonObject
// Removed extrafields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result = $this->deleteExtraFields();
if ($result < 0)
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}
@ -4152,7 +4149,7 @@ class PropaleLigne extends CommonObjectLine
{
$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;
$result = $this->insertExtraFields();
@ -4204,7 +4201,7 @@ class PropaleLigne extends CommonObjectLine
if ($this->db->query($sql))
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->deleteExtraFields();
@ -4334,7 +4331,7 @@ class PropaleLigne extends CommonObjectLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$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);
print load_fiche_titre($langs->trans("ProspectionArea"), '', 'commercial');
print load_fiche_titre($langs->trans("ProspectionArea"), '', 'propal');
//print '<table width="100%" class="notopnoleftnoright">';
//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="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";
$modelmail = "proposal_send";

View File

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

View File

@ -384,7 +384,7 @@ if (empty($reshook))
}
// 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();
$array_options = $lines[$i]->array_options;
@ -1493,7 +1493,7 @@ if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
// Mode creation
if ($action == 'create' && $usercancreate)
{
print load_fiche_titre($langs->trans('CreateOrder'), '', 'commercial');
print load_fiche_titre($langs->trans('CreateOrder'), '', 'order');
$soc = new Societe($db);
if ($socid > 0)

View File

@ -33,7 +33,8 @@ class Orders extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
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
* @return int ID of order

View File

@ -3342,7 +3342,7 @@ class Commande extends CommonOrder
$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();
if ($result < 0)
@ -3409,6 +3409,19 @@ class Commande extends CommonOrder
$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)
{
// Delete order details
@ -3437,14 +3450,11 @@ class Commande extends CommonOrder
if (!$error)
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
$result = $this->deleteExtraFields();
if ($result < 0)
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
@ -4255,7 +4265,7 @@ class OrderLine extends CommonOrderLine
if ($resql)
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->deleteExtraFields();
@ -4401,7 +4411,7 @@ class OrderLine extends CommonOrderLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet');
$this->rowid = $this->id;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -4534,7 +4544,7 @@ class OrderLine extends CommonOrderLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$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);
print load_fiche_titre($langs->trans("OrdersArea"), '', 'commercial');
print load_fiche_titre($langs->trans("OrdersArea"), '', 'order');
print '<div class="fichecenter"><div class="fichethirdleft">';
@ -106,6 +106,7 @@ if ($resql)
$total = 0;
$totalinprocess = 0;
$dataseries = array();
$colorseries = array();
$vals = array();
// -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not)
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="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";
$modelmail = "order_send";

View File

@ -285,7 +285,7 @@ if (($action == 'create' || $action == 'add') && !$error)
}
// 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();
$array_options = $lines[$i]->array_options;
}

View File

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

View File

@ -23,8 +23,8 @@
* \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 (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
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');
}
require '../main.inc.php';

View File

@ -823,13 +823,10 @@ class Account extends CommonObject
if ($result)
{
// 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();
if ($result < 0) $error++;
}
$result = $this->insertExtraFields();
if ($result < 0) $error++;
}
if (!$error && !$notrigger)
@ -1107,7 +1104,7 @@ class Account extends CommonObject
if ($result)
{
// Remove extrafields
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)

View File

@ -346,7 +346,7 @@ if ($result)
$paymenttmp->fetch($links[$key]['url_id']);
$paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
/*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 '</a>';*/
print $paymenttmp->getNomUrl(1);
@ -357,7 +357,7 @@ if ($result)
$paymenttmp->fetch($links[$key]['url_id']);
$paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
/*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 '</a>';*/
print $paymenttmp->getNomUrl(1);
@ -369,67 +369,67 @@ if ($result)
}
elseif ($links[$key]['type'] == 'sc') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'payment_sc') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'payment_vat') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'payment_salary') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'payment_loan') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'loan') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'member') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'payment_donation') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'banktransfert') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'user') {
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 '</a>';
}
elseif ($links[$key]['type'] == 'payment_various') {
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 '</a>';
}

View File

@ -979,7 +979,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
*/
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
$product_static = new Product($db);

View File

@ -140,8 +140,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
// retained warranty invoice available type
$retainedWarrantyInvoiceAvailableType=array();
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$retainedWarrantyInvoiceAvailableType = array();
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
}
@ -952,7 +952,7 @@ if (empty($reshook))
}
$discount->tva_tx = abs($tva_tx);
$discount->vat_src_code =$vat_src_code;
$discount->vat_src_code = $vat_src_code;
$result = $discount->create($user);
if ($result < 0)
@ -1146,7 +1146,7 @@ if (empty($reshook))
foreach ($facture_source->lines as $line)
{
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) {
if (method_exists($line, 'fetch_optionals')) {
// load extrafields
$line->fetch_optionals();
}
@ -1362,11 +1362,11 @@ if (empty($reshook))
$object->situation_cycle_ref = $object->newCycle();
}
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) {
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
else{
else {
$object->retained_warranty = 0;
$object->retained_warranty_fk_cond_reglement = 0;
}
@ -1644,7 +1644,7 @@ if (empty($reshook))
}
// 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();
$array_options = $lines[$i]->array_options;
}
@ -1768,19 +1768,21 @@ if (empty($reshook))
if (!empty($origin) && !empty($originid))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$object->origin = $origin;
$object->origin_id = $originid;
// retained warranty
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
{
$retained_warranty = GETPOST('retained_warranty', 'int');
if(price2num($retained_warranty) > 0)
if (price2num($retained_warranty) > 0)
{
$object->retained_warranty = price2num($retained_warranty);
$object->retained_warranty = price2num($retained_warranty);
}
if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
if (GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
{
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
@ -1800,6 +1802,17 @@ if (empty($reshook))
$line->fetch_optionals();
$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
if ($line->fk_remise_except)
{
@ -1844,6 +1857,7 @@ if (empty($reshook))
{
$nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id);
// create extrafields with data from create form
$extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost(null, $nextSituationInvoice);
@ -2629,10 +2643,10 @@ if (empty($reshook))
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
if($object->type == Facture::TYPE_SITUATION){
if ($object->type == Facture::TYPE_SITUATION) {
$situation_percent = 0;
}
else{
else {
$situation_percent = 100;
}
$fk_prev_id = '';
@ -2770,7 +2784,7 @@ if ($action == 'create')
$facturestatic = new Facture($db);
$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)
$res = $soc->fetch($socid);
@ -3393,19 +3407,19 @@ if ($action == 'create')
print '</td></tr>';
if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
if ($conf->global->INVOICE_USE_RETAINED_WARRANTY) {
$rwStyle = 'display:none;';
if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) {
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
if(empty($retained_warranty)){
if(!empty($objectsrc->retained_warranty)){ // use previous situation value
if (empty($retained_warranty)) {
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
}
}
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
$retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
@ -3413,11 +3427,11 @@ if ($action == 'create')
// Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
if(empty($retained_warranty_fk_cond_reglement)){
if (empty($retained_warranty_fk_cond_reglement)) {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
}else{
} else {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}

View File

@ -342,7 +342,7 @@ class FactureRec extends CommonInvoice
if ($objectline->fetch($result_insert))
{
// 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);
$objectline->array_options = $facsrc->lines[$i]->array_options;
}
@ -438,7 +438,7 @@ class FactureRec extends CommonInvoice
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -748,9 +748,13 @@ class FactureRec extends CommonInvoice
$error = 0;
$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;
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;
dol_syslog($sql);
@ -759,6 +763,9 @@ class FactureRec extends CommonInvoice
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error = -3;
// Delete extrafields
$res = $this->deleteExtraFields();
if ($res < 0) $error = -4;
}
else
{
@ -1966,6 +1973,14 @@ class FactureLigneRec extends CommonInvoiceLine
}
}
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
}
}
if (!$error)
{
$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);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -813,12 +813,12 @@ class Facture extends CommonInvoice
$vatrate = $line->tva_tx;
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid=$line->origin_id;
$origintype=$line->origin;
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid = $line->origin_id;
$origintype = $line->origin;
} else {
$originid=$line->id;
$origintype=$this->element;
$originid = $line->id;
$origintype = $this->element;
}
$result = $this->addline(
@ -1394,11 +1394,11 @@ class Facture extends CommonInvoice
$label = '';
if ($user->rights->facture->lire) {
$label = '<u>'.$langs->trans("ShowInvoice").'</u>';
if ($this->type == self::TYPE_REPLACEMENT) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceReplace").'</u>';
if ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceAvoir").'</u>';
if ($this->type == self::TYPE_DEPOSIT) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceDeposit").'</u>';
if ($this->type == self::TYPE_SITUATION) $label = '<u>'.$langs->transnoentitiesnoconv("ShowInvoiceSituation").'</u>';
$label = '<u>'.$langs->trans("Invoice").'</u>';
if ($this->type == self::TYPE_REPLACEMENT) $label = '<u>'.$langs->transnoentitiesnoconv("ReplacementInvoice").'</u>';
if ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u>'.$langs->transnoentitiesnoconv("CreditNote").'</u>';
if ($this->type == self::TYPE_DEPOSIT) $label = '<u>'.$langs->transnoentitiesnoconv("Deposit").'</u>';
if ($this->type == self::TYPE_SITUATION) $label = '<u>'.$langs->transnoentitiesnoconv("InvoiceSituation").'</u>';
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_client))
@ -1426,7 +1426,7 @@ class Facture extends CommonInvoice
{
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label = $langs->trans("ShowInvoice");
$label = $langs->trans("Invoice");
$linkclose .= ' alt="'.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);
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 .= '<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 .= '</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
@ -1881,7 +1882,7 @@ class Facture extends CommonInvoice
$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();
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
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid;
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;
@ -3733,44 +3737,44 @@ class Facture extends CommonInvoice
}
if (!empty($addon)) {
dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG);
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
$mybool = false;
$file = $addon . '.php';
$file = $addon.'.php';
$classname = $addon;
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');
$dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/');
// Load file with numbering class (if found)
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
}
}
// For compatibility
if (!$mybool) {
$file = $addon . '/' . $addon . '.modules.php';
$classname = 'mod_' . $moduleName . '_' . $addon;
$file = $addon.'/'.$addon.'.modules.php';
$classname = 'mod_'.$moduleName.'_'.$addon;
$classname = preg_replace('/\-.*$/', '', $classname);
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot) {
$dir = $dirroot . '/core/modules/' . $moduleName . '/';
$dir = $dirroot.'/core/modules/'.$moduleName.'/';
// Load file with numbering class (if found)
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
}
}
}
if (!$mybool) {
dol_print_error('', 'Failed to include file ' . $file);
dol_print_error('', 'Failed to include file '.$file);
return '';
}
@ -3789,7 +3793,7 @@ class Facture extends CommonInvoice
return $numref;
} else {
$langs->load('errors');
print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
return '';
}
}
@ -4755,7 +4759,7 @@ class Facture extends CommonInvoice
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
$displayWarranty = false;
if(!empty($this->retained_warranty)) {
if (!empty($this->retained_warranty)) {
$displayWarranty = true;
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
@ -4794,7 +4798,7 @@ class Facture extends CommonInvoice
$retainedWarrantyAmount = 0;
// Billed - retained warranty
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
{
$displayWarranty = true;
// Check if this situation invoice is 100% for real
@ -4834,7 +4838,7 @@ class Facture extends CommonInvoice
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
}
if($rounding>0){
if ($rounding > 0) {
return round($retainedWarrantyAmount, $rounding);
}
@ -5237,7 +5241,7 @@ class FactureLigne extends CommonInvoiceLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
$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();
if ($result < 0)
@ -5423,7 +5427,7 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->insertExtraFields();
@ -5476,6 +5480,13 @@ class FactureLigne extends CommonInvoiceLine
}
// 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;
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 .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON (f.rowid = fd.fk_facture) ';
$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;
$res = $this->db->query($sql);
@ -5576,6 +5587,8 @@ class FactureLigne extends CommonInvoiceLine
while ($obj = $this->db->fetch_object($res)) {
$returnPercent = $returnPercent + floatval($obj->situation_percent);
}
} else {
dol_print_error($this->db);
}
}

View File

@ -333,7 +333,7 @@ if ($resql)
$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>';

View File

@ -691,7 +691,7 @@ if ($resql)
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
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";
$modelmail = "facture_send";

View File

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

View File

@ -87,7 +87,7 @@ $thirdpartystatic = new Societe($db);
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">';
@ -101,7 +101,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
$listofsearchfields['search_invoice'] = array('text'=>'CustomerInvoice');
}
// 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');
}
@ -231,7 +231,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
/**
* 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 .= ", s.nom as name";
@ -447,7 +447,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
// 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");
$facstatic = new FactureFournisseur($db);
@ -958,7 +958,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
/*
* 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);

View File

@ -250,7 +250,7 @@ llxHeader('', $name);
//$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>";
//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,'',$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);
}
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 .= " 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';
if (null !== $ref) {
$sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')';
$sql .= ' AND t.code = '.'\''.$ref.'\'';
$sql .= " AND t.code = '".$this->db->escape($ref)."'";
} else {
$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="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 '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";

View File

@ -88,7 +88,7 @@ $formother = new FormOther($db);
llxHeader();
$titre = ($year ? $langs->trans("PaymentsReportsForYear", $year) : $langs->trans("PaymentsReports"));
print load_fiche_titre($titre, '', 'invoicing');
print load_fiche_titre($titre, '', 'bill');
// Formulaire de generation
print '<form method="post" action="rapport.php?year='.$year.'">';
@ -154,9 +154,11 @@ if ($year)
{
$tfile = $dir.'/'.$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_date(dol_filemtime($tfile), "dayhour").'</td></tr>';
print '<td class="right">'.dol_print_date(dol_filemtime($tfile), "dayhour").'</td>';
print '</tr>';
}
}
closedir($handle);

View File

@ -252,7 +252,7 @@ if ($resql)
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 '<tr class="liste_titre">';

View File

@ -227,17 +227,15 @@ print "</tr>\n";
if ($modecompta == 'BOOKKEEPING')
{
$predefinedgroupwhere = "(";
//$predefinedgroupwhere.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
$predefinedgroupwhere .= " (pcg_type = 'EXPENSE')";
$predefinedgroupwhere .= " OR ";
//$predefinedgroupwhere.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
$predefinedgroupwhere .= " (pcg_type = 'INCOME')";
$predefinedgroupwhere .= ")";
$charofaccountstring = $conf->global->CHARTOFACCOUNTS;
$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 .= ", ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " WHERE f.numero_compte = aa.account_number";
@ -271,7 +269,7 @@ if ($modecompta == 'BOOKKEEPING')
print '<tr class="oddeven">';
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 "</tr>\n";
@ -282,7 +280,7 @@ if ($modecompta == 'BOOKKEEPING')
// This make 14 calls for each detail of account (NP, N and month m)
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 thirdparty_code = '".$db->escape($objp->name)."'";

View File

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

View File

@ -462,7 +462,7 @@ if (count($amount)) {
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>';
print '<td></td>';
} else {
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>';
if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>';
print '<td></td>';
} else {
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>';
if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>';
print '<td></td>';
} else {
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;
if (!empty($conf->global->TAX_REPORT_EXTRA_REPORT))
{
$description .= '<br>'
. '<input type="radio" name="extra_report" value="0" '.($special_report ? '' : 'checked="checked"').'> '
. $langs->trans('SimpleReport')
. '</input>'
. '<br>'
. '<input type="radio" name="extra_report" value="1" '.($special_report ? 'checked="checked"' : '').'> '
. $langs->trans('AddExtraReport')
. '</input>'
. '<br>';
$description .= '<br>';
$description .= '<input type="radio" name="extra_report" value="0" '.($special_report ? '' : 'checked="checked"').'> ';
$description .= $langs->trans('SimpleReport');
$description .= '</input>';
$description .= '<br>';
$description .= '<input type="radio" name="extra_report" value="1" '.($special_report ? 'checked="checked"' : '').'> ';
$description .= $langs->trans('AddExtraReport');
$description .= '</input>';
$description .= '<br>';
}
$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>";
//$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,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode);

View File

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

View File

@ -147,11 +147,11 @@ if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeA
if ($object->thirdparty->fournisseur)
{
$thirdTypeArray['supplier'] = $langs->trans("supplier");
if ($conf->fournisseur->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_invoice->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_order->enabled)) && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']= $langs->transnoentitiesnoconv('SuppliersOrders');
// There no contact type for supplier proposals
// if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
// There no contact type for supplier proposals
// 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>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
* it under the terms of the GNU General Public License as published by
@ -57,29 +58,58 @@ $v = new vCard();
$v->setProdId('Dolibarr '.DOL_VERSION);
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
$v->setName($contact->lastname, $contact->firstname, "", "", "");
$v->setFormattedName($contact->getFullName($langs));
$v->setName($contact->lastname, $contact->firstname, "", $contact->civility, "");
$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_perso,"TYPE=HOME;VOICE");
$v->setPhoneNumber($contact->phone_mobile, "TYPE=CELL;VOICE");
$v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX");
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code ? $contact->country : ''), "TYPE=WORK;POSTAL");
$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);
$country = $contact->country_code ? $contact->country : '' ;
$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);
// Data from linked company
if ($company->id)
{
$v->setURL($company->url, "TYPE=WORK");
if (!$contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
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 (empty($contact->email)) $v->setEmail($company->email, 'TYPE=PREF,INTERNET');
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
if (! $contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
// 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"
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name);
}
@ -95,7 +125,7 @@ $db->close();
$output = $v->getVCard();
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
//$filename = dol_sanitizeFileName($filename);

View File

@ -146,14 +146,16 @@ if ($id > 0)
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
}
$permtoedit = 0;
$morehtmlref .= '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
// Ref supplier
$morehtmlref .= '<br>';
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
// Thirdparty
$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>)';
@ -165,7 +167,8 @@ if ($id > 0)
if ($user->rights->contrat->creer)
{
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') {
//$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
$array_options = array();
// 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();
$array_options = $lines[$i]->array_options;
}
@ -1098,7 +1098,7 @@ if ($result > 0)
// Create
if ($action == 'create')
{
print load_fiche_titre($langs->trans('AddContract'), '', 'commercial');
print load_fiche_titre($langs->trans('AddContract'), '', 'contract');
$soc = new Societe($db);
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();
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)
{
// Delete contratdet
@ -1383,7 +1399,7 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql);
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();
if ($result < 0)
@ -1588,7 +1604,7 @@ class Contrat extends CommonObject
{
$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->array_options = $array_options;
@ -1777,7 +1793,7 @@ class Contrat extends CommonObject
$result = $this->update_statut($user);
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->fetch($rowid);
@ -1859,18 +1875,15 @@ class Contrat extends CommonObject
$error++;
}
if (empty($error)) {
if (!$error) {
// Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$contractline = new ContratLigne($this->db);
$contractline->id = $idline;
$result = $contractline->deleteExtraFields();
if ($result < 0)
{
$contractline = new ContratLigne($this->db);
$contractline->id = $idline;
$result = $contractline->deleteExtraFields();
if ($result < 0)
{
$error++;
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
}
$error++;
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
}
}
@ -3092,7 +3105,7 @@ class ContratLigne extends CommonObjectLine
$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();
if ($result < 0)
@ -3202,6 +3215,8 @@ class ContratLigne extends CommonObjectLine
{
global $conf, $user;
$error = 0;
// Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
$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');
// 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();
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');
// Thirdparty
$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
if (!empty($conf->projet->enabled))
{

View File

@ -70,7 +70,7 @@ $now = dol_now();
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">';

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="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";
$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("ListOfExpiredServices");
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)
{

View File

@ -751,7 +751,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
}
// 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();
$array_options = $lines[$i]->array_options;
}

View File

@ -40,20 +40,20 @@ top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
// Load original field value
if (! empty($output) && isset($amount) && isset($tva_tx))
if (!empty($output) && isset($amount) && isset($tva_tx))
{
$return=array();
$price='';
$return = array();
$price = '';
if (is_numeric($amount) && $amount != '')
{
if ($output == 'price_ttc') {
$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
$price = price2num($amount * (1 + ($tva_tx / 100)), 'MU');
$return['price_ht'] = $amount;
$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
}
elseif ($output == 'price_ht') {
$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
$price = price2num($amount / (1 + ($tva_tx / 100)), 'MU');
$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
$return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
}

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