diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d17347a0ad7..68fe9de68d6 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -116,13 +116,13 @@ a process to follow to optimize the chance to have PRs merged efficiently... Also, some code changes need a prior approbation: -* if you want to include a new external library (into htdocs/includes directory), please ask before to the core project manager (mention @dolibarr-yoda in your issue) to see if such a library can be accepted. +* if you want to include a new external library (into htdocs/includes directory), please ask before to the core project manager (mention @dolibarr-jedi in your issue) to see if such a library can be accepted. -* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@dolibarr-yoda) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest. +* if you add a new tables or fields, you MUST first submit a standalone PR with the data structure changes you plan to add/modify (and only data structure changes). Start development only once this data structure has been accepted. Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case). -If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of PR (but it can be analyzed for discussion). +If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of the PR (but it can be analyzed for discussion). If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 84deea18f00..13a3e6fa77b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,18 +1,18 @@ # Instructions *This is a template to help you make good pull requests. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.* *Please:* -- *only keep the "Fix", "Close" or "New" section* +- *only keep the "FIX", "CLOSE" or "NEW" section* (use uppercase to have the PR appears into the ChangeLog, lowercase will not appears) - *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)* - *replace the bracket enclosed texts with meaningful information* -# Fix #[*issue_number Short description*] +# FIX|Fix #[*issue_number Short description*] [*Long description*] -# Close #[*issue_number Short description*] +# CLOSE|Close #[*issue_number Short description*] [*Long description*] -# New [*Short description*] +# NEW|New [*Short description*] [*Long description*] diff --git a/ChangeLog b/ChangeLog index de1482ea183..ddda40a0e31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,7 @@ Following changes may create regressions for some external modules, but were nec * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. * Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. * The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). - +* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines. ***** ChangeLog for 14.0.2 compared to 14.0.1 ***** diff --git a/dev/initdemo/mysqldump_dolibarr_14.0.0.sql b/dev/initdemo/mysqldump_dolibarr_14.0.0.sql index 4061fb9f4cf..e619c2c8fda 100644 --- a/dev/initdemo/mysqldump_dolibarr_14.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_14.0.0.sql @@ -2056,7 +2056,7 @@ CREATE TABLE `llx_c_holiday_types` ( `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `affect` int(11) NOT NULL, `delay` int(11) NOT NULL, - `newByMonth` double(8,5) NOT NULL DEFAULT 0.00000, + `newbymonth` double(8,5) NOT NULL DEFAULT 0.00000, `fk_country` int(11) DEFAULT NULL, `active` int(11) DEFAULT 1, PRIMARY KEY (`rowid`), diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 126f61e272c..80dddd28edb 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -430,7 +430,7 @@ if ($action != 'export_csv') { print ''; print ''.$accounting_account.''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { - print ''.price($opening_balance).''; + print ''.price(price2num($opening_balance, 'MT')).''; } $urlzoom = ''; @@ -444,9 +444,9 @@ if ($action != 'export_csv') { } } // Debit - print ''.price($line->debit).''; + print ''.price(price2num($line->debit, 'MT')).''; // Credit - print ''.price($line->credit).''; + print ''.price(price2num($line->credit, 'MT')).''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print ''.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).''; @@ -467,10 +467,10 @@ if ($action != 'export_csv') { if (!empty($show_subgroup)) { print ''.$langs->trans("SubTotal").':'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { - print ''.price($sous_total_opening_balance).''; + print ''.price(price2num($sous_total_opening_balance, 'MT')).''; } - print ''.price($sous_total_debit).''; - print ''.price($sous_total_credit).''; + print ''.price(price2num($sous_total_debit, 'MT')).''; + print ''.price(price2num($sous_total_credit, 'MT')).''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print '' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . ''; } else { @@ -482,10 +482,10 @@ if ($action != 'export_csv') { print ''.$langs->trans("AccountBalance").':'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { - print ''.price($total_opening_balance).''; + print ''.price(price2num($total_opening_balance, 'MT')).''; } - print ''.price($total_debit).''; - print ''.price($total_credit).''; + print ''.price(price2num($total_debit, 'MT')).''; + print ''.price(price2num($total_credit, 'MT')).''; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { print '' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . ''; } else { diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 81060f0e413..2c4dbfd51cd 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -914,7 +914,8 @@ class AccountancyExport print "ValidDate".$separator; print "Montantdevise".$separator; print "Idevise".$separator; - print "DateLimitReglmt"; + print "DateLimitReglmt".$separator; + print "NumFacture".$separator; print $end_line; foreach ($objectLines as $line) { @@ -927,6 +928,22 @@ class AccountancyExport $date_validation = dol_print_date($line->date_validation, '%Y%m%d'); $date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d'); + if ($line->doc_type == 'customer_invoice') { + // Customer invoice + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $invoice = new Facture($db); + $invoice->fetch($line->fk_doc); + + $refInvoice = $invoice->ref; + } elseif ($line->doc_type == 'supplier_invoice') { + // Supplier invoice + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $invoice = new FactureFournisseur($db); + $invoice->fetch($line->fk_doc); + + $refInvoice = $invoice->ref_supplier; + } + // FEC:JournalCode print $line->code_journal . $separator; @@ -984,6 +1001,9 @@ class AccountancyExport // FEC_suppl:DateLimitReglmt print $date_limit_payment; + // FEC_suppl:NumFacture + print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator; + print $end_line; } } @@ -1020,7 +1040,8 @@ class AccountancyExport print "ValidDate".$separator; print "Montantdevise".$separator; print "Idevise".$separator; - print "DateLimitReglmt"; + print "DateLimitReglmt".$separator; + print "NumFacture".$separator; print $end_line; foreach ($objectLines as $line) { @@ -1033,6 +1054,22 @@ class AccountancyExport $date_validation = dol_print_date($line->date_validation, '%Y%m%d'); $date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d'); + if ($line->doc_type == 'customer_invoice') { + // Customer invoice + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $invoice = new Facture($db); + $invoice->fetch($line->fk_doc); + + $refInvoice = $invoice->ref; + } elseif ($line->doc_type == 'supplier_invoice') { + // Supplier invoice + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $invoice = new FactureFournisseur($db); + $invoice->fetch($line->fk_doc); + + $refInvoice = $invoice->ref_supplier; + } + // FEC:JournalCode print $line->code_journal . $separator; @@ -1090,6 +1127,10 @@ class AccountancyExport // FEC_suppl:DateLimitReglmt print $date_limit_payment; + // FEC_suppl:NumFacture + print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator; + + print $end_line; } } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 1e7c38b2607..7f09e111a23 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -191,7 +191,14 @@ print ''; + } + } elseif ($val['type'] == 'product') { + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { + $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $form->select_produits($selected, $constname, '', 0); + } + } else { + print ''; + } + print ''; + } + } + print ''; + + print '
'; + print ''; + print '
'; + + print ''; + print '
'; +} else { + if (!empty($arrayofparameters)) { + print ''; + print ''; + + foreach ($arrayofparameters as $constname => $val) { + if ($val['enabled']==1) { + $setupnotempty++; + print ''; + } + } + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + print $form->textwithpicto($langs->trans($constname), $tooltiphelp); + print ''; + + if ($val['type'] == 'textarea') { + print dol_nl2br($conf->global->{$constname}); + } elseif ($val['type']== 'html') { + print $conf->global->{$constname}; + } elseif ($val['type'] == 'yesno') { + print ajax_constantonoff($constname); + } elseif (preg_match('/emailtemplate:/', $val['type'])) { + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $tmp = explode(':', $val['type']); + + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + if ($template<0) { + setEventMessages(null, $formmail->errors, 'errors'); + } + print $langs->trans($template->label); + } elseif (preg_match('/category:/', $val['type'])) { + $c = new Categorie($db); + $result = $c->fetch($conf->global->{$constname}); + if ($result < 0) { + setEventMessages(null, $c->errors, 'errors'); + } + $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text + $toprint = array(); + foreach ($ways as $way) { + $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; + } + print '
      ' . implode(' ', $toprint) . '
    '; + } elseif (preg_match('/thirdparty_type/', $val['type'])) { + if ($conf->global->{$constname}==2) { + print $langs->trans("Prospect"); + } elseif ($conf->global->{$constname}==3) { + print $langs->trans("ProspectCustomer"); + } elseif ($conf->global->{$constname}==1) { + print $langs->trans("Customer"); + } elseif ($conf->global->{$constname}==0) { + print $langs->trans("NorProspectNorCustomer"); + } + } elseif ($val['type'] == 'product') { + $product = new Product($db); + $resprod = $product->fetch($conf->global->{$constname}); + if ($resprod > 0) { + print $product->ref; + } elseif ($resprod < 0) { + setEventMessages(null, $object->errors, "errors"); + } + } else { + print $conf->global->{$constname}; + } + print '
    '; + + print '
    '; + print ''.$langs->trans("Modify").''; + print '
    '; + } else { + print '
    '.$langs->trans("NothingToSetup"); + } +} + + +if (empty($setupnotempty)) { + print '
    '.$langs->trans("NothingToSetup"); +} + +// Page end +print dol_get_fiche_end(); + +llxFooter(); +$db->close(); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 2317d63ab7f..4010d724c1a 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -1,10 +1,10 @@ - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2006-2020 Laurent Destailleur - * Copyright (C) 2011-2013 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2006-2020 Laurent Destailleur + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -153,7 +153,7 @@ $arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP"); print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE); print ''.$langs->trans("LDAPDnSynchroActiveExample").''; if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) { - print '
    '.$langs->trans("LDAPSetupNotComplete").''; + print '
    '.$langs->trans("LDAPSetupNotComplete").''; } print ''; @@ -297,24 +297,24 @@ if (function_exists("ldap_connect")) { if ($result > 0) { // Test ldap connect and bind print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; + print ''.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; print '
    '; if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) { if ($result == 2) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; + print ''.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; print '
    '; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; + print ''.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; print '
    '; print $langs->trans("Error").' '.$ldap->error; print '
    '; } } else { print img_picto('', 'warning').' '; - print ''.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").''; + print ''.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").''; print '
    '; } @@ -322,18 +322,18 @@ if (function_exists("ldap_connect")) { // Test ldap_getversion if (($ldap->getVersion() == 3)) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSetupForVersion3").''; + print ''.$langs->trans("LDAPSetupForVersion3").''; print '
    '; } else { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSetupForVersion2").''; + print ''.$langs->trans("LDAPSetupForVersion2").''; print '
    '; } $unbind = $ldap->unbind(); } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; + print ''.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; print '
    '; print $langs->trans("Error").' '.$ldap->error; print '
    '; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 3be7d63759b..fef3882d2ff 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -321,12 +321,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
    '; + print ''.$langs->trans("LDAPSynchroOK").'
    '; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } @@ -336,9 +336,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 7ba47fb8e3d..82ee85b9a20 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -260,12 +260,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
    '; + print ''.$langs->trans("LDAPSynchroOK").'
    '; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } @@ -275,9 +275,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } @@ -331,9 +331,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index cda1700299c..876c31d79b1 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -472,12 +472,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
    '; + print ''.$langs->trans("LDAPSynchroOK").'
    '; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } @@ -487,9 +487,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 1fde587f21e..05572dc8bbf 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -223,12 +223,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
    '; + print ''.$langs->trans("LDAPSynchroOK").'
    '; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } @@ -238,9 +238,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index ffb1e2ca90b..e6041650d63 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -444,12 +444,12 @@ if (function_exists("ldap_connect")) { if ($result2 > 0) { print img_picto('', 'info').' '; - print ''.$langs->trans("LDAPSynchroOK").'
    '; + print ''.$langs->trans("LDAPSynchroOK").'
    '; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); + print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } @@ -459,9 +459,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } @@ -530,9 +530,9 @@ if (function_exists("ldap_connect")) { print "\n
    "; } else { print img_picto('', 'error').' '; - print ''.$langs->trans("LDAPSynchroKO"); + print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; - print '
    '; + print '
    '; print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'
    '; } } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index c11d5023e27..be45a2101f5 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -307,7 +307,7 @@ for ($i = 1; $i <= 6; $i++) { $pid = false; } } else { - $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } if ($pid) { print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 1368fe48488..0a0e0b5973a 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -63,7 +63,7 @@ if ($action == 'updateform') { if ($res3 && $res4 && $res5 && $res6) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } -} elseif ($action == 'delete') { +} elseif ($action == 'deletefile') { // Delete file $langs->load("other"); $file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha'); diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index d6b6d6e428a..05abf8c3995 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -183,7 +183,7 @@ if ($action == 'edit') { if (count($listofmethods)) { print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, $conf->global->MAIN_SMS_SENDMODE, 1); } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 00b5fbfdb8e..808528cdc0a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -132,6 +132,8 @@ if ($action == 'updateMask') { if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } +} elseif ($action == 'unsetdoc') { + dolibarr_del_const($db, "COMMANDE_SUPPLIER_ADDON_PDF", $conf->entity); } elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -397,7 +399,8 @@ foreach ($dirmodels as $reldir) { // Default print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { - print img_picto($langs->trans("Default"), 'on'); + // print img_picto($langs->trans("Default"), 'on'); + print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index ce2c9f0f872..b31e4c9a433 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -89,6 +89,8 @@ if ($action == 'updateMask') { if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } +} elseif ($action == 'unsetdoc') { + dolibarr_del_const($db, "SUPPLIER_PAYMENT_ADDON_PDF", $conf->entity); } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 4f6977ffb41..77200404a03 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -55,7 +55,7 @@ if (!$user->admin) { * Actions */ -if ($action == 'delete') { +if ($action == 'deletefile') { if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha'))) { $file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); $ret = dol_delete_file($file, 1); @@ -513,7 +513,7 @@ if (!empty($_SESSION["commandbackuplastdone"])) { $_SESSION["commandbackupresult"] = ''; } if (!empty($_SESSION["commandbackuptorun"])) { - print '
    '.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':
    '."\n"; + print '
    '.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':
    '."\n"; print '
    '."\n"; print ajax_autoselect("commandbackuptoruntext", 0); print '
    '; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 00fd1a91a8a..f10c7b10b48 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -120,7 +120,7 @@ class Documents extends DolibarrApi * * Test sample 1: { "modulepart": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }. * - * @param string $modulepart Name of module or area concerned by file download ('invoice', 'order', ...). + * @param string $modulepart Name of module or area concerned by file download ('thirdparty', 'member', 'proposal', 'supplier_proposal', 'order', 'supplier_order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...) * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf). * @param string $doctemplate Set here the doc template to use for document generation (If not set, use the default template). * @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language). @@ -325,6 +325,20 @@ class Documents extends DolibarrApi throw new RestException(404, 'Proposal not found'); } + $upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + } elseif ($modulepart == 'supplier_proposal') { + require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; + + if (!DolibarrApiAccess::$user->rights->supplier_proposal->read) { + throw new RestException(401); + } + + $object = new Propal($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Supplier proposal not found'); + } + $upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); } elseif ($modulepart == 'commande' || $modulepart == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -340,6 +354,22 @@ class Documents extends DolibarrApi } $upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande'); + } elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') { + $modulepart = 'supplier_order'; + + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + + if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->lire) && empty(DolibarrApiAccess::$user->rights->supplier_order->lire)) { + throw new RestException(401); + } + + $object = new CommandeFournisseur($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Purchase order not found'); + } + + $upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); } elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; @@ -373,7 +403,7 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - if (!DolibarrApiAccess::$user->rights->fournisseur->facture->lire) { + if (empty(DolibarrApiAccess::$user->rights->fournisseur->facture->lire) && empty(DolibarrApiAccess::$user->rights->supplier_invoice->lire)) { throw new RestException(401); } @@ -504,7 +534,7 @@ class Documents extends DolibarrApi * Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }. * * @param string $filename Name of file to create ('FA1705-0123.txt') - * @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...) + * @param string $modulepart Name of module or area concerned by file upload ('product', 'service', 'invoice', 'proposal', 'project', 'project_task', 'supplier_invoice', 'expensereport', 'member', ...) * @param string $ref Reference of object (This will define subdir automatically and store submited file into it) * @param string $subdir Subdirectory (Only if ref not provided) * @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided) diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 4ebbe832dc5..be76a00099c 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -274,7 +274,7 @@ if ($conf->product->enabled || $conf->product->service) { } else { $disabled = 1; $titleno = $langs->trans("NoBarcodeNumberingTemplateDefined"); - print ''.$langs->trans("NoBarcodeNumberingTemplateDefined").' ('.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").')
    '; + print ''.$langs->trans("NoBarcodeNumberingTemplateDefined").' ('.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").')
    '; } if (empty($nbno)) { $disabled1 = 1; diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 8f3cadeedc2..edd9bd69ef4 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -54,7 +54,9 @@ function bomAdminPrepareHead() //$this->tabs = array( // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'bom'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp'); + + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@mrp', 'remove'); return $head; } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 477146fbfd1..e07574bacf5 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -73,8 +73,10 @@ $search_title = GETPOST('search_title', 'alpha'); $search_note = GETPOST('search_note', 'alpha'); $dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'), 'tzuserrel'); -$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'), 'tzuserrel'); -$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'), 'tzuserrel'); +$datestart_dtstart = dol_mktime(0, 0, 0, GETPOST('datestart_dtstartmonth', 'int'), GETPOST('datestart_dtstartday', 'int'), GETPOST('datestart_dtstartyear', 'int'), 'tzuserrel'); +$datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int'), GETPOST('datestart_dtendday', 'int'), GETPOST('datestart_dtendyear', 'int'), 'tzuserrel'); +$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel'); +$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel'); if ($search_status == '' && !GETPOSTISSET('search_status')) { $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); } @@ -205,8 +207,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_id = ''; $search_title = ''; $search_note = ''; - $datestart = ''; - $dateend = ''; + $datestart_dtstart = ''; + $datestart_dtend = ''; + $dateend_dtstart = ''; + $dateend_dtend = ''; $search_status = ''; $toselect = ''; $search_array_options = array(); @@ -323,23 +327,41 @@ if ($search_title != '') { if ($search_note != '') { $param .= '&search_note='.urlencode($search_note); } -if (GETPOST('datestartday', 'int')) { - $param .= '&datestartday='.GETPOST('datestartday', 'int'); +if (GETPOST('datestartday_dtstart', 'int')) { + $param .= '&datestartday_dtstart='.GETPOST('datestartday_dtstart', 'int'); } -if (GETPOST('datestartmonth', 'int')) { - $param .= '&datestartmonth='.GETPOST('datestartmonth', 'int'); +if (GETPOST('datestartmonth_dtstart', 'int')) { + $param .= '&datestartmonth_dtstart='.GETPOST('datestartmonth_dtstart', 'int'); } -if (GETPOST('datestartyear', 'int')) { - $param .= '&datestartyear='.GETPOST('datestartyear', 'int'); +if (GETPOST('datestartyear_dtstart', 'int')) { + $param .= '&datestartyear_dtstart='.GETPOST('datestartyear_dtstart', 'int'); } -if (GETPOST('dateendday', 'int')) { - $param .= '&dateendday='.GETPOST('dateendday', 'int'); +if (GETPOST('datestartday_dtend', 'int')) { + $param .= '&datestartday_dtend='.GETPOST('datestartday_dtend', 'int'); } -if (GETPOST('dateendmonth', 'int')) { - $param .= '&dateendmonth='.GETPOST('dateendmonth', 'int'); +if (GETPOST('datestartmonth_dtend', 'int')) { + $param .= '&datestartmonth_dtend='.GETPOST('datestartmonth_dtend', 'int'); } -if (GETPOST('dateendyear', 'int')) { - $param .= '&dateendyear='.GETPOST('dateendyear', 'int'); +if (GETPOST('datestartyear_dtend', 'int')) { + $param .= '&datestartyear_dtend='.GETPOST('datestartyear_dtend', 'int'); +} +if (GETPOST('dateendday_dtstart', 'int')) { + $param .= '&dateendday_dtstart='.GETPOST('dateendday_dtstart', 'int'); +} +if (GETPOST('dateendmonth_dtstart', 'int')) { + $param .= '&dateendmonth_dtstart='.GETPOST('dateendmonth_dtstart', 'int'); +} +if (GETPOST('dateendyear_dtstart', 'int')) { + $param .= '&dateendyear_dtstart='.GETPOST('dateendyear_dtstart', 'int'); +} +if (GETPOST('dateendday_dtend', 'int')) { + $param .= '&dateendday_dtend='.GETPOST('dateendday_dtend', 'int'); +} +if (GETPOST('dateendmonth_dtend', 'int')) { + $param .= '&dateendmonth_dtend='.GETPOST('dateendmonth_dtend', 'int'); +} +if (GETPOST('dateendyear_dtend', 'int')) { + $param .= '&dateendyear_dtend='.GETPOST('dateendyear_dtend', 'int'); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -502,11 +524,17 @@ if ($filtert > 0 || $usergroup > 0) { if ($dateselect > 0) { $sql .= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect - 3600)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."'))"; } -if ($datestart > 0) { - $sql .= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart + 3600 * 24 - 1)."'"; +if ($datestart_dtstart > 0) { + $sql .= " AND a.datep >= '".$db->idate($datestart_dtstart)."'"; } -if ($dateend > 0) { - $sql .= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend + 3600 * 24 - 1)."'"; +if ($datestart_dtend > 0) { + $sql .= " AND a.datep <= '".$db->idate($datestart_dtend)."'"; +} +if ($dateend_dtstart > 0) { + $sql .= " AND a.datep2 >= '".$db->idate($dateend_dtstart)."'"; +} +if ($dateend_dtend > 0) { + $sql .= " AND a.datep2 <= '".$db->idate($dateend_dtend)."'"; } // Add where from extra fields @@ -723,12 +751,22 @@ if (!empty($arrayfields['a.note']['checked'])) { } if (!empty($arrayfields['a.datep']['checked'])) { print ''; - print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); + print '
    '; + print $form->selectDate($datestart_dtstart, 'datestart_dtstart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel'); + print '
    '; + print '
    '; + print $form->selectDate($datestart_dtend, 'datestart_dtend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('To'), 'tzuserrel'); + print '
    '; print ''; } if (!empty($arrayfields['a.datep2']['checked'])) { print ''; - print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); + print '
    '; + print $form->selectDate($dateend_dtstart, 'dateend_dtstart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel'); + print '
    '; + print '
    '; + print $form->selectDate($dateend_dtend, 'dateend_dtend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('To'), 'tzuserrel'); + print '
    '; print ''; } if (!empty($arrayfields['s.nom']['checked'])) { diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 9b6238ca0de..b75c93df799 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -163,7 +163,7 @@ if ($resql) { // Button to build doc print ''; - print 'month.'&year='.$obj->year.'">'.img_picto($langs->trans('BuildDoc'), 'filenew').''; + print ''.img_picto($langs->trans('BuildDoc'), 'filenew').''; print ''; $name = "actions-".$obj->month."-".$obj->year.".pdf"; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index ff630b6b4da..45437020107 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -351,7 +351,7 @@ if ($object->id > 0) { print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; + print ' ('.$langs->trans("WrongCustomerCode").')'; } print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2ed56683c02..614bedb8268 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -912,7 +912,7 @@ if ($action == 'create') { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); @@ -1161,7 +1161,7 @@ if ($action == 'create') { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e3d151c6bbb..340ac1dfc8c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -284,7 +284,7 @@ if ($object->fetch($id) >= 0) { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b2cb45e5b1a..81e242c242d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3756,8 +3756,9 @@ if ($action == 'create') { print ''."\n"; print ''."\n"; print ''."\n"; - print ''; - print ''; + // The commented lines below are fields already added as hidden parameters before + //print ''; + //print ''; switch (get_class($objectsrc)) { case 'Propal': diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 7e5a7047060..084d24ebfdb 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -81,6 +81,12 @@ if ($type == 'bank-transfer') { } } +if ($type == 'bank-transfer') { + $usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); +} else { + $usercancreate = $user->rights->facture->creer; +} + /* * Actions @@ -93,7 +99,7 @@ if ($reshook < 0) { } if (empty($reshook)) { - if ($action == "new") { + if ($action == "new" && $usercancreate) { if ($object->id > 0) { $db->begin(); @@ -117,7 +123,7 @@ if (empty($reshook)) { $action = ''; } - if ($action == "delete") { + if ($action == "delete" && $usercancreate) { if ($object->id > 0) { $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); if ($result == 0) { @@ -126,6 +132,83 @@ if (empty($reshook)) { } } } + + // payments conditions + if ($action == 'setconditions' && $usercancreate) { + $object->fetch($id); + $object->cond_reglement_code = 0; // To clean property + $object->cond_reglement_id = 0; // To clean property + + $error = 0; + + $db->begin(); + + if (!$error) { + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); + if ($result < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if (!$error) { + $old_date_echeance = $object->date_echeance; + $new_date_echeance = $object->calculate_date_lim_reglement(); + if ($new_date_echeance > $old_date_echeance) { + $object->date_echeance = $new_date_echeance; + } + if ($object->date_echeance < $object->date) { + $object->date_echeance = $object->date; + } + $result = $object->update($user); + if ($result < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } elseif ($action == 'setmode' && $usercancreate) { + // payment mode + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); + } elseif ($action == 'setdatef' && $usercancreate) { + $newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver'); + if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) { + setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); + } else { + setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); + } + } + + $object->date = $newdate; + $date_echence_calc = $object->calculate_date_lim_reglement(); + if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc) { + $object->date_echeance = $date_echence_calc; + } + if ($object->date_echeance && $object->date_echeance < $object->date) { + $object->date_echeance = $object->date; + } + + $result = $object->update($user); + if ($result < 0) { + dol_print_error($db, $object->error); + } + } elseif ($action == 'setdate_lim_reglement' && $usercancreate) { + $object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int')); + if (!empty($object->date_echeance) && $object->date_echeance < $object->date) { + $object->date_echeance = $object->date; + setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings'); + } + $result = $object->update($user); + if ($result < 0) { + dol_print_error($db, $object->error); + } + } } @@ -206,6 +289,34 @@ if ($object->id > 0) { $head = facture_prepare_head($object); } + $numopen = 0; + $pending = 0; + $numclosed = 0; + + // How many Direct debit or Credit transfer open requests ? + + $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; + $sql .= " , pfd.date_traite as date_traite"; + $sql .= " , pfd.amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + if ($type == 'bank-transfer') { + $sql .= " WHERE fk_facture_fourn = ".((int) $object->id); + } else { + $sql .= " WHERE fk_facture = ".((int) $object->id); + } + $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.ext_payment_id IS NULL"; + $sql .= " ORDER BY pfd.date_demande DESC"; + + $result_sql = $db->query($sql); + if ($result_sql) { + $num = $db->num_rows($result_sql); + $numopen = $num; + } else { + dol_print_error($db); + } + + print dol_get_fiche_head($head, 'standingorders', $title, -1, ($type == 'bank-transfer' ? 'supplier_invoice' : 'bill')); // Invoice content @@ -363,14 +474,14 @@ if ($object->id > 0) { print $langs->trans('DateInvoice'); print ''; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; if ($object->type != $object::TYPE_CREDIT_NOTE) { if ($action == 'editinvoicedate') { - $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate'); + print $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate', 0, 0, 1, $type); } else { print dol_print_date($object->date, 'day'); } @@ -386,13 +497,13 @@ if ($object->id > 0) { print $langs->trans('PaymentConditionsShort'); print ''; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).''; + print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetConditions'), 1).''; } print ''; print ''; if ($object->type != $object::TYPE_CREDIT_NOTE) { if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 0, $type); } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); } @@ -407,7 +518,7 @@ if ($object->id > 0) { print $langs->trans('DateMaxPayment'); print ''; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).''; + print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).''; } print ''; print ''; @@ -418,7 +529,7 @@ if ($object->id > 0) { } if ($action == 'editpaymentterm') { - $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm'); + print $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm', 0, 0, 1, $type); } else { print dol_print_date($duedate, 'day'); if ($object->hasDelay()) { @@ -436,12 +547,16 @@ if ($object->id > 0) { print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).''; + print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetMode'), 1).''; } print ''; print ''; + $filtertype = 'CRDT'; + if ($type == 'bank-transfer') { + $filtertype = 'DBIT'; + } if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', $filtertype, 1, 0, $type); } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } @@ -453,7 +568,7 @@ if ($object->id > 0) { print $langs->trans('BankAccount'); print ''; if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetBankAccount'), 1).''; } print ''; print ''; @@ -481,7 +596,9 @@ if ($object->id > 0) { print img_warning('Error on default bank number for IBAN : '.$bac->error_message); } } else { - print img_warning($langs->trans("NoDefaultIBANFound")); + if ($numopen || ($type != 'bank-transfer' && $object->mode_reglement_code == 'PRE') || ($type == 'bank-transfer' && $object->mode_reglement_code == 'VIR')) { + print img_warning($langs->trans("NoDefaultIBANFound")); + } } print ''; @@ -565,34 +682,6 @@ if ($object->id > 0) { print dol_get_fiche_end(); - $numopen = 0; - $pending = 0; - $numclosed = 0; - - - // How many Direct debit opened requests ? - - $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; - $sql .= " , pfd.date_traite as date_traite"; - $sql .= " , pfd.amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - if ($type == 'bank-transfer') { - $sql .= " WHERE fk_facture_fourn = ".((int) $object->id); - } else { - $sql .= " WHERE fk_facture = ".((int) $object->id); - } - $sql .= " AND pfd.traite = 0"; - $sql .= " AND pfd.ext_payment_id IS NULL"; - $sql .= " ORDER BY pfd.date_demande DESC"; - - $result_sql = $db->query($sql); - if ($result_sql) { - $num = $db->num_rows($result_sql); - $numopen = $num; - } else { - dol_print_error($db); - } - // For which amount ? $sql = "SELECT SUM(pfd.amount) as amount"; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9cb9bca667b..7f3865906c8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -363,7 +363,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU } print ''.price($obj->total_ttc).''; print ''.dol_print_date($db->jdate($obj->tms), 'day').''; - print ''.$facstatic->getLibStatut(3).''; + $alreadypaid = $facstatic->getSommePaiement(); + print ''.$facstatic->getLibStatut(3, $alreadypaid).''; print ''; $total_ht += $obj->total_ht; $total_ttc += $obj->total_ttc; @@ -711,7 +712,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user print "\n"; } - print ''.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).') '; + print ''.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).') '; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print ''.price($tot_ht).''; } diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index eccbf017735..ab6f0f5e574 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -416,10 +416,13 @@ if ($resql) { print ''.$invoice->getLibStatut(5, $alreadypayed).''; print "\n"; - if ($objp->paye == 1) { // If at least one invoice is paid, disable delete + + // If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production + if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) { $disable_delete = 1; $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid")); } + $total = $total + $objp->amount; $i++; } diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 79696d12997..8babb849e7e 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -173,7 +173,7 @@ if ($result > 0) { // Show tree if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (!is_array($records)) { - print ''.$langs->trans("ErrorFailedToReadLDAP").''; + print ''.$langs->trans("ErrorFailedToReadLDAP").''; } else { $result = show_ldap_content($records, 0, $records['count'], true); } diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index a6157d2a26b..e4483258b92 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -129,7 +129,6 @@ if ($action == 'add' && !empty($permissiontoadd)) { if (!$error) { $result = $object->create($user); - var_dump($object);exit; if ($result > 0) { // Creation OK if ($conf->categorie->enabled && method_exists($object, 'setCategories')) { @@ -298,6 +297,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) { } $result = $object->delete($user); + if ($result > 0) { // Delete OK setEventMessages("RecordDeleted", null, 'mesgs'); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 810a23957fd..2a42d4a3d00 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -334,7 +334,7 @@ if ($type == 'directory') { $textifempty = $langs->trans('NoFileFound'); } elseif ($section === '0') { if ($module == 'ecm') { - $textifempty = '
    '.$langs->trans("DirNotSynchronizedSyncFirst").'

    '; + $textifempty = '
    '.$langs->trans("DirNotSynchronizedSyncFirst").'

    '; } else { $textifempty = $langs->trans('NoFileFound'); } @@ -396,9 +396,9 @@ if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) { //$param.=($param?'?':'').(preg_replace('/^&/','',$param)); -if ($useajax || $action == 'delete') { +if ($useajax || $action == 'deletefile') { $urlfile = ''; - if ($action == 'delete') { + if ($action == 'deletefile') { $urlfile = GETPOST('urlfile', 'alpha'); } diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 9a0a11f04d4..d63726dcea6 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -283,7 +283,7 @@ if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_ print ''; print ''; if ($nbofsubdir && $nboffilesinsubdir) { - print '+'.$nboffilesinsubdir.' '; + print '+'.$nboffilesinsubdir.' '; } print ''; @@ -439,7 +439,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, print ''; print ''; if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) { - print '+'.$nboffilesinsubdir.' '; + print '+'.$nboffilesinsubdir.' '; } print ''; diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 6aefc1f2d74..97090895500 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -86,13 +86,23 @@ class box_contacts extends ModeleBoxes $sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail"; $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.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", spe.accountancy_code_customer as code_compta"; + $sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur"; + } else { + $sql .= ", s.code_compta"; + $sql .= ", s.code_compta_fournisseur"; + } $sql .= ", s.logo, s.email, s.entity"; $sql .= ", co.label as country, co.code as country_code"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON sp.fk_pays = co.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); + } if (!$user->rights->societe->client->voir && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 3b6e857b058..c78e5b7dec9 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -88,7 +88,12 @@ class box_factures_imp extends ModeleBoxes if ($user->rights->facture->lire) { $sql = "SELECT 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.client"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", spe.accountancy_code_customer as code_compta"; + } else { + $sql .= ", s.code_compta"; + } $sql .= ", s.logo, s.email, s.entity"; $sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= ", f.ref, f.date_lim_reglement as datelimite"; @@ -100,6 +105,9 @@ class box_factures_imp extends ModeleBoxes $sql .= ", f.paye, f.fk_statut as status, f.rowid as facid"; $sql .= ", sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); + } if (!$user->rights->societe->client->voir && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } @@ -115,7 +123,12 @@ class box_factures_imp extends ModeleBoxes if ($user->socid) { $sql .= " AND s.rowid = ".((int) $user->socid); } - $sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,"; + $sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_customer as code_compta,"; + } else { + $sql .= " s.code_compta,"; + } $sql .= " f.ref, f.date_lim_reglement,"; $sql .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; //$sql.= " ORDER BY f.datef DESC, f.ref DESC "; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 438e9f77389..f0b150f281a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3629,7 +3629,7 @@ abstract class CommonObject public function add_object_linked($origin = null, $origin_id = null, $f_user = null, $notrigger = 0) { // phpcs:enable - global $user; + global $user, $hookmanager, $action; $origin = (!empty($origin) ? $origin : $this->origin); $origin_id = (!empty($origin_id) ? $origin_id : $this->origin_id); $f_user = isset($f_user) ? $f_user : $user; @@ -3647,6 +3647,20 @@ abstract class CommonObject if ($origin == 'supplierorder') { $origin = 'order_supplier'; } + + // Elements of the core modules which have `$module` property but may to which we don't want to prefix module part to the element name for finding the linked object in llx_element_element. + // It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target. + $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization'); + // Add module part to target type if object has $module property and isn't in core modules. + $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; + + $parameters = array('targettype'=>$targettype); + // Hook for explicitly set the targettype if it must be differtent than $this->element + $reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype']; + } + $this->db->begin(); $error = 0; @@ -3659,7 +3673,7 @@ abstract class CommonObject $sql .= ((int) $origin_id); $sql .= ", '" . $this->db->escape($origin) . "'"; $sql .= ", " . ((int) $this->id); - $sql .= ", '" . $this->db->escape($this->element) . "'"; + $sql .= ", '" . $this->db->escape($targettype) . "'"; $sql .= ")"; dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); @@ -3712,7 +3726,7 @@ abstract class CommonObject */ public function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1) { - global $conf; + global $conf, $hookmanager, $action; $this->linkedObjectsIds = array(); $this->linkedObjects = array(); @@ -3722,6 +3736,16 @@ abstract class CommonObject $withtargettype = false; $withsourcetype = false; + $parameters = array('sourcetype'=>$sourcetype, 'sourceid'=>$sourceid, 'targettype'=>$targettype, 'targetid'=>$targetid); + // Hook for explicitly set the targettype if it must be differtent than $this->element + $reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + if (!empty($hookmanager->resArray['sourcetype'])) $sourcetype = $hookmanager->resArray['sourcetype']; + if (!empty($hookmanager->resArray['sourceid'])) $sourceid = $hookmanager->resArray['sourceid']; + if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype']; + if (!empty($hookmanager->resArray['targetid'])) $targetid = $hookmanager->resArray['targetid']; + } + if (!empty($sourceid) && !empty($sourcetype) && empty($targetid)) { $justsource = true; // the source (id and type) is a search criteria if (!empty($targettype)) { @@ -5335,7 +5359,7 @@ abstract class CommonObject $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content $ecmfile->keywords = ''; // keyword content - $ecmfile->src_object_type = $this->table_element.(empty($this->module) ? '' : '@'.$this->module); + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. $ecmfile->src_object_id = $this->id; $result = $ecmfile->create($user); @@ -7819,7 +7843,7 @@ abstract class CommonObject $out .= $labeltoshow; } if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) { - $out .= ' *'; + $out .= ' *'; } } else { if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index e4a91d903df..ac2965668a2 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1519,7 +1519,7 @@ class DolGraph if (empty($conf->dol_optimize_smallscreen)) { return ($defaultsize ? $defaultsize : '500'); } else { - return (empty($_SESSION['dol_screen_width']) ? '280' : ($_SESSION['dol_screen_width'] - 40)); + return (empty($_SESSION['dol_screenwidth']) ? '280' : ($_SESSION['dol_screenwidth'] - 40)); } } if ($direction == 'height') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0cbe27281ce..c4f6fbd14b6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1268,6 +1268,7 @@ class Form $selected_input_value = $societetmp->name; unset($societetmp); } + // mode 1 $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : ''); $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); @@ -1443,6 +1444,10 @@ class Form $label .= ' ('.$obj->name_alias.')'; } + if ($conf->global->SOCIETE_SHOW_VAT_IN_LIST && !empty($obj->tva_intra)) { + $label .= ' - '.$obj->tva_intra.''; + } + if ($showtype) { if ($obj->client || $obj->fournisseur) { $label .= ' ('; @@ -3621,6 +3626,7 @@ class Form $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut $label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; @@ -3875,10 +3881,10 @@ class Form * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. * See instead to force the default value by the caller. * - * @param int $selected Id of payment term to preselect by default - * @param string $htmlname Nom de la zone select - * @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates) - * @param int $addempty Add an empty entry + * @param int $selected Id of payment term to preselect by default + * @param string $htmlname Nom de la zone select + * @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates) + * @param int $addempty Add an empty entry * @param int $noinfoadmin 0=Add admin info, 1=Disable admin info * @param string $morecss Add more CSS on select tag * @param float $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters) @@ -3904,20 +3910,17 @@ class Form if ($addempty) { print ''; } - $selectedDepositPercent = null; foreach ($this->cache_conditions_paiements as $id => $arrayconditions) { if ($filtertype <= 0 && ! empty($arrayconditions['deposit_percent'])) { continue; } - if ($selected == $id) { $selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent']; print ''; } print ''; @@ -3933,7 +3935,6 @@ class Form print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } print ajax_combobox($htmlname); - if ($deposit_percent >= 0) { print '