2
0
forked from Wavyzz/dolibarr

Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2022-12-20 23:25:59 +01:00
55 changed files with 456 additions and 257 deletions

View File

@@ -3,6 +3,16 @@ English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead.
***** ChangeLog for 17.0.0 compared to 16.0.0 ***** ***** ChangeLog for 17.0.0 compared to 16.0.0 *****
For users: For users:

View File

@@ -0,0 +1,19 @@
# Fail2Ban configuration file
#
# Regexp to detect forbidden access on pages (public or not) so we can add mitigation on IP making too much
# access to your a Dolibarr instance.
[Definition]
# To test, you can inject this example into log
# echo `myvirtualhost.com:443 1.2.3.4 - - [15/Dec/2022:09:57:47 +0000] "GET /public/abc" 403 123 "-" "Mozilla" >> /var/log/apache2/access.log
#
# then
# fail2ban-client status web-accesslog-limit403
#
# To test rule file on a existing log file
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
ignoreregex =

View File

@@ -1227,22 +1227,22 @@ if (empty($action) || $action == 'view') {
$account_ledger = $k; $account_ledger = $k;
// Try to force general ledger account depending on type // Try to force general ledger account depending on type
if ($tabtype[$key] == 'payment') { if ($tabtype[$key] == 'payment') {
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
} }
if ($tabtype[$key] == 'payment_supplier') { if ($tabtype[$key] == 'payment_supplier') {
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
} }
if ($tabtype[$key] == 'payment_expensereport') { if ($tabtype[$key] == 'payment_expensereport') {
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
} }
if ($tabtype[$key] == 'payment_salary') { if ($tabtype[$key] == 'payment_salary') {
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
} }
if ($tabtype[$key] == 'payment_vat') { if ($tabtype[$key] == 'payment_vat') {
$account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; $account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT');
} }
if ($tabtype[$key] == 'member') { if ($tabtype[$key] == 'member') {
$account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; $account_ledger = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT');
} }
if ($tabtype[$key] == 'payment_various') { if ($tabtype[$key] == 'payment_various') {
$account_ledger = $tabpay[$key]["account_various"]; $account_ledger = $tabpay[$key]["account_various"];
@@ -1281,7 +1281,7 @@ if (empty($action) || $action == 'view') {
} }
} }
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">'; print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
print $accounttoshow; print $accounttoshow; // This is a HTML string
print "</td>"; print "</td>";
// Subledger account // Subledger account
@@ -1310,7 +1310,7 @@ if (empty($action) || $action == 'view') {
} }
} }
print '<td class="maxwidth300">'; print '<td class="maxwidth300">';
print $accounttoshowsubledger; print $accounttoshowsubledger; // This is a html string
print "</td>"; print "</td>";
print "<td>".$reflabel."</td>"; print "<td>".$reflabel."</td>";

View File

@@ -451,8 +451,8 @@ print '<td class="liste_titre"></td>';
// Status // Status
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$array = array("1"=>$langs->trans("OnlyNonValid")); $array = array("1" => "OnlyNonValid");
print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1); print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status maxwidth200 onrightofpage', 1);
print '</td>'; print '</td>';
// Status note // Status note
@@ -533,7 +533,7 @@ if (is_array($blocks)) {
print '<td>'.dol_escape_htmltag($block->id).'</td>'; print '<td>'.dol_escape_htmltag($block->id).'</td>';
// Date // Date
print '<td>'.dol_print_date($block->date_creation, 'dayhour').'</td>'; print '<td class="nowraponall">'.dol_print_date($block->date_creation, 'dayhour').'</td>';
// User // User
print '<td>'; print '<td>';

View File

@@ -555,7 +555,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {

View File

@@ -134,7 +134,7 @@ if ($tmp) {
* Draft customer proposals * Draft customer proposals
*/ */
if (isModEnabled("propal") && $user->rights->propal->lire) { if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
@@ -232,7 +232,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
* Draft supplier proposals * Draft supplier proposals
*/ */
if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) { if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "lire")) {
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
@@ -427,7 +427,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) {
* Draft purchase orders * Draft purchase orders
*/ */
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) {
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status"; $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
@@ -819,7 +819,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
/* /*
* Latest contracts * Latest contracts
*/ */
if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
$staticcontrat = new Contrat($db); $staticcontrat = new Contrat($db);
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
@@ -897,7 +897,7 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A RE
/* /*
* Opened (validated) proposals * Opened (validated) proposals
*/ */
if (isModEnabled("propal") && $user->rights->propal->lire) { if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";

View File

@@ -1868,7 +1868,7 @@ if ($action == 'create' && $usercancreate) {
// Incoterms // Incoterms
if (isModEnabled('incoterm')) { if (isModEnabled('incoterm')) {
print '<tr>'; print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->label_incoterms, 1).'</label></td>'; print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms, 1).'</label></td>';
print '<td class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
$incoterm_id = GETPOST('incoterm_id'); $incoterm_id = GETPOST('incoterm_id');
$incoterm_location = GETPOST('location_incoterms'); $incoterm_location = GETPOST('location_incoterms');

View File

@@ -201,10 +201,10 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
@@ -298,19 +298,19 @@ if (empty($reshook)) {
// Mass actions // Mass actions
$objectclass = 'Commande'; $objectclass = 'Commande';
$objectlabel = 'Orders'; $objectlabel = 'Orders';
$permissiontoread = $user->rights->commande->lire; $permissiontoread = $user->hasRight("commande", "lire");
$permissiontoadd = $user->rights->commande->creer; $permissiontoadd = $user->hasRight("commande", "creer");
$permissiontodelete = $user->rights->commande->supprimer; $permissiontodelete = $user->hasRight("commande", "supprimer");
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$permissiontovalidate = $user->rights->commande->order_advance->validate; $permissiontovalidate = $user->hasRight("commande", "order_advance", "validate");
$permissiontoclose = $user->rights->commande->order_advance->close; $permissiontoclose = $user->hasRight("commande", "order_advance", "close");
$permissiontocancel = $user->rights->commande->order_advance->annuler; $permissiontocancel = $user->hasRight("commande", "order_advance", "annuler");
$permissiontosendbymail = $user->rights->commande->order_advance->send; $permissiontosendbymail = $user->hasRight("commande", "order_advance", "send");
} else { } else {
$permissiontovalidate = $user->rights->commande->creer; $permissiontovalidate = $user->hasRight("commande", "creer");
$permissiontoclose = $user->rights->commande->creer; $permissiontoclose = $user->hasRight("commande", "creer");
$permissiontocancel = $user->rights->commande->creer; $permissiontocancel = $user->hasRight("commande", "creer");
$permissiontosendbymail = $user->rights->commande->creer; $permissiontosendbymail = $user->hasRight("commande", "creer");
} }
$uploaddir = $conf->commande->multidir_output[$conf->entity]; $uploaddir = $conf->commande->multidir_output[$conf->entity];
$triggersendname = 'ORDER_SENTBYMAIL'; $triggersendname = 'ORDER_SENTBYMAIL';
@@ -1287,7 +1287,7 @@ if ($resql) {
if ($permissiontocancel) { if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
} }
if (isModEnabled('facture') && $user->rights->facture->creer) { if (isModEnabled('facture') && $user->hasRight("facture", "creer")) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
} }
if ($permissiontoclose) { if ($permissiontoclose) {
@@ -1394,7 +1394,7 @@ if ($resql) {
$moreforfilter = ''; $moreforfilter = '';
// If the user can view prospects? sales other than his own // If the user can view prospects? sales other than his own
if ($user->rights->user->user->lire) { if ($user->hasRight("user", "user", "lire")) {
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
@@ -1402,7 +1402,7 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If the user can view other users // If the user can view other users
if ($user->rights->user->user->lire) { if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('LinkedToSpecificUsers'); $tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
@@ -1410,7 +1410,7 @@ if ($resql) {
} }
// If the user can view other products/services than his own // If the user can view other products/services than his own
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag'); $tmptitle = $langs->trans('IncludingProductWithTag');
@@ -1419,7 +1419,7 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If Categories are enabled & user has rights to see // If Categories are enabled & user has rights to see
if (isModEnabled('categorie') && $user->rights->categorie->lire) { if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');

View File

@@ -488,7 +488,7 @@ if (!empty($arrayfields['b.clos']['checked'])) {
'opened'=>$langs->trans("Opened"), 'opened'=>$langs->trans("Opened"),
'closed'=>$langs->trans("Closed") 'closed'=>$langs->trans("Closed")
); );
print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray("search_status", $array, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth125 onrightofpage', 1);
print '</td>'; print '</td>';
} }
// Balance // Balance

View File

@@ -17,7 +17,7 @@
*/ */
/** /**
* \file cashcontrol_list.php * \file htdocs/compta/cashcontrol/cashcontrol_list.php
* \ingroup cashdesk|takepos * \ingroup cashdesk|takepos
* \brief List page for cashcontrol * \brief List page for cashcontrol
*/ */
@@ -50,8 +50,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0; $page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@@ -105,11 +106,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field // If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) { if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1, 1, '1'); $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array( $arrayfields['t.'.$key] = array(
'label'=>$val['label'], 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'], 'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : '' 'help'=> isset($val['help']) ? $val['help'] : ''
); );
@@ -194,7 +195,8 @@ $now = dol_now();
//$help_url="EN:Module_pos_cash_fence|FR:Module_pos_cash_fence_FR|ES:Módulo_pos_cash_fence"; //$help_url="EN:Module_pos_cash_fence|FR:Module_pos_cash_fence_FR|ES:Módulo_pos_cash_fence";
$help_url = ''; $help_url = '';
$title = $langs->trans('CashControl'); $title = $langs->trans('CashControl');
$morejs = array();
$morecss = array();
// Build and execute select // Build and execute select
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -211,6 +213,9 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
@@ -237,17 +242,17 @@ foreach ($search as $key => $val) {
$mode_search = 2; $mode_search = 2;
} }
if ($search[$key] != '') { if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
} }
} else { } else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) { if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
} }
if (preg_match('/_dtend$/', $key)) { if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
} }
} }
} }
@@ -267,11 +272,13 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required /* If a group by is required
$sql.= " GROUP BY "; $sql.= " GROUP BY ";
foreach($object->fields as $key => $val) { foreach($object->fields as $key => $val) {
$sql .= "t.".$key.", "; $sql .= "t.".$db->escape($key).", ";
} }
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
}
} }
// Add where from hooks // Add where from hooks
$parameters=array(); $parameters=array();
@@ -280,35 +287,43 @@ $sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql); $sql=preg_replace('/,\s*$/','', $sql);
*/ */
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql); /* The fast and low memory method to get and count full list converts the sql into a sql count */
$nbtotalofrecords = $db->num_rows($resql); $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
$db->free($resql);
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql); // Complete request and execute it with limit
if (!$resql) { $sql .= $db->order($sortfield, $sortorder);
dol_print_error($db); if ($limit) {
exit; $sql .= $db->plimit($limit + 1, $offset);
}
$num = $db->num_rows($resql);
} }
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Direct jump if only one record found // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@@ -326,6 +341,9 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscroll
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@@ -333,11 +351,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.urlencode($limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key])) {
foreach ($search[$key] as $skey) { foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey); if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
} }
} else { } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]); $param .= '&search_'.$key.'='.urlencode($search[$key]);
} }
} }
@@ -373,6 +397,7 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$permforcashfence = 1; $permforcashfence = 1;
@@ -389,10 +414,13 @@ $trackid = 'cashfence'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) { if ($search_all) {
$setupstring = '';
foreach ($fieldstosearchall as $key => $val) { foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";";
} }
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }
$moreforfilter = ''; $moreforfilter = '';
@@ -433,13 +461,13 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
@@ -525,7 +553,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; $j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@@ -546,7 +575,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>'; print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') { if ($key == 'status') {
print $object->getLibStatut(5); print $object->getLibStatut(5);
} elseif ($key == 'rowid') { } elseif ($key == 'rowid') {
@@ -609,13 +642,13 @@ if ($num == 0) {
$colspan++; $colspan++;
} }
} }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} }
$db->free($resql); $db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</table>'."\n"; print '</table>'."\n";

View File

@@ -376,9 +376,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
if (empty($reshook)) { if (empty($reshook)) {
$objectclass = 'Facture'; $objectclass = 'Facture';
$objectlabel = 'Invoices'; $objectlabel = 'Invoices';
$permissiontoread = $user->rights->facture->lire; $permissiontoread = $user->hasRight("facture", "lire");
$permissiontoadd = $user->rights->facture->creer; $permissiontoadd = $user->hasRight("facture", "creer");
$permissiontodelete = $user->rights->facture->supprimer; $permissiontodelete = $user->hasRight("facture", "supprimer");
$uploaddir = $conf->facture->dir_output; $uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
@@ -1185,7 +1185,7 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->facture->creer); $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer"));
} }
$i = 0; $i = 0;
@@ -1237,7 +1237,7 @@ if ($resql) {
// If the user can view prospects other than his' // If the user can view prospects other than his'
$moreforfilter = ''; $moreforfilter = '';
if ($user->rights->user->user->lire) { if ($user->hasRight("user", "user", "lire")) {
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
@@ -1245,14 +1245,14 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($user->rights->user->user->lire) { if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('LinkedToSpecificUsers'); $tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// Filter on product tags // Filter on product tags
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag'); $tmptitle = $langs->trans('IncludingProductWithTag');
@@ -1260,7 +1260,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
if (isModEnabled('categorie') && $user->rights->categorie->lire) { if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
@@ -2574,8 +2574,8 @@ if ($resql) {
$urlsource .= str_replace('&amp;', '&', $param); $urlsource .= str_replace('&amp;', '&', $param);
$filedir = $diroutputmassaction; $filedir = $diroutputmassaction;
$genallowed = $user->rights->facture->lire; $genallowed = $user->hasRight("facture", "lire");
$delallowed = $user->rights->facture->creer; $delallowed = $user->hasRight("facture", "creer");
$title = ''; $title = '';
print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);

View File

@@ -281,7 +281,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
// Last modified supplier invoices // Last modified supplier invoices
if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) { if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire")) || (isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) {
$langs->load("boxes"); $langs->load("boxes");
$facstatic = new FactureFournisseur($db); $facstatic = new FactureFournisseur($db);
@@ -590,7 +590,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) {
/* /*
* Customers orders to be billed * Customers orders to be billed
*/ */
if (isModEnabled('facture') && isModEnabled('commande') && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("commande", "lire") && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
$commandestatic = new Commande($db); $commandestatic = new Commande($db);
$langs->load("orders"); $langs->load("orders");

View File

@@ -385,14 +385,15 @@ if ($action == 'new') {
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">'; print '<input type="submit" class="button small" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">';
if ($search_date_start || $search_date_end || $filteraccountid > 0) { if ($search_date_start || $search_date_end || $filteraccountid > 0) {
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="submit" class="button" name="removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="submit" class="button" name="removefilter small" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
} }
print '</div>'; print '</div>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
print '<br>';
$sql = "SELECT ba.rowid as bid, ba.label,"; $sql = "SELECT ba.rowid as bid, ba.label,";
$sql .= " b.rowid as transactionid, b.label as transactionlabel, b.datec as datec, b.dateo as date, "; $sql .= " b.rowid as transactionid, b.label as transactionlabel, b.datec as datec, b.dateo as date, ";

View File

@@ -32,15 +32,23 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills')); $langs->loadLangs(array('banks', 'categories', 'compta', 'bills'));
$checkdepositstatic = new RemiseCheque($db);
$accountstatic = new Account($db);
// Security check // Security check
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
$result = restrictedArea($user, 'banque', '', ''); $result = restrictedArea($user, 'banque', '', '');
$usercancreate = $user->hasRight('banque', 'cheque');
$checkdepositstatic = new RemiseCheque($db);
$accountstatic = new Account($db); /*
* Actions
*/
// None
/* /*
@@ -49,7 +57,12 @@ $accountstatic = new Account($db);
llxHeader('', $langs->trans("ChequesArea")); llxHeader('', $langs->trans("ChequesArea"));
print load_fiche_titre($langs->trans("ChequesArea"), '', $checkdepositstatic->picto); $newcardbutton = '';
if ($usercancreate) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewDeposit'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new');
}
print load_fiche_titre($langs->trans("ChequesArea"), $newcardbutton, $checkdepositstatic->picto);
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
@@ -64,6 +77,7 @@ $sql .= " AND b.amount > 0";
$resql = $db->query($sql); $resql = $db->query($sql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n"; print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
@@ -79,10 +93,10 @@ if ($resql) {
print '<td class="right">'; print '<td class="right">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>'; print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '</td></tr>'; print '</td></tr>';
print "</table>\n";
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
print "</table></div>\n";
print '</div><div class="fichetwothirdright">'; print '</div><div class="fichetwothirdright">';

View File

@@ -362,31 +362,31 @@ if ($type == 'directory') {
if ($module == 'medias') { if ($module == 'medias') {
$useinecm = 6; $useinecm = 6;
$modulepart = 'medias'; $modulepart = 'medias';
$perm = ($user->rights->website->write || $user->rights->emailing->creer); $perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer"));
$title = 'none'; $title = 'none';
} elseif ($module == 'ecm') { // DMS/ECM -> manual structure } elseif ($module == 'ecm') { // DMS/ECM -> manual structure
if ($user->rights->ecm->read) { if ($user->hasRight("ecm", "read")) {
// Buttons: Preview // Buttons: Preview
$useinecm = 2; $useinecm = 2;
} }
if ($user->rights->ecm->upload) { if ($user->hasRight("ecm", "upload")) {
// Buttons: Preview + Delete // Buttons: Preview + Delete
$useinecm = 4; $useinecm = 4;
} }
if ($user->rights->ecm->setup) { if ($user->hasRight("ecm", "setup")) {
// Buttons: Preview + Delete + Edit // Buttons: Preview + Delete + Edit
$useinecm = 5; $useinecm = 5;
} }
$perm = $user->rights->ecm->upload; $perm = $user->hasRight("ecm", "upload");
$modulepart = 'ecm'; $modulepart = 'ecm';
$title = ''; // Use default $title = ''; // Use default
} else { } else {
$useinecm = 5; $useinecm = 5;
$modulepart = 'ecm'; $modulepart = 'ecm';
$perm = $user->rights->ecm->upload; $perm = $user->hasRight("ecm", "upload");
$title = ''; // Use default $title = ''; // Use default
} }

View File

@@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes
$totalnb = 0; $totalnb = 0;
$line = 0; $line = 0;
$cachetime = 3600; $cachetime = 3600;
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache'; $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache';
$now = dol_now(); $now = dol_now();
$nbofperiod = 3; $nbofperiod = 3;
@@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes
// list the summary of the propals // list the summary of the propals
if (isModEnabled("propal") && $user->rights->propal->lire) { if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic = new Propal($this->db); $propalstatic = new Propal($this->db);
@@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes
} }
// list the summary of the orders // list the summary of the orders
if (isModEnabled('commande') && $user->rights->commande->lire) { if (isModEnabled('commande') && $user->hasRight("commande", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic = new Commande($this->db); $commandestatic = new Commande($this->db);
@@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes
// list the summary of the bills // list the summary of the bills
if (isModEnabled('facture') && $user->rights->facture->lire) { if (isModEnabled('facture') && $user->hasRight("facture", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic = new Facture($this->db); $facturestatic = new Facture($this->db);

View File

@@ -131,8 +131,10 @@ class HookManager
dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG); dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG);
} }
if (!empty($this->hooks[$context])) { foreach ($arraycontext as $context) {
ksort($this->hooks[$context], SORT_NATURAL); if (!empty($this->hooks[$context])) {
ksort($this->hooks[$context], SORT_NATURAL);
}
} }
return 1; return 1;

View File

@@ -3275,7 +3275,7 @@ class Form
$langs->load('other'); $langs->load('other');
} }
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock,"; $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock, p.tva_tx as tva_tx_sale, p.default_vat_code as default_vat_code_sale,";
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,"; $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,";
$sql .= " pfp.supplier_reputation"; $sql .= " pfp.supplier_reputation";
@@ -3371,6 +3371,12 @@ class Form
while ($i < $num) { while ($i < $num) {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
if (is_null($objp->idprodfournprice)) {
// There is no supplier price found, we will use the vat rate for sale
$objp->tva_tx = $objp->tva_tx_sale;
$objp->default_vat_code = $objp->default_vat_code_sale;
}
$outkey = $objp->idprodfournprice; // id in table of price $outkey = $objp->idprodfournprice; // id in table of price
if (!$outkey && $alsoproductwithnosupplierprice) { if (!$outkey && $alsoproductwithnosupplierprice) {
$outkey = 'idprod_'.$objp->rowid; // id of product $outkey = 'idprod_'.$objp->rowid; // id of product
@@ -3566,14 +3572,17 @@ class Form
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) { if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) {
$optstart .= ' disabled'; $optstart .= ' disabled';
} }
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
$opt .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"'; $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
$opt .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"'; $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
$opt .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"'; $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
$opt .= ' data-up="'.dol_escape_htmltag($objp->unitprice).'"'; $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
$opt .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"'; $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
$opt .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"'; $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
$opt .= ' data-tvatx="'.dol_escape_htmltag($objp->tva_tx).'"'; $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
} }
$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"'; $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
@@ -3585,7 +3594,8 @@ class Form
'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'tva_tx' => $objp->tva_tx, 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
'tva_tx' => price2num($objp->tva_tx),
'default_vat_code' => $objp->default_vat_code, 'default_vat_code' => $objp->default_vat_code,
'discount' => $outdiscount, 'discount' => $outdiscount,
'type' => $outtype, 'type' => $outtype,
@@ -3613,14 +3623,15 @@ class Form
$outarray, $outarray,
array('key'=>$outkey, array('key'=>$outkey,
'value'=>$outref, 'value'=>$outref,
'label'=>$outval, 'label'=>$outvallabel,
'qty'=>$outqty, 'qty'=>$outqty,
'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'price_qty_ht_locale'=>price($objp->fprice), 'price_qty_ht_locale'=>price($objp->fprice),
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
'price_unit_ht_locale'=>price($objp->unitprice), 'price_unit_ht_locale'=>price($objp->unitprice),
'tva_tx'=>$objp->tva_tx, 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
'tva_tx_formated' => price($objp->tva_tx),
'tva_tx'=>price2num($objp->tva_tx),
'default_vat_code'=>$objp->default_vat_code, 'default_vat_code'=>$objp->default_vat_code,
'discount'=>$outdiscount, 'discount'=>$outdiscount,
'type'=>$outtype, 'type'=>$outtype,
@@ -5047,9 +5058,9 @@ class Form
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
if ($input['type'] == 'text') { if ($input['type'] == 'text') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n"; $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
} elseif ($input['type'] == 'password') { } elseif ($input['type'] == 'password') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n"; $more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
} elseif ($input['type'] == 'textarea') { } elseif ($input['type'] == 'textarea') {
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; /*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>'; $more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';

View File

@@ -32,18 +32,19 @@ class FormMailing extends Form
*/ */
public $errors = array(); public $errors = array();
/** /**
* Output a select with destinaries status * Output a select with destinaries status
* *
* @param string $selectedid The selected id * @param string $selectedid The selected id
* @param string $htmlname Name of controm * @param string $htmlname Name of controm
* @param integer $show_empty Show empty option * @param integer $show_empty Show empty option
* @return string HTML select * @return string HTML select
*/ */
public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0) public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0)
{ {
global $langs; global $langs;
$langs->load("mails"); $langs->load("mails");
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
@@ -51,12 +52,9 @@ class FormMailing extends Form
$options = array(); $options = array();
if ($show_empty) {
$options[-2] = ''; // Note -1 is used for error
}
$options = $options + $mailing->statut_dest; $options = $options + $mailing->statut_dest;
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1); // Note -1 is used for error, so we use -2 for tempty value
return Form::selectarray($htmlname, $options, $selectedid, ($show_empty ? -2 : 0), 0, 0, '', 1);
} }
} }

View File

@@ -197,6 +197,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= ' $script .= '
// For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on // For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on
console.log("PRODUIT_CUSTOMER_PRICES_BY_QTY is on, propagate also prices by quantity into data-pbqxxx properties");
$("#'.$htmlnamejquery.'").attr("data-pbq", ui.item.pbq); $("#'.$htmlnamejquery.'").attr("data-pbq", ui.item.pbq);
$("#'.$htmlnamejquery.'").attr("data-pbqup", ui.item.price_ht); $("#'.$htmlnamejquery.'").attr("data-pbqup", ui.item.price_ht);
$("#'.$htmlnamejquery.'").attr("data-pbqbase", ui.item.pricebasetype); $("#'.$htmlnamejquery.'").attr("data-pbqbase", ui.item.pricebasetype);

View File

@@ -73,9 +73,11 @@ function expedition_prepare_head(Expedition $object)
*/ */
function expedition_admin_prepare_head() function expedition_admin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user, $db;
$langs->load("sendings"); $langs->load("sendings");
$extrafields = new ExtraFields($db);
$h = 0; $h = 0;
$head = array(); $head = array();
@@ -87,23 +89,29 @@ function expedition_admin_prepare_head()
*/ */
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$extrafields->fetch_name_optionals_label('expedition');
$extrafields->fetch_name_optionals_label('expeditiondet');
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
$head[$h][1] = $langs->trans("Shipment"); $head[$h][1] = $langs->trans("Shipment");
$head[$h][2] = 'shipment'; $head[$h][2] = 'shipment';
$h++; $h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['expedition']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_shipment'; $head[$h][2] = 'attributes_shipment';
$h++; $h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_shipment'; $head[$h][2] = 'attributeslines_shipment';
$h++; $h++;
} }
@@ -114,15 +122,24 @@ function expedition_admin_prepare_head()
$h++; $h++;
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
$extrafields->fetch_name_optionals_label('delivery');
$extrafields->fetch_name_optionals_label('deliverydet');
$head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['delivery']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_receivings'; $head[$h][2] = 'attributes_receivings';
$h++; $h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['deliverydet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_receivings'; $head[$h][2] = 'attributeslines_receivings';
$h++; $h++;
} }

View File

@@ -19,6 +19,7 @@
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr> * Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -9385,6 +9386,17 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
continue; continue;
} }
if ($values[3]) { if ($values[3]) {
if ($filterorigmodule) { // If a filter of module origin has been requested
if (strpos($values[3], '@')) { // This is an external module
if ($filterorigmodule != 'external') {
continue;
}
} else { // This looks a core module
if ($filterorigmodule != 'core') {
continue;
}
}
}
$langs->load($values[3]); $langs->load($values[3]);
} }
if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) { if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {

View File

@@ -1043,7 +1043,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$regType = array(); $regType = array();
if (preg_match('/\{(t+)\}/i', $mask, $regType)) { if (preg_match('/\{(t+)\}/i', $mask, $regType)) {
$masktype = $regType[1]; $masktype = $regType[1];
$masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask) $masktype_value = dol_substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask)
$masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask $masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask
} else { } else {
$masktype = ''; $masktype = '';

View File

@@ -994,7 +994,9 @@ class ImportCsv extends ModeleImports
if ($sql) { if ($sql) {
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). if (!$is_table_category_link) {
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
}
$insertdone = true; $insertdone = true;
} else { } else {
//print 'E'; //print 'E';

View File

@@ -1041,7 +1041,9 @@ class ImportXlsx extends ModeleImports
if ($sql) { if ($sql) {
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). if (!$is_table_category_link) {
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
}
$insertdone = true; $insertdone = true;
} else { } else {
//print 'E'; //print 'E';

View File

@@ -153,7 +153,7 @@ class doc_generic_product_odt extends ModelePDFProduct
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">'; $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">'; $texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH; $texte .= getDolGlobalString('PRODUCT_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>'; $texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">'; $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">'; $texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';

View File

@@ -44,13 +44,13 @@ $permtoadd = 0;
$permtoupload = 0; $permtoupload = 0;
$showroot = 0; $showroot = 0;
if ($module == 'ecm') { if ($module == 'ecm') {
$permtoadd = $user->rights->ecm->setup; $permtoadd = $user->hasRight("ecm", "setup");
$permtoupload = $user->rights->ecm->upload; $permtoupload = $user->hasRight("ecm", "upload");
$showroot = 0; $showroot = 0;
} }
if ($module == 'medias') { if ($module == 'medias') {
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->write); $permtoadd = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write); $permtoupload = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
$showroot = 1; $showroot = 1;
} }

View File

@@ -971,10 +971,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
} }
?> ?>
// Deal with supplier ref price
// Deal with supplier ref price (idprodfournprice = int)
if (jQuery('#idprodfournprice').val() > 0) if (jQuery('#idprodfournprice').val() > 0)
{ {
console.log("objectline_create.tpl #idprodfournprice is > 0, so we set some properties into page"); console.log("objectline_create.tpl #idprodfournprice is is an ID > 0, so we set some properties into page");
var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select
if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with ajax autocomplete if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with ajax autocomplete
@@ -1023,14 +1024,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
} }
<?php <?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) { if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) {
?> ?>
var description = $('option:selected', this).attr('data-description'); var description = $('option:selected', this).attr('data-description');
if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); }
console.log("Load desciption into text area : "+description); console.log("Load desciption into text area : "+description);
<?php <?php
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {
?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{ {
var editor = CKEDITOR.instances['dp_desc']; var editor = CKEDITOR.instances['dp_desc'];
@@ -1039,15 +1041,41 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
} }
} }
<?php <?php
} else { ?> } else {
?>
jQuery('#dp_desc').text(description); jQuery('#dp_desc').text(description);
<?php <?php
} }
}?> }
?>
} else if (jQuery('#idprodfournprice').length > 0) { } else if (jQuery('#idprodfournprice').length > 0) {
console.log("objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page");
var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select
if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with ajax autocomplete
var default_vat_code = $('option:selected', this).attr('data-default-vat-code'); // When select is done from HTML select
if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete
var stringforvatrateselection = tva_tx;
if (typeof default_vat_code != 'undefined' && default_vat_code != null) {
stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')';
}
console.log("objectline_create.tpl We find data for price : tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+" for product id = "+jQuery('#idprodfournprice').val());
// Set vat rate if field is an input box
$('#tva_tx').val(tva_tx);
// Set vat rate by selecting the combo
//$('#tva_tx option').val(tva_tx); // This is bugged, it replaces the vat key of all options
$('#tva_tx option').removeAttr('selected');
console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val());
$('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true);
<?php <?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) { if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {
?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{ {
var editor = CKEDITOR.instances['dp_desc']; var editor = CKEDITOR.instances['dp_desc'];
@@ -1056,11 +1084,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
} }
} }
<?php <?php
} else { ?> } else {
?>
jQuery('#dp_desc').text(''); jQuery('#dp_desc').text('');
<?php <?php
} }
}?> }
?>
} }

View File

@@ -94,14 +94,14 @@ $permissiontoread = 0;
$permissiontoadd = 0; $permissiontoadd = 0;
$permissiontoupload = 0; $permissiontoupload = 0;
if ($module == 'ecm') { if ($module == 'ecm') {
$permissiontoread = $user->rights->ecm->read; $permissiontoread = $user->hasRight("ecm", "read");
$permissiontoadd = $user->rights->ecm->setup; $permissiontoadd = $user->hasRight("ecm", "setup");
$permissiontoupload = $user->rights->ecm->upload; $permissiontoupload = $user->hasRight("ecm", "upload");
} }
if ($module == 'medias') { if ($module == 'medias') {
$permissiontoread = ($user->rights->mailing->lire || $user->rights->website->read); $permissiontoread = ($user->hasRight("mailing", "lire") || $user->hasRight("website", "read"));
$permissiontoadd = ($user->rights->mailing->creer || $user->rights->website->write); $permissiontoadd = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
$permissiontoupload = ($user->rights->mailing->creer || $user->rights->website->write); $permissiontoupload = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
} }
if (!$permissiontoread) { if (!$permissiontoread) {

View File

@@ -37,6 +37,7 @@ $langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal'
// Get parameters // Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$file_manager = GETPOST('file_manager', 'alpha'); $file_manager = GETPOST('file_manager', 'alpha');
@@ -50,6 +51,7 @@ $overwritefile = GETPOST('overwritefile', 'int');
if (empty($action) && $file_manager) { if (empty($action) && $file_manager) {
$action = 'file_manager'; $action = 'file_manager';
} }
$pageid = GETPOST('pageid', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');

View File

@@ -67,7 +67,7 @@ $search_date_order_endyear = GETPOST('search_date_order_endyear', 'int');
$search_date_order_start = dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear); // Use tzserver $search_date_order_start = dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear); // Use tzserver
$search_date_order_end = dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear); $search_date_order_end = dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear);
$search_date_delivery_starvtday = GETPOST('search_date_delivery_startday', 'int'); $search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int'); $search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int'); $search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); $search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');

View File

@@ -796,7 +796,7 @@ IMG;
// Export to PDF using LibreOffice // Export to PDF using LibreOffice
if ($conf->global->MAIN_ODT_AS_PDF == 'libreoffice') { if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') {
dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable
// We delete and recreate a subdir because the soffice may have change pemrissions on it // We delete and recreate a subdir because the soffice may have change pemrissions on it
@@ -808,7 +808,7 @@ IMG;
// using linux/mac libreoffice that must be in path // using linux/mac libreoffice that must be in path
// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
$command ='soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name); $command ='soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
} elseif (preg_match('/unoconv/', $conf->global->MAIN_ODT_AS_PDF)) { } elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) {
// If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87 // If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87
// MAIN_ODT_AS_PDF should be "sudo -u unoconv /usr/bin/unoconv" and userunoconv must have sudo to be root by adding file /etc/sudoers.d/unoconv with content www-data ALL=(unoconv) NOPASSWD: /usr/bin/unoconv . // MAIN_ODT_AS_PDF should be "sudo -u unoconv /usr/bin/unoconv" and userunoconv must have sudo to be root by adding file /etc/sudoers.d/unoconv with content www-data ALL=(unoconv) NOPASSWD: /usr/bin/unoconv .
@@ -833,17 +833,17 @@ IMG;
// - set shell of user to bash instead of nologin. // - set shell of user to bash instead of nologin.
// - set permission to read/write to user on home directory /var/www so user can create the libreoffice , dconf and .cache dir and files then set permission back // - set permission to read/write to user on home directory /var/www so user can create the libreoffice , dconf and .cache dir and files then set permission back
$command = $conf->global->MAIN_ODT_AS_PDF.' '.escapeshellcmd($name); $command = getDolGlobalString('MAIN_ODT_AS_PDF').' '.escapeshellcmd($name);
//$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name); //$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name);
} else { } else {
// deprecated old method using odt2pdf.sh (native, jodconverter, ...) // deprecated old method using odt2pdf.sh (native, jodconverter, ...)
$tmpname=preg_replace('/\.odt/i', '', $name); $tmpname=preg_replace('/\.odt/i', '', $name);
if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT)) { if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) {
$command = $conf->global->MAIN_DOL_SCRIPTS_ROOT.'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF); $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
} else { } else {
dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING); dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF); $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
} }
} }

View File

@@ -178,31 +178,31 @@ ACCOUNTING_RESULT_PROFIT=Result accounting account (Profit)
ACCOUNTING_RESULT_LOSS=Result accounting account (Loss) ACCOUNTING_RESULT_LOSS=Result accounting account (Loss)
ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal of closure ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal of closure
ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer ACCOUNTING_ACCOUNT_TRANSFER_CASH=Account (from the Chart Of Account) to be used as the account for transitional bank transfers
TransitionalAccount=Transitional bank transfer account TransitionalAccount=Transitional bank transfer account
ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait ACCOUNTING_ACCOUNT_SUSPENSE=Account (from the Chart Of Account) to be used as the account for unallocated funds either received or paid i.e. funds in "wait[ing]"
DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations DONATION_ACCOUNTINGACCOUNT=Account (from the Chart Of Account) to be used to register donations (Donation module)
ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Account (from the Chart Of Account) to be used to register memberships subscriptions (Membership module - if membership recorded without invoice)
ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Accounting account by default to register customer deposit ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT=Account (from the Chart Of Account) to be used as the default account to register customer deposit
UseAuxiliaryAccountOnCustomerDeposit=Store customer account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty) UseAuxiliaryAccountOnCustomerDeposit=Store customer account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty)
ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Accounting account by default to register supplier deposit ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT=Account (from the Chart Of Account) to be used as the default
UseAuxiliaryAccountOnSupplierDeposit=Store supplier account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty) UseAuxiliaryAccountOnSupplierDeposit=Store supplier account as individual account in subsidiary ledger for lines of down payments (if disabled, individual account for down payment lines will remain empty)
ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for the bought products (used if not defined in the product sheet) ACCOUNTING_PRODUCT_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products purchased within same country (used if not defined in the product sheet)
ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Accounting account by default for the bought products in EEC (used if not defined in the product sheet) ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products purchased from EEC to another EEC country (used if not defined in the product sheet)
ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT=Accounting account by default for the bought products and imported out of EEC (used if not defined in the product sheet) ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products purchased and imported from any other foreign country (used if not defined in the product sheet)
ACCOUNTING_PRODUCT_SOLD_ACCOUNT=Accounting account by default for the sold products (used if not defined in the product sheet) ACCOUNTING_PRODUCT_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the sold products (used if not defined in the product sheet)
ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT=Accounting account by default for the products sold in EEC (used if not defined in the product sheet) ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products sold from EEC to another EEC country (used if not defined in the product sheet)
ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT=Accounting account by default for the products sold and exported out of EEC (used if not defined in the product sheet) ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the products sold and exported to any other foreign country (used if not defined in the product sheet)
ACCOUNTING_SERVICE_BUY_ACCOUNT=Accounting account by default for the bought services (used if not defined in the service sheet) ACCOUNTING_SERVICE_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services purchased within same country (used if not defined in the service sheet)
ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT=Accounting account by default for the bought services in EEC (used if not defined in the service sheet) ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services purchased from EEC to another EEC country (used if not defined in the service sheet)
ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT=Accounting account by default for the bought services and imported out of EEC (used if not defined in the service sheet) ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services purchased and imported from other foreign country (used if not defined in the service sheet)
ACCOUNTING_SERVICE_SOLD_ACCOUNT=Accounting account by default for the sold services (used if not defined in the service sheet) ACCOUNTING_SERVICE_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the sold services (used if not defined in the service sheet)
ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT=Accounting account by default for the services sold in EEC (used if not defined in the service sheet) ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services sold from EEC to another EEC country (used if not defined in the service sheet)
ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT=Accounting account by default for the services sold and exported out of EEC (used if not defined in the service sheet) ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for the services sold and exported to any other foreign country (used if not defined in the service sheet)
Doctype=Type of document Doctype=Type of document
Docdate=Date Docdate=Date

View File

@@ -246,12 +246,12 @@ TurnoverPerProductInCommitmentAccountingNotRelevant=The report of Turnover colle
TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The report of Turnover collected per sale tax rate is not available. This report is only available for turnover invoiced. TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The report of Turnover collected per sale tax rate is not available. This report is only available for turnover invoiced.
CalculationMode=Calculation mode CalculationMode=Calculation mode
AccountancyJournal=Accounting code journal AccountancyJournal=Accounting code journal
ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for VAT on sales (used if not defined on VAT dictionary setup) ACCOUNTING_VAT_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for VAT on sales (used if not defined on VAT dictionary setup)
ACCOUNTING_VAT_BUY_ACCOUNT=Accounting account by default for VAT on purchases (used if not defined on VAT dictionary setup) ACCOUNTING_VAT_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for VAT on purchases (used if not defined on VAT dictionary setup)
ACCOUNTING_VAT_PAY_ACCOUNT=Accounting account by default for paying VAT ACCOUNTING_VAT_PAY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for paying VAT
ACCOUNTING_ACCOUNT_CUSTOMER=Accounting account used for customer third parties ACCOUNTING_ACCOUNT_CUSTOMER=Account (from the Chart Of Account) used for "customer" third parties
ACCOUNTING_ACCOUNT_CUSTOMER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated customer accounting account on third party is not defined. ACCOUNTING_ACCOUNT_CUSTOMER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated customer accounting account on third party is not defined.
ACCOUNTING_ACCOUNT_SUPPLIER=Accounting account used for vendor third parties ACCOUNTING_ACCOUNT_SUPPLIER=Account (from the Chart of Account) used for the "vendor" third parties
ACCOUNTING_ACCOUNT_SUPPLIER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated vendor accounting account on third party is not defined. ACCOUNTING_ACCOUNT_SUPPLIER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated vendor accounting account on third party is not defined.
ConfirmCloneTax=Confirm the clone of a social/fiscal tax ConfirmCloneTax=Confirm the clone of a social/fiscal tax
ConfirmCloneVAT=Confirm the clone of a VAT declaration ConfirmCloneVAT=Confirm the clone of a VAT declaration

View File

@@ -28,7 +28,7 @@ CantUseScheduleWithLoanStartedToPaid = Can't generate a timeline for a loan with
CantModifyInterestIfScheduleIsUsed = You can't modify interest if you use schedule CantModifyInterestIfScheduleIsUsed = You can't modify interest if you use schedule
# Admin # Admin
ConfigLoan=Configuration of the module loan ConfigLoan=Configuration of the module loan
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Account (from the Chart Of Account) to be used by default for capital (Loan module)
LOAN_ACCOUNTING_ACCOUNT_INTEREST=Accounting account interest by default LOAN_ACCOUNTING_ACCOUNT_INTEREST=Account (from the Chart Of Account) to be used by default for interest (Loan module)
LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Accounting account insurance by default LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Account (from the Chart Of Account) to be used by default for insurance (Loan module)
CreateCalcSchedule=Edit financial commitment CreateCalcSchedule=Edit financial commitment

View File

@@ -1148,18 +1148,18 @@ EventReminder=Event Reminder
UpdateForAllLines=Update for all lines UpdateForAllLines=Update for all lines
OnHold=On hold OnHold=On hold
Civility=Civility Civility=Civility
AffectTag=Affect Tag AffectTag=Assign Tag
AffectUser=Affect User AffectUser=Assign User
SetSupervisor=Set Supervisor SetSupervisor=Set Supervisor
CreateExternalUser=Create external user CreateExternalUser=Create external user
ConfirmAffectTag=Bulk Tag Affect ConfirmAffectTag=Bulk Tag Assignement
ConfirmAffectUser=Bulk User Affect ConfirmAffectUser=Bulk User Assignement
ProjectRole=Role assigned on each project ProjectRole=Role assigned on each project
TasksRole=Role assigned on each task of each project TasksRole=Role assigned on each task of each project
ConfirmSetSupervisor=Bulk Supervisor Set ConfirmSetSupervisor=Bulk Supervisor Set
ConfirmUpdatePrice=Choose a increase/decrease price rate ConfirmUpdatePrice=Choose a increase/decrease price rate
ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)? ConfirmAffectTagQuestion=Are you sure you want to assign tags to the %s selected record(s)?
ConfirmAffectUserQuestion=Are you sure you want to affect users to the %s selected record(s)? ConfirmAffectUserQuestion=Are you sure you want to assign users to the %s selected record(s)?
ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)? ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)?
ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)? ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)?
CategTypeNotFound=No tag type found for type of records CategTypeNotFound=No tag type found for type of records
@@ -1170,6 +1170,7 @@ InformationOnLinkToContract=This amount is only the total of all the lines of th
ConfirmCancel=Are you sure you want to cancel ConfirmCancel=Are you sure you want to cancel
EmailMsgID=Email MsgID EmailMsgID=Email MsgID
EmailDate=Email date EmailDate=Email date
SetToStatus=Set to status %s
SetToEnabled=Set to enabled SetToEnabled=Set to enabled
SetToDisabled=Set to disabled SetToDisabled=Set to disabled
ConfirmMassEnabling=mass enabling confirmation ConfirmMassEnabling=mass enabling confirmation
@@ -1198,8 +1199,8 @@ Terminated=Terminated
AddLineOnPosition=Add line on position (at the end if empty) AddLineOnPosition=Add line on position (at the end if empty)
ConfirmAllocateCommercial=Assign sales representative confirmation ConfirmAllocateCommercial=Assign sales representative confirmation
ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)? ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)?
CommercialsAffected=Sales representatives affected CommercialsAffected=Sales representatives assigned
CommercialAffected=Sales representative affected CommercialAffected=Sales representative assigned
YourMessage=Your message YourMessage=Your message
YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible. YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible.
UrlToCheck=Url to check UrlToCheck=Url to check

View File

@@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - salaries # Dolibarr language file - Source file is en_US - salaries
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Account (from the Chart of Account) used by default for "user" third parties
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accounting account on user is not defined. SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated account defined on user card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accounting account on user is not defined.
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments
CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Automatically create a total payment" when creating a Salary CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Automatically create a total payment" when creating a Salary
Salary=Salary Salary=Salary

View File

@@ -572,7 +572,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {

View File

@@ -123,7 +123,7 @@ foreach ($object->fields as $key => $val) {
$visible = (int) dol_eval($val['visible'], 1); $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array( $arrayfields['t.'.$key] = array(
'label'=>$val['label'], 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible <= 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'], 'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : '' 'help'=> isset($val['help']) ? $val['help'] : ''

View File

@@ -204,7 +204,7 @@ if ($action == 'set') {
if ($action == 'del') { if ($action == 'del') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
if ($conf->global->PRODUCT_ADDON_PDF == "$value") { if (getDolGlobalString('PRODUCT_ADDON_PDF') == "$value") {
dolibarr_del_const($db, 'PRODUCT_ADDON_PDF', $conf->entity); dolibarr_del_const($db, 'PRODUCT_ADDON_PDF', $conf->entity);
} }
} }
@@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) {
// Defaut // Defaut
print '<td class="center">'; print '<td class="center">';
if ($conf->global->PRODUCT_ADDON_PDF == $name) { if (getDolGlobalString('PRODUCT_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';

View File

@@ -5158,11 +5158,7 @@ class Product extends CommonObject
// Positionne le modele sur le nom du modele a utiliser // Positionne le modele sur le nom du modele a utiliser
if (!dol_strlen($modele)) { if (!dol_strlen($modele)) {
if (!empty($conf->global->PRODUCT_ADDON_PDF)) { $modele = getDolGlobalString('PRODUCT_ADDON_PDF', 'strato');
$modele = $conf->global->PRODUCT_ADDON_PDF;
} else {
$modele = 'strato';
}
} }
$modelpath = "core/modules/product/doc/"; $modelpath = "core/modules/product/doc/";

View File

@@ -1143,12 +1143,12 @@ if (!empty($arrayfields['p.tms']['checked'])) {
} }
if (!empty($arrayfields['p.tosell']['checked'])) { if (!empty($arrayfields['p.tosell']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1); print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
print '</td >'; print '</td >';
} }
if (!empty($arrayfields['p.tobuy']['checked'])) { if (!empty($arrayfields['p.tobuy']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1); print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
print '</td>'; print '</td>';
} }
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {

View File

@@ -465,7 +465,8 @@ if (empty($reshook)) {
break; break;
} }
if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) { // If price has changed, we update it
if (!array_key_exists($key, $object->multiprices) || $object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) {
$res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']);
} else { } else {
$res = 0; $res = 0;

View File

@@ -440,16 +440,16 @@ if ($result || !($id > 0)) {
continue; continue;
} }
if ($graphfiles == 'propal' && !$user->rights->propal->lire) { if ($graphfiles == 'propal' && empty($user->rights->propal->lire)) {
continue; continue;
} }
if ($graphfiles == 'order' && !$user->rights->commande->lire) { if ($graphfiles == 'order' && empty($user->rights->commande->lire)) {
continue; continue;
} }
if ($graphfiles == 'invoices' && !$user->rights->facture->lire) { if ($graphfiles == 'invoices' && empty($user->rights->facture->lire)) {
continue; continue;
} }
if ($graphfiles == 'proposals_suppliers' && !$user->rights->supplier_proposal->lire) { if ($graphfiles == 'proposals_suppliers' && empty($user->rights->supplier_proposal->lire)) {
continue; continue;
} }
if ($graphfiles == 'invoices_suppliers' && empty($user->rights->fournisseur->facture->lire)) { if ($graphfiles == 'invoices_suppliers' && empty($user->rights->fournisseur->facture->lire)) {
@@ -458,7 +458,7 @@ if ($result || !($id > 0)) {
if ($graphfiles == 'orders_suppliers' && empty($user->rights->fournisseur->commande->lire)) { if ($graphfiles == 'orders_suppliers' && empty($user->rights->fournisseur->commande->lire)) {
continue; continue;
} }
if ($graphfiles == 'mrp' && empty($user->rights->mrp->mo->read)) { if ($graphfiles == 'mrp' && empty($user->rights->mrp->read)) {
continue; continue;
} }

View File

@@ -485,7 +485,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">'; print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 20px;"></div>'; print '<div class="clearboth" style="padding-bottom: 20px;"></div>';

View File

@@ -397,7 +397,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">'; print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 20px;"></div>'; print '<div class="clearboth" style="padding-bottom: 20px;"></div>';

View File

@@ -498,7 +498,7 @@ $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.
print '</div>'; print '</div>';
print ' '; print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone'); print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">'; print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>'; print '</div>';
print '<div class="clearboth" style="padding-bottom: 20px;"></div>'; print '<div class="clearboth" style="padding-bottom: 20px;"></div>';

View File

@@ -1542,7 +1542,11 @@ while ($i < $imaxinloop) {
//if ($obj->opp_status_code) //if ($obj->opp_status_code)
if (strcmp($obj->opp_amount, '')) { if (strcmp($obj->opp_amount, '')) {
print '<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').'</span>'; print '<span class="amount">'.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').'</span>';
$totalarray['val']['p.opp_amount'] += $obj->opp_amount; if (empty($totalarray['val']['p.opp_amount'])) {
$totalarray['val']['p.opp_amount'] = $obj->opp_amount;
} else {
$totalarray['val']['p.opp_amount'] += $obj->opp_amount;
}
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@@ -1571,7 +1575,11 @@ while ($i < $imaxinloop) {
print '<td align="right">'; print '<td align="right">';
if ($obj->opp_weighted_amount) { if ($obj->opp_weighted_amount) {
print '<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').'</span>'; print '<span class="amount">'.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').'</span>';
$totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; if (empty($totalarray['val']['opp_weighted_amount'])) {
$totalarray['val']['opp_weighted_amount'] = $obj->opp_weighted_amount;
} else {
$totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount;
}
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@@ -1586,7 +1594,11 @@ while ($i < $imaxinloop) {
print '<td class="right">'; print '<td class="right">';
if ($obj->budget_amount != '') { if ($obj->budget_amount != '') {
print '<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).'</span>'; print '<span class="amount">'.price($obj->budget_amount, 1, $langs, 1, -1, -1).'</span>';
$totalarray['val']['p.budget_amount'] += $obj->budget_amount; if (empty($totalarray['val']['p.budget_amount'])) {
$totalarray['val']['p.budget_amount'] = $obj->budget_amount;
} else {
$totalarray['val']['p.budget_amount'] += $obj->budget_amount;
}
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {

View File

@@ -1239,7 +1239,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
} }
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid, "projectstatic" => $projectstatic, "withproject" => $withproject); $parameters = array('formConfirm' => $formconfirm, "projectstatic" => $projectstatic, "withproject" => $withproject);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint; $formconfirm .= $hookmanager->resPrint;
@@ -1265,7 +1265,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
} }
$arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1); $arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1);
$arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1); $arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1);
if ($conf->service->enabled && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
$arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1);
} }
$arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); $arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1);
@@ -1971,7 +1971,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$total = 0; $total = 0;
$totalvalue = 0; $totalvalue = 0;
$totalarray = array(); $totalarray = array('nbfield'=>0);
foreach ($tasks as $task_time) { foreach ($tasks as $task_time) {
if ($i >= $limit) { if ($i >= $limit) {
break; break;
@@ -2168,11 +2168,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration';
} }
$totalarray['val']['t.task_duration'] += $task_time->task_duration; if (empty($totalarray['val']['t.task_duration'])) {
$totalarray['val']['t.task_duration'] = $task_time->task_duration;
} else {
$totalarray['val']['t.task_duration'] += $task_time->task_duration;
}
if (!$i) { if (!$i) {
$totalarray['totaldurationfield'] = $totalarray['nbfield']; $totalarray['totaldurationfield'] = $totalarray['nbfield'];
} }
$totalarray['totalduration'] += $task_time->task_duration; if (empty($totalarray['totalduration'])) {
$totalarray['totalduration'] = $task_time->task_duration;
} else {
$totalarray['totalduration'] += $task_time->task_duration;
}
} }
//Product //Product
@@ -2208,11 +2216,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'value'; $totalarray['pos'][$totalarray['nbfield']] = 'value';
} }
$totalarray['val']['value'] += $value; if (empty($totalarray['val']['value'])) {
$totalarray['val']['value'] = $value;
} else {
$totalarray['val']['value'] += $value;
}
if (!$i) { if (!$i) {
$totalarray['totalvaluefield'] = $totalarray['nbfield']; $totalarray['totalvaluefield'] = $totalarray['nbfield'];
} }
$totalarray['totalvalue'] += $value; if (empty($totalarray['totalvalue'])) {
$totalarray['totalvalue'] = $value;
} else {
$totalarray['totalvalue'] += $value;
}
} }
// Invoiced // Invoiced

View File

@@ -927,7 +927,7 @@ if (!empty($arrayfields['e.date_delivery']['checked'])) {
if (!empty($arrayfields['l.ref']['checked'])) { if (!empty($arrayfields['l.ref']['checked'])) {
// Delivery ref // Delivery ref
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"'; print '<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['l.date_delivery']['checked'])) { if (!empty($arrayfields['l.date_delivery']['checked'])) {
@@ -960,7 +960,7 @@ if (!empty($arrayfields['e.tms']['checked'])) {
// Status // Status
if (!empty($arrayfields['e.fk_statut']['checked'])) { if (!empty($arrayfields['e.fk_statut']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">'; print '<td class="liste_titre maxwidthonsmartphone right">';
print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1); print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status onrightofpage');
print '</td>'; print '</td>';
} }
// Status billed // Status billed

View File

@@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh <testldr9@dolicloud.com> /* Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh <testldr9@dolicloud.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -28,7 +29,11 @@
*/ */
function recruitmentAdminPrepareHead() function recruitmentAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('recruitment_recruitmentjobposition');
$extrafields->fetch_name_optionals_label('recruitment_recruitmentcandidature');
$langs->load("recruitment"); $langs->load("recruitment");
@@ -52,11 +57,19 @@ function recruitmentAdminPrepareHead()
$head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1); $head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtrafieldsJobPosition"); $head[$h][1] = $langs->trans("ExtrafieldsJobPosition");
$nbExtrafields = $extrafields->attributes['recruitment_recruitmentjobposition']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'jobposition_extrafields'; $head[$h][2] = 'jobposition_extrafields';
$h++; $h++;
$head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1); $head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtrafieldsApplication"); $head[$h][1] = $langs->trans("ExtrafieldsApplication");
$nbExtrafields = $extrafields->attributes['recruitment_recruitmentcandidature']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'candidature_extrafields'; $head[$h][2] = 'candidature_extrafields';
$h++; $h++;

View File

@@ -796,36 +796,41 @@ class Societe extends CommonObject
*/ */
public $bank_account; public $bank_account;
const STATUS_CEASED = 0;
const STATUS_INACTIVITY = 1;
/** /**
* Third party is no customer * Third party type is no customer
*/ */
const NO_CUSTOMER = 0; const NO_CUSTOMER = 0;
/** /**
* Third party is a customer * Third party type is a customer
*/ */
const CUSTOMER = 1; const CUSTOMER = 1;
/** /**
* Third party is a prospect * Third party type is a prospect
*/ */
const PROSPECT = 2; const PROSPECT = 2;
/** /**
* Third party is a customer and a prospect * Third party type is a customer and a prospect
*/ */
const CUSTOMER_AND_PROSPECT = 3; const CUSTOMER_AND_PROSPECT = 3;
/** /**
* Third party is no supplier * Third party supplier flag is not supplier
*/ */
const NO_SUPPLIER = 0; const NO_SUPPLIER = 0;
/** /**
* Third party is a supplier * Third party supplier flag is a supplier
*/ */
const SUPPLIER = 1; const SUPPLIER = 1;
/** /**
* Constructor * Constructor
* *

View File

@@ -184,7 +184,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
$statstring .= "</tr>"; $statstring .= "</tr>";
} }
$statstring2 = ''; $statstring2 = '';
if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { if (((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'facture', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
$statstring2 = "<tr>"; $statstring2 = "<tr>";
$statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>'; $statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
$statstring2 .= "</tr>"; $statstring2 .= "</tr>";

View File

@@ -321,7 +321,8 @@ if ($action == "change") { // Change customer for TakePOS
} }
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = ''; $action = 'list';
$massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = ''; $massaction = '';
@@ -936,10 +937,10 @@ if (isModEnabled('category') && $user->hasRight("societe", "creer")) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
} }
if ($user->hasRight("societe", "creer")) { if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled"); $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_INACTIVITY));
} }
if ($user->hasRight("societe", "creer")) { if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled"); $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToStatus", $object->LibStatut($object::STATUS_CEASED));
} }
if ($user->hasRight("societe", "creer")) { if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial"); $arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
@@ -1028,7 +1029,7 @@ if ($search_all) {
// Filter on categories // Filter on categories
$moreforfilter = ''; $moreforfilter = '';
if (empty($type) || $type == 'c' || $type == 'p') { if (empty($type) || $type == 'c' || $type == 'p') {
if (isModEnabled('categorie') && $user->rights->categorie->lire) { if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('Categories'); $tmptitle = $langs->trans('Categories');
@@ -1039,7 +1040,7 @@ if (empty($type) || $type == 'c' || $type == 'p') {
} }
if (empty($type) || $type == 'f') { if (empty($type) || $type == 'f') {
if (isModEnabled("fournisseur") && isModEnabled('categorie') && $user->rights->categorie->lire) { if (isModEnabled("fournisseur") && isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('Categories'); $tmptitle = $langs->trans('Categories');
@@ -1050,7 +1051,7 @@ if (empty($type) || $type == 'f') {
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) { if ($user->hasRight("societe", "client", "voir") || $socid) {
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('SalesRepresentatives'); $tmptitle = $langs->trans('SalesRepresentatives');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
@@ -1310,7 +1311,7 @@ if (!empty($arrayfields['s.tms']['checked'])) {
// Status // Status
if (!empty($arrayfields['s.status']['checked'])) { if (!empty($arrayfields['s.status']['checked'])) {
print '<td class="liste_titre center minwidth75imp">'; print '<td class="liste_titre center minwidth75imp">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1);
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['s.import_key']['checked'])) { if (!empty($arrayfields['s.import_key']['checked'])) {

View File

@@ -71,7 +71,7 @@ if ($id > 0 || $ref) {
} }
$selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array(); $selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
$selected = "";
// Security check // Security check
if (!isModEnabled('variants')) { if (!isModEnabled('variants')) {
accessforbidden('Module not enabled'); accessforbidden('Module not enabled');
@@ -140,7 +140,7 @@ $productCombination2ValuePairs1 = array();
if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST('selectvariant', 'alpha') && empty($subaction)) { // We click on Create all defined combinations if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST('selectvariant', 'alpha') && empty($subaction)) { // We click on Create all defined combinations
//$features = GETPOST('features', 'array'); //$features = GETPOST('features', 'array');
$features = $_SESSION['addvariant_'.$object->id]; $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
if (!$features) { if (!$features) {
if ($action == 'create') { if ($action == 'create') {
@@ -474,7 +474,7 @@ if (!empty($id) || !empty($ref)) {
if ($action == 'add') { if ($action == 'add') {
$title = $langs->trans('NewProductCombination'); $title = $langs->trans('NewProductCombination');
// print dol_get_fiche_head(); // print dol_get_fiche_head();
$features = $_SESSION['addvariant_'.$object->id]; $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
//First, sanitize //First, sanitize
$listofvariantselected = '<div id="parttoaddvariant">'; $listofvariantselected = '<div id="parttoaddvariant">';
if (!empty($features)) { if (!empty($features)) {