diff --git a/README-FR.md b/README-FR.md index 81fdff13047..a67bf204076 100644 --- a/README-FR.md +++ b/README-FR.md @@ -8,12 +8,10 @@ Il est simple d'utilisation et modulaire, vous permettant de n'activez que les f ![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg) - ## LICENCE Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure. - ## INSTALLER DOLIBARR ### Configuration simple @@ -54,7 +52,6 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg - Suivez les instructions de l'installateur - ## METTRE A JOUR DOLIBARR Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: @@ -65,14 +62,12 @@ Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: - Au prochain accès, Dolibarr proposera la page de "mise à jour" des données (si nécessaire). Si un fichier install.lock existe pour verrouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transférés sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents") -*Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/* - +Note: *Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/* ## CE QUI EST NOUVEAU See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. - ## CE QUE DOLIBARR PEUT FAIRE ### Modules principaux (tous optionnels) @@ -122,7 +117,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Peux être multi-société par ajout du module externe multi-société. - Plusieurs thèmes visuels. - Application simple à utiliser. -- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur https://wiki.dolibarr.org/index.php/Prérequis). +- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur [https://wiki.dolibarr.org/index.php/Prérequis](https://wiki.dolibarr.org/index.php/Prérequis)). - Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP. - APIs. - Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...) @@ -142,7 +137,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com). - ## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE Voici un liste de fonctionnalités pas encore gérées par Dolibarr: @@ -152,18 +146,15 @@ Voici un liste de fonctionnalités pas encore gérées par Dolibarr: - Dolibarr n'embarque pas de Webmail intégré nativement. - Dolibarr ne fait pas le café (pas encore). - ## DOCUMENTATION La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org). - ## CONTRIBUER Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]. - - +[![Dolibarr](https://opencollective.com/dolibarr/contributors.svg?width=890&button=false)](https://github.com/Dolibarr/dolibarr/graphs/contributors) ## CREDITS @@ -171,7 +162,6 @@ Dolibarr est le résultat du travail de nombreux contributeurs depuis des année Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) - ## ACTUALITES ET RESEAUX SOCIAUX Suivez le projet Dolibarr project sur les réseaux francophones diff --git a/README.md b/README.md index 54fdf1e958b..b0f7a2c3761 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ You can use a web server and a supported database (MariaDB, MySQL or PostgreSQL) On GNU/Linux, first check if your distribution has already packaged Dolibarr. -#### Generic install steps: +#### Generic install steps - Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases). @@ -71,86 +71,87 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr. - Follow the installer instructions - ### Saas/Cloud setup -If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free. - +If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See [https://saas.dolibarr.org](https://saas.dolibarr.org)). However, this third solution is not free. ## UPGRADING Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! - + - At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). - ## WHAT'S NEW See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. - ## FEATURES ### Main application/modules (all optional) -- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts -- Members/Membership/Foundation management +- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts +- Members/Membership/Foundation management - Product Management -- Products and/or Services catalog -- Stock / Warehouse management + Inventory -- Barcodes -- Batches / Lots / Serials -- Product Variants + Product Management + +- Products and/or Services catalog +- Stock / Warehouse management + Inventory +- Barcodes +- Batches / Lots / Serials +- Product Variants - Bill of Materials (BOM) -- Manufacturing Orders +- Manufacturing Orders - Customer/Sales Management -- Customers/Prospects + Contacts management -- Opportunities or Leads management -- Commercial proposals management -- Customer Orders management -- Contracts/Subscription management -- Interventions management -- Ticket System -- Shipping management -- Customer Invoices/Credit notes and payment management -- Point of Sale (POS) + Customer/Sales Management - Supplier/Purchase Management -- Suppliers/Vendors + Contacts -- Supplier (price) requests -- Purchase Orders management -- Delivery/Receiption -- Supplier Invoices/credit notes and payment management -- INCOTERMS +- Customers/Prospects + Contacts management +- Opportunities or Leads management +- Commercial proposals management +- Customer Orders management +- Contracts/Subscription management +- Interventions management +- Ticket System +- Shipping management +- Customer Invoices/Credit notes and payment management +- Point of Sale (POS) - Finance / Accounting -- Invoices / Payments -- Bank accounts management -- Direct debit orders management (European SEPA) -- Accounting management -- Donations management -- Loan management -- Margins -- Reports + Supplier/Purchase Management - Collaboration -- Shared calendar/agenda (with ical and vcal export for third party tools integration) -- Projects & Tasks management -- Ticket System +- Suppliers/Vendors + Contacts +- Supplier (price) requests +- Purchase Orders management +- Delivery/Receiption +- Supplier Invoices/credit notes and payment management +- INCOTERMS + + Finance / Accounting + +- Invoices / Payments +- Bank accounts management +- Direct debit orders management (European SEPA) +- Accounting management +- Donations management +- Loan management +- Margins +- Reports + + Collaboration + +- Shared calendar/agenda (with ical and vcal export for third party tools integration) +- Projects & Tasks management +- Ticket System - Surveys - HR -- Employee's leave requests management -- Expense reports -- Recruitment management -- Timesheets + HR +- Employee's leave requests management +- Expense reports +- Recruitment management +- Timesheets ### Other application/modules @@ -171,7 +172,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) (around 100 modules available by default, 1000+ on the addon market place) - ### Other general features - Localization in most major languages @@ -190,27 +190,24 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Canadian double taxes (federal/province) and other countries using cumulative VAT - Tunisian tax stamp - Argentina invoice numbering using A,B,C... - - Compatible with [European directives] (https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) + - Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) - Compatible with European GDPR rules - ... - Flexible PDF & ODT generation for invoices, proposals, orders... - ... - ### System Environment / Requirements - PHP -- MariaDB, MySQL or PostgreSQL +- MariaDB, MySQL or PostgreSQL - Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites. See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite) - ### Extending Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com). - ## WHAT DOLIBARR CAN'T DO YET These are features that Dolibarr does **not** yet fully support: @@ -220,21 +217,18 @@ These are features that Dolibarr does **not** yet fully support: - No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc. - Dolibarr can't do coffee (yet) - ## DOCUMENTATION Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org). - ## CONTRIBUTING -This project exists thanks to all the people who contribute. +This project exists thanks to all the people who contribute. Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)] A view on Contributors: - - +[![Dolibarr](https://opencollective.com/dolibarr/contributors.svg?width=890&button=false)](https://github.com/Dolibarr/dolibarr/graphs/contributors) ## CREDITS @@ -242,7 +236,6 @@ Dolibarr is the work of many contributors over the years and uses some fine PHP See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file. - ## NEWS AND SOCIAL NETWORKS Follow Dolibarr project on: @@ -253,8 +246,6 @@ Follow Dolibarr project on: - [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [GitHub](https://github.com/Dolibarr/dolibarr) - ### Sponsors Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)] - diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index cce6351950c..7ce22e790c3 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -168,6 +168,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php - protected $default_monospaced_font = 'courier'; + protected $default_monospaced_font = 'freemono'; +* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning + of the function, replace: + + $roman = ''; + +with: + + $roman = ''; + if ($number >= 4000) { + // do not represent numbers above 4000 in Roman numerals + return strval($number); + } diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index d98357bc93c..e7616ededf3 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -199,7 +199,7 @@ if ($action == 'update') { $nb_exists = $db->num_rows($resql_exists); if ($nb_exists <= 0) { // insert - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')"; + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")"; $sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')"; } else { $obj_exists = $db->fetch_object($resql_exists); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 0dca0d86193..5967d670856 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -59,7 +59,7 @@ $permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the i $hookmanager->initHooks(array('subscriptioncard', 'globalcard')); // Security check -$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id +$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id /* diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 8060398574c..1cce5388f90 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -83,26 +83,26 @@ if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); $defaultValues = new DefaultValues($db); - $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); - if (!is_array($result) && $result<0) { + $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); + if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); - } elseif (count($result)>0) { + } elseif (count($result) > 0) { foreach ($result as $defval) { - $defaultValues->id=$defval->id; + $defaultValues->id = $defval->id; $resultDel = $defaultValues->delete($user); - if ($resultDel<0) { + if ($resultDel < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } } } - $defaultValues->type='createform'; - $defaultValues->entity=$conf->entity; - $defaultValues->user_id=0; - $defaultValues->page='comm/action/card.php'; - $defaultValues->param='complete'; - $defaultValues->value=GETPOST('AGENDA_EVENT_DEFAULT_STATUS'); - $resultCreat=$defaultValues->create($user); - if ($resultCreat<0) { + $defaultValues->type = 'createform'; + $defaultValues->entity = $conf->entity; + $defaultValues->user_id = 0; + $defaultValues->page = 'comm/action/card.php'; + $defaultValues->param = 'complete'; + $defaultValues->value = GETPOST('AGENDA_EVENT_DEFAULT_STATUS'); + $resultCreat = $defaultValues->create($user); + if ($resultCreat < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } } elseif ($action == 'specimen') { // For orders @@ -355,13 +355,13 @@ print ''."\n"; print ''.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").''."\n"; print ' '."\n"; print ''."\n"; -$defval='na'; +$defval = 'na'; $defaultValues = new DefaultValues($db); -$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); -if (!is_array($result) && $result<0) { +$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); +if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); -} elseif (count($result)>0) { - $defval=reset($result)->value; +} elseif (count($result) > 0) { + $defval = reset($result)->value; } $formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200'); print ''."\n"; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 5e7a229fee3..25446dbed4d 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -307,7 +307,7 @@ class Dolistore } } else { //need update - $version = ''.$langs->trans( + $version = ''.$langs->trans( 'CompatibleAfterUpdate', DOL_VERSION, $product->dolibarr_min, diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 6246f9c09c3..74c46112241 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -237,7 +237,7 @@ if (empty($mysoc->country_code)) { $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)"; + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')"; $sql .= " ORDER BY t.taux ASC"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 9c5418ac19d..1283c5698d3 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -829,23 +829,23 @@ if ($action == 'edit') { if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) { // List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com' - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD); + $text .= ($text ? '

' : '').''.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD); } else { // MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'. if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) { // List of IP show as record to add in SPF if we use the mail method - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); + $text .= ($text ? '

' : '').''.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); } } } else { if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) { // List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]' // TODO Add a key to allow to show the IP/name of server detected dynamically - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); + $text .= ($text ? '

' : '').''.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); } if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server. // List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com' - $text .= ($text ? '

' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD); + $text .= ($text ? '

' : '').''.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD); } } diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index e09dd13b045..207642fe8e3 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -102,11 +102,11 @@ if ($action == "set") { } $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity); - if (! ($res > 0)) { + if (!($res > 0)) { $error++; } - if (! $error) { + if (!$error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 5c9b863ba32..e8f59727c07 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE); } +print ""; +print "\n"; print ''; print ''.$langs->trans("WarehouseAskWarehouseDuringPropal").''; @@ -693,6 +695,9 @@ if ($conf->use_javascript_ajax) { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL); } +print ""; +print "\n"; + print ''; print ''.$langs->trans("WarehouseAskWarehouseDuringOrder").''; print ''; @@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER); } -print ""; print ''; print "\n"; +/* +print ''; +print ''.$langs->trans("WarehouseAskWarehouseDuringProject").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT); +} +print ''; +print "\n"; +*/ + print ''; print ''; print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 613c8853297..646f4a7be74 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -270,7 +270,7 @@ print ''; echo '
'; echo ''; echo ''; -echo ''; +echo ''; echo ''; echo ''; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 4dd2fbad58e..c8a2a02498c 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -90,7 +90,7 @@ $_SESSION["commandbackuptorun"] = ''; $_SESSION["commandbackupresult"] = ''; // Increase limit of time. Works only if we are not in safe mode -$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit +$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit if (!empty($ExecTimeLimit)) { $err = error_reporting(); error_reporting(0); // Disable all errors diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 83241f2a9e2..e89cbb2fd41 100755 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -26,8 +26,8 @@ require "../main.inc.php"; // Libraries -require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php'; //require_once "../class/myclass.class.php"; // Translations diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index f10c7b10b48..3cd8d3e0774 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -497,11 +497,11 @@ class Documents extends DolibarrApi throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.'); } else { if (($object->id) > 0 && !empty($modulepart)) { - require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; + require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; $ecmfile = new EcmFiles($this->db); $result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id)); if ($result < 0) { - throw new RestException(503, 'Error when retrieve ecm list : ' . $this->db->lasterror()); + throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror()); } elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) { $filearray['ecmfiles_infos'] = $ecmfile->lines; } diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 524b92a080e..35c0ffcff88 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -316,8 +316,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $filename = dol_sanitizeFileName($object->ref); $filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 2cb4d972493..6bfd655b62d 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -25,7 +25,7 @@ if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token. if (!defined('NOTOKENRENEWAL')) { - define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) + define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) } } @@ -277,10 +277,10 @@ dol_htmloutput_errors($mesg); //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'
'; //print '
'; -print ''; // The target is for brothers that open the file instead of downloading it +print ''; // The target is for brothers that open the file instead of downloading it print ''; print ''; -print ''; // The page will not renew the token but force download of a file, so we must use here currentToken +print ''; // The page will not renew the token but force download of a file, so we must use here currentToken print '
'; diff --git a/htdocs/bom/ajax/interface.php b/htdocs/bom/ajax/interface.php deleted file mode 100644 index 23b208e25ba..00000000000 --- a/htdocs/bom/ajax/interface.php +++ /dev/null @@ -1,28 +0,0 @@ -'. (int) $current_bom_id; - $resql = $db->query($sql); - if ($resql && $db->num_rows($resql) > 0) { - $options = array(); - $cpt=0; - while ($obj = $db->fetch_object($resql)) { - $options[$obj->rowid] = $obj->ref.' - '.$obj->label; - $cpt++; - } - print json_encode($options); - } - - break; -} diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 5e86611507b..31ad955afdb 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -243,6 +243,7 @@ if (empty($reshook)) { } + /* * View */ @@ -573,38 +574,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
' . $langs->trans('Parameter') . '' . $langs->trans('Value') . '
'.$langs->trans('Parameter').''.$langs->trans('Value').'
'; } - ?> - - '; print "\n"; @@ -612,9 +581,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea '."\n"; @@ -965,8 +964,8 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s // We are in a particular day for $username, now we scan all events foreach ($eventarray as $daykey => $notused) { $annee = dol_print_date($daykey, '%Y'); - $mois = dol_print_date($daykey, '%m'); - $jour = dol_print_date($daykey, '%d'); + $mois = dol_print_date($daykey, '%m'); + $jour = dol_print_date($daykey, '%d'); if ($day == $jour && $month == $mois && $year == $annee) { // Is it the day we are looking for when calling function ? // Scan all event for this date diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 0148170d316..de9c979c0fb 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -387,7 +387,6 @@ if ($conf->use_javascript_ajax) { $s .= 'jQuery(".family_birthday").toggle();'."\n"; if ($action == "show_week" || $action == "show_month" || empty($action)) { $s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {'; - $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n"; } $s .= '});'."\n"; $s .= ''."\n"; @@ -802,7 +801,7 @@ $currentdaytoshow = $firstdaytoshow; echo '
'; while ($currentdaytoshow < $lastdaytoshow) { - echo ''; + echo '
'; echo ''; echo ''; print ''; - print ''; + print ''; print ''; } @@ -1095,8 +1097,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print ''; print ''; + print ''; + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty); + print ''; print ''; } @@ -1323,7 +1327,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - print ''; + print ''; } print ''; } -if (!empty($arrayfields['p.no_email']['checked'])) { +if (!empty($arrayfields['unsubscribed']['checked'])) { print ''; @@ -965,8 +977,8 @@ if (!empty($arrayfields['p.fax']['checked'])) { if (!empty($arrayfields['p.email']['checked'])) { print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); } -if (!empty($arrayfields['p.no_email']['checked'])) { - print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['unsubscribed']['checked'])) { + print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center '); } if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -1156,8 +1168,14 @@ while ($i < min($num, $limit)) { } } // No EMail - if (!empty($arrayfields['p.no_email']['checked'])) { - print ''; + if (!empty($arrayfields['unsubscribed']['checked'])) { + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 60136fe0dc7..eeeccddd671 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -194,9 +194,10 @@ if ($id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index f30ff3ead4c..31405545dbb 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -505,8 +505,8 @@ if (empty($reshook)) { $desc = $prod->description; //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time - if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { - $product_desc=''; + if ($product_desc == $desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { + $product_desc = ''; } if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) { @@ -1335,9 +1335,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 793273c833f..fe8edd30ea4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1729,85 +1729,77 @@ class Contrat extends CommonObject } } - $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'"; - $sql .= ",price_ht='".price2num($price)."'"; - $sql .= ",subprice='".price2num($subprice)."'"; - $sql .= ",remise='".price2num($remise)."'"; - $sql .= ",remise_percent='".price2num($remise_percent)."'"; - $sql .= ",qty='".$qty."'"; - $sql .= ",tva_tx='".price2num($tvatx)."'"; - $sql .= ",localtax1_tx='".price2num($localtax1tx)."'"; - $sql .= ",localtax2_tx='".price2num($localtax2tx)."'"; - $sql .= ",localtax1_type='".$this->db->escape($localtax1_type)."'"; - $sql .= ",localtax2_type='".$this->db->escape($localtax2_type)."'"; - $sql .= ", total_ht='".price2num($total_ht)."'"; - $sql .= ", total_tva='".price2num($total_tva)."'"; - $sql .= ", total_localtax1='".price2num($total_localtax1)."'"; - $sql .= ", total_localtax2='".price2num($total_localtax2)."'"; - $sql .= ", total_ttc='".price2num($total_ttc)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description = '".$this->db->escape($desc)."'"; + $sql .= ",price_ht = ".((float) price2num($price)); + $sql .= ",subprice = ".((float) price2num($subprice)); + $sql .= ",remise = ".((float) price2num($remise)); + $sql .= ",remise_percent = ".((float) price2num($remise_percent)); + $sql .= ",qty = ".((float) $qty); + $sql .= ",tva_tx = ".((float) price2num($tvatx)); + $sql .= ",localtax1_tx = ".((float) price2num($localtax1tx)); + $sql .= ",localtax2_tx = ".((float) price2num($localtax2tx)); + $sql .= ",localtax1_type='".$this->db->escape($localtax1_type); + $sql .= ",localtax2_type='".$this->db->escape($localtax2_type); + $sql .= ", total_ht = ".((float) price2num($total_ht)); + $sql .= ", total_tva = ".((float) price2num($total_tva)); + $sql .= ", total_localtax1 = ".((float) price2num($total_localtax1)); + $sql .= ", total_localtax2 = ".((float) price2num($total_localtax2)); + $sql .= ", total_ttc = ".((float) price2num($total_ttc)); $sql .= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null"); - $sql .= ", buy_price_ht='".price2num($pa_ht)."'"; + $sql .= ", buy_price_ht = ".((float) price2num($pa_ht)); if ($date_start > 0) { - $sql .= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; + $sql .= ",date_ouverture_prevue = '".$this->db->idate($date_start)."'"; } else { - $sql .= ",date_ouverture_prevue=null"; + $sql .= ",date_ouverture_prevue = null"; } if ($date_end > 0) { - $sql .= ",date_fin_validite='".$this->db->idate($date_end)."'"; + $sql .= ",date_fin_validite = '".$this->db->idate($date_end)."'"; } else { - $sql .= ",date_fin_validite=null"; + $sql .= ",date_fin_validite = null"; } if ($date_debut_reel > 0) { - $sql .= ",date_ouverture='".$this->db->idate($date_debut_reel)."'"; + $sql .= ",date_ouverture = '".$this->db->idate($date_debut_reel)."'"; } else { - $sql .= ",date_ouverture=null"; + $sql .= ",date_ouverture = null"; } if ($date_fin_reel > 0) { - $sql .= ",date_cloture='".$this->db->idate($date_fin_reel)."'"; + $sql .= ",date_cloture = '".$this->db->idate($date_fin_reel)."'"; } else { - $sql .= ",date_cloture=null"; + $sql .= ",date_cloture = null"; } - $sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null"); + $sql .= ", fk_unit = ".($fk_unit > 0 ? ((int) $fk_unit) : "null"); $sql .= " WHERE rowid = ".((int) $rowid); dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - $result = $this->update_statut($user); - if ($result >= 0) { - if (is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used - $contractline = new ContratLigne($this->db); - $contractline->fetch($rowid); - $contractline->fetch_optionals(); + if (is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used + $contractline = new ContratLigne($this->db); + $contractline->fetch($rowid); - // We replace values in $contractline->array_options only for entries defined into $array_options - foreach ($array_options as $key => $value) { - $contractline->array_options[$key] = $array_options[$key]; - } - - $result = $contractline->insertExtraFields(); - if ($result < 0) { - $this->error[] = $contractline->error; - $error++; - } + // We replace values in $contractline->array_options only for entries defined into $array_options + foreach ($array_options as $key => $value) { + $contractline->array_options[$key] = $array_options[$key]; } - if (empty($error)) { - // Call trigger - $result = $this->call_trigger('LINECONTRACT_UPDATE', $user); - if ($result < 0) { - $this->db->rollback(); - return -3; - } - // End call triggers - - $this->db->commit(); - return 1; + $result = $contractline->insertExtraFields(); + if ($result < 0) { + $this->error[] = $contractline->error; + $error++; } - } else { - $this->db->rollback(); - dol_syslog(get_class($this)."::updateline Erreur -2"); - return -2; + } + + if (empty($error)) { + // Call trigger + $result = $this->call_trigger('LINECONTRACT_UPDATE', $user); + if ($result < 0) { + $this->db->rollback(); + return -3; + } + // End call triggers + + $this->db->commit(); + return 1; } } else { $this->db->rollback(); diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 9b016e92b19..d053a9a4fa0 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -177,9 +177,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index c54823ee142..b4cf2fc1fbf 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -167,9 +167,10 @@ if ($object->id) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 50f84a148a4..01378a65786 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -134,9 +134,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index f46c1051c53..63b4b3f7fc6 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -218,8 +218,8 @@ if ($type == 'directory') { $parameters = array('modulepart'=>$module); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); - if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0) { - $automodules[]=$hookmanager->resArray['module']; + if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { + $automodules[] = $hookmanager->resArray['module']; } // TODO change for multicompany sharing diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 52cc23faf8f..0b1106ca20a 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -99,7 +99,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { $perm = 1; - } elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && !empty($user->rights->produit->creer)) { + } elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) { $perm = 1; } elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) { $perm = 1; diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php index 05ae866463f..46c4b38988e 100644 --- a/htdocs/core/bookmarks_page.php +++ b/htdocs/core/bookmarks_page.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/bookmarks_page.php - * \brief File to return a page with the complete list of bookmarks (all search input fields) + * \brief File to return a page with the complete list of bookmarks */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language @@ -45,7 +45,7 @@ if (GETPOST('lang', 'aZ09')) { $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php } -$langs->load("main"); +$langs->loadLangs(array("bookmarks")); $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); @@ -57,7 +57,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); $title = $langs->trans("Bookmarks"); -// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests +// URL http://mydolibarr/core/bookmarks_page?dol_use_jmobile=1 can be used for tests $head = ''."\n"; $arrayofjs = array(); $arrayofcss = array(); @@ -69,44 +69,58 @@ print ''."\n"; print '
'; //print '
'; -$nbofsearch = 0; - // Instantiate hooks of thirdparty module $hookmanager->initHooks(array('bookmarks')); // Define $bookmarks -$bookmarks = ''; +$bookmarkList = ''; +$searchForm = ''; -$arrayresult = array(); -//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; +if (empty($conf->bookmarks->enabled)) { + $langs->load("admin"); + $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).''; + $bookmarkList .= '

'; +} else { + // Menu with list of bookmarks + $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; + $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)"; + $sql .= " AND entity IN (".getEntity('bookmarks').")"; + $sql .= " ORDER BY position"; + if ($resql = $db->query($sql)) { + $bookmarkList = ''; + + + $searchForm .= ''; + } else { + dol_print_error($db); } - - //$bookmarks .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, $val['img'], $showtitlebefore, ($i > 0 ? 0 : 1)); - - $i++; } - -// Execute hook printSearchForm -$parameters = array('bookmarks'=>$bookmarks); +// Execute hook printBookmarks +$parameters = array('bookmarks'=>$bookmarkList); $reshook = $hookmanager->executeHooks('printBookmarks', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - $bookmarks .= $hookmanager->resPrint; + $bookmarkList .= $hookmanager->resPrint; } else { - $bookmarks = $hookmanager->resPrint; + $bookmarkList = $hookmanager->resPrint; } @@ -115,7 +129,7 @@ print "\n"; print '
'; print ''; print '
'."\n"; -print $bookmarks; +print $bookmarkList; print '
'."\n"; print '
'; print "\n\n"; diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index 4077b04c6d9..22fafb4633c 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -35,7 +35,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes public $boxcode = "customersoutstandingbillreached"; public $boximg = "object_company"; public $boxlabel = "BoxCustomersOutstandingBillReached"; - public $depends = array("facture","societe"); + public $depends = array("facture", "societe"); /** * @var DoliDB Database handler. diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index 28c3b22788d..fd89e732937 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -24,7 +24,7 @@ * \ingroup projet * \brief Module to show the funnel of prospection */ -include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php"; +include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; /** * Class to manage the box to show last projet @@ -91,8 +91,8 @@ class box_funnel_of_prospection extends ModeleBoxes $badgeStatus7 = '#baa32b'; $badgeStatus8 = '#993013'; $badgeStatus9 = '#e7f0f0'; - if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php')) { - include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php'; + if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) { + include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; } $listofoppstatus = array(); $listofopplabel = array(); @@ -100,7 +100,7 @@ class box_funnel_of_prospection extends ModeleBoxes $colorseriesstat = array(); $bordercolorseries = array(); $sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label"; - $sql .= " FROM " . MAIN_DB_PREFIX . "c_lead_status as cls"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= " WHERE active=1"; $sql .= " AND cls.code <> 'LOST'"; $sql .= $this->db->order('cls.rowid', 'ASC'); @@ -148,14 +148,14 @@ class box_funnel_of_prospection extends ModeleBoxes $this->max = $max; $this->info_box_head = array( - 'text' => $langs->trans("Statistics") . ' - ' . $langs->trans("BoxTitleFunnelOfProspection"), + 'text' => $langs->trans("Statistics").' - '.$langs->trans("BoxTitleFunnelOfProspection"), 'graph' => '1' ); if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p, " . MAIN_DB_PREFIX . "c_lead_status as cls"; - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; + $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_opp_status = cls.rowid"; $sql .= " AND p.fk_statut = 1"; // Opend projects only $sql .= " AND cls.code NOT IN ('LOST')"; @@ -200,14 +200,14 @@ class box_funnel_of_prospection extends ModeleBoxes $liststatus = array(); $data = array(''); $customlabels = array(); - $total=0; + $total = 0; foreach ($listofstatus as $status) { $customlabel = ''; $labelStatus = ''; if ($status != 7) { $code = dol_getIdFromCode($this->db, $status, 'c_lead_status', 'rowid', 'code'); if ($code) { - $labelStatus = $langs->transnoentitiesnoconv("OppStatus" . $code); + $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code); } if (empty($labelStatus)) { $labelStatus = $listofopplabel[$status]; @@ -218,16 +218,16 @@ class box_funnel_of_prospection extends ModeleBoxes $liststatus[] = $labelStatus; if (!$conf->use_javascript_ajax) { $stringtoprint .= '
'; - $stringtoprint .= ''; - $stringtoprint .= ''; + $stringtoprint .= ''; + $stringtoprint .= ''; $stringtoprint .= "\n"; } } - $customlabels[]=$customlabel; + $customlabels[] = $customlabel; } $dataseries[] = $data; if ($conf->use_javascript_ajax) { - include_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetMinValue(0); $dolgraph->SetData($dataseries); @@ -273,7 +273,7 @@ class box_funnel_of_prospection extends ModeleBoxes 'tr' => 'class="oddeven"', 'td' => 'class="left "', 'maxlength' => 500, - 'text' => $langs->trans("OpportunityTotalAmount") . ' (' . $langs->trans("WonLostExcluded") . ')' + 'text' => $langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')' ); $this->info_box_contents[$line][] = array( 'tr' => 'class="oddeven"', @@ -286,7 +286,7 @@ class box_funnel_of_prospection extends ModeleBoxes 'tr' => 'class="oddeven"', 'td' => 'class="left "', 'maxlength' => 500, - 'text' => $form->textwithpicto($langs->trans("OpportunityPonderatedAmount") . ' (' . $langs->trans("WonLostExcluded") . ')', $langs->trans("OpportunityPonderatedAmountDesc"), 1) + 'text' => $form->textwithpicto($langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')', $langs->trans("OpportunityPonderatedAmountDesc"), 1) ); $this->info_box_contents[$line][] = array( diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php index 83acae25b45..1c0e7a6e3ff 100644 --- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php +++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php @@ -80,8 +80,8 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes $badgeStatus7 = '#baa32b'; $badgeStatus8 = '#993013'; $badgeStatus9 = '#e7f0f0'; - if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php')) { - include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php'; + if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) { + include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; } $this->max = $max; @@ -97,22 +97,22 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes $days = 7; } require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; - $text = $langs->trans("BoxTicketLastXDays", $days).' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_last_days" class="linkobject"'); + $text = $langs->trans("BoxTicketLastXDays", $days).' '.img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_last_days" class="linkobject"'); $this->info_box_head = array( 'text' => $text, 'limit' => dol_strlen($text) ); $today = date_time_set(date_create(), 0, 0); $todayformat = date('Y-m-d', date_timestamp_get($today)); - $intervaltosub = new DateInterval('P' . dol_escape_htmltag($days - 1) . 'D'); + $intervaltosub = new DateInterval('P'.dol_escape_htmltag($days - 1).'D'); $intervaltoadd = new DateInterval('P1D'); $minimumdatec = date_sub($today, $intervaltosub); $minimumdatecformated = date('Y-m-d', date_timestamp_get($minimumdatec)); if ($user->rights->ticket->read) { $sql = "SELECT CAST(t.datec AS DATE) as datec, COUNT(t.datec) as nb"; - $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; - $sql .= " WHERE CAST(t.datec AS DATE) > DATE_SUB(CURRENT_DATE, INTERVAL " . $days . " DAY)"; + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; + $sql .= " WHERE CAST(t.datec AS DATE) > DATE_SUB(CURRENT_DATE, INTERVAL ".$days." DAY)"; $sql .= " GROUP BY CAST(t.datec AS DATE)"; $resql = $this->db->query($sql); if ($resql) { @@ -148,12 +148,12 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes }); '; $stringtoshow .= '
'; // hideobject is to start hidden - $stringtoshow .= '
'; - $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= ''; - $stringtoshow .= ' ' . $langs->trans("Days"); - $stringtoshow .= ''; + $stringtoshow .= ' '.$langs->trans("Days"); + $stringtoshow .= ''; $stringtoshow .= ''; $stringtoshow .= '
'; @@ -181,21 +181,21 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes $px1->mode = 'depth'; $px1->draw('idgraphticketlastxdays'); - $graphtoshow= $px1->show($totalnb ? 0 : 1); + $graphtoshow = $px1->show($totalnb ? 0 : 1); } if ($totalnb) { $stringtoshow .= $graphtoshow; } $stringtoshow .= ''; if ($totalnb) { - $this->info_box_contents[][]=array( + $this->info_box_contents[][] = array( 'td' => 'center', 'text' => $stringtoshow ); } else { $this->info_box_contents[0][0] = array( 'td' => 'class="center opacitymedium"', - 'text' => $stringtoshow . $langs->trans("BoxNoTicketLastXDays", $days) + 'text' => $stringtoshow.$langs->trans("BoxNoTicketLastXDays", $days) ); } } else { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 3b98d3f3356..c7a5beae245 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -970,8 +970,8 @@ abstract class CommonInvoiceLine extends CommonObjectLine public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation public $buy_price_ht; - public $buyprice; // For backward compatibility - public $pa_ht; // For backward compatibility + public $buyprice; // For backward compatibility + public $pa_ht; // For backward compatibility public $marge_tx; public $marque_tx; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c68cc9c7d84..91446f38070 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1851,7 +1851,7 @@ abstract class CommonObject $result = false; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table; - $sql .= " WHERE ".$field." = '".$key."'"; + $sql .= " WHERE ".$field." = '".$this->db->escape($key)."'"; if (!empty($element)) { $sql .= " AND entity IN (".getEntity($element).")"; } else { diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index ad69982357c..f6edb58207c 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -88,7 +88,7 @@ class DefaultValues extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), 'type' =>array('type'=>'varchar(10)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>20), @@ -145,8 +145,12 @@ class DefaultValues extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { + $this->fields['rowid']['visible'] = 0; + } + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) { + $this->fields['entity']['enabled'] = 0; + } // Unset fields that are disabled foreach ($this->fields as $key => $val) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 68bba0e04b5..56f7c41994b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -193,12 +193,12 @@ class Form * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') - * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value + * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @param string $moreparam More param to add on the form action href URL * @param int $notabletag Do no output table tags - * @param string $formatfunc Call a specific function to output field + * @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email') * @param string $paramid Key of parameter for id ('id', 'socid') * @return string HTML edit field */ @@ -214,7 +214,7 @@ class Form } // When option to edit inline is activated - if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select + if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select $ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); } else { $editmode = (GETPOST('action', 'aZ09') == 'edit'.$htmlname); @@ -236,7 +236,7 @@ class Form } elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { $tmp = explode(':', $typeofdata); $valuetoshow = price2num($editvalue ? $editvalue : $value); - $ret .= ''; + $ret .= ''; } elseif (preg_match('/^(checkbox)/', $typeofdata)) { $tmp = explode(':', $typeofdata); $ret .= ''; @@ -5088,8 +5088,7 @@ class Form if ($selected) { $projet = new Project($this->db); $projet->fetch($selected); - //print ''.$projet->title.''; - $out .= $projet->getNomUrl(0, '', 1); + $out .= $projet->getNomUrl(1, '', 1); } else { $out .= " "; } @@ -8679,7 +8678,7 @@ class Form */ public function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $morehtmlright = '') { - global $langs, $conf, $hookmanager, $extralanguages; + global $conf, $langs, $hookmanager, $extralanguages; $ret = ''; if (empty($fieldid)) { @@ -8691,7 +8690,7 @@ class Form // Preparing gender's display if there is one $addgendertxt = ''; - if (!empty($object->gender)) { + if (property_exists($object, 'gender') && !empty($object->gender)) { $addgendertxt = ' '; switch ($object->gender) { case 'man': @@ -8705,6 +8704,15 @@ class Form break; } } + /* + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + }*/ // Add where from hooks if (is_object($hookmanager)) { @@ -8837,7 +8845,7 @@ class Form $ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); } } elseif (in_array($object->element, array('contact', 'user', 'usergroup'))) { - $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt; + $ret .= dol_htmlentities($object->getFullName($langs)); } elseif (in_array($object->element, array('action', 'agenda'))) { $ret .= $object->ref.'
'.$object->label; } elseif (in_array($object->element, array('adherent_type'))) { @@ -9085,7 +9093,7 @@ class Form } $ret .= '
'; @@ -829,7 +828,7 @@ while ($currentdaytoshow < $lastdaytoshow) { // Filter on days print img_picto('', 'clock', 'class="fawidth30 inline-block paddingleft"'); print ''.$langs->trans("DaysOfWeek").''; - print "\n".'
'; + print "\n".'
'; print ''; if (empty($conf->dol_use_jmobile)) { print ' - '; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 222f6ab8a87..c046281f18e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2014,14 +2014,14 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project if (!empty($conf->projet->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'.$langs->trans('Project').''; if ($usercancreate) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; @@ -2041,9 +2041,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ': '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 69876476907..fedf6a6233d 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -166,9 +166,10 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index e1e9eec4ee4..1135dfcf0c2 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -159,9 +159,10 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 5a8d2b2294c..dc43af9ceff 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -106,9 +106,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3535ae0cde1..1ccbd22d511 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1383,10 +1383,24 @@ if ($resql) { if (!empty($arrayfields['sale_representative']['checked'])) { print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); } + $totalarray = array( + 'nbfield' => 0, + 'val' => array( + 'p.total_ht' => 0, + 'p.total_tva' => 0, + 'p.total_ttc' => 0, + ), + ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, + ); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { @@ -1412,12 +1426,6 @@ if ($resql) { $now = dol_now(); $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val'] = array(); - $totalarray['val']['p.total_ht'] = 0; - $totalarray['val']['p.total_tva'] = 0; - $totalarray['val']['p.total_ttc'] = 0; $typenArray = null; while ($i < min($num, $limit)) { diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index c46fb7a67b2..13fa42edb29 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -130,9 +130,10 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index cb62cf0094f..db29da62565 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2075,9 +2075,10 @@ if ($action == 'create' && $usercancreate) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 5b9705209c5..a4d857a47fd 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -161,9 +161,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 7eb835fe938..b2b024f686a 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -153,9 +153,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index d9221096392..38d8beba2ec 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -106,9 +106,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index c3218c8cbe8..55140c30ae2 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -125,9 +125,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index fddf7a2879f..8abbdaa0dd3 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -578,7 +578,7 @@ print '
'; foreach ($listofchoices as $choice => $val) { if (empty($val['enabled'])) { - continue; // list not qualified + continue; // list not qualified } $disabled = ''; if (empty($val['perms'])) { diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index eabe47e54ca..8628e287bd0 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -8,7 +8,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -64,11 +64,12 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id); +$massaction = GETPOST('massaction', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); -if ($fielvalue) { +if ($fieldvalue) { if ($user->socid) { $socid = $user->socid; } @@ -97,6 +98,8 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search $search_req_nb = GETPOST("req_nb", 'alpha'); $search_num_releve = GETPOST("search_num_releve", 'alpha'); $search_conciliated = GETPOST("search_conciliated", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $num_releve = GETPOST("num_releve", "alpha"); if (empty($dateop)) { $dateop = -1; @@ -211,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_thirdparty_user = ''; $search_num_releve = ''; $search_conciliated = ''; + $toselect = ''; $search_account = ""; if ($id > 0 || !empty($ref)) { @@ -221,14 +225,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (empty($reshook)) { $objectclass = 'Account'; $objectlabel = 'BankTransaction'; - $permissiontoread = $user->rights->banque->lire; - $permissiontodelete = $user->rights->banque->supprimer; + $permissiontoread = !empty($user->rights->banque->lire); + $permissiontodelete = !empty($user->rights->banque->modifier); $uploaddir = $conf->bank->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } // Conciliation -if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && $user->rights->banque->consolidate +if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && !empty($user->rights->banque->consolidate) && (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) { $error = 0; @@ -310,7 +314,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' } -if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) { +if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) { $error = 0; if (price2num(GETPOST("addcredit")) > 0) { @@ -370,7 +374,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) { } } -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) { +if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->banque->modifier)) { $accline = new AccountLine($db); $result = $accline->fetch(GETPOST("rowid", "int")); $result = $accline->delete($user); @@ -484,6 +488,11 @@ if ($optioncss != '') { if ($action == 'reconcile') { $param .= '&action=reconcile'; } +$totalarray = array( + 'nbfield' => 0, + 'totalcred' => 0, + 'totaldeb' => 0, +); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -574,7 +583,7 @@ if ($search_bid > 0) { } $sql .= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql .= " ".MAIN_DB_PREFIX."bank as b"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($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 (b.rowid = ef.fk_object)"; } $sql .= " WHERE b.fk_account = ba.rowid"; @@ -732,7 +741,7 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $arrayofselected = is_array($toselect) ? $toselect : array(); + $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array(); // List of mass actions available $arrayofmassactions = array( @@ -759,7 +768,9 @@ if ($resql) { print ''; print ''; print ''; - print ''; + if (!empty($view)) { + print ''; + } print ''; print ''; print ''; @@ -833,7 +844,7 @@ if ($resql) { } // Form to add a transaction with no invoice - if ($user->rights->banque->modifier && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { + if (!empty($user->rights->banque->modifier) && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { print load_fiche_titre($langs->trans("AddBankRecordLong"), '', ''); print ''; @@ -939,6 +950,7 @@ if ($resql) { } } + $morehtml = ''; /*$morehtml = '
'; $morehtml .= ' "; // ' Page '; $morehtml .= ''; @@ -1050,7 +1062,7 @@ if ($resql) { print '
'; } if (!empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['ba.ref']['checked'])) { print '"; } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 3b078698728..d4245594447 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -540,7 +540,7 @@ if ($id) { array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1), array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)), array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)), - array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens") . ' ' . $set_value_help, 'values' => $sensarray, 'default' => $object->sens), + array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => $object->sens), ); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index fe534e3dd82..7f70a447c38 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1218,9 +1218,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 602757522b2..ba505f33d67 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2846,6 +2846,7 @@ if (empty($reshook)) { * View */ + $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); @@ -3818,8 +3819,16 @@ if ($action == 'create') { print '
'; @@ -1160,7 +1172,6 @@ if ($resql) { // Loop on each record $sign = 1; - $totalarray = array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); $links = $bankaccountstatic->get_url($objp->rowid); @@ -1296,18 +1307,10 @@ if ($resql) { $backgroundcolor = "class='oddeven'"; } else { if ($objp->amount < 0) { - if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR1)) { - $color = '#fca955'; - } else { - $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1; - } + $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955'); $backgroundcolor = 'style="background: '.$color.';"'; } else { - if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) { - $color = '#7fdb86'; - } else { - $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2; - } + $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86'); $backgroundcolor = 'style="background: '.$color.';"'; } } @@ -1333,7 +1336,7 @@ if ($resql) { $titletoshow = ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction - if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { + if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) { $labeltoshow = $langs->trans($reg[1]); } else { if ($objp->label == '(payment_salary)') { @@ -1357,6 +1360,7 @@ if ($resql) { } elseif ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment + $paymentstatic->date = $db->jdate($objp->do); print ' '.$paymentstatic->getNomUrl(2); } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 5567678c366..f86c50f31cc 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); +$socid = 0; if ($user->socid) { $socid = $user->socid; } @@ -568,6 +569,12 @@ if ($result) { // Bank line print '
'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); + $arrayselected = array(); + $c = new Categorie($db); + $cats = $c->containing($bankline->id, Categorie::TYPE_BANK_LINE); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); print "
'; } - print ''; + print "\n"; } elseif ($id > 0 || !empty($ref)) { + if (empty($object->id)) { + llxHeader(); + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; + } + /* * Show object in view mode */ @@ -4249,9 +4258,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index b589607ac37..100334e046a 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -126,8 +126,8 @@ class FactureRec extends CommonInvoice public $suspended; // status - public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice - public $generate_pdf; // 1 to generate PDF on invoice generation (default) + public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice + public $generate_pdf; // 1 to generate PDF on invoice generation (default) /** * @var int 1 if status is draft @@ -712,12 +712,12 @@ class FactureRec extends CommonInvoice //$line->code_ventilation = $objp->fk_code_ventilation; $line->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price; - $line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility + $line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $objp->fk_product_fournisseur_price, $objp->pa_ht); $line->buyprice = $marginInfos[0]; - $line->pa_ht = $marginInfos[0]; // For backward compatibility + $line->pa_ht = $marginInfos[0]; // For backward compatibility $line->marge_tx = $marginInfos[1]; $line->marque_tx = $marginInfos[2]; $line->rang = $objp->rang; @@ -1930,14 +1930,14 @@ class FactureLigneRec extends CommonInvoiceLine public $fk_product_fournisseur_price; - public $fk_fournprice; // For backward compatibility + public $fk_fournprice; // For backward compatibility public $rang; public $desc; public $description; - public $fk_product_type; // Use instead product_type + public $fk_product_type; // Use instead product_type public $fk_contract_line; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 90641062b40..04c1383c4a5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1560,8 +1560,11 @@ class Facture extends CommonInvoice $hookmanager->initHooks(array('invoicedao')); $parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $result = $hookmanager->resPrint; - else $result .= $hookmanager->resPrint; + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 4381557cd28..6354c0bf5fd 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -100,6 +100,14 @@ if ($action == 'addcontact' && $user->rights->facture->creer) { * View */ +if (empty($object->id)) { + llxHeader(); + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; +} + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); @@ -160,9 +168,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index c9b6f9a39a8..89a67e75cb7 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -92,6 +92,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; * View */ +if (empty($object->id)) { + llxHeader(); + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; +} + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents'); $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; @@ -153,9 +161,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 69322187e59..f8dd1418000 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -62,6 +62,14 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field * View */ +if (empty($object->id)) { + llxHeader(); + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; +} + $form = new Form($db); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); @@ -112,9 +120,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 84ad5bd0f31..52b2fcceee0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -676,12 +676,6 @@ if (strlen(trim($search_country))) { if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') { $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; } -if ($search_company) { - $sql .= natural_search('s.nom', $search_company); -} -if ($search_company_alias) { - $sql .= natural_search('s.name_alias', $search_company_alias); -} if ($search_montant_ht != '') { $sql .= natural_search('f.total_ht', $search_montant_ht, 1); } diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 40bb97fa236..6f699774d32 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -77,6 +77,14 @@ if (empty($reshook)) { * View */ +if (empty($object->id)) { + llxHeader(); + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + llxFooter(); + exit; +} + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); @@ -129,9 +137,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index c49d98baafe..d815fad4ba6 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -371,9 +371,10 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 9b235926421..33e14407dd6 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015-2016 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * 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 @@ -388,7 +388,7 @@ if ($action == 'new') { $i = 0; while ($obj = $db->fetch_object($resql)) { $accounts[$obj->bid] = $obj->label; - $lines[$obj->bid][$i]["date"] = $db->jdate($obj->date); + $lines[$obj->bid][$i]["date"] = $db->jdate($obj->datec); $lines[$obj->bid][$i]["amount"] = $obj->amount; $lines[$obj->bid][$i]["emetteur"] = $obj->emetteur; $lines[$obj->bid][$i]["numero"] = $obj->num_chq; @@ -398,6 +398,7 @@ if ($action == 'new') { $lines[$obj->bid][$i]["label"] = $obj->transactionlabel; $lines[$obj->bid][$i]["paymentid"] = $obj->paymentid; $lines[$obj->bid][$i]["paymentref"] = $obj->paymentref; + $lines[$obj->bid][$i]["paymentdate"] = $db->jdate($obj->date); $i++; } @@ -468,6 +469,7 @@ if ($action == 'new') { print '
'; $paymentstatic->id = $value["paymentid"]; $paymentstatic->ref = $value["paymentref"]; + $paymentstatic->date = $value["paymentdate"]; if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); } else { diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 03dfd0288bd..42bf73eaae6 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -90,10 +90,10 @@ if (empty($reshook)) { } } if ($action == 'create') { - $default_account=($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT'); + $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT'); if ($id_bankaccount != $conf->global->{$default_account}) { - $res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); //Set as default + $res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); //Set as default } require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index e7e9840af61..c095dc24b99 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -514,9 +514,10 @@ if ($id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index fa95b08faca..9a4b50e3474 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -600,7 +600,7 @@ class PaymentSocialContribution extends CommonObject $result = $acc->add_url_line( $bank_line_id, $socialcontrib->fk_user, - DOL_URL_ROOT . '/user/card.php?id=', + DOL_URL_ROOT.'/user/card.php?id=', $fuser->getFullName($langs), 'user' ); diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index d0cf3a1f34c..66800c4d449 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -127,9 +127,10 @@ if ($object->id) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index eefd667b964..546a4c711d0 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -94,9 +94,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9e9895444b8..62f2262e2d6 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -818,7 +818,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print '
'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)).''; + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); + print '
'; $useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); - print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty).'
'.$langs->trans("No_Email").''.yn($object->no_email).'
'.$langs->trans("No_Email").''; + if ($object->email) { + print yn($object->no_email); + } else { + print ''.$langs->trans("EMailNotDefined").''; + } + print '
'.$langs->trans("ContactVisibility").''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index db65ba8c7d2..82c26b559d2 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -204,6 +204,12 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { $arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1); } +$arrayfields['unsubscribed'] = array( + 'label'=>'No_Email', + 'checked'=>0, + 'enabled'=>(!empty($conf->mailing->enabled)), + 'position'=>41); + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { @@ -355,7 +361,7 @@ if ($resql) { } $sql = "SELECT s.rowid as socid, s.nom as name,"; -$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.no_email,"; +$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email,"; $sql .= " p.socialnetworks, p.photo,"; $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,"; @@ -366,6 +372,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } +if (!empty($conf->mailing->enabled)) { + $sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed"; +} // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -499,8 +508,11 @@ if (strlen($search_town)) { if (count($search_roles) > 0) { $sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))"; } -if ($search_no_email != '' && $search_no_email >= 0) { - $sql .= " AND p.no_email = ".((int) $search_no_email); +if ($search_no_email != -1 && $search_no_email > 0) { + $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0"; +} +if ($search_no_email != -1 && $search_no_email == 0) { + $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''"; } if ($search_status != '' && $search_status >= 0) { $sql .= " AND p.statut = ".((int) $search_status); @@ -568,75 +580,75 @@ llxHeader('', $title, $help_url); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.$contextpage; + $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.$limit; + $param .= '&limit='.((int) $limit); } -$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); -$param .= '&type='.urlencode($type).'&view='.urlencode($view); +$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); +$param .= '&type='.urlencode($type).'&view='.urlencode($view); if (!empty($search_categ) && $search_categ != '-1') { - $param .= '&search_categ='.urlencode($search_categ); + $param .= '&search_categ='.urlencode($search_categ); } if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') { - $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty); + $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty); } if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { - $param .= '&search_categ_supplier='.urlencode($search_categ_supplier); + $param .= '&search_categ_supplier='.urlencode($search_categ_supplier); } if ($sall != '') { - $param .= '&sall='.urlencode($sall); + $param .= '&sall='.urlencode($sall); } if ($search_id > 0) { - $param .= "&search_id=".urlencode($search_id); + $param .= "&search_id=".urlencode($search_id); } if ($search_lastname != '') { - $param .= '&search_lastname='.urlencode($search_lastname); + $param .= '&search_lastname='.urlencode($search_lastname); } if ($search_firstname != '') { - $param .= '&search_firstname='.urlencode($search_firstname); + $param .= '&search_firstname='.urlencode($search_firstname); } if ($search_societe != '') { - $param .= '&search_societe='.urlencode($search_societe); + $param .= '&search_societe='.urlencode($search_societe); } if ($search_address != '') { - $param .= '&search_address='.urlencode($search_address); + $param .= '&search_address='.urlencode($search_address); } if ($search_zip != '') { - $param .= '&search_zip='.urlencode($search_zip); + $param .= '&search_zip='.urlencode($search_zip); } if ($search_town != '') { - $param .= '&search_town='.urlencode($search_town); + $param .= '&search_town='.urlencode($search_town); } if ($search_country != '') { $param .= "&search_country=".urlencode($search_country); } if ($search_poste != '') { - $param .= '&search_poste='.urlencode($search_poste); + $param .= '&search_poste='.urlencode($search_poste); } if ($search_phone_pro != '') { - $param .= '&search_phone_pro='.urlencode($search_phone_pro); + $param .= '&search_phone_pro='.urlencode($search_phone_pro); } if ($search_phone_perso != '') { - $param .= '&search_phone_perso='.urlencode($search_phone_perso); + $param .= '&search_phone_perso='.urlencode($search_phone_perso); } if ($search_phone_mobile != '') { - $param .= '&search_phone_mobile='.urlencode($search_phone_mobile); + $param .= '&search_phone_mobile='.urlencode($search_phone_mobile); } if ($search_fax != '') { - $param .= '&search_fax='.urlencode($search_fax); + $param .= '&search_fax='.urlencode($search_fax); } if ($search_email != '') { - $param .= '&search_email='.urlencode($search_email); + $param .= '&search_email='.urlencode($search_email); } if ($search_no_email != '') { - $param .= '&search_no_email='.urlencode($search_no_email); + $param .= '&search_no_email='.urlencode($search_no_email); } if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); + $param .= '&search_status='.urlencode($search_status); } if ($search_priv == '0' || $search_priv == '1') { - $param .= "&search_priv=".urlencode($search_priv); + $param .= "&search_priv=".urlencode($search_priv); } if ($search_stcomm != '') { $param .= '&search_stcomm='.urlencode($search_stcomm); @@ -843,7 +855,7 @@ if (!empty($arrayfields['p.email']['checked'])) { print ''; print ''; print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email); print ''.yn($obj->no_email).''; + if (empty($obj->email)) { + //print ''.$langs->trans("NoEmail").''; + } else { + print yn(($obj->unsubscribed > 0) ? 1 : 0); + } + print '
' . $labelStatus . '' . price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency) . ''.$labelStatus.''.price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency).'
'; if ($object->photo) { - $ret .= ''; + $ret .= ''; } $ret .= ''; $ret .= '
'.$langs->trans("Delete").'



'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d313d91f505..ffa441c0527 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -500,7 +500,7 @@ class FormFile $modellist = array(); if ($modulepart == 'company') { - $showempty = 1; // can have no template active + $showempty = 1; // can have no template active if (is_array($genallowed)) { $modellist = $genallowed; } else { @@ -564,7 +564,7 @@ class FormFile $modellist = ModelePDFFactures::liste_modeles($this->db); } } elseif ($modulepart == 'contract') { - $showempty = 1; // can have no template active + $showempty = 1; // can have no template active if (is_array($genallowed)) { $modellist = $genallowed; } else { @@ -628,7 +628,7 @@ class FormFile $modellist = ModelePDFSuppliersOrders::liste_modeles($this->db); } } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') { - $showempty = 1; // can have no template active + $showempty = 1; // can have no template active if (is_array($genallowed)) { $modellist = $genallowed; } else { @@ -1708,7 +1708,7 @@ class FormFile } else { $parameters = array('modulepart'=>$modulepart); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); - if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0) { + if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { if (array_key_exists('classpath', $hookmanager->resArray) && !empty($hookmanager->resArray['classpath'])) { dol_include_once($hookmanager->resArray['classpath']); if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) { @@ -1789,9 +1789,9 @@ class FormFile preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); } else { - $parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file); + $parameters = array('modulepart'=>$modulepart, 'fileinfo'=>$file); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); - if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0) { + if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { if (array_key_exists('ref', $hookmanager->resArray) && !empty($hookmanager->resArray['ref'])) { $ref = $hookmanager->resArray['ref']; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 4f9ec52dd8d..0478b4e215f 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -691,9 +691,9 @@ class FormMail extends Form $out .= ''; $out .= $langs->trans("GroupEmails"); $out .= ''; - $out .= ' withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> '; - $out .= $langs->trans("OneEmailPerRecipient"); - $out .= ''; + $out .= ' withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> '; + $out .= ''; + $out .= ''; $out .= ' - '; $out .= $langs->trans("WarningIfYouCheckOneRecipientPerEmail"); $out .= ''; @@ -773,12 +773,11 @@ class FormMail extends Form if (!empty($this->withmaindocfile)) { if ($this->withmaindocfile == 1) { - $out .= ''; + $out .= ''; + } elseif ($this->withmaindocfile == -1) { + $out .= ''; } - if ($this->withmaindocfile == -1) { - $out .= ''; - } - $out .= ' '.$langs->trans("JoinMainDoc").'.
'; + $out .= '
'; } if (is_numeric($this->withfile)) { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 34ea7b0a2e8..022bf55f243 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -514,7 +514,17 @@ class FormProjets } $linkedtothirdparty = false; - if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales', 'entrepot'))) { + if (!in_array($table_element, array( + 'don', + 'expensereport_det', + 'expensereport', 'loan', + 'stock_mouvement', + 'payment_salary', + 'payment_various', + 'salary', + 'chargesociales', + 'entrepot') + )) { $linkedtothirdparty = true; } diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index b78ff5cfa8e..2773ece2569 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -104,6 +104,7 @@ class FormPropal print ''; } + $i = 0; foreach ($listofstatus as $key => $obj) { if ($excludedraft) { if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') { diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index b9f320b7db8..7e2154ee309 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1,17 +1,18 @@ - * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2019 Frédéric France - * Copyright (C) 2021 Juanjo Menent +/* Copyright (C) 2013-2015 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2019 Frédéric France + * Copyright (C) 2021 Juanjo Menent + * Copyright (C) 2021 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -508,11 +509,13 @@ class FormTicket print ''; } - if (!empty($conf->projet->enabled) && !$this->ispublic) { - $formproject = new FormProjets($this->db); - print ''; - print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); - print ''; + if ($subelement != 'project') { + if (!empty($conf->projet->enabled) && !$this->ispublic) { + $formproject = new FormProjets($this->db); + print ''; + print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print ''; + } } // Other attributes diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index bdd0f79a0aa..adde51c4974 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -151,7 +151,7 @@ class InfoBox $box->rowid = (empty($obj->rowid) ? '' : $obj->rowid); $box->id = (empty($obj->box_id) ? '' : $obj->box_id); $box->position = ((isset($obj->position) && $obj->position == '') ? '' : (isset($obj->position) ? $obj->position : '')); // '0' must stay '0' - $box->box_order = (empty($obj->box_order) ? '' : $obj->box_order); + $box->box_order = (empty($obj->box_order) ? '' : $obj->box_order); $box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user); $box->sourcefile = $relsourcefile; $box->class = $boxname; @@ -215,7 +215,7 @@ class InfoBox /** * Save order of boxes for area and user * - * @param DoliDB $dbs Database handler + * @param DoliDB $dbs Database handler * @param int $zone Name of area (0 for Homepage, ...) * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' * @param int $userid Id of user diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 4743d4559b6..c287aae1c2f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1422,7 +1422,7 @@ class SMTPs $this->_msgContent[$strType]['dataText'] = $strContentAltText; if ($this->getMD5flag()) { - $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3); + $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3); } //} } @@ -1622,7 +1622,7 @@ class SMTPs $this->_msgContent['image'][$strImageName]['data'] = $strContent; if ($this->getMD5flag()) { - $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3); + $this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3); } } } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index e7ab98ca3b6..d4028e2196b 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -681,7 +681,7 @@ function dol_get_first_day_week($day, $month, $year, $gm = false) function getGMTEasterDatetime($year) { $base = new DateTime("$year-03-21", new DateTimeZone("UTC")); - $days = easter_days($year); // Return number of days between 21 march and easter day. + $days = easter_days($year); // Return number of days between 21 march and easter day. $tmp = $base->add(new DateInterval("P{$days}D")); return $tmp->getTimestamp(); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5f014ce3d48..2a48858c9f6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -108,6 +108,10 @@ function getEntity($element, $shared = 1, $currentobject = null) { global $conf, $mc, $hookmanager, $object, $action; + if (! is_object($hookmanager)) { + $hookmanager = new HookManager($db); + } + // fix different element names (France to English) switch ($element) { case 'contrat': @@ -2289,6 +2293,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = { global $conf, $langs; + // If date undefined or "", we return "" + if (dol_strlen($time) == 0) { + return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) + } + if ($tzoutput === 'auto') { $tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver')); } @@ -2312,7 +2321,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $user_date_tz = new DateTimeZone($offsettzstring); $user_dt = new DateTime(); $user_dt->setTimezone($user_date_tz); - $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : $time); + $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time); $offsettz = $user_dt->getOffset(); } else { // old method (The 'tzuser' was processed like the 'tzuserrel') $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore @@ -2380,11 +2389,6 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = str_replace('yyyy', 'yy', $format); } - // If date undefined or "", we return "" - if (dol_strlen($time) == 0) { - return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) - } - // Clean format if (preg_match('/%b/i', $format)) { // There is some text to translate // We inhibate translation to text made by strftime functions. We will use trans instead later. @@ -2401,7 +2405,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = // Analyze date $reg = array(); if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 - dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]); + dol_print_error('', "Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]); return ''; } elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date // This part of code should not be used anymore. @@ -3670,9 +3674,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', - 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', - 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', - 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', + 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', + 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter', + 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', @@ -3682,7 +3686,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house', 'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', - 'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', + 'supplier'=>'building', 'technic'=>'cogs', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', 'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card', @@ -4473,7 +4477,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss $result = ($nodiv ? '' : '
').' '.$text.($nodiv ? '' : '
'); if ($textfordropdown) { - $tmpresult .= ''.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').''; + $tmpresult = ''.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').''; $tmpresult .= ''; } } - print ' '.$alreadyconsumed; + print ' '.price2num($alreadyconsumed, 'MS'); print ''; // Warehouse print ''; print ''; + // Stock if ($conf->stock->enabled) { print ''; if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { print img_warning($langs->trans('StockTooLow')).' '; } - print $tmpproduct->stock_reel; // Available + print price2num($tmpproduct->stock_reel, 'MS'); // Available print ''; } + // Lot if ($conf->productbatch->enabled) { - print ''; // Lot + print ''; } + // Action delete line if ($permissiontodelete) { - $href = $_SERVER["PHP_SELF"]; - $href .= '?id='.$object->id; - $href .= '&action=deleteline'; - $href .= '&lineid='.$line->id; + $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line->id); print ''; - print ''; - print img_picto('', "delete"); + print ''; + print img_picto('', 'delete'); print ''; print ''; } @@ -911,16 +919,26 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Show detailed of already consumed with js code to collapse foreach ($arrayoflines as $line2) { print ''; + + // Date print ''; $tmpstockmovement->id = $line2['fk_stock_movement']; print ''.img_picto($langs->trans("StockMovement"), 'movement', 'class="paddingright"').''; print dol_print_date($line2['date'], 'dayhour', 'tzuserrel'); print ''; + + // Already consumed print ''; + + // Qty print ''.$line2['qty'].''; + + // Cost price if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { print ''; } + + // Warehouse print ''; if ($line2['fk_warehouse'] > 0) { $result = $tmpwarehouse->fetch($line2['fk_warehouse']); @@ -929,6 +947,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } print ''; + + // Stock + if ($conf->stock->enabled) { + print ''; + } + // Lot Batch print ''; if ($line2['batch'] != '') { @@ -936,6 +960,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $tmpbatch->getNomUrl(1); } print ''; + + // Action delete line + if ($permissiontodelete) { + print ''; + } + print ''; } @@ -954,11 +984,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $disable = 'disabled'; } + // Qty print ''; + + // Cost if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { print ''; } + + // Already consumed print ''; + + // Warehouse print ''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (empty($line->disable_stock_change)) { @@ -970,10 +1007,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { print ''.$langs->trans("NoStockChangeOnServices").''; } - // Lot / Batch print ''; + + // Stock + if ($conf->stock->enabled) { + print ''; + } + + // Lot / Batch if ($conf->productbatch->enabled) { - print ''; + print 'aaa'; if ($tmpproduct->status_batch) { $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); print ''; @@ -981,6 +1024,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; } + + // Action delete line + if ($permissiontodelete) { + print ''; + } + print ''; } } @@ -1003,13 +1052,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $nblinetoproduce++; } } - $newlinetext = ''; - if ($object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall') { - if ($nblinetoproduce == 0 || $object->mrptype == 1) { - $newlinetext = ''.$langs->trans("AddNewProduceLines").''; - } + + $newcardbutton = ''; + $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addproduceline&token='.newToken(); + $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall'; + $parameters = array('morecss'=>'reposition'); + if ($nblinetoproduce == 0 || $object->mrptype == 1) { + $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); } - print load_fiche_titre($langs->trans('Production'), '', '', 0, '', '', $newlinetext); + + print load_fiche_titre($langs->trans('Production'), $newcardbutton, '', 0, '', ''); print '
'; print ''; @@ -1044,7 +1096,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; print ''; print ''; // Qty print ''; @@ -1052,10 +1104,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Qty already produced - print ''; + print ''; // Lot - serial if ($conf->productbatch->enabled) { @@ -1155,7 +1207,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $href .= '&action=deleteline'; $href .= '&lineid='.$line->id; print ''; diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index dee6476f773..16e728512f6 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -282,7 +282,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $_SESSION["FinalPaymentAmt"] = $paymentAmount; $_SESSION["currencyCodeType"] = $currencyCodeType; $_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole' - $_SESSION['ipaddress'] = getUserRemoteIP(); // Payer ip + $_SESSION['ipaddress'] = getUserRemoteIP(); // Payer ip //'--------------------------------------------------------------------------------------------------------------- //' Make the API call to PayPal diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 9ba8d9cec09..84562bf95a4 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -144,7 +144,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { if (!$found && isset($price_level) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { // If we need a particular price level (from 1 to 6) $sql = "SELECT price, price_ttc, price_base_type, tva_tx"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price "; - $sql .= " WHERE fk_product = '".$id."'"; + $sql .= " WHERE fk_product = ".((int) $id); $sql .= " AND entity IN (".getEntity('productprice').")"; $sql .= " AND price_level = ".((int) $price_level); $sql .= " ORDER BY date_price"; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 79418b83c43..b14d4a4efca 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1922,11 +1922,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; + // State if (empty($conf->global->PRODUCT_DISABLE_STATE)) { print ''; @@ -1937,7 +1938,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state($object->state_id, $object->country_code); + print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code); print ''; print ''; } diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index d3c23b17c4a..407eac7c30a 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -739,7 +739,7 @@ class Productcustomerprice extends CommonObject $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; $sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").","; - $sql .= " ref_customer=".(isset($this->ref_customer) ? "'" . $this->db->escape($this->ref_customer) . "'" : "null").","; + $sql .= " ref_customer=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : "null").","; $sql .= " price=".(isset($this->price) ? $this->price : "null").","; $sql .= " price_ttc=".(isset($this->price_ttc) ? $this->price_ttc : "null").","; $sql .= " price_min=".(isset($this->price_min) ? $this->price_min : "null").","; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 8ec03d408f3..14d9b320e8e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -793,7 +793,7 @@ if ($resql) { $categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1); $categoriesProductArr[-2] = '- '.$langs->trans('NotCategorized').' -'; $moreforfilter .= Form::multiselectarray('search_category_product_list', $categoriesProductArr, $searchCategoryProductList, 0, 0, 'minwidth300'); - $moreforfilter .= ' '.$langs->trans('UseOrOperatorForCategories').''; + $moreforfilter .= ' '; $moreforfilter .= ''; } diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 8ffae0bee8c..32a2cd08cc9 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -178,7 +178,7 @@ $arrayofmode = array( 'facture' => 'Facture' ); $title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1); -$title .= ' '; +$title .= ' '; print ''; @@ -198,7 +198,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort print '
'; - print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300'); + print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth300'); print ''; // Warehouse - print ''; print ''; + print ''; print ''; - print ''; + print ''; print img_picto('', "delete"); print ''; print '
'.$langs->trans("CountryOrigin").''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); + print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } print '
'; -print ""; +print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index ef4abef5173..d2d9f289fd1 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -45,6 +45,7 @@ $ref = GETPOST('ref', 'alpha'); $mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit'); $search_year = GETPOST('search_year', 'int'); $search_categ = GETPOST('search_categ', 'int'); +$notab = GETPOST('notab', 'int'); $error = 0; $mesg = ''; @@ -56,7 +57,7 @@ if (!empty($user->socid)) { } // Security check -$fieldvalue = (!empty($id) ? $id : $ref); +$fieldvalue = ($id > 0 ? $id : $ref); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -69,6 +70,11 @@ if (empty($search_year)) { } $moreforfilter = ""; +$object = new Product($db); +if ($id > 0 || !empty($ref)) { + $result = $object->fetch($id, $ref); +} + $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); @@ -85,9 +91,10 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product $form = new Form($db); $htmlother = new FormOther($db); -$object = new Product($db); -if (!$id && empty($ref)) { +if (!($id > 0) && empty($ref) || $notab) { + $notab = 1; + llxHeader("", $langs->trans("ProductStatistics")); $type = GETPOST('type', 'int'); @@ -132,7 +139,7 @@ if (!$id && empty($ref)) { } -if ($result && (!empty($id) || !empty($ref))) { +if ($result && ($id > 0 || !empty($ref)) && empty($notab)) { $head = product_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); @@ -145,11 +152,11 @@ if ($result && (!empty($id) || !empty($ref))) { print dol_get_fiche_end(); } -if (empty($id) && empty($ref)) { +if ((!($id > 0) && empty($ref)) || $notab) { $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.$type : ''); + $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.((int) $type) : ''); $head[$h][1] = $langs->trans("Chart"); $head[$h][2] = 'chart'; $h++; @@ -162,7 +169,7 @@ if (empty($id) && empty($ref)) { $title = $langs->trans("ListProductByPopularity"); } - $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.$type : ''); + $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.((int) $type) : ''); $head[$h][1] = $langs->trans("ProductsPerPopularity"); $head[$h][2] = 'popularity'; $h++; @@ -171,21 +178,29 @@ if (empty($id) && empty($ref)) { } -if ($result || empty($id)) { +if ($result || !($id > 0)) { print ''; print ''; - print ''; + if (empty($id) || $notab) { + print ''; + } print '
'; print ''; - if (empty($id)) { + if (!($id > 0) || $notab) { // Type - print ''; + // Product + print ''; + // Tag if ($conf->categorie->enabled) { print ''; } + } else { + print ''; } // Year @@ -224,7 +241,7 @@ if ($result || empty($id)) { } if ($mode == 'bynumber') { - print 'id).($type != '' ? '&type='.$type : '').'&mode=byunit&search_year='.$search_year.'">'; + print ''; } else { print ''; } @@ -240,7 +257,7 @@ if ($result || empty($id)) { } if ($mode == 'byunit') { - print 'id).($type != '' ? '&type='.$type : '').'&mode=bynumber&search_year='.$search_year.'">'; + print ''; } else { print ''; } @@ -258,9 +275,7 @@ if ($result || empty($id)) { } print '
'; - //print '
'.$langs->trans("Filter").'
'.$langs->trans("ProductsAndServices").''; + print '
'.$langs->trans("Type").''; $array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); print $form->selectarray('type', $array, $type); print '
'.$langs->trans("ProductOrService").''; + print img_picto('', 'product', 'class="pictofixedwidth"'); + print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, 'maxwidth500'); + print '
'.$langs->trans("Categories").''; @@ -194,6 +209,8 @@ if ($result || empty($id)) { print $moreforfilter; print '
'; - - // Generation des graphs + // Generation of graphs $dir = (!empty($conf->product->multidir_temp[$object->entity]) ? $conf->product->multidir_temp[$object->entity] : $conf->service->multidir_temp[$object->entity]); if ($object->id > 0) { // We are on statistics for a dedicated product if (!file_exists($dir.'/'.$object->id)) { @@ -385,7 +400,7 @@ if ($result || empty($id)) { $px->SetShading(3); //print 'x '.$key.' '.$graphfiles[$key]['file']; - $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']); + $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.((int) $object->entity).'&file='.urlencode($graphfiles[$key]['file']).($notab ? '¬ab='.$notab : ''); $px->draw($dir."/".$graphfiles[$key]['file'], $url); $graphfiles[$key]['total'] = $px->total(); @@ -446,7 +461,9 @@ if ($result || empty($id)) { } else { $dategenerated = ($mesg ? ''.$mesg.'' : $langs->trans("ChartNotGenerated")); } - $linktoregenerate = 'id).((string) $type != '' ? '&type='.$type : '').'&action=recalcul&mode='.$mode.'&search_year='.$search_year.'&search_categ='.$search_categ.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh').''; + $linktoregenerate = ' 0 ? '&search_categ='.((int) $search_categ) : '').'">'; + $linktoregenerate .= img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh'); + $linktoregenerate .= ''; // Show graph print '
'; @@ -480,7 +497,7 @@ if ($result || empty($id)) { } } -if (!$id) { +if (!($id > 0)) { print dol_get_fiche_end(); } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index e485ea3d543..ce9c26c5480 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -451,9 +451,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index 36897c7aef0..db6560a9970 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -81,9 +81,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index e223714e82d..bfd96716bb7 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -195,6 +195,7 @@ $now = dol_now(); $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; $title = $langs->trans("ListOfWarehouses"); +$totalarray = array(); // Build and execute select // -------------------------------------------------------------------- @@ -566,7 +567,6 @@ print ''."\n"; // Loop on record // -------------------------------------------------------------------- $i = 0; -$totalarray = array(); $warehouse = new Entrepot($db); diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index e028c49396b..7d261a73f7a 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -671,9 +671,10 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index c6e72c6f0da..4f695f990e4 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -113,7 +113,9 @@ if ($user->socid > 0) { // Protection if external user accessforbidden(); } //$result = restrictedArea($user, 'productbatch'); -if (!$permissiontoread) accessforbidden(); +if (!$permissiontoread) { + accessforbidden(); +} /* diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d5bf172f5b3..ed7b5f1980e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -358,12 +358,14 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot IN ('.$db->sanitize($listofqualifiedwarehousesid).')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; +$list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid); +$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse) .')'; + //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).')'; } - // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook @@ -577,6 +579,9 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock'); print dol_get_fiche_head($head, 'replenish', '', -1, ''); print ''.$langs->trans("ReplenishmentStatusDesc").''."\n"; + +//$link = ''.$langs->trans("MenuNewWarehouse").''; + if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { print ''.$langs->trans("ReplenishmentStatusDescPerWarehouse").''."\n"; } diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 3fc409f58be..d5de51c7311 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -607,7 +607,7 @@ $parameters = array('sql'=>$sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (empty($date) || ! $dateIsValid) { +if (empty($date) || !$dateIsValid) { $colspan = 8; if ($mode == 'future') { $colspan++; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index aa823dc44d6..6d8b54d1954 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1183,7 +1183,7 @@ class Project extends CommonObject $label = ''; if ($option != 'nolink') { - $label = img_picto('', $this->picto).' '.$langs->trans("Project").''; + $label = img_picto('', $this->picto, 'class="pictofixedwidth"').' '.$langs->trans("Project").''; } if (isset($this->status)) { $label .= ' '.$this->getLibStatut(5); @@ -1252,7 +1252,7 @@ class Project extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 66288159f39..ff68d9fbb05 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1,13 +1,13 @@ - * Copyright (C) 2004-2020 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2012-2016 Juanjo Menent - * Copyright (C) 2015-2019 Alexandre Spangaro - * Copyright (C) 2015 Marcos García - * Copyright (C) 2016 Josep Lluís Amador - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2021 Noé Cendrier +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2012-2016 Juanjo Menent + * Copyright (C) 2015-2021 Alexandre Spangaro + * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 Josep Lluís Amador + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2021 Noé Cendrier * * 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 @@ -164,7 +164,7 @@ if ($id == '' && $ref == '') { exit(); } -$mine = (!empty($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0; +$mine = GETPOST('mode') == 'mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); @@ -366,19 +366,19 @@ $listofreferent = array( 'class'=>'Entrepot', 'table'=>'entrepot', 'datefieldname'=>'date_entrepot', - 'urlnew'=>DOL_URL_ROOT.'/product/stock/card.php?action=create&projectid='.$id, + 'urlnew'=>DOL_URL_ROOT.'/product/stock/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'entrepot', 'buttonnew'=>'AddWarehouse', 'project_field'=>'fk_project', 'testnew'=>$user->rights->stock->creer, - 'test'=>$conf->stock->enabled && $user->rights->stock->lire), + 'test'=>$conf->stock->enabled && $user->rights->stock->lire && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT)), 'propal'=>array( 'name'=>"Proposals", 'title'=>"ListProposalsAssociatedProject", 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', - 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'propal', 'buttonnew'=>'AddProp', 'testnew'=>$user->rights->propal->creer, @@ -389,7 +389,7 @@ $listofreferent = array( 'class'=>'Commande', 'table'=>'commande', 'datefieldname'=>'date_commande', - 'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'orders', 'buttonnew'=>'CreateOrder', 'testnew'=>$user->rights->commande->creer, @@ -401,7 +401,7 @@ $listofreferent = array( 'margin'=>'add', 'table'=>'facture', 'datefieldname'=>'datef', - 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'bills', 'buttonnew'=>'CreateBill', 'testnew'=>$user->rights->facture->creer, @@ -412,7 +412,7 @@ $listofreferent = array( 'class'=>'FactureRec', 'table'=>'facture_rec', 'datefieldname'=>'datec', - 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'bills', 'buttonnew'=>'CreateBill', 'testnew'=>$user->rights->facture->creer, @@ -423,7 +423,7 @@ $listofreferent = array( 'class'=>'SupplierProposal', 'table'=>'supplier_proposal', 'datefieldname'=>'date_valid', - 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object + 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'supplier_proposal', 'buttonnew'=>'AddSupplierProposal', 'testnew'=>$user->rights->supplier_proposal->creer, @@ -434,7 +434,7 @@ $listofreferent = array( 'class'=>'CommandeFournisseur', 'table'=>'commande_fournisseur', 'datefieldname'=>'date_commande', - 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object + 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'suppliers', 'buttonnew'=>'AddSupplierOrder', 'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer), @@ -446,7 +446,7 @@ $listofreferent = array( 'margin'=>'minus', 'table'=>'facture_fourn', 'datefieldname'=>'datef', - 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object + 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object 'lang'=>'suppliers', 'buttonnew'=>'AddSupplierInvoice', 'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), @@ -457,7 +457,7 @@ $listofreferent = array( 'class'=>'Contrat', 'table'=>'contrat', 'datefieldname'=>'date_contrat', - 'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'contracts', 'buttonnew'=>'AddContract', 'testnew'=>$user->rights->contrat->creer, @@ -470,7 +470,7 @@ $listofreferent = array( 'datefieldname'=>'date_valid', 'disableamount'=>0, 'margin'=>'minus', - 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', 'testnew'=>$user->rights->ficheinter->creer, @@ -481,7 +481,7 @@ $listofreferent = array( 'class'=>'Expedition', 'table'=>'expedition', 'datefieldname'=>'date_valid', - 'urlnew'=>DOL_URL_ROOT.'/expedition/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/expedition/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'sendings', 'buttonnew'=>'CreateShipment', 'testnew'=>0, @@ -492,7 +492,7 @@ $listofreferent = array( 'class'=>'Mo', 'table'=>'mrp_mo', 'datefieldname'=>'date_valid', - 'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'mrp', 'buttonnew'=>'CreateMO', 'testnew'=>'$user->rights->mrp->write', @@ -506,7 +506,7 @@ $listofreferent = array( 'datefieldname'=>'dated', 'margin'=>'minus', 'disableamount'=>1, - 'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'trips', 'buttonnew'=>'AddTrip', 'testnew'=>$user->rights->deplacement->creer, @@ -519,7 +519,7 @@ $listofreferent = array( 'datefieldname'=>'date', 'margin'=>'minus', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'trips', 'buttonnew'=>'AddTrip', 'testnew'=>$user->rights->expensereport->creer, @@ -532,7 +532,7 @@ $listofreferent = array( 'table'=>'don', 'datefieldname'=>'datedon', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'donations', 'buttonnew'=>'AddDonation', 'testnew'=>$user->rights->don->creer, @@ -545,7 +545,7 @@ $listofreferent = array( 'table'=>'loan', 'datefieldname'=>'datestart', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'loan', 'buttonnew'=>'AddLoan', 'testnew'=>$user->rights->loan->write, @@ -558,7 +558,7 @@ $listofreferent = array( 'table'=>'chargesociales', 'datefieldname'=>'date_ech', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$id, + 'urlnew'=>DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'compta', 'buttonnew'=>'AddSocialContribution', 'testnew'=>$user->rights->tax->charges->lire, @@ -571,7 +571,7 @@ $listofreferent = array( 'table'=>'projet_task', 'datefieldname'=>'task_date', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id, + 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'buttonnew'=>'AddTimeSpent', 'testnew'=>$user->rights->projet->creer, 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), @@ -588,13 +588,13 @@ $listofreferent = array( 'name'=>"Salaries", 'title'=>"ListSalariesAssociatedProject", 'class'=>'Salary', - 'table'=>'payment_salary', - 'datefieldname'=>'datev', + 'table'=>'salary', + 'datefieldname'=>'datesp', 'margin'=>'minus', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/salaries/card.php?action=create&projectid='.$id, + 'urlnew'=>DOL_URL_ROOT.'/salaries/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'salaries', - 'buttonnew'=>'AddSalaryPayment', + 'buttonnew'=>'AddSalary', 'testnew'=>$user->rights->salaries->write, 'test'=>$conf->salaries->enabled && $user->rights->salaries->read), 'variouspayment'=>array( @@ -605,7 +605,7 @@ $listofreferent = array( 'datefieldname'=>'datev', 'margin'=>'minus', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id, + 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'banks', 'buttonnew'=>'AddVariousPayment', 'testnew'=>$user->rights->banque->modifier, @@ -618,7 +618,7 @@ $listofreferent = array( 'table'=>'actioncomm', 'datefieldname'=>'datep', 'disableamount'=>1, - 'urlnew'=>DOL_URL_ROOT.'/comm/action/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/comm/action/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'lang'=>'agenda', 'buttonnew'=>'AddEvent', 'testnew'=>$user->rights->agenda->myactions->create, @@ -814,7 +814,7 @@ foreach ($listofreferent as $key => $value) { } // Define $total_ht_by_line - if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') { + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') { $total_ht_by_line = $element->amount; } elseif ($tablename == 'fichinter') { $total_ht_by_line = $element->getAmount(); @@ -856,7 +856,7 @@ foreach ($listofreferent as $key => $value) { } // Define $total_ttc_by_line - if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') { + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') { $total_ttc_by_line = $element->amount; } elseif ($tablename == 'fichinter') { $total_ttc_by_line = $element->getAmount(); @@ -880,7 +880,7 @@ foreach ($listofreferent as $key => $value) { } // Add total if we have to - if ($qualifiedfortotal) { + if ($qualifiedfortotal) { $total_ht = $total_ht + $total_ht_by_line; $total_ttc = $total_ttc + $total_ttc_by_line; } @@ -1073,7 +1073,7 @@ foreach ($listofreferent as $key => $value) { print ''; // if $key == 'project_task', we don't want details per user } elseif (in_array($tablename, array('payment_various'))) { print ''; // if $key == 'payment_various', we don't have any thirdparty - } elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'payment_salary'))) { + } elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'salary'))) { print $langs->trans("User"); } else { print $langs->trans("ThirdParty"); @@ -1231,8 +1231,8 @@ foreach ($listofreferent as $key => $value) { $date = $element->date; // No draft status on lines } elseif ($tablename == 'stock_mouvement') { $date = $element->datem; - } elseif ($tablename == 'payment_salary') { - $date = $element->datev; + } elseif ($tablename == 'salary') { + $date = $element->datesp; } elseif ($tablename == 'payment_various') { $date = $element->datev; } elseif ($tablename == 'chargesociales') { @@ -1290,7 +1290,7 @@ foreach ($listofreferent as $key => $value) { $tmpuser = new User($db); $tmpuser->fetch($expensereport->fk_user_author); print $tmpuser->getNomUrl(1, '', 48); - } elseif ($tablename == 'payment_salary') { + } elseif ($tablename == 'salary') { $tmpuser = new User($db); $tmpuser->fetch($element->fk_user); print $tmpuser->getNomUrl(1, '', 48); @@ -1318,7 +1318,7 @@ foreach ($listofreferent as $key => $value) { if (empty($value['disableamount'])) { $total_ht_by_line = null; $othermessage = ''; - if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') { + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') { $total_ht_by_line = $element->amount; } elseif ($tablename == 'fichinter') { $total_ht_by_line = $element->getAmount(); @@ -1372,7 +1372,7 @@ foreach ($listofreferent as $key => $value) { // Amount inc tax if (empty($value['disableamount'])) { $total_ttc_by_line = null; - if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') { + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') { $total_ttc_by_line = $element->amount; } elseif ($tablename == 'fichinter') { $total_ttc_by_line = $element->getAmount(); diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 56649af9a45..ae0542d8b4b 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -19,7 +19,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_statut = 1"; // Opend projects only if ($mine || empty($user->rights->projet->all->lire)) { @@ -91,7 +91,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $labelStatus = $listofopplabel[$status]; } if (empty($labelStatus)) { - $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example. + $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example. } //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 753ccc9b419..0b26161c28c 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -59,9 +59,9 @@ restrictedArea($user, 'projet', $object->fk_project, 'projet&project'); // Add new contact if ($action == 'addcontact' && $user->rights->projet->creer) { - $source = 'internal'; + $source = 'internal'; if (GETPOST("addsourceexternal")) { - $source ='external'; + $source = 'external'; } $result = $object->fetch($id, $ref); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 53b1a85e889..f56d531ffdf 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -67,10 +67,12 @@ $search_task_user = GETPOST('search_task_user', 'int'); $search_task_progress = GETPOST('search_task_progress'); $search_task_budget_amount = GETPOST('search_task_budget_amount'); $search_societe = GETPOST('search_societe'); +$search_opp_status = GETPOST("search_opp_status", 'alpha'); -$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0; +$mine = GETPOST('mode', 'alpha') == 'mine' ? 1 : 0; if ($mine) { - $search_task_user = $user->id; $mine = 0; + $search_task_user = $user->id; + $mine = 0; } $search_date_startday = GETPOST('search_date_startday', 'int'); @@ -346,7 +348,7 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } -if (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)"; } if ($search_project_user > 0) { @@ -604,7 +606,9 @@ print ''; print ''; print ''; print ''; -print ''; +if (!empty($type)) { + print ''; +} print ''; // Show description of content @@ -634,7 +638,7 @@ if ($search_all) { print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } -$morehtmlfilter = ''; +$moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { @@ -861,10 +865,34 @@ if (!empty($arrayfields['t.tobill']['checked'])) { if (!empty($arrayfields['t.billed']['checked'])) { print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); } +$totalarray = array( + 'nbfield' => 0, + 'val' => array( + 't.planned_workload' => 0, + 't.duration_effective' => 0, + 't.progress' => 0, + 't.budget_amount' => 0, + ), + 'totalplannedworkload' => 0, + 'totaldurationeffective' => 0, + 'totaldurationdeclared' => 0, + 'totaltobillfield' => 0, + 'totalbilledfield' => 0, + 'totalbudget_amountfield' => 0, + 'totalbudgetamount' => 0, + 'totaltobill' => 0, + 'totalbilled' => 0, +); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, +); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.datec']['checked'])) { @@ -887,7 +915,6 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) { } $i = 0; -$totalarray = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -1148,7 +1175,7 @@ while ($i < min($num, $limit)) { } $totalarray['val']['t.budget_amount'] += $obj->budget_amount; if (!$i) { - $totalarray['totalbudget_amount'] = $totalarray['nbfield']; + $totalarray['totalbudget_amountfield'] = $totalarray['nbfield']; } $totalarray['totalbudgetamount'] += $obj->budget_amount; print ''; @@ -1269,7 +1296,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota print '
'; } elseif ($totalarray['totalbilledfield'] == $i) { print ''; - } elseif ($totalarray['totalbudget_amount'] == $i) { + } elseif ($totalarray['totalbudget_amountfield'] == $i) { print ''; } else { print ''; diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index ede24103bdb..b350ece39f4 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -268,6 +268,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } else { // Need to create a confattendee $confattendee->date_creation = dol_now(); + $confattendee->date_subscription = dol_now(); $confattendee->email = $email; $confattendee->fk_project = $project->id; $confattendee->fk_actioncomm = $id; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 65b12a91342..66b4af425e7 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -61,6 +61,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $refusepropal = GETPOST('refusepropal', 'alpha'); +$message = GETPOST('message', 'aZ09'); // Input are: // type ('invoice','order','contractline'), @@ -120,25 +121,33 @@ $creditor = $mysoc->name; $object = new Propal($db); $object->fetch(0, $ref); + /* * Actions */ if ($action == 'confirm_refusepropal') { + $db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$object->note_private."', date_signature='".$db->idate(dol_now())."'"; + $sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape($object->note_private)."', date_signature='".$db->idate(dol_now())."'"; $sql .= " WHERE rowid = ".((int) $object->id); + dol_syslog(__METHOD__, LOG_DEBUG); $resql = $db->query($sql); if (!$resql) { $error++; } + if (!$error) { $db->commit(); - setEventMessage("PropalRefused"); + + $message = 'refused'; + setEventMessages("PropalRefused", null, 'warning'); } else { $db->rollback(); } + $object->fetch(0, $ref); } @@ -367,7 +376,7 @@ if ($action == "dosign" && empty($cancel)) { success: function(response) { if(response == "success"){ console.log("Success on saving signature"); - window.location.replace("'.$_SERVER["SELF"].'?ref='.$ref.'"); + window.location.replace("'.$_SERVER["SELF"].'?ref='.$ref.'&message=signed"); }else{ console.error(response); } @@ -390,10 +399,18 @@ if ($action == "dosign" && empty($cancel)) { } else { if ($object->status == $object::STATUS_SIGNED) { print '
'; - print ''.$langs->trans("PropalAlreadySigned").''; + if ($message == 'signed') { + print ''.$langs->trans("PropalSigned").''; + } else { + print ''.$langs->trans("PropalAlreadySigned").''; + } } elseif ($object->status == $object::STATUS_NOTSIGNED) { print '
'; - print ''.$langs->trans("PropalAlreadyRefused").''; + if ($message == 'refused') { + print ''.$langs->trans("PropalRefused").''; + } else { + print ''.$langs->trans("PropalAlreadyRefused").''; + } } else { print ''; print ''; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index f44bc0b1c99..6674ce9c6de 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -83,6 +83,21 @@ if (empty($endpoint_secret)) { exit(); } +if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) { + // We set the user to use for all ipn actions in Dolibarr + $user = new User($db); + $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); + $user->getrights(); +} else { + print 'Error: Setup of module Stripe not complete for mode '.$service.'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.'; + http_response_code(400); // PHP 5.4 or greater + exit(); +} + + +// TODO Add a check on a security key + + /* * Actions @@ -110,10 +125,6 @@ try { $langs->load("main"); -// TODO Do we really need a user in setup just to have a name to fill an email topic when it is a technical system notification email -$user = new User($db); -$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); -$user->getrights(); if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc)) { $sql = "SELECT entity"; @@ -276,11 +287,11 @@ if ($event->type == 'payout.created') { $ret = $mailfile->sendfile(); - http_response_code(200); // PHP 5.4 or greater + http_response_code(200); return 1; } else { $error++; - http_response_code(500); // PHP 5.4 or greater + http_response_code(500); return -1; } } elseif ($event->type == 'customer.source.created') { @@ -385,4 +396,4 @@ if ($event->type == 'payout.created') { // This event is deprecated. } -http_response_code(200); // PHP 5.4 or greater +http_response_code(200); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 96953d93824..de6ccc2c7e7 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1351,9 +1351,10 @@ if ($action == 'create') { if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 1c368dc9caa..a7cec515e29 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -172,9 +172,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index a75dd432082..725c23ae738 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -149,9 +149,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($objectsrc->fk_project)) { $proj = new Project($db); $proj->fetch($objectsrc->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index a8b17665fa1..99916b8ed70 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -224,8 +224,9 @@ class FormResource $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); } elseif ($format == 3) { $value = $arraytypes['code']; + } elseif (empty($value)) { + print ' '; } - print $value ? $value : ' '; print ''; } } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index e6a8a02d59a..7b74283d90a 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -349,9 +349,7 @@ if (!$ret) { if (!empty($act->fk_project)) { $proj = new Project($db); $proj->fetch($act->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; } @@ -533,9 +531,10 @@ if (!$ret) { if (!empty($fichinter->fk_project)) { $proj = new Project($db); $proj->fetch($fichinter->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 0d47a90796f..3caf2afa7bd 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -48,6 +48,8 @@ $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $confirm = GETPOST('confirm'); $label = GETPOST('label', 'alphanohtml'); @@ -76,7 +78,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('salarycard', 'globalcard')); -$object = new Salary($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); @@ -98,6 +99,7 @@ $socid = GETPOSTINT('socid'); if ($user->socid) { $socid = $user->socid; } + restrictedArea($user, 'salaries', $object->id, 'salary', ''); @@ -105,9 +107,39 @@ restrictedArea($user, 'salaries', $object->id, 'salary', ''); * Actions */ -if ($cancel) { - header("Location: list.php"); - exit; +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + $error = 0; + + $backurlforlist = dol_buildpath('/salaries/list.php', 1); + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = dol_buildpath('/salaries/card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } + } + } + + if ($cancel) { + /*var_dump($cancel); + var_dump($backtopage);exit;*/ + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; + } } // Link to a project @@ -405,8 +437,7 @@ llxHeader("", $title, $help_url); $form = new Form($db); if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); -if ($id) { - $object = new Salary($db); +if ($id > 0) { $result = $object->fetch($id); if ($result <= 0) { dol_print_error($db); @@ -440,6 +471,12 @@ if ($action == 'create') { print ''; print ''; print ''; + if ($backtopage) { + print ''; + } + if ($backtopageforcancel) { + print ''; + } print load_fiche_titre($langs->trans("NewSalary"), '', 'salary'); @@ -750,9 +787,10 @@ if ($id) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index 47d03e62380..3181770cfcc 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -197,9 +197,10 @@ if ($object->id) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/salaries/info.php b/htdocs/salaries/info.php index 173e03c2c7d..b6a818e6f54 100644 --- a/htdocs/salaries/info.php +++ b/htdocs/salaries/info.php @@ -160,9 +160,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ab200397dc6..7c820f92e8e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -204,7 +204,7 @@ if (empty($reshook)) { $object->client = $object->client | $soc_origin->client; $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; $listofproperties = array( - 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'linkedin', 'socialnetworks', 'url', 'barcode', + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'socialnetworks', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', @@ -458,10 +458,7 @@ if (empty($reshook)) { $object->town = GETPOST('town', 'alphanohtml'); $object->country_id = GETPOST('country_id', 'int'); $object->state_id = GETPOST('state_id', 'int'); - //$object->skype = GETPOST('skype', 'alpha'); - //$object->twitter = GETPOST('twitter', 'alpha'); - //$object->facebook = GETPOST('facebook', 'alpha'); - //$object->linkedin = GETPOST('linkedin', 'alpha'); + $object->socialnetworks = array(); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -470,6 +467,7 @@ if (empty($reshook)) { } } } + $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); @@ -1045,10 +1043,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->zip = GETPOST('zipcode', 'alphanohtml'); $object->town = GETPOST('town', 'alphanohtml'); $object->state_id = GETPOST('state_id', 'int'); - //$object->skype = GETPOST('skype', 'alpha'); - //$object->twitter = GETPOST('twitter', 'alpha'); - //$object->facebook = GETPOST('facebook', 'alpha'); - //$object->linkedin = GETPOST('linkedin', 'alpha'); + $object->socialnetworks = array(); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -1057,6 +1052,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } } + $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); @@ -1785,10 +1781,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->town = GETPOST('town', 'alphanohtml'); $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; $object->state_id = GETPOST('state_id', 'int'); - //$object->skype = GETPOST('skype', 'alpha'); - //$object->twitter = GETPOST('twitter', 'alpha'); - //$object->facebook = GETPOST('facebook', 'alpha'); - //$object->linkedin = GETPOST('linkedin', 'alpha'); + $object->socialnetworks = array(); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -1797,6 +1790,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } } + $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); @@ -2495,7 +2489,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print '
'; - print '
'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).''.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).'
'; + print '
'; // Type Prospect/Customer/Supplier print '
'.$langs->trans('NatureOfThirdParty').''; @@ -2724,7 +2718,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print '
'; - print ''; + print '
'; // Tags / categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 0257b692b62..ab8153a39bc 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1799,6 +1799,11 @@ class Thirdparties extends DolibarrApi unset($object->twitter); unset($object->facebook); unset($object->linkedin); + unset($object->instagram); + unset($object->snapchat); + unset($object->googleplus); + unset($object->youtube); + unset($object->whatsapp); return $object; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 416c16e46a3..5c7eac48240 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -853,7 +853,7 @@ class Societe extends CommonObject $this->accountancy_code_customer = trim($this->code_compta); $this->accountancy_code_supplier = trim($this->code_compta_fournisseur); $this->accountancy_code_buy = trim($this->accountancy_code_buy); - $this->accountancy_code_sell= trim($this->accountancy_code_sell); + $this->accountancy_code_sell = trim($this->accountancy_code_sell); if (!empty($this->multicurrency_code)) { $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); @@ -917,8 +917,8 @@ class Societe extends CommonObject $sql .= ", ".(int) $this->fk_multicurrency; $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; } $sql .= ")"; @@ -931,9 +931,9 @@ class Societe extends CommonObject // update accountancy for this entity if (!$error && !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "societe_perentity WHERE fk_soc = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); + $this->db->query("DELETE FROM ".MAIN_DB_PREFIX."societe_perentity WHERE fk_soc = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_perentity ("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perentity ("; $sql .= " fk_soc"; $sql .= ", entity"; $sql .= ", accountancy_code_customer"; @@ -942,11 +942,11 @@ class Societe extends CommonObject $sql .= ", accountancy_code_sell"; $sql .= ") VALUES ("; $sql .= $this->id; - $sql .= ", " . $conf->entity; - $sql .= ", '" . $this->db->escape($this->accountancy_code_customer) . "'"; - $sql .= ", '" . $this->db->escape($this->accountancy_code_supplier) . "'"; - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ", ".$conf->entity; + $sql .= ", '".$this->db->escape($this->accountancy_code_customer)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_supplier)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; $sql .= ")"; $result = $this->db->query($sql); if (!$result) { @@ -1053,7 +1053,7 @@ class Societe extends CommonObject $error++; $this->error = $contact->error; $this->errors = array_merge($this->errors, $contact->errors); - dol_syslog(get_class($this) . "::create_individual Affect Tag ERROR:" . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::create_individual Affect Tag ERROR:".$this->error, LOG_ERR); $contactId = $result; } } @@ -1063,7 +1063,7 @@ class Societe extends CommonObject if ($result < 0) { $this->error = $contact->error; $this->errors = array_merge($this->errors, $contact->errors); - dol_syslog(get_class($this) . "::create_individual set mailing status ERROR:" . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::create_individual set mailing status ERROR:".$this->error, LOG_ERR); $contactId = $result; } } @@ -1299,7 +1299,7 @@ class Societe extends CommonObject } $this->code_compta_client = trim(empty($this->code_compta) ? $this->code_compta_client : $this->code_compta); - $this->code_compta = $this->code_compta_client; // for backward compatibility + $this->code_compta = $this->code_compta_client; // for backward compatibility $this->code_compta_fournisseur = trim($this->code_compta_fournisseur); // Check parameters. More tests are done later in the ->verify() @@ -1340,7 +1340,7 @@ class Societe extends CommonObject $this->webservices_key = trim($this->webservices_key); $this->accountancy_code_buy = trim($this->accountancy_code_buy); - $this->accountancy_code_sell= trim($this->accountancy_code_sell); + $this->accountancy_code_sell = trim($this->accountancy_code_sell); //Incoterms $this->fk_incoterms = (int) $this->fk_incoterms; @@ -1467,8 +1467,8 @@ class Societe extends CommonObject $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; if ($customer) { $sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null"); @@ -1559,9 +1559,9 @@ class Societe extends CommonObject // update accountancy for this entity if (!$error && !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "societe_perentity WHERE fk_soc = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); + $this->db->query("DELETE FROM ".MAIN_DB_PREFIX."societe_perentity WHERE fk_soc = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_perentity ("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perentity ("; $sql .= " fk_soc"; $sql .= ", entity"; $sql .= ", accountancy_code_customer"; @@ -1570,11 +1570,11 @@ class Societe extends CommonObject $sql .= ", accountancy_code_sell"; $sql .= ") VALUES ("; $sql .= $this->id; - $sql .= ", " . $conf->entity; - $sql .= ", '" . $this->db->escape($this->code_compta_client)."'"; - $sql .= ", '" . $this->db->escape($this->code_compta_fournisseur)."'"; - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ", ".$conf->entity; + $sql .= ", '".$this->db->escape($this->code_compta_client)."'"; + $sql .= ", '".$this->db->escape($this->code_compta_fournisseur)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; $sql .= ")"; $result = $this->db->query($sql); if (!$result) { @@ -1702,7 +1702,7 @@ class Societe extends CommonObject } $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); + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as e ON s.fk_effectif = e.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; @@ -1792,7 +1792,7 @@ class Societe extends CommonObject $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; $this->region_id = $obj->region_id; - $this->region_code = $obj->region_code; + $this->region_code = $obj->region_code; $this->state = ($obj->state != '-' ? $obj->state : ''); $transcode = $langs->trans('StatusProspect'.$obj->fk_stcomm); @@ -2630,7 +2630,7 @@ class Societe extends CommonObject $label .= '
'.implode(' ', $phonelist); } if (!empty($this->address)) { - $label .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country + $label .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country } elseif (!empty($this->country_code)) { $label .= '
'.$langs->trans('Country').': '.$this->country_code; } @@ -3350,7 +3350,7 @@ class Societe extends CommonObject if ($type == 'customer') { $this->code_compta_client = $mod->code; - $this->code_compta = $this->code_compta_client; // For backward compatibility + $this->code_compta = $this->code_compta_client; // For backward compatibility } elseif ($type == 'supplier') { $this->code_compta_fournisseur = $mod->code; } @@ -3385,7 +3385,7 @@ class Societe extends CommonObject if ($this->id) { // Check if the id we want to add as parent has not already one parent that is the current id we try to update if ($id > 0) { - $sameparent = $this->validateFamilyTree($id, $this->id, 0); + $sameparent = $this->validateFamilyTree($id, $this->id, 0); if ($sameparent < 0) { return -1; } @@ -3397,7 +3397,7 @@ class Societe extends CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe SET parent = '.($id > 0 ? $id : 'null').' WHERE rowid = '.((int) $this->id); - $resql = $this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->parent = $id; return 1; @@ -3426,16 +3426,16 @@ class Societe extends CommonObject $sql = 'SELECT s.parent'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= ' WHERE rowid = '.((int) $idparent); - $resql = $this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - if ($obj->parent == '') { + if ($obj->parent == '') { return 0; - } elseif ($obj->parent == $idchild) { + } elseif ($obj->parent == $idchild) { return 1; } else { - $sameparent = $this->validateFamilyTree($obj->parent, $idchild, ($counter + 1)); + $sameparent = $this->validateFamilyTree($obj->parent, $idchild, ($counter + 1)); } return $sameparent; } else { @@ -3936,7 +3936,7 @@ class Societe extends CommonObject */ public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') { - // phpcs:enable + // phpcs:enable global $conf, $user, $langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -4819,19 +4819,19 @@ class Societe extends CommonObject } $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET "; - $sql.= $field." = '".$this->db->escape($value)."'"; - $sql.= " WHERE rowid = ".((int) $this->id); + $sql .= $field." = '".$this->db->escape($value)."'"; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('COMPANY_MODIFY', $this, $user, $langs, $conf); + include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; + $interface = new Interfaces($this->db); + $result = $interface->run_triggers('COMPANY_MODIFY', $this, $user, $langs, $conf); if ($result < 0) { - $this->errors=$interface->errors; + $this->errors = $interface->errors; $this->db->rollback(); return -1; } @@ -4842,7 +4842,7 @@ class Societe extends CommonObject $this->db->commit(); return 1; } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d071e8f9921..ed836de658d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1007,12 +1007,12 @@ print '
'; if (!empty($arrayfields['s.rowid']['checked'])) { - print ''; } if (!empty($arrayfields['s.nom']['checked'])) { - print ''; print "\n"; print ''; if (!empty($arrayfields['s.rowid']['checked'])) { - print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder); } if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder); } if (!empty($arrayfields['s.name_alias']['checked'])) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder); @@ -1394,7 +1394,7 @@ while ($i < min($num, $limit)) { } print '>'; if (!empty($arrayfields['s.rowid']['checked'])) { - print '\n"; if (!$i) { @@ -1406,7 +1406,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['s.name_alias']['checked'])) { $companystatic->name_alias = ''; } - print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').'>'; + print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">'; if ($contextpage == 'poslist') { print $obj->name; } else { diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index a24b6a4776c..72246fdf9cb 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -374,7 +374,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Ref. Customer print ''; - print ''; + print ''; // VAT print '
'; + print ''; print ''; print ''; + print ''; if (!empty($search_nom_only) && empty($search_nom)) { $search_nom = $search_nom_only; } @@ -1243,10 +1243,10 @@ print '
'; + print ''; print $obj->rowid; print "
'.$langs->trans('RefCustomer').'
'.$langs->trans("VATRate").''; diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index a885cab03ed..125264e14d7 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -21,6 +21,8 @@ if (empty($conf) || !is_object($conf)) { exit; } +print ''; + // Sale representative print '
'; print '
'; @@ -45,7 +47,7 @@ if ($action == 'editsalesrepresentatives') { $arrayselected = $object->getSalesRepresentatives($user, 1); } print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%"); - print ''; + print ''; print ''; } else { $listsalesrepresentatives = $object->getSalesRepresentatives($user); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 6fc7f4df73a..a5837c2557f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1492,9 +1492,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 907c3bf26c3..9c84e2c2e89 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1019,7 +1019,7 @@ class SupplierProposal extends CommonObject $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, - empty($this->lines[$i]->label) ? '' : $this->lines[$i]->label, // deprecated + empty($this->lines[$i]->label) ? '' : $this->lines[$i]->label, // deprecated $this->lines[$i]->array_options, $this->lines[$i]->ref_fourn, $this->lines[$i]->fk_unit, @@ -1405,7 +1405,9 @@ class SupplierProposal extends CommonObject $soc = new Societe($this->db); $result = $soc->fetch($this->socid); - if ($result < 0) return -1; + if ($result < 0) { + return -1; + } // Define new ref if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index faa9127779c..f1756f17814 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -157,9 +157,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 3d5ce3fbb47..a8b85fc25b5 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -144,9 +144,10 @@ if ($object->id > 0) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php index 7d6d72276d8..0b796937d2e 100644 --- a/htdocs/supplier_proposal/info.php +++ b/htdocs/supplier_proposal/info.php @@ -99,9 +99,10 @@ if (!empty($conf->projet->enabled)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index 6466c6f42cb..5a19a94b402 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -128,9 +128,10 @@ if ($id > 0 || !empty($ref)) { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ' : '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 2c4da0515f1..8271103cfb6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1121,14 +1121,24 @@ if ($resql) { } $hookmanager->initHooks(array('takeposfrontend')); -$reshook = $hookmanager->executeHooks('ActionButtons'); -if (!empty($reshook)) { - if (is_array($reshook) && !isset($reshook['title'])) { - foreach ($reshook as $reshook) { - $menus[$r++] = $reshook; +$parameters = array('menus'=>$menus); +$reshook = $hookmanager->executeHooks('ActionButtons', $parameters); +if ($reshook == 0) { //add buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } elseif ($reshook == 1) { + $r = 0; //replace buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } } - } else { - $menus[$r++] = $reshook; } } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b3c13594939..d2e3c43a3aa 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -298,6 +298,9 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment { cursor: pointer; max-width: 350px; } +input.short { + width: 40px; +} .nofocusvisible:focus-visible { outline: none; } @@ -680,6 +683,12 @@ textarea.centpercent { .alignstart { text-align: start; } +.start { + text-align: start; +} +.end { + text-align: end; +} .left { text-align: ; } @@ -1423,7 +1432,7 @@ table[summary="list_of_modules"] .fa-cog { .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } .titlefield { /* width: 25%; */ width: 250px; } -.titlefieldmiddle { width: 50%; } +.titlefieldmiddle { width: 45%; } .titlefieldmax45 { max-width: 45%; } .imgmaxwidth180 { max-width: 180px; } .imgmaxheight50 { max-height: 50px; } @@ -1683,7 +1692,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select } .linkobject { cursor: pointer; } -table.tableforfield tr>td:first-of-type, tr.trforfield>td:first-of-type, div.tableforfield div.tagtr>div.tagtd:first-of-type { +table.tableforfield tr:not(.liste_titre)>td:first-of-type, tr.trforfield:not(.liste_titre)>td:first-of-type, div.tableforfield div.tagtr:not(.liste_titre)>div.tagtd:first-of-type { color: var(--tableforfieldcolor); } @@ -3376,6 +3385,15 @@ td.border, div.tagtable div div.border { width:auto; } +/* To have left column sticky +.tagtable td[data-key="ref"] { + position: sticky; + left: 0; + top: 0; + max-width: 150px !important; +} +*/ + /* Main boxes */ .nobordertop, .nobordertop tr:first-of-type td { @@ -4462,7 +4480,7 @@ div.titre { } div.fiche > table.table-fiche-title:first-of-type div { color: var(--colortexttitlenotab); - font-size: 1.05em; + font-size: 1.1em; /* text-transform: uppercase; */ /* font-weight: 600; */ } @@ -4756,7 +4774,7 @@ div.visible { display: block; } -div.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { +div.hidden, header.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { display: none; } .unvisible { diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3fe2552c86a..d1d47c568c5 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -150,13 +150,14 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { cursor: default; font-size: 10px; - line-height: 22px; - padding: 0px 3px; + line-height: 1.5em; + padding: 4px 3px; text-align: center; opacity: 1; -webkit-transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s; } + .box-flex-item.info-box-module.--disabled { /* opacity: 0.6; */ } diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index 7d0f75614c7..ec6472c80e6 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -64,7 +64,7 @@ top_httphead('text/json'); if (empty($dolibarr_nocache)) { header('Cache-Control: max-age=10800, public, must-revalidate'); // For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server - header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT'); + header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800).' GMT'); } else { header('Cache-Control: no-cache'); } @@ -79,8 +79,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { } -$manifest->theme_color = !empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR:'#F05F40'; -$manifest->background_color = !empty($conf->global->MAIN_MANIFEST_APPLI_BG_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_BG_COLOR:"#ffffff"; +$manifest->theme_color = !empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR) ? $conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR : '#F05F40'; +$manifest->background_color = !empty($conf->global->MAIN_MANIFEST_APPLI_BG_COLOR) ? $conf->global->MAIN_MANIFEST_APPLI_BG_COLOR : "#ffffff"; $manifest->display = "standalone"; $manifest->splash_pages = null; $manifest->icons = array(); @@ -97,8 +97,8 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) { $manifest->icons[] = $icon; } elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) { if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)) { - $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; - $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; + $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; + $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); if ($imgSize) { @@ -112,8 +112,8 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) { } if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)) { - $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; - $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; + $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; + $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); if ($imgSize) { @@ -127,8 +127,8 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) { } if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) { - $iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; - $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; + $iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; + $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); if ($imgSize) { diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index a363475c409..a4af0081aeb 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -242,8 +242,8 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { cursor: default; font-size: 10px; - line-height: 22px; - padding: 0px 3px; + line-height: 1.5em; + padding: 4px 3px; text-align: center; opacity: 1; -webkit-transition: opacity 0.5s, visibility 0s 0.5s; diff --git a/htdocs/theme/md/manifest.json.php b/htdocs/theme/md/manifest.json.php index b249e81e7df..2ad98e7e565 100644 --- a/htdocs/theme/md/manifest.json.php +++ b/htdocs/theme/md/manifest.json.php @@ -71,7 +71,7 @@ top_httphead('text/json'); if (empty($dolibarr_nocache)) { header('Cache-Control: max-age=10800, public, must-revalidate'); // For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server - header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT'); + header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800).' GMT'); } else { header('Cache-Control: no-cache'); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index bd4ebed0b49..4acf119eff7 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -441,6 +441,9 @@ input, select { input.button.massactionconfirmed { margin: 4px; } +input.short { + width: 40px; +} textarea { border-radius: 0; @@ -829,6 +832,12 @@ textarea.centpercent { .alignstart { text-align: start; } +.start { + text-align: start; +} +.end { + text-align: end; +} .left { text-align: ; } @@ -1699,7 +1708,7 @@ table[summary="list_of_modules"] .fa-cog { } .linkobject { cursor: pointer; } -table.tableforfield tr>td:first-of-type, tr.trforfield>td:first-of-type, div.tableforfield div.tagtr>div.tagtd:first-of-type { +table.tableforfield tr:not(.liste_titre)>td:first-of-type, tr.trforfield:not(.liste_titre)>td:first-of-type, div.tableforfield div.tagtr:not(.liste_titre)>div.tagtd:first-of-type { color: #666; } @@ -4651,7 +4660,7 @@ div.visible { display: block; } -div.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { +div.hidden, header.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { display: none; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 18e46d9750d..581ca8601e8 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1,8 +1,9 @@ - * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2018 Laurent Destailleur - * Copyright (C) 2021 Frédéric France +/* Copyright (C) 2013-2016 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018 Laurent Destailleur + * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021 Alexandre Spangaro * * 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 @@ -232,6 +233,12 @@ if (empty($reshook)) { } // Link ticket to project + if (GETPOST('origin', 'alpha') == 'projet') { + $projectid = GETPOST('originid', 'int'); + } else { + $projectid = GETPOST('projectid', 'int'); + } + if ($projectid > 0) { $object->setProject($projectid); } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 1b24775e10c..141cafa17fd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -886,10 +886,19 @@ foreach ($object->fields as $key => $val) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; } } +$totalarray = array( + 'nbfield' => 0, +); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, +); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; @@ -910,8 +919,7 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a // Loop on record // -------------------------------------------------------------------- $i = 0; -$totalarray = array(); -$totalarray['nbfield']=0; + $cacheofoutputfield = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 0f6b5302982..fa4c7231de5 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -83,7 +83,7 @@ $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire); $permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer)); // Ok if user->rights->salaries->read or user->rights->hrm->read -//$result = restrictedArea($user, 'salaries|hrm', $id, 'user&user', $feature2); +//$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2); $ok = false; if ($user->id == $id) { $ok = true; // A user can always read its own card @@ -203,8 +203,17 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) { } } +// update birth +if ($action == 'setbirth' && $canadduser && !$cancel) { + $object->birth = dol_mktime(0, 0, 0, GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); + $result = $object->update($user); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + // update personal email -if ($action == 'setpersonal_email' && $canadduser) { +if ($action == 'setpersonal_email' && $canadduser && !$cancel) { $object->personal_email = (string) GETPOST('personal_email', 'alphanohtml'); $result = $object->update($user); if ($result < 0) { @@ -213,7 +222,7 @@ if ($action == 'setpersonal_email' && $canadduser) { } // update personal mobile -if ($action == 'setpersonal_mobile' && $canadduser) { +if ($action == 'setpersonal_mobile' && $canadduser && !$cancel) { $object->personal_mobile = (string) GETPOST('personal_mobile', 'alphanohtml'); $result = $object->update($user); if ($result < 0) { @@ -288,23 +297,160 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; - print ''; - print ''; + print ''; + if (!empty($object->ldap_sid) && $object->statut == 0) { + print ''; + } else { + print ''; + } print ''; + + // Hierarchy + print ''; + print ''; + print "\n"; + + // Expense report validator + if (!empty($conf->expensereport->enabled)) { + print ''; + print ''; + print "\n"; + } + + // Holiday request validator + if (!empty($conf->holiday->enabled)) { + print ''; + print ''; + print "\n"; + } + + // Position/Job + print ''; + print ''; + print ''."\n"; + + // Weeklyhours + print ''; + print ''; + print "\n"; + + // Sensitive salary/value information + if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates + || (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall)) + || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) { + $langs->load("salaries"); + + // Salary + print ''; + print ''; + print "\n"; + + // THM + print ''; + print ''; + print "\n"; + + // TJM + print ''; + print ''; + print "\n"; + } + + // Date employment + print ''; + print ''; + print "\n"; + + // Date of birth + print ''; + print ''; + print "\n"; + + // Personal email print ''; print ''; print ''; + // Personal phone print ''; print ''; print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 1b6aeda7316..2e06d89c39c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -262,10 +262,6 @@ if (empty($reshook)) { $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); - //$object->skype = GETPOST("skype", 'alphanohtml'); - //$object->twitter = GETPOST("twitter", 'alphanohtml'); - //$object->facebook = GETPOST("facebook", 'alphanohtml'); - //$object->linkedin = GETPOST("linkedin", 'alphanohtml'); if (!empty($conf->socialnetworks->enabled)) { $object->socialnetworks = array(); foreach ($socialnetworks as $key => $value) { @@ -424,10 +420,7 @@ if (empty($reshook)) { $object->office_phone = GETPOST("office_phone", 'alphanohtml'); $object->office_fax = GETPOST("office_fax", 'alphanohtml'); $object->user_mobile = GETPOST("user_mobile", 'alphanohtml'); - //$object->skype = GETPOST("skype", 'alphanohtml'); - //$object->twitter = GETPOST("twitter", 'alphanohtml'); - //$object->facebook = GETPOST("facebook", 'alphanohtml'); - //$object->linkedin = GETPOST("linkedin", 'alphanohtml'); + if (!empty($conf->socialnetworks->enabled)) { $object->socialnetworks = array(); foreach ($socialnetworks as $key => $value) { @@ -436,6 +429,7 @@ if (empty($reshook)) { } } } + $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alphanohtml')); $object->job = GETPOST("job", 'alphanohtml'); $object->signature = GETPOST("signature", 'restricthtml'); @@ -1414,23 +1408,24 @@ if ($action == 'create' || $action == 'adduserldap') { // Login print ''; if (!empty($object->ldap_sid) && $object->statut == 0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; - // Administrator - print ''."\n"; - // Type print ''."\n"; - // TODO Move this into tab RH, visible when salarie or RH is visible (HierarchicalResponsible must be on both tab) + // TODO This is also available into the tab RH // Hierarchy print ''; @@ -1512,30 +1507,31 @@ if ($action == 'create' || $action == 'adduserldap') { print "\n"; } - // Default warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - print ''; - } - // Position/Job print ''; print ''; print ''."\n"; - if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && in_array($id, $childids)) + // Weeklyhours + print ''; + print ''; + print "\n"; + + // Sensitive salary/value information + if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates || (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) { - // Even a superior can't see this info of its subordinates wihtout $user->rights->salaries->read and $user->rights->hrm->employee->read (setting/viewing is reserverd to HR people). - // However, he can see the valuation of timesheet of its subordinates even without these permissions. $langs->load("salaries"); + // Salary + print ''; + print ''; + print "\n"; + // THM print ''; print "\n"; - - // Salary - print ''; - print ''; - print "\n"; } - // Weeklyhours - print ''; - print ''; - print "\n"; - // Date employment print ''; print ''; print "\n"; - // Date of birth - print ''; - print ''; - print "\n"; + // Default warehouse + if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + print ''; + } // Accountancy code if (!empty($conf->accounting->enabled)) { @@ -2342,6 +2329,18 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; } + // OpenID url + if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) { + print "".''; + print ''; + } print '
'.$langs->trans("Login").''.$object->login.'
'.$langs->trans("Login").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'.$langs->trans("HierarchicalResponsible").''; + if (empty($object->fk_user)) { + print ''.$langs->trans("None").''; + } else { + $huser = new User($db); + if ($object->fk_user > 0) { + $huser->fetch($object->fk_user); + print $huser->getNomUrl(1); + } else { + print ''.$langs->trans("None").''; + } + } + print '
'; + $text = $langs->trans("ForceUserExpenseValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ''; + if (!empty($object->fk_user_expense_validator)) { + $evuser = new User($db); + $evuser->fetch($object->fk_user_expense_validator); + print $evuser->getNomUrl(1); + } + print '
'; + $text = $langs->trans("ForceUserHolidayValidator"); + print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); + print ''; + if (!empty($object->fk_user_holiday_validator)) { + $hvuser = new User($db); + $hvuser->fetch($object->fk_user_holiday_validator); + print $hvuser->getNomUrl(1); + } + print '
'.$langs->trans("PostOrFunction").''.dol_escape_htmltag($object->job).'
'.$langs->trans("WeeklyHours").''; + print price2num($object->weeklyhours); + print '
'.$langs->trans("Salary").''; + print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').''.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').''; + print '
'; + $text = $langs->trans("THM"); + print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); + print ''; + print ($object->thm != '' ?price($object->thm, '', $langs, 1, -1, -1, $conf->currency) : ''); + print '
'; + $text = $langs->trans("TJM"); + print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm'); + print ''; + print ($object->tjm != '' ?price($object->tjm, '', $langs, 1, -1, -1, $conf->currency) : ''); + print '
'.$langs->trans("DateOfEmployment").''; + if ($object->dateemployment) { + print ''.$langs->trans("FromDate").' '; + print dol_print_date($object->dateemployment, 'day'); + } + if ($object->dateemploymentend) { + print ' - '.$langs->trans("To").' '; + print dol_print_date($object->dateemploymentend, 'day'); + } + print '
'; + print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer); + print ''; + print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer, 'day', $object->birth); + print '
'; print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer); print ''; - print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', ($object->personal_email != '' ? dol_print_email($object->personal_email) : '')); + print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', '', null, null, '', 0, 'dol_print_email'); print '
'; print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer); print ''; - print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', ($object->personal_mobile != '' ? dol_print_phone($object->personal_mobile) : '')); + print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', '', null, null, '', 0, 'dol_print_phone'); print '
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''.showValueWithClipboardCPButton($object->login).''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'.$langs->trans("Administrator").''; - if (!empty($conf->multicompany->enabled) && $object->admin && !$object->entity) { - print $form->textwithpicto(yn($object->admin), $langs->trans("SuperAdministratorDesc"), 1, "superadmin"); - } elseif ($object->admin) { - print $form->textwithpicto(yn($object->admin), $langs->trans("AdministratorDesc"), 1, "admin"); - } else { - print yn($object->admin); - } - print '
'; $text = $langs->trans("Type"); @@ -1461,7 +1456,7 @@ if ($action == 'create' || $action == 'adduserldap') { //print yn($object->employee); print '
'.$langs->trans("HierarchicalResponsible").'
'.$langs->trans("DefaultWarehouse").''; - if ($object->fk_warehouse > 0) { - $warehousestatic = new Entrepot($db); - $warehousestatic->fetch($object->fk_warehouse); - print $warehousestatic->getNomUrl(1); - } - print '
'.$langs->trans("PostOrFunction").''.dol_escape_htmltag($object->job).'
'.$langs->trans("WeeklyHours").''; + print price2num($object->weeklyhours); + print '
'.$langs->trans("Salary").''; + print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').''.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').''; + print '
'; $text = $langs->trans("THM"); @@ -1555,22 +1551,8 @@ if ($action == 'create' || $action == 'adduserldap') { print ($object->tjm != '' ?price($object->tjm, '', $langs, 1, -1, -1, $conf->currency) : ''); print '
'.$langs->trans("Salary").''; - print ($object->salary != '' ? img_picto('', 'salary', 'class="pictofixedwidth paddingright"').''.price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : '').''; - print '
'.$langs->trans("WeeklyHours").''; - print price2num($object->weeklyhours); - print '
'.$langs->trans("DateOfEmployment").''; @@ -1585,12 +1567,17 @@ if ($action == 'create' || $action == 'adduserldap') { print '
'.$langs->trans("DateOfBirth").''; - print dol_print_date($object->birth, 'day'); - print '
'.$langs->trans("DefaultWarehouse").''; + if ($object->fk_warehouse > 0) { + $warehousestatic = new Entrepot($db); + $warehousestatic->fetch($object->fk_warehouse); + print $warehousestatic->getNomUrl(1); + } + print '
'.$langs->trans("OpenIDURL").''; + if ($caneditfield) { + print ''; + } else { + print ''; + print $object->openid; + } + print '

'; @@ -2471,21 +2470,16 @@ if ($action == 'create' || $action == 'adduserldap') { } } - // OpenID url - if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) { - print "".''; - print '
'.$langs->trans("OpenIDURL").''; - if ($caneditfield) { - print ''; - } else { - print ''; - print $object->openid; - } + print '

'; + + // Default warehouse + if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + print ''; } - print '
'.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ' '; print '

'; - // Accountancy code if (!empty($conf->accounting->enabled)) { print ""; @@ -2643,14 +2637,6 @@ if ($action == 'create' || $action == 'adduserldap') { // TODO Move this into tab RH (HierarchicalResponsible must be on both tab) - // Default warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { - print ''; - } - // Position/Job print ''; print ''; - if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && in_array($id, $childids)) + // Weeklyhours + print ''; + print ''; + print "\n"; + + // Sensitive salary/value information + if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates || (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) { - $langs->load("salaries"); + $langs->load("salaries"); + + // Salary + print ''; + print ''; + print "\n"; // THM print ''; print "\n"; - - // Salary - print ''; - print ''; - print "\n"; } - // Weeklyhours - print ''; - print ''; - print "\n"; - // Date employment print ''; print '
'.$langs->trans("DefaultWarehouse").''; - print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); - print ' '; - print '
'.$langs->trans("PostOrFunction").''; @@ -2662,10 +2648,29 @@ if ($action == 'create' || $action == 'adduserldap') { } print '
'.$langs->trans("WeeklyHours").''; + if ($caneditfield) { + print ''; + } else { + print price2num($object->weeklyhours); + } + print '
'.$langs->trans("Salary").''; + print img_picto('', 'salary', 'class="pictofixedwidth paddingright"').''; + print '
'; @@ -2694,26 +2699,8 @@ if ($action == 'create' || $action == 'adduserldap') { } print '
'.$langs->trans("Salary").''; - print img_picto('', 'salary', 'class="pictofixedwidth paddingright"').''; - print '
'.$langs->trans("WeeklyHours").''; - if ($caneditfield) { - print ''; - } else { - print price2num($object->weeklyhours); - } - print '
'.$langs->trans("DateEmployment").''; diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 9362f815b3b..21d5b0bdd70 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -688,6 +688,7 @@ class Users extends DolibarrApi unset($object->lines); unset($object->model_pdf); + unset($object->skype); unset($object->twitter); unset($object->facebook); diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 9bd109ec5fb..e420c63cfa9 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -163,7 +163,25 @@ if ($object->id) { print ''; // Login - print ''; + print ''; + if (!empty($object->ldap_sid) && $object->statut == 0) { + print ''; + } else { + print ''; + } + print ''; // Nunber of files print ''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 924dceb14ab..c8dbdf2c1b8 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -137,11 +137,11 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $lastcreatedbox .='
'; - $lastcreatedbox .='
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("Login").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; - $lastcreatedbox .=''; - $lastcreatedbox .=''; - $lastcreatedbox .=''."\n"; + $lastcreatedbox .= '
'; + $lastcreatedbox .= '
'.$langs->trans("LastUsersCreated", min($num, $max)).''.$langs->trans("FullList").'
'; + $lastcreatedbox .= ''; + $lastcreatedbox .= ''; + $lastcreatedbox .= ''."\n"; $i = 0; while ($i < $num && $i < $max) { @@ -162,24 +162,24 @@ if ($resql) { $companystatic->code_client = $obj->code_client; $companystatic->canvas = $obj->canvas; - $lastcreatedbox .=''; - $lastcreatedbox .=''; + $lastcreatedbox .= '"; - $lastcreatedbox .=''; - $lastcreatedbox .=""; + $lastcreatedbox .= ''; + $lastcreatedbox .= "'; - $lastcreatedbox .=''; - $lastcreatedbox .=''; + $lastcreatedbox .= ''; + $lastcreatedbox .= ''; + $lastcreatedbox .= ''; - $lastcreatedbox .=''; + $lastcreatedbox .= ''; $i++; } - $lastcreatedbox .="
'.$langs->trans("LastUsersCreated", min($num, $max)).''.$langs->trans("FullList").'
'; - $lastcreatedbox .=$fuserstatic->getNomUrl(-1); + $lastcreatedbox .= '
'; + $lastcreatedbox .= $fuserstatic->getNomUrl(-1); if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) { - $lastcreatedbox .=img_picto($langs->trans("SuperAdministrator"), 'redstar'); + $lastcreatedbox .= img_picto($langs->trans("SuperAdministrator"), 'redstar'); } elseif ($obj->admin) { - $lastcreatedbox .=img_picto($langs->trans("Administrator"), 'star'); + $lastcreatedbox .= img_picto($langs->trans("Administrator"), 'star'); } - $lastcreatedbox .="'.$obj->login.'"; + $lastcreatedbox .= "'.$obj->login.'"; if ($obj->fk_soc) { - $lastcreatedbox .=$companystatic->getNomUrl(1); + $lastcreatedbox .= $companystatic->getNomUrl(1); } else { - $lastcreatedbox .=$langs->trans("InternalUser"); + $lastcreatedbox .= $langs->trans("InternalUser"); } if ($obj->ldap_sid) { - $lastcreatedbox .=' ('.$langs->trans("DomainUser").')'; + $lastcreatedbox .= ' ('.$langs->trans("DomainUser").')'; } $entity = $obj->entity; @@ -193,19 +193,19 @@ if ($resql) { $entitystring = $mc->label; } } - $lastcreatedbox .=($entitystring ? ' ('.$entitystring.')' : ''); + $lastcreatedbox .= ($entitystring ? ' ('.$entitystring.')' : ''); - $lastcreatedbox .=''.dol_print_date($db->jdate($obj->datec), 'dayhour').''; - $lastcreatedbox .=$fuserstatic->getLibStatut(3); - $lastcreatedbox .=''.dol_print_date($db->jdate($obj->datec), 'dayhour').''; + $lastcreatedbox .= $fuserstatic->getLibStatut(3); + $lastcreatedbox .= '
"; - $lastcreatedbox .="
"; + $lastcreatedbox .= "
"; + $lastcreatedbox .= "
"; $db->free($resql); } else { @@ -238,11 +238,11 @@ if ($canreadperms) { } $num = $db->num_rows($resql); - $lastgroupbox .='
'; - $lastgroupbox .=''; - $lastgroupbox .=''; - $lastgroupbox .=''; - $lastgroupbox .=''; + $lastgroupbox .= '
'; + $lastgroupbox .= '
'.$langs->trans("LastGroupsCreated", ($num ? $num : $max)).''.$langs->trans("FullList").'
'; + $lastgroupbox .= ''; + $lastgroupbox .= ''; + $lastgroupbox .= ''; $i = 0; $grouptemp = new UserGroup($db); @@ -254,21 +254,21 @@ if ($canreadperms) { $grouptemp->name = $obj->name; $grouptemp->note = $obj->note; - $lastgroupbox .=''; - $lastgroupbox .=''; + $lastgroupbox .= '"; + $lastgroupbox .= ""; if (!empty($conf->multicompany->enabled) && is_object($mc)) { $mc->getInfo($obj->entity); - $lastgroupbox .=''; + $lastgroupbox .= ''; } - $lastgroupbox .=''; - $lastgroupbox .=""; + $lastgroupbox .= ''; + $lastgroupbox .= ""; $i++; } $lastgroupbox .= "
'.$langs->trans("LastGroupsCreated", ($num ? $num : $max)).''.$langs->trans("FullList").'
'; - $lastgroupbox .=$grouptemp->getNomUrl(1); + $lastgroupbox .= '
'; + $lastgroupbox .= $grouptemp->getNomUrl(1); if (!$obj->entity) { - $lastgroupbox .=img_picto($langs->trans("GlobalGroup"), 'redstar'); + $lastgroupbox .= img_picto($langs->trans("GlobalGroup"), 'redstar'); } - $lastgroupbox .="'; - $lastgroupbox .=$mc->label; - $lastgroupbox .=''; + $lastgroupbox .= $mc->label; + $lastgroupbox .= ''.dol_print_date($db->jdate($obj->datec), 'dayhour').'
'.dol_print_date($db->jdate($obj->datec), 'dayhour').'
"; diff --git a/htdocs/user/note.php b/htdocs/user/note.php index ba8c10f351b..1cf1f112df4 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -112,7 +112,25 @@ if ($id) { print ''; // Login - print ''; + print ''; + if (!empty($object->ldap_sid) && $object->statut == 0) { + print ''; + } else { + print ''; + } + print ''; $editenabled = (($action == 'edit') && !empty($user->rights->user->user->creer)); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 48cbad46799..90a65593d31 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -164,9 +164,21 @@ if ($result > 0) { // Login print ''; if (!empty($object->ldap_sid) && $object->statut == 0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; @@ -349,21 +361,17 @@ if ($result > 0) { foreach($conf->global as $key => $val) { if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; print ''; @@ -384,9 +391,7 @@ if ($result > 0) { print ''; print ''; }*/ - /*if ($user->admin) - { - $var = ! $var; + /*if ($user->admin) { print ''; @@ -403,7 +408,7 @@ if ($result > 0) { // List $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,"; - $sql .= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; + $sql .= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail, c.statut as status,"; $sql .= " a.code, a.label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql .= " ".MAIN_DB_PREFIX."notify as n"; @@ -477,6 +482,8 @@ if ($result > 0) { $userstatic->id = $obj->id; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; + $userstatic->statut = $obj->status; + $userstatic->email = $obj->email; print $userstatic->getNomUrl(1); print $obj->email ? ' <'.$obj->email.'>' : $langs->trans("NoMail"); } else { @@ -497,13 +504,12 @@ if ($result > 0) { print ''; // TODO Add link to object here for other types /*print '';*/ + print '';*/ // print print''; print ''; diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 35997d16d6e..25eeec6430f 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -527,7 +527,7 @@ function createProductOrService($authentication, $product) $newobject->label = empty($product['label']) ? '' : $product['label']; $newobject->description = empty($product['description']) ? '' : $product['description']; $newobject->note_public = empty($product['note_public']) ? '' : $product['note_public']; - $newobject->note_private = empty($product['note_private']) ? '' :$product['note_private']; + $newobject->note_private = empty($product['note_private']) ? '' : $product['note_private']; $newobject->status = empty($product['status_tosell']) ? 0 : $product['status_tosell']; $newobject->status_buy = empty($product['status_tobuy']) ? 0 : $product['status_tobuy']; $newobject->price = isset($product['price_net']) ? $product['price_net'] : 0; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index ab23a55e525..f66f2c51f49 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -111,8 +111,8 @@ class Workstation extends CommonObject 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>512, 'notnull'=>-1, 'visible'=>-2,), 'nb_operators_required' => array('type'=>'integer', 'label'=>'NbOperatorsRequired', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), - 'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), - 'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), + 'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), + 'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMMachineEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled'),), ); public $rowid; diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 72fb91cfe85..0b670891583 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -38,8 +38,8 @@ class WorkstationResource extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'fk_workstation' => array ('type' => 'integer'), - 'fk_resource' => array ('type' => 'integer') + 'fk_workstation' => array('type' => 'integer'), + 'fk_resource' => array('type' => 'integer') ); /** diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index 86fdda7ce66..a40ea43143a 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -37,8 +37,8 @@ class WorkstationUserGroup extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'fk_workstation' => array ('type' => 'integer'), - 'fk_usergroup' => array ('type' => 'integer') + 'fk_workstation' => array('type' => 'integer'), + 'fk_usergroup' => array('type' => 'integer') ); /** diff --git a/htdocs/workstation/lib/workstation.lib.php b/htdocs/workstation/lib/workstation.lib.php index fc57575bcf9..92ea28d8bfb 100755 --- a/htdocs/workstation/lib/workstation.lib.php +++ b/htdocs/workstation/lib/workstation.lib.php @@ -34,7 +34,7 @@ function workstationAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT . "/admin/workstation.php"; + $head[$h][0] = DOL_URL_ROOT."/admin/workstation.php"; $head[$h][1] = $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++; diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index c68f1162790..2681164c857 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -360,13 +360,13 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; $this->assertTrue($ok, 'Found non escaped string in building of a sql request (case 1) in '.$file['relativename'].' - Bad.'); - // Check string sql|set...'".$yyy->xxx with xxx that is not 'escape', 'idate', .... It means we forget a db->escape when forging sql request. + // Check string sql|set|WHERE|...'".$yyy->xxx with xxx that is not 'escape', 'idate', .... It means we forget a db->escape when forging sql request. $ok=true; $matches=array(); - preg_match_all('/(sql|SET|WHERE|INSERT|VALUES).+\s*\'"\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER); + preg_match_all('/(sql|SET|WHERE|INSERT|VALUES).+\s*\'"\s*\.\s*\$(.......)/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { - if (! in_array($val[2], array('this->db-', 'this->esc', 'db->escap', 'dbs->esca', 'mydb->esc', 'dbsession', 'db->idate', 'escapedli', 'excludeGr', 'includeGr'))) { - $ok=false; + if (! in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) { + $ok=false; // This will generate error break; } //if ($reg[0] != 'db') $ok=false; diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 4b63450c332..0db809be2f7 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -83,7 +83,10 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') { - print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(1); + print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; + print "You can launch the test from command line with:\n"; + print "php -d date.timezone='Europe/Paris' phpunit DateLibTzFranceTest.php\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 81eff830b49..fe091b0fe47 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -874,6 +874,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase print "result = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result); + $result=dol_eval('$a=exec ("ls")', 1, 1); + print "result = ".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); + $result=dol_eval('$a="test"; $$a;', 1, 0); print "result = ".$result."\n"; $this->assertContains('Bad string syntax to evaluate', $result);
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("Login").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''; + print $langs->trans("LoginAccountDisableInDolibarr"); + print ''.$object->login.''; + $addadmin = ''; + if (property_exists($object, 'admin')) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); + } elseif (!empty($object->admin)) { + $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); + } + } + print showValueWithClipboardCPButton($object->login).$addadmin; + print '
'; - $listtmp=explode(',',$val); + $listtmp=explode(',', $val); $first=1; - foreach($listtmp as $keyemail => $valemail) - { + foreach($listtmp as $keyemail => $valemail) { if (! $first) print ', '; $first=0; $valemail=trim($valemail); //print $keyemail.' - '.$valemail.' - '.$reg[1].'
'; - if (isValidEmail($valemail, 1)) - { + if (isValidEmail($valemail, 1)) { if ($valemail == '__SUPERVISOREMAIL__') print $valemail; else print ' <'.$valemail.'>'; - } - else - { + } else { print ' '.img_warning().' '.$langs->trans("ErrorBadEMail",$valemail); } } @@ -373,8 +381,7 @@ if ($result > 0) { $notifcodecond=preg_replace('/^.*_(THRESHOLD_)/','$1',$reg[1]); $label=($langs->trans("Notify_".$notifcode)!="Notify_".$notifcode?$langs->trans("Notify_".$notifcode):$notifcode); print $label; - if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) - { + if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) { print ' - '.$langs->trans("IfAmountHigherThan",$regcond[1]); } print '
'.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
'; print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; print '
'; - if ($obj->object_type == 'order') - { + if ($obj->object_type == 'order') { $orderstatic->id=$obj->object_id; $orderstatic->ref=... print $orderstatic->getNomUrl(1); } - print ''.dol_print_date($db->jdate($obj->daten), 'dayhour').'