Merge remote-tracking branch 'upstream/develop' into 15a29

This commit is contained in:
Alexandre SPANGARO 2021-11-02 04:52:50 +01:00
commit dd7ee9e5f4
107 changed files with 1503 additions and 1337 deletions

View File

@ -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) ![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
## LICENCE ## LICENCE
Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure. Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure.
## INSTALLER DOLIBARR ## INSTALLER DOLIBARR
### Configuration simple ### 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 - Suivez les instructions de l'installateur
## METTRE A JOUR DOLIBARR ## METTRE A JOUR DOLIBARR
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: 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). - 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") 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 ## CE QUI EST NOUVEAU
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## CE QUE DOLIBARR PEUT FAIRE ## CE QUE DOLIBARR PEUT FAIRE
### Modules principaux (tous optionnels) ### 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é. - Peux être multi-société par ajout du module externe multi-société.
- Plusieurs thèmes visuels. - Plusieurs thèmes visuels.
- Application simple à utiliser. - 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. - Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP.
- APIs. - APIs.
- Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...) - 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). 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 ## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE
Voici un liste de fonctionnalités pas encore gérées par Dolibarr: 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 n'embarque pas de Webmail intégré nativement.
- Dolibarr ne fait pas le café (pas encore). - Dolibarr ne fait pas le café (pas encore).
## DOCUMENTATION ## 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). 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 ## CONTRIBUER
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]. Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a> [![Dolibarr](https://opencollective.com/dolibarr/contributors.svg?width=890&button=false)](https://github.com/Dolibarr/dolibarr/graphs/contributors)
## CREDITS ## 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) Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT)
## ACTUALITES ET RESEAUX SOCIAUX ## ACTUALITES ET RESEAUX SOCIAUX
Suivez le projet Dolibarr project sur les réseaux francophones Suivez le projet Dolibarr project sur les réseaux francophones

View File

@ -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. 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). - Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
@ -71,11 +71,9 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
- Follow the installer instructions - Follow the installer instructions
### Saas/Cloud setup ### 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 ## UPGRADING
@ -87,12 +85,10 @@ Dolibarr supports upgrading, usually without the need for any (commercial) suppo
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process. - 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*").  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 ## WHAT'S NEW
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## FEATURES ## FEATURES
### Main application/modules (all optional) ### Main application/modules (all optional)
@ -101,6 +97,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Members/Membership/Foundation management - Members/Membership/Foundation management
Product Management Product Management
- Products and/or Services catalog - Products and/or Services catalog
- Stock / Warehouse management + Inventory - Stock / Warehouse management + Inventory
- Barcodes - Barcodes
@ -110,6 +107,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Manufacturing Orders - Manufacturing Orders
Customer/Sales Management Customer/Sales Management
- Customers/Prospects + Contacts management - Customers/Prospects + Contacts management
- Opportunities or Leads management - Opportunities or Leads management
- Commercial proposals management - Commercial proposals management
@ -122,6 +120,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Point of Sale (POS) - Point of Sale (POS)
Supplier/Purchase Management Supplier/Purchase Management
- Suppliers/Vendors + Contacts - Suppliers/Vendors + Contacts
- Supplier (price) requests - Supplier (price) requests
- Purchase Orders management - Purchase Orders management
@ -130,6 +129,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- INCOTERMS - INCOTERMS
Finance / Accounting Finance / Accounting
- Invoices / Payments - Invoices / Payments
- Bank accounts management - Bank accounts management
- Direct debit orders management (European SEPA) - Direct debit orders management (European SEPA)
@ -140,18 +140,19 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Reports - Reports
Collaboration Collaboration
- Shared calendar/agenda (with ical and vcal export for third party tools integration) - Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Projects & Tasks management - Projects & Tasks management
- Ticket System - Ticket System
- Surveys - Surveys
HR HR
- Employee's leave requests management - Employee's leave requests management
- Expense reports - Expense reports
- Recruitment management - Recruitment management
- Timesheets - Timesheets
### Other application/modules ### Other application/modules
- Electronic Document Management (EDM) - Electronic Document Management (EDM)
@ -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) (around 100 modules available by default, 1000+ on the addon market place)
### Other general features ### Other general features
- Localization in most major languages - Localization in most major languages
@ -190,13 +190,12 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Canadian double taxes (federal/province) and other countries using cumulative VAT - Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp - Tunisian tax stamp
- Argentina invoice numbering using A,B,C... - 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 - Compatible with European GDPR rules
- ... - ...
- Flexible PDF & ODT generation for invoices, proposals, orders... - Flexible PDF & ODT generation for invoices, proposals, orders...
- ... - ...
### System Environment / Requirements ### System Environment / Requirements
- PHP - PHP
@ -205,12 +204,10 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite) See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)
### Extending ### 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). 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 ## WHAT DOLIBARR CAN'T DO YET
These are features that Dolibarr does **not** yet fully support: These are features that Dolibarr does **not** yet fully support:
@ -220,12 +217,10 @@ 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. - 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) - Dolibarr can't do coffee (yet)
## DOCUMENTATION ## DOCUMENTATION
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org). Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
## CONTRIBUTING ## CONTRIBUTING
This project exists thanks to all the people who contribute. This project exists thanks to all the people who contribute.
@ -233,8 +228,7 @@ Please read the instructions how to contribute (report a bug/error, a feature re
A view on Contributors: A view on Contributors:
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a> [![Dolibarr](https://opencollective.com/dolibarr/contributors.svg?width=890&button=false)](https://github.com/Dolibarr/dolibarr/graphs/contributors)
## CREDITS ## 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. See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
## NEWS AND SOCIAL NETWORKS ## NEWS AND SOCIAL NETWORKS
Follow Dolibarr project on: Follow Dolibarr project on:
@ -253,8 +246,6 @@ Follow Dolibarr project on:
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr) - [GitHub](https://github.com/Dolibarr/dolibarr)
### Sponsors ### Sponsors
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)] Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]

View File

@ -199,7 +199,7 @@ if ($action == 'update') {
$nb_exists = $db->num_rows($resql_exists); $nb_exists = $db->num_rows($resql_exists);
if ($nb_exists <= 0) { if ($nb_exists <= 0) {
// insert // 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) . "')"; $sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
} else { } else {
$obj_exists = $db->fetch_object($resql_exists); $obj_exists = $db->fetch_object($resql_exists);

View File

@ -1788,13 +1788,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border tableforfield tableforfield centpercent">'; print '<table class="border tableforfield tableforfield centpercent">';
// Birth Date // Tags / Categories
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>'; print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
@ -1802,6 +1796,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>'; print '</td></tr>';
} }
// Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Other attributes // Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';

View File

@ -209,7 +209,6 @@ if ($result > 0) {
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close();
} else { } else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@ -170,7 +170,6 @@ if ($result > 0) {
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close();
} else { } else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@ -290,24 +290,24 @@ if (function_exists("ldap_connect")) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>';
} }
if ($_GET["action"] == 'test') { if ($action == 'test') {
$ldap = new Ldap(); // Les parametres sont passes et recuperes via $conf $ldap = new Ldap(); // Les parametres sont passes et recuperes via $conf
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) { if ($result > 0) {
// Test ldap connect and bind // Test ldap connect and bind
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>'; print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
print '<br>'; print '<br>';
if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) { if (!empty($conf->global->LDAP_ADMIN_DN) && !empty($conf->global->LDAP_ADMIN_PASS)) {
if ($result == 2) { if ($result == 2) {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<span class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>'; print '<span class="ok">'.$langs->trans("LDAPBindOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<br>'; print '<br>';
} else { } else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<span class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>'; print '<span class="error">'.$langs->trans("LDAPBindKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<br>'; print '<br>';
print $langs->trans("Error").' '.$ldap->error; print $langs->trans("Error").' '.$ldap->error;
print '<br>'; print '<br>';
@ -330,10 +330,10 @@ if (function_exists("ldap_connect")) {
print '<br>'; print '<br>';
} }
$unbind = $ldap->unbind(); $ldap->unbind();
} else { } else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>'; print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
print '<br>'; print '<br>';
print $langs->trans("Error").' '.$ldap->error; print $langs->trans("Error").' '.$ldap->error;
print '<br>'; print '<br>';

View File

@ -192,7 +192,7 @@ print "</tr>\n";
// DN Pour les utilisateurs // DN Pour les utilisateurs
print '<!-- LDAP_USER_DN -->'; print '<!-- LDAP_USER_DN -->';
print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserDn").'</span></td><td>'; print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserDn").'</span></td><td>';
print '<input size="48" type="text" name="user" value="'.$conf->global->LDAP_USER_DN.'">'; print '<input size="48" type="text" name="user" value="'.getDolGlobalString('LDAP_USER_DN').'">';
print '</td><td>'.$langs->trans("LDAPUserDnExample").'</td>'; print '</td><td>'.$langs->trans("LDAPUserDnExample").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -200,7 +200,7 @@ print '</tr>';
// List of object class used to define attributes in structure // List of object class used to define attributes in structure
print '<!-- LDAP_USER_OBJECT_CLASS -->'; print '<!-- LDAP_USER_OBJECT_CLASS -->';
print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserObjectClassList").'</span></td><td>'; print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserObjectClassList").'</span></td><td>';
print '<input size="48" type="text" name="objectclass" value="'.$conf->global->LDAP_USER_OBJECT_CLASS.'">'; print '<input size="48" type="text" name="objectclass" value="'.getDolGlobalString('LDAP_USER_OBJECT_CLASS').'">';
print '</td><td>'.$langs->trans("LDAPUserObjectClassListExample").'</td>'; print '</td><td>'.$langs->trans("LDAPUserObjectClassListExample").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -208,7 +208,7 @@ print '</tr>';
// Filter, used to filter search // Filter, used to filter search
print '<!-- LDAP_FILTER_CONNECTION -->'; print '<!-- LDAP_FILTER_CONNECTION -->';
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFilterConnection").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">'; print '<input size="48" type="text" name="filterconnection" value="'.getDolGlobalString('LDAP_FILTER_CONNECTION').'">';
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
print '<td></td>'; print '<td></td>';
print '</tr>'; print '</tr>';
@ -225,168 +225,168 @@ print "</tr>\n";
// Common name // Common name
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFullname").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_FIELD_FULLNAME.'">'; print '<input size="25" type="text" name="fieldfullname" value="'.getDolGlobalString('LDAP_FIELD_FULLNAME').'">';
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FULLNAME) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FULLNAME') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Name // Name
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldName").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldName").'</td><td>';
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_FIELD_NAME.'">'; print '<input size="25" type="text" name="fieldname" value="'.getDolGlobalString('LDAP_FIELD_NAME').'">';
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_NAME) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_NAME') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Firstname // Firstname
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'">'; print '<input size="25" type="text" name="fieldfirstname" value="'.getDolGlobalString('LDAP_FIELD_FIRSTNAME').'">';
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FIRSTNAME) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FIRSTNAME') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Login unix // Login unix
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_FIELD_LOGIN.'">'; print '<input size="25" type="text" name="fieldlogin" value="'.getDolGlobalString('LDAP_FIELD_LOGIN').'">';
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Login samba // Login samba
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_FIELD_LOGIN_SAMBA.'">'; print '<input size="25" type="text" name="fieldloginsamba" value="'.getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA').'">';
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN_SAMBA) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Password not crypted // Password not crypted
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">'; print '<input size="25" type="text" name="fieldpassword" value="'.getDolGlobalString('LDAP_FIELD_PASSWORD').'">';
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Password crypted // Password crypted
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">'; print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED').'">';
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Mail // Mail
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMail").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_FIELD_MAIL.'">'; print '<input size="25" type="text" name="fieldmail" value="'.getDolGlobalString('LDAP_FIELD_MAIL').'">';
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MAIL) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MAIL') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Phone // Phone
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPhone").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_FIELD_PHONE.'">'; print '<input size="25" type="text" name="fieldphone" value="'.getDolGlobalString('LDAP_FIELD_PHONE').'">';
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_PHONE) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_PHONE') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Mobile // Mobile
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMobile").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_FIELD_MOBILE.'">'; print '<input size="25" type="text" name="fieldmobile" value="'.getDolGlobalString('LDAP_FIELD_MOBILE').'">';
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MOBILE) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MOBILE') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Skype // Skype
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
print '<input size="25" type="text" name="fieldskype" value="'.$conf->global->LDAP_FIELD_SKYPE.'">'; print '<input size="25" type="text" name="fieldskype" value="'.getDolGlobalString('LDAP_FIELD_SKYPE').'">';
print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SKYPE) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SKYPE') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Fax // Fax
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_FIELD_FAX.'">'; print '<input size="25" type="text" name="fieldfax" value="'.getDolGlobalString('LDAP_FIELD_FAX').'">';
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FAX) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FAX') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Company // Company
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_FIELD_COMPANY.'">'; print '<input size="25" type="text" name="fieldcompany" value="'.getDolGlobalString('LDAP_FIELD_COMPANY').'">';
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Address // Address
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">'; print '<input size="25" type="text" name="fieldaddress" value="'.getDolGlobalString('LDAP_FIELD_ADDRESS').'">';
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// ZIP // ZIP
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">'; print '<input size="25" type="text" name="fieldzip" value="'.getDolGlobalString('LDAP_FIELD_ZIP').'">';
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// TOWN // TOWN
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">'; print '<input size="25" type="text" name="fieldtown" value="'.getDolGlobalString('LDAP_FIELD_TOWN').'">';
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// COUNTRY // COUNTRY
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">'; print '<input size="25" type="text" name="fieldcountry" value="'.getDolGlobalString('LDAP_FIELD_COUNTRY').'">';
print '</td><td>&nbsp;</td>'; print '</td><td>&nbsp;</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Title // Title
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">'; print '<input size="25" type="text" name="fieldtitle" value="'.getDolGlobalString('LDAP_FIELD_TITLE').'">';
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Note // Note
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">'; print '<input size="25" type="text" name="fielddescription" value="'.getDolGlobalString('LDAP_FIELD_DESCRIPTION').'">';
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Sid // Sid
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSid").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSid").'</td><td>';
print '<input size="25" type="text" name="fieldsid" value="'.$conf->global->LDAP_FIELD_SID.'">'; print '<input size="25" type="text" name="fieldsid" value="'.getDolGlobalString('LDAP_FIELD_SID').'">';
print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>';
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) ? ' checked' : '')."></td>"; print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SID') ? ' checked' : '')."></td>";
print '</tr>'; print '</tr>';
// Group id // Group id
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldGroupid").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldGroupid").'</td><td>';
print '<input size="25" type="text" name="fieldgroupid" value="'.$conf->global->LDAP_FIELD_GROUPID.'">'; print '<input size="25" type="text" name="fieldgroupid" value="'.getDolGlobalString('LDAP_FIELD_GROUPID').'">';
print '</td><td>'.$langs->trans("LDAPFieldGroupidExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldGroupidExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Userid // Userid
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldUserid").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldUserid").'</td><td>';
print '<input size="25" type="text" name="fielduserid" value="'.$conf->global->LDAP_FIELD_USERID.'">'; print '<input size="25" type="text" name="fielduserid" value="'.getDolGlobalString('LDAP_FIELD_USERID').'">';
print '</td><td>'.$langs->trans("LDAPFieldUseridExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldUseridExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Home Directory // Home Directory
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectory").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectory").'</td><td>';
print '<input size="25" type="text" name="fieldhomedirectory" value="'.$conf->global->LDAP_FIELD_HOMEDIRECTORY.'">'; print '<input size="25" type="text" name="fieldhomedirectory" value="'.getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY').'">';
print '</td><td>'.$langs->trans("LDAPFieldHomedirectoryExample").'</td>'; print '</td><td>'.$langs->trans("LDAPFieldHomedirectoryExample").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Home Directory Prefix // Home Directory Prefix
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectoryprefix").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectoryprefix").'</td><td>';
print '<input size="25" type="text" name="fieldhomedirectoryprefix" value="'.$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX.'">'; print '<input size="25" type="text" name="fieldhomedirectoryprefix" value="'.getDolGlobalString('LDAP_FIELD_HOMEDIRECTORYPREFIX').'">';
print '</td><td></td>'; print '</td><td></td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -405,20 +405,20 @@ print '</form>';
/* /*
* Test de la connexion * Test de la connexion
*/ */
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') { if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'dolibarr2ldap') {
$butlabel = $langs->trans("LDAPTestSynchroUser"); $butlabel = $langs->trans("LDAPTestSynchroUser");
$testlabel = 'testuser'; $testlabel = 'testuser';
$key = $conf->global->LDAP_KEY_USERS; $key = getDolGlobalString('LDAP_KEY_USERS');
$dn = $conf->global->LDAP_USER_DN; $dn = getDolGlobalString('LDAP_USER_DN');
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS; $objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass); show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') { } elseif (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'ldap2dolibarr') {
$butlabel = $langs->trans("LDAPTestSearch"); $butlabel = $langs->trans("LDAPTestSearch");
$testlabel = 'testsearchuser'; $testlabel = 'testsearchuser';
$key = $conf->global->LDAP_KEY_USERS; $key = getDolGlobalString('LDAP_KEY_USERS');
$dn = $conf->global->LDAP_USER_DN; $dn = getDolGlobalString('LDAP_USER_DN');
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS; $objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass); show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
} }
@ -479,29 +479,29 @@ if (function_exists("ldap_connect")) {
if ($result > 0) { if ($result > 0) {
$required_fields = array( $required_fields = array(
$conf->global->LDAP_KEY_USERS, getDolGlobalString('LDAP_KEY_USERS'),
$conf->global->LDAP_FIELD_FULLNAME, getDolGlobalString('LDAP_FIELD_FULLNAME'),
$conf->global->LDAP_FIELD_NAME, getDolGlobalString('LDAP_FIELD_NAME'),
$conf->global->LDAP_FIELD_FIRSTNAME, getDolGlobalString('LDAP_FIELD_FIRSTNAME'),
$conf->global->LDAP_FIELD_LOGIN, getDolGlobalString('LDAP_FIELD_LOGIN'),
$conf->global->LDAP_FIELD_LOGIN_SAMBA, getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'),
$conf->global->LDAP_FIELD_PASSWORD, getDolGlobalString('LDAP_FIELD_PASSWORD'),
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED, getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED'),
$conf->global->LDAP_FIELD_PHONE, getDolGlobalString('LDAP_FIELD_PHONE'),
$conf->global->LDAP_FIELD_FAX, getDolGlobalString('LDAP_FIELD_FAX'),
$conf->global->LDAP_FIELD_SKYPE, getDolGlobalString('LDAP_FIELD_SKYPE'),
$conf->global->LDAP_FIELD_MOBILE, getDolGlobalString('LDAP_FIELD_MOBILE'),
$conf->global->LDAP_FIELD_MAIL, getDolGlobalString('LDAP_FIELD_MAIL'),
$conf->global->LDAP_FIELD_TITLE, getDolGlobalString('LDAP_FIELD_TITLE'),
$conf->global->LDAP_FIELD_DESCRIPTION, getDolGlobalString('LDAP_FIELD_DESCRIPTION'),
$conf->global->LDAP_FIELD_SID getDolGlobalString('LDAP_FIELD_SID')
); );
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated // Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement"))); $required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
// Get from LDAP database an array of results // Get from LDAP database an array of results
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); $ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1);
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1); //$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
if (is_array($ldapusers)) { if (is_array($ldapusers)) {
@ -523,8 +523,8 @@ if (function_exists("ldap_connect")) {
print "<br>\n"; print "<br>\n";
print "LDAP search for user:<br>\n"; print "LDAP search for user:<br>\n";
print "search: *<br>\n"; print "search: *<br>\n";
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n"; print "userDN: ".getDolGlobalString('LDAP_USER_DN')."<br>\n";
print "useridentifier: ".$conf->global->LDAP_KEY_USERS."<br>\n"; print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')."<br>\n";
print "required_fields: ".implode(',', $required_fields)."<br>\n"; print "required_fields: ".implode(',', $required_fields)."<br>\n";
print "=> ".count($liste)." records<br>\n"; print "=> ".count($liste)." records<br>\n";
print "\n<br>"; print "\n<br>";

View File

@ -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 = "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 .= " 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"; $sql .= " ORDER BY t.taux ASC";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {

View File

@ -848,8 +848,19 @@ if ($action == 'edit') {
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD); $text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
} }
} }
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$dnsinfo = false;
if (!empty($companyemail) && function_exists('dns_get_record')) {
$domain = array_pop(explode('@', $companyemail));
$dnsinfo = dns_get_record($domain, DNS_TXT);
}
if (!empty($dnsinfo) && is_array($dnsinfo)) {
foreach ($dnsinfo as $info) {
if (strpos($info['txt'], 'v=spf') !== false) {
$text .= ($text ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
}
}
}
if ($text) { if ($text) {
print info_admin($text); print info_admin($text);
} }

View File

@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $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 $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
} }
print "</td>";
print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>'; print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
@ -693,6 +695,9 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $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 $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
} }
print "</td>";
print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>'; print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $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 $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER);
} }
print "</td>";
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringProject").'</td>';
print '<td class="right">';
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 '</td>';
print "</tr>\n";
*/
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));

View File

@ -169,7 +169,11 @@ if ($action == 'create') {
// Target // Target
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>'; print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow")); $liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); $defaulttarget = 1;
if ($url && !preg_match('/^http/i', $url)) {
$defaulttarget = 0;
}
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : $defaulttarget, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>'; print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>';
// Owner // Owner

View File

@ -62,9 +62,9 @@ $id = GETPOST("id", 'int');
$object = new Bookmark($db); $object = new Bookmark($db);
$permissiontoread = $user->rights->bookmark->lire; $permissiontoread = !empty($user->rights->bookmark->lire);
$permissiontoadd = $user->rights->bookmark->write; $permissiontoadd = !empty($user->rights->bookmark->creer);
$permissiontodelete = $user->rights->bookmark->delete; $permissiontodelete = !empty($user->rights->bookmark->supprimer);
/* /*

View File

@ -1976,6 +1976,12 @@ class Categorie extends CommonObject
if ($type == 'bank_account') { if ($type == 'bank_account') {
$type = 'account'; $type = 'account';
} }
if ($type == 'customer') {
$type = 'societe';
}
if ($type == 'supplier') {
$type = 'fournisseur';
}
if (empty($searchList) && !is_array($searchList)) { if (empty($searchList) && !is_array($searchList)) {
return ""; return "";

View File

@ -795,7 +795,7 @@ if ($type == Categorie::TYPE_CONTACT) {
$permission = $user->rights->societe->creer; $permission = $user->rights->societe->creer;
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($contacts < 0) { if (is_numeric($contacts) && $contacts < 0) {
dol_print_error($db, $object->error, $object->errors); dol_print_error($db, $object->error, $object->errors);
} else { } else {
// Form to add record into a category // Form to add record into a category

View File

@ -1474,7 +1474,7 @@ if ($id > 0) {
print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">'; print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">';
print '<input type="hidden" name="page_y" value="">'; print '<input type="hidden" name="page_y" value="">';
if ($backtopage) { if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : htmlentities($_SERVER["HTTP_REFERER"])).'">'; print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
} }
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'; print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
@ -2210,7 +2210,7 @@ if ($id > 0) {
$delallowed = $user->rights->agenda->myactions->create; $delallowed = $user->rights->agenda->myactions->create;
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang); print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang());
print '</div><div class="fichehalfright">'; print '</div><div class="fichehalfright">';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com> * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -629,14 +629,17 @@ print $nav;
$s = $newtitle; $s = $newtitle;
// Calendars from hooks // Calendars from hooks
$parameters = array(); $object = null; $parameters = array();
$object = null;
$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
if (empty($reshook)) { if (empty($reshook)) {
$s .= $hookmanager->resPrint; $s .= $hookmanager->resPrint;
} elseif ($reshook > 1) { } elseif ($reshook > 1) {
$s = $hookmanager->resPrint; $s = $hookmanager->resPrint;
} }
$viewyear = is_object($object) ? dol_print_date($object->datep, '%Y') : '';
$viewmonth = is_object($object) ? dol_print_date($object->datep, '%m') : '';
$viewday = is_object($object) ? dol_print_date($object->datep, '%d') : '';
$viewmode = ''; $viewmode = '';
$viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">'; $viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">'; //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
@ -644,25 +647,25 @@ $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewm
//$viewmode .= '</span>'; //$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>'; $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">'; $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">'; //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"'); $viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
//$viewmode .= '</span>'; //$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>'; $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">'; $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">'; //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"'); $viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= '</span>'; //$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>'; $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">'; $viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">'; //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"'); $viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= '</span>'; //$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>'; $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
$viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">'; $viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.$viewyear.'&month='.$viewmonth.'&day='.$viewday.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">'; //$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"'); $viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= '</span>'; //$viewmode .= '</span>';
@ -671,7 +674,8 @@ $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsm
$viewmode .= '<span class="marginrightonly"></span>'; $viewmode .= '<span class="marginrightonly"></span>';
// Add more views from hooks // Add more views from hooks
$parameters = array(); $object = null; $parameters = array();
$object = null;
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) { if (empty($reshook)) {
$viewmode .= $hookmanager->resPrint; $viewmode .= $hookmanager->resPrint;
@ -681,7 +685,7 @@ if (empty($reshook)) {
$tmpforcreatebutton = dol_getdate(dol_now(), true); $tmpforcreatebutton = dol_getdate(dol_now(), true);
$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
//$param='month='.$monthshown.'&year='.$year; //$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000'; $hourminsec = '100000';

View File

@ -377,7 +377,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n"; $s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) { 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 .= '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";
$s .= '</script>'."\n"; $s .= '</script>'."\n";

View File

@ -387,7 +387,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n"; $s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) { 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 .= '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";
$s .= '</script>'."\n"; $s .= '</script>'."\n";

View File

@ -1383,10 +1383,24 @@ if ($resql) {
if (!empty($arrayfields['sale_representative']['checked'])) { if (!empty($arrayfields['sale_representative']['checked'])) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); 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 // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // 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 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) { if (!empty($arrayfields['p.datec']['checked'])) {
@ -1412,12 +1426,6 @@ if ($resql) {
$now = dol_now(); $now = dol_now();
$i = 0; $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; $typenArray = null;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {

View File

@ -8,7 +8,7 @@
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -64,11 +64,12 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id); $contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
$massaction = GETPOST('massaction', 'alpha');
// Security check // Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid'); $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
if ($fielvalue) { if ($fieldvalue) {
if ($user->socid) { if ($user->socid) {
$socid = $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_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha'); $search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int'); $search_conciliated = GETPOST("search_conciliated", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$num_releve = GETPOST("num_releve", "alpha"); $num_releve = GETPOST("num_releve", "alpha");
if (empty($dateop)) { if (empty($dateop)) {
$dateop = -1; $dateop = -1;
@ -211,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = ''; $search_thirdparty_user = '';
$search_num_releve = ''; $search_num_releve = '';
$search_conciliated = ''; $search_conciliated = '';
$toselect = '';
$search_account = ""; $search_account = "";
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
@ -221,14 +225,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
if (empty($reshook)) { if (empty($reshook)) {
$objectclass = 'Account'; $objectclass = 'Account';
$objectlabel = 'BankTransaction'; $objectlabel = 'BankTransaction';
$permissiontoread = $user->rights->banque->lire; $permissiontoread = !empty($user->rights->banque->lire);
$permissiontodelete = $user->rights->banque->supprimer; $permissiontodelete = !empty($user->rights->banque->modifier);
$uploaddir = $conf->bank->dir_output; $uploaddir = $conf->bank->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
// Conciliation // 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')))) { && (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) {
$error = 0; $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; $error = 0;
if (price2num(GETPOST("addcredit")) > 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); $accline = new AccountLine($db);
$result = $accline->fetch(GETPOST("rowid", "int")); $result = $accline->fetch(GETPOST("rowid", "int"));
$result = $accline->delete($user); $result = $accline->delete($user);
@ -484,6 +488,11 @@ if ($optioncss != '') {
if ($action == 'reconcile') { if ($action == 'reconcile') {
$param .= '&action=reconcile'; $param .= '&action=reconcile';
} }
$totalarray = array(
'nbfield' => 0,
'totalcred' => 0,
'totaldeb' => 0,
);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 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_account as ba,";
$sql .= " ".MAIN_DB_PREFIX."bank as b"; $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 .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
} }
$sql .= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
@ -732,7 +741,7 @@ $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($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 // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
@ -759,7 +768,9 @@ if ($resql) {
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="'.($action ? $action : 'search').'">'; print '<input type="hidden" name="action" value="'.($action ? $action : 'search').'">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">'; if (!empty($view)) {
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
}
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
@ -833,7 +844,7 @@ if ($resql) {
} }
// Form to add a transaction with no invoice // 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 load_fiche_titre($langs->trans("AddBankRecordLong"), '', '');
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -939,6 +950,7 @@ if ($resql) {
} }
} }
$morehtml = '';
/*$morehtml = '<div class="inline-block '.(($buttonreconcile || $newcardbutton) ? 'marginrightonly' : '').'">'; /*$morehtml = '<div class="inline-block '.(($buttonreconcile || $newcardbutton) ? 'marginrightonly' : '').'">';
$morehtml .= '<label for="pageplusone">'.$langs->trans("Page")."</label> "; // ' Page '; $morehtml .= '<label for="pageplusone">'.$langs->trans("Page")."</label> "; // ' Page ';
$morehtml .= '<input type="text" name="pageplusone" id="pageplusone" class="flat right width25 pageplusone" value="'.($page + 1).'">'; $morehtml .= '<input type="text" name="pageplusone" id="pageplusone" class="flat right width25 pageplusone" value="'.($page + 1).'">';
@ -1050,7 +1062,7 @@ if ($resql) {
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
} }
if (!empty($arrayfields['bu.label']['checked'])) { if (!empty($arrayfields['bu.label']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).'"></td>';
} }
if (!empty($arrayfields['ba.ref']['checked'])) { if (!empty($arrayfields['ba.ref']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -1160,7 +1172,6 @@ if ($resql) {
// Loop on each record // Loop on each record
$sign = 1; $sign = 1;
$totalarray = array();
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$links = $bankaccountstatic->get_url($objp->rowid); $links = $bankaccountstatic->get_url($objp->rowid);
@ -1296,18 +1307,10 @@ if ($resql) {
$backgroundcolor = "class='oddeven'"; $backgroundcolor = "class='oddeven'";
} else { } else {
if ($objp->amount < 0) { if ($objp->amount < 0) {
if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR1)) { $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955');
$color = '#fca955';
} else {
$color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1;
}
$backgroundcolor = 'style="background: '.$color.';"'; $backgroundcolor = 'style="background: '.$color.';"';
} else { } else {
if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) { $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86');
$color = '#7fdb86';
} else {
$color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2;
}
$backgroundcolor = 'style="background: '.$color.';"'; $backgroundcolor = 'style="background: '.$color.';"';
} }
} }
@ -1333,7 +1336,7 @@ if ($resql) {
$titletoshow = ''; $titletoshow = '';
$reg = array(); $reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction 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]); $labeltoshow = $langs->trans($reg[1]);
} else { } else {
if ($objp->label == '(payment_salary)') { if ($objp->label == '(payment_salary)') {
@ -1357,6 +1360,7 @@ if ($resql) {
} elseif ($links[$key]['type'] == 'payment') { } elseif ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id']; $paymentstatic->id = $links[$key]['url_id'];
$paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment
$paymentstatic->date = $db->jdate($objp->do);
print ' '.$paymentstatic->getNomUrl(2); print ' '.$paymentstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_supplier') { } elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->id = $links[$key]['url_id'];

View File

@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check // Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid'); $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
$socid = 0;
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
@ -568,6 +569,12 @@ if ($result) {
// Bank line // Bank line
print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>'; print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); $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 img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print "</td></tr>"; print "</td></tr>";
} }

View File

@ -2846,15 +2846,6 @@ if (empty($reshook)) {
* View * View
*/ */
if (empty($object->id)) {
llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors');
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -3828,8 +3819,16 @@ if ($action == 'create') {
print '</table>'; print '</table>';
} }
print '</form>'; print "</form>\n";
} elseif ($id > 0 || !empty($ref)) { } elseif ($id > 0 || !empty($ref)) {
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
/* /*
* Show object in view mode * Show object in view mode
*/ */

View File

@ -102,10 +102,8 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -94,10 +94,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -64,10 +64,8 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -676,12 +676,6 @@ if (strlen(trim($search_country))) {
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') { if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; $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 != '') { if ($search_montant_ht != '') {
$sql .= natural_search('f.total_ht', $search_montant_ht, 1); $sql .= natural_search('f.total_ht', $search_montant_ht, 1);
} }

View File

@ -79,10 +79,8 @@ if (empty($reshook)) {
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -388,7 +388,7 @@ if ($action == 'new') {
$i = 0; $i = 0;
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
$accounts[$obj->bid] = $obj->label; $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]["amount"] = $obj->amount;
$lines[$obj->bid][$i]["emetteur"] = $obj->emetteur; $lines[$obj->bid][$i]["emetteur"] = $obj->emetteur;
$lines[$obj->bid][$i]["numero"] = $obj->num_chq; $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]["label"] = $obj->transactionlabel;
$lines[$obj->bid][$i]["paymentid"] = $obj->paymentid; $lines[$obj->bid][$i]["paymentid"] = $obj->paymentid;
$lines[$obj->bid][$i]["paymentref"] = $obj->paymentref; $lines[$obj->bid][$i]["paymentref"] = $obj->paymentref;
$lines[$obj->bid][$i]["paymentdate"] = $db->jdate($obj->date);
$i++; $i++;
} }
@ -468,6 +469,7 @@ if ($action == 'new') {
print '<td class="center">'; print '<td class="center">';
$paymentstatic->id = $value["paymentid"]; $paymentstatic->id = $value["paymentid"];
$paymentstatic->ref = $value["paymentref"]; $paymentstatic->ref = $value["paymentref"];
$paymentstatic->date = $value["paymentdate"];
if ($paymentstatic->id) { if ($paymentstatic->id) {
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
} else { } else {

View File

@ -182,7 +182,6 @@ if ($result > 0) {
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close();
} else { } else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@ -1031,6 +1031,7 @@ print "</tr>\n";
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -99,7 +99,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1; $perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) { } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1; $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; $perm = 1;
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) { } elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
$perm = 1; $perm = 1;

View File

@ -514,7 +514,17 @@ class FormProjets
} }
$linkedtothirdparty = false; $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; $linkedtothirdparty = true;
} }

View File

@ -104,6 +104,7 @@ class FormPropal
print '<option value="-1">&nbsp;</option>'; print '<option value="-1">&nbsp;</option>';
} }
$i = 0;
foreach ($listofstatus as $key => $obj) { foreach ($listofstatus as $key => $obj) {
if ($excludedraft) { if ($excludedraft) {
if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') { if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') {

View File

@ -1,17 +1,18 @@
<?php <?php
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io> /* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* 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. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
@ -508,11 +509,13 @@ class FormTicket
print '</tr>'; print '</tr>';
} }
if (!empty($conf->projet->enabled) && !$this->ispublic) { if ($subelement != 'project') {
$formproject = new FormProjets($this->db); if (!empty($conf->projet->enabled) && !$this->ispublic) {
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>'; $formproject = new FormProjets($this->db);
print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
print '</td></tr>'; print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</td></tr>';
}
} }
// Other attributes // Other attributes

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -48,6 +48,11 @@ class Ldap
*/ */
public $server = array(); public $server = array();
/**
* Current connected server
*/
public $connectedServer;
/** /**
* Base DN (e.g. "dc=foo,dc=com") * Base DN (e.g. "dc=foo,dc=com")
*/ */
@ -132,35 +137,33 @@ class Ldap
if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) { if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) {
$this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE; $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
} }
$this->serverPort = $conf->global->LDAP_SERVER_PORT; $this->serverPort = getDolGlobalInt('LDAP_SERVER_PORT', 389);
$this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION; $this->ldapProtocolVersion = getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION');
$this->dn = $conf->global->LDAP_SERVER_DN; $this->dn = getDolGlobalString('LDAP_SERVER_DN');
$this->serverType = $conf->global->LDAP_SERVER_TYPE; $this->serverType = getDolGlobalString('LDAP_SERVER_TYPE');
$this->domain = $conf->global->LDAP_SERVER_DN; $this->domain = getDolGlobalString('LDAP_SERVER_DN');
$this->searchUser = $conf->global->LDAP_ADMIN_DN; $this->searchUser = getDolGlobalString('LDAP_ADMIN_DN');
$this->searchPassword = $conf->global->LDAP_ADMIN_PASS; $this->searchPassword = getDolGlobalString('LDAP_ADMIN_PASS');
$this->people = $conf->global->LDAP_USER_DN; $this->people = getDolGlobalString('LDAP_USER_DN');
$this->groups = $conf->global->LDAP_GROUP_DN; $this->groups = getDolGlobalString('LDAP_GROUP_DN');
$this->filter = $conf->global->LDAP_FILTER_CONNECTION; // Filter on user $this->filter = getDolGlobalString('LDAP_FILTER_CONNECTION'); // Filter on user
$this->filtergroup = $conf->global->LDAP_GROUP_FILTER; // Filter on groups $this->filtergroup = getDolGlobalString('LDAP_GROUP_FILTER'); // Filter on groups
$this->filtermember = $conf->global->LDAP_MEMBER_FILTER; // Filter on member $this->filtermember = getDolGlobalString('LDAP_MEMBER_FILTER'); // Filter on member
// Users // Users
$this->attr_login = $conf->global->LDAP_FIELD_LOGIN; //unix $this->attr_login = getDolGlobalString('LDAP_FIELD_LOGIN'); //unix
$this->attr_sambalogin = $conf->global->LDAP_FIELD_LOGIN_SAMBA; //samba, activedirectory $this->attr_sambalogin = getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'); //samba, activedirectory
$this->attr_name = $conf->global->LDAP_FIELD_NAME; $this->attr_name = getDolGlobalString('LDAP_FIELD_NAME');
$this->attr_firstname = $conf->global->LDAP_FIELD_FIRSTNAME; $this->attr_firstname = getDolGlobalString('LDAP_FIELD_FIRSTNAME');
$this->attr_mail = $conf->global->LDAP_FIELD_MAIL; $this->attr_mail = getDolGlobalString('LDAP_FIELD_MAIL');
$this->attr_phone = $conf->global->LDAP_FIELD_PHONE; $this->attr_phone = getDolGlobalString('LDAP_FIELD_PHONE');
$this->attr_skype = $conf->global->LDAP_FIELD_SKYPE; $this->attr_skype = getDolGlobalString('LDAP_FIELD_SKYPE');
$this->attr_fax = $conf->global->LDAP_FIELD_FAX; $this->attr_fax = getDolGlobalString('LDAP_FIELD_FAX');
$this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE; $this->attr_mobile = getDolGlobalString('LDAP_FIELD_MOBILE');
} }
// Connection handling methods ------------------------------------------- // Connection handling methods -------------------------------------------
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -288,16 +291,18 @@ class Ldap
$return = -1; $return = -1;
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING); dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
} }
$this->connectedServer = $host;
return $return; return $return;
} }
/** /**
* Simply closes the connection set up earlier. * Simply closes the connection set up earlier. Returns true if OK, false if there was an error.
* Returns true if OK, false if there was an error. * This method seems a duplicate/alias of unbind().
* *
* @return boolean true or false * @return boolean true or false
* @deprecated ldap_close is an alias of ldap_unbind
* @see unbind()
*/ */
public function close() public function close()
{ {
@ -349,16 +354,21 @@ class Ldap
} }
/** /**
* Unbind du serveur ldap. * Unbind of LDAP server (close connection).
* *
* @return boolean true or false * @return boolean true or false
* @see close()
*/ */
public function unbind() public function unbind()
{ {
if (!$this->result = @ldap_unbind($this->connection)) { $this->result = true;
return false; if ($this->connection) {
} else { $this->result = @ldap_unbind($this->connection);
}
if ($this->result) {
return true; return true;
} else {
return false;
} }
} }
@ -411,7 +421,7 @@ class Ldap
*/ */
public function add($dn, $info, $user) public function add($dn, $info, $user)
{ {
dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',', $info)); dol_syslog(get_class($this)."::add dn=".$dn." info=".json_encode($info));
// Check parameters // Check parameters
if (!$this->connection) { if (!$this->connection) {

View File

@ -318,14 +318,14 @@ abstract class DoliDB implements Database
/** /**
* Return first result from query as object * Return first result from query as object
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries * Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
* Dont add LIMIT to your query, it will be added by this method * Dont add LIMIT to your query, it will be added by this method.
* @param string $sql the sql query string *
* @return bool| object * @param string $sql The sql query string
* @deprecated * @return bool|object Result of fetch_object
*/ */
public function getRow($sql) public function getRow($sql)
{ {
$sql .= ' LIMIT 1;'; $sql .= ' LIMIT 1';
$res = $this->query($sql); $res = $this->query($sql);
if ($res) { if ($res) {
@ -338,9 +338,10 @@ abstract class DoliDB implements Database
/** /**
* return all results from query as an array of objects * return all results from query as an array of objects
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries * Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
* be carefull with this method use it only with some limit of results to avoid performences loss * be carefull with this method use it only with some limit of results to avoid performences loss.
* @param string $sql the sql query string *
* @return bool| array * @param string $sql The sql query string
* @return bool|array Result
* @deprecated * @deprecated
*/ */
public function getRows($sql) public function getRows($sql)

View File

@ -48,7 +48,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
case 'sellist': case 'sellist':
$tmp = ''; $tmp = '';
$tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) { if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys = array_keys($tmpparam['options']); $tmpkeys = array_keys($tmpparam['options']);
$tmp = array_shift($tmpkeys); $tmp = array_shift($tmpkeys);
} }

View File

@ -108,6 +108,10 @@ function getEntity($element, $shared = 1, $currentobject = null)
{ {
global $conf, $mc, $hookmanager, $object, $action; global $conf, $mc, $hookmanager, $object, $action;
if (! is_object($hookmanager)) {
$hookmanager = new HookManager($db);
}
// fix different element names (France to English) // fix different element names (France to English)
switch ($element) { switch ($element) {
case 'contrat': case 'contrat':
@ -2289,6 +2293,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
{ {
global $conf, $langs; 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') { if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver')); $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_date_tz = new DateTimeZone($offsettzstring);
$user_dt = new DateTime(); $user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz); $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(); $offsettz = $user_dt->getOffset();
} else { // old method (The 'tzuser' was processed like the 'tzuserrel') } 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 $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); $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 // Clean format
if (preg_match('/%b/i', $format)) { // There is some text to translate 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. // 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 // Analyze date
$reg = array(); $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 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 ''; 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 } 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. // 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', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt', 'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', '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', 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square', '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', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house', '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', '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', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt', 'title_agenda'=>'calendar-alt',
'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card', 'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card',
@ -4473,7 +4477,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
$result = ($nodiv ? '' : '<div class="'.$class.' hideonsmartphone'.($morecss ? ' '.$morecss : '').($textfordropdown ? ' hidden' : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>'); $result = ($nodiv ? '' : '<div class="'.$class.' hideonsmartphone'.($morecss ? ' '.$morecss : '').($textfordropdown ? ' hidden' : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>');
if ($textfordropdown) { if ($textfordropdown) {
$tmpresult .= '<span class="'.$class.'text opacitymedium cursorpointer">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>'; $tmpresult = '<span class="'.$class.'text opacitymedium cursorpointer">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>';
$tmpresult .= '<script type="text/javascript" language="javascript"> $tmpresult .= '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery(".'.$class.'text").click(function() { jQuery(".'.$class.'text").click(function() {
@ -4496,7 +4500,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
* This function must be called when a blocking technical error is encountered. * This function must be called when a blocking technical error is encountered.
* However, one must try to call it only within php pages, classes must return their error through their property "error". * However, one must try to call it only within php pages, classes must return their error through their property "error".
* *
* @param DoliDB $db Database handler * @param DoliDB|string $db Database handler
* @param string|string[] $error String or array of errors strings to show * @param string|string[] $error String or array of errors strings to show
* @param array $errors Array of errors * @param array $errors Array of errors
* @return void * @return void
@ -4824,7 +4828,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
* Show a title. * Show a title.
* *
* @param string $title Title to show * @param string $title Title to show
* @return string Title to show * @return void
* @deprecated Use load_fiche_titre instead * @deprecated Use load_fiche_titre instead
* @see load_fiche_titre() * @see load_fiche_titre()
*/ */
@ -5189,16 +5193,16 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
* Function to format a value into an amount for visual output * Function to format a value into an amount for visual output
* Function used into PDF and HTML pages * Function used into PDF and HTML pages
* *
* @param float $amount Amount to format * @param float $amount Amount to format
* @param integer $form Type of format, HTML or not (not by default) * @param integer $form Type of format, HTML or not (not by default)
* @param Translate $outlangs Object langs for output * @param Translate|string $outlangs Object langs for output
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless. * @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless.
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
* @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force) * @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force)
* @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency) * @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency)
* @return string Chaine avec montant formate * @return string String with formated amount
* *
* @see price2num() Revert function of price * @see price2num() Revert function of price
*/ */
function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $forcerounding = -1, $currency_code = '') function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $forcerounding = -1, $currency_code = '')
{ {
@ -5852,7 +5856,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
$ret .= ' ('.$obj->default_vat_code.')'; $ret .= ' ('.$obj->default_vat_code.')';
} }
} }
$db->free($sql); $db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
@ -8151,16 +8155,20 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1)
return 'Bad string syntax to evaluate: '.$s; return 'Bad string syntax to evaluate: '.$s;
} }
// We block using of php exec or php file functions // We block use of php exec or php file functions
$forbiddenphpstrings = array("exec(", "passthru(", "shell_exec(", "system(", "proc_open(", "popen(", "eval(", "dol_eval(", "executeCLI("); $forbiddenphpstrings = array('$$');
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array("fopen(", "file_put_contents(", "fputs(", "fputscsv(", "fwrite(", "fpassthru(", "unlink(", "mkdir(", "rmdir(", "symlink(", "touch(", "umask("));
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('function(', '$$', 'call_user_func('));
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST')); $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST'));
$forbiddenphpregex = 'global\s+\$';
$forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI");
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "unlink", "mkdir", "rmdir", "symlink", "touch", "umask"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func"));
$forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b';
do { do {
$oldstringtoclean = $s; $oldstringtoclean = $s;
$s = str_ireplace($forbiddenphpstrings, '__forbiddenstring__', $s); $s = str_ireplace($forbiddenphpstrings, '__forbiddenstring__', $s);
$s = preg_replace('/'.$forbiddenphpregex.'/', '__forbiddenstring__', $s); $s = preg_replace('/'.$forbiddenphpregex.'/i', '__forbiddenstring__', $s);
//$s = preg_replace('/\$[a-zA-Z0-9_\->\$]+\(/i', '', $s); // Remove $function( call and $mycall->mymethod( //$s = preg_replace('/\$[a-zA-Z0-9_\->\$]+\(/i', '', $s); // Remove $function( call and $mycall->mymethod(
} while ($oldstringtoclean != $s); } while ($oldstringtoclean != $s);
@ -8818,7 +8826,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
* Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag) * Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
* *
* @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char. * @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
* @return string HTML code to set focus * @return void
*/ */
function dol_set_focus($selector) function dol_set_focus($selector)
{ {

View File

@ -251,7 +251,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
dol_syslog("getURLContent request=".$request); dol_syslog("getURLContent request=".$request);
if (!empty($conf->global->MAIN_GETURLCONTENT_OUTPUT_RESPONSE)) { if (!empty($conf->global->MAIN_GETURLCONTENT_OUTPUT_RESPONSE)) {
// This may contains binary data, so we dont output reponse by default. // This may contains binary data, so we dont output reponse by default.
dol_syslog("getURLContent response =".response); dol_syslog("getURLContent response =".$response);
} }
dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2006-2021 Regis Houssin <regis.houssin@inodbox.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -89,7 +89,6 @@ function ldap_prepare_head()
return $head; return $head;
} }
/** /**
* Show button test LDAP synchro * Show button test LDAP synchro
* *
@ -119,7 +118,6 @@ function show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass)
print '<br><br>'; print '<br><br>';
} }
/** /**
* Show a LDAP array into an HTML output array. * Show a LDAP array into an HTML output array.
* *
@ -153,7 +151,7 @@ function show_ldap_content($result, $level, $count, $var, $hide = 0, $subcount =
if ("$key" == "dn") { if ("$key" == "dn") {
continue; continue;
} }
if ("$val" == "objectclass") { if (!is_array($val) && "$val" == "objectclass") {
continue; continue;
} }
@ -181,7 +179,7 @@ function show_ldap_content($result, $level, $count, $var, $hide = 0, $subcount =
} }
print '<br>'; print '<br>';
} }
if ("$val" != $lastkey[$level] && !$subcount) { if (!is_array($val) && "$val" != $lastkey[$level] && !$subcount) {
print '</td></tr>'; print '</td></tr>';
} }
} }

View File

@ -1045,7 +1045,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line2 .= ($line2 ? " - " : "").$fromcompany->email; $line2 .= ($line2 ? " - " : "").$fromcompany->email;
} }
} }
if ($showdetails == 2 || $showdetails == 3 || ($fromcompany->country_code == 'DE')) { if ($showdetails == 2 || $showdetails == 3 || (!empty($fromcompany->country_code) && $fromcompany->country_code == 'DE')) {
// Managers // Managers
if ($fromcompany->managers) { if ($fromcompany->managers) {
$line2 .= ($line2 ? " - " : "").$fromcompany->managers; $line2 .= ($line2 ? " - " : "").$fromcompany->managers;
@ -1054,11 +1054,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Line 3 of company infos // Line 3 of company infos
// Juridical status // Juridical status
if ($fromcompany->forme_juridique_code) { if (!empty($fromcompany->forme_juridique_code) && $fromcompany->forme_juridique_code) {
$line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
} }
// Capital // Capital
if ($fromcompany->capital) { if (!empty($fromcompany->capital) && $fromcompany->capital) {
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string $tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) { if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); $line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
@ -1067,7 +1067,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
} }
} }
// Prof Id 1 // Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { if (!empty($fromcompany->idprof1) && $fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
$field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code); $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) { if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1]; $field = $reg[1];
@ -1075,7 +1075,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1); $line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) { if (!empty($fromcompany->idprof2) && $fromcompany->idprof2) {
$field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code); $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) { if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1]; $field = $reg[1];
@ -1085,7 +1085,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Line 4 of company infos // Line 4 of company infos
// Prof Id 3 // Prof Id 3
if ($fromcompany->idprof3) { if (!empty($fromcompany->idprof3) && $fromcompany->idprof3) {
$field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code); $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) { if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1]; $field = $reg[1];
@ -1093,7 +1093,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3); $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) { if (!empty($fromcompany->idprof4) && $fromcompany->idprof4) {
$field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code); $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) { if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1]; $field = $reg[1];
@ -1101,7 +1101,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
} }
// Prof Id 5 // Prof Id 5
if ($fromcompany->idprof5) { if (!empty($fromcompany->idprof5) && $fromcompany->idprof5) {
$field = $outputlangs->transcountrynoentities("ProfId5", $fromcompany->country_code); $field = $outputlangs->transcountrynoentities("ProfId5", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) { if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1]; $field = $reg[1];
@ -1109,7 +1109,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5); $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
} }
// Prof Id 6 // Prof Id 6
if ($fromcompany->idprof6) { if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
$field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code); $field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) { if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1]; $field = $reg[1];
@ -1117,7 +1117,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6); $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') { if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra != '') {
$line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra); $line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2008-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -91,7 +91,6 @@ function dol_decode($chain, $key = '1')
return $chain; return $chain;
} }
/** /**
* Returns a hash of a string. * Returns a hash of a string.
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (recommanded value is 'password_hash') * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (recommanded value is 'password_hash')
@ -123,7 +122,7 @@ function dol_hash($chain, $type = '0')
} elseif ($type == '3' || $type == 'md5') { } elseif ($type == '3' || $type == 'md5') {
return md5($chain); return md5($chain);
} elseif ($type == '4' || $type == 'md5openldap') { } elseif ($type == '4' || $type == 'md5openldap') {
return '{md5}'.base64_encode(mhash(MHASH_MD5, $chain)); // For OpenLdap with md5 (based on an unencrypted password in base) return '{md5}'.base64_encode(pack("H*", md5($chain))); // For OpenLdap with md5 (based on an unencrypted password in base)
} elseif ($type == '5' || $type == 'sha256') { } elseif ($type == '5' || $type == 'sha256') {
return hash('sha256', $chain); return hash('sha256', $chain);
} elseif ($type == '6' || $type == 'password_hash') { } elseif ($type == '6' || $type == 'password_hash') {
@ -168,7 +167,6 @@ function dol_verifyHash($chain, $hash, $type = '0')
return dol_hash($chain, $type) == $hash; return dol_hash($chain, $type) == $hash;
} }
/** /**
* Check permissions of a user to show a page and an object. Check read permission. * Check permissions of a user to show a page and an object. Check read permission.
* If GETPOST('action','aZ09') defined, we also check write and delete permission. * If GETPOST('action','aZ09') defined, we also check write and delete permission.
@ -492,10 +490,14 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->fournisseur->commande->supprimer) { if (!$user->rights->fournisseur->commande->supprimer) {
$deleteok = 0; $deleteok = 0;
} }
} elseif ($feature == 'payment_supplier') { } elseif ($feature == 'payment_supplier') { // Permission to delete a payment of an invoice is permission to edit an invoice.
if (!$user->rights->fournisseur->facture->creer) { if (!$user->rights->fournisseur->facture->creer) {
$deleteok = 0; $deleteok = 0;
} }
} elseif ($feature == 'payment') { // Permission to delete a payment of an invoice is permission to edit an invoice.
if (!$user->rights->facture->creer) {
$deleteok = 0;
}
} elseif ($feature == 'banque') { } elseif ($feature == 'banque') {
if (empty($user->rights->banque->modifier)) { if (empty($user->rights->banque->modifier)) {
$deleteok = 0; $deleteok = 0;

View File

@ -120,7 +120,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
if ($ldapdebug) { if ($ldapdebug) {
print "DEBUG: User ".$usertotest." must change password<br>\n"; print "DEBUG: User ".$usertotest." must change password<br>\n";
} }
$ldap->close(); $ldap->unbind();
sleep(1); sleep(1);
$langs->load('ldap'); $langs->load('ldap');
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("YouMustChangePassNextLogon", $usertotest, $ldap->domainFQDN); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("YouMustChangePassNextLogon", $usertotest, $ldap->domainFQDN);
@ -131,7 +131,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
print "DEBUG: ".$ldap->error."<br>\n"; print "DEBUG: ".$ldap->error."<br>\n";
} }
} }
$ldap->close(); $ldap->unbind();
} }
// Forge LDAP user and password to test with them // Forge LDAP user and password to test with them
@ -166,14 +166,14 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$now = dol_now(); $now = dol_now();
if ($tmpuser->datestartvalidity && $db->jdate($tmpuser->datestartvalidity) >= $now) { if ($tmpuser->datestartvalidity && $db->jdate($tmpuser->datestartvalidity) >= $now) {
$ldap->close(); $ldap->unbind();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('main', 'errors')); $langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
return '--bad-login-validity--'; return '--bad-login-validity--';
} }
if ($tmpuser->dateendvalidity && $db->jdate($tmpuser->dateendvalidity) <= dol_get_first_hour($now)) { if ($tmpuser->dateendvalidity && $db->jdate($tmpuser->dateendvalidity) <= dol_get_first_hour($now)) {
$ldap->close(); $ldap->unbind();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('main', 'errors')); $langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity"); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
@ -271,7 +271,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$_SESSION["dol_loginmesg"] = ($ldap->error ? $ldap->error : $langs->transnoentitiesnoconv("ErrorBadLoginPassword")); $_SESSION["dol_loginmesg"] = ($ldap->error ? $ldap->error : $langs->transnoentitiesnoconv("ErrorBadLoginPassword"));
} }
$ldap->close(); $ldap->unbind();
} }
return $login; return $login;

View File

@ -282,7 +282,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$sepaname = '______________________________________________'; $sepaname = '______________________________________________';
if ($thirdparty->id > 0) { if ($thirdparty->id > 0) {
$sepaname = $thirdparty->name.($object->account_owner ? ' ('.$object->account_owner.')' : ''); $sepaname = $thirdparty->name.($object->proprio ? ' ('.$object->proprio.')' : '');
} }
$posY = $pdf->GetY(); $posY = $pdf->GetY();
$posY += 3; $posY += 3;

View File

@ -349,7 +349,7 @@ class modAdherent extends DolibarrModules
$this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty"; $this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty";
} }
// Add extra fields // Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -200,58 +200,58 @@ class modHRM extends DolibarrModules
$this->rights[$r][1] = 'Read skill/job/position'; // Permission label $this->rights[$r][1] = 'Read skill/job/position'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'all'; $this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->read) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->all->read)
$r++; $r++;
$this->rights[$r][0] = 4011; // Permission id (must not be already used) $this->rights[$r][0] = 4011; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify skill/job/position'; // Permission label $this->rights[$r][1] = 'Create/modify skill/job/position'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'all'; $this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->write) $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->all->write)
$r++; $r++;
$this->rights[$r][0] = 4012; // Permission id (must not be already used) $this->rights[$r][0] = 4012; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete skill/job/position'; // Permission label $this->rights[$r][1] = 'Delete skill/job/position'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'all'; $this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->delete) $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->hrm->all->delete)
$r++; $r++;
// Evaluation // Evaluation
$this->rights[$r][0] = 4020; // Permission id (must not be already used) $this->rights[$r][0] = 4020; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read evaluation'; // Permission label $this->rights[$r][1] = 'Read evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->read) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->read)
$r++; $r++;
$this->rights[$r][0] = 4021; // Permission id (must not be already used) $this->rights[$r][0] = 4021; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify evaluation'; // Permission label $this->rights[$r][1] = 'Create/modify your own evaluation'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->write) $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->write)
$r++; $r++;
$this->rights[$r][0] = 4022; // Permission id (must not be already used) $this->rights[$r][0] = 4022; // Permission id (must not be already used)
$this->rights[$r][1] = 'Validate evaluation'; // Permission label $this->rights[$r][1] = 'Validate evaluation'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation_advance';
$this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->write) $this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->validate)
$r++; $r++;
$this->rights[$r][0] = 4023; // Permission id (must not be already used) $this->rights[$r][0] = 4023; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete evaluation'; // Permission label $this->rights[$r][1] = 'Delete all evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->delete) $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->delete)
$r++; $r++;
// Comparison // Comparison
$this->rights[$r][0] = 4030; // Permission id (must not be already used) $this->rights[$r][0] = 4030; // Permission id (must not be already used)
$this->rights[$r][1] = 'See comparison menu'; // Permission label $this->rights[$r][1] = 'See comparison menu'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'compare'; $this->rights[$r][4] = 'compare_advance';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->delete) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read)
$r++; $r++;
} }

View File

@ -638,7 +638,7 @@ class modProduct extends DolibarrModules
// Add extra fields // Add extra fields
$import_extrafield_sample = array(); $import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -296,7 +296,7 @@ class modProjet extends DolibarrModules
$this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation"); $this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation");
// Add extra fields // Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -268,7 +268,7 @@ class modResource extends DolibarrModules
$this->import_tables_array[$r] = array('r'=>MAIN_DB_PREFIX.'resource', 'extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order) $this->import_tables_array[$r] = array('r'=>MAIN_DB_PREFIX.'resource', 'extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array('r.ref'=>"ResourceFormLabel_ref*", 'r.fk_code_type_resource'=>'ResourceTypeCode', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>'DateCreation'); $this->import_fields_array[$r] = array('r.ref'=>"ResourceFormLabel_ref*", 'r.fk_code_type_resource'=>'ResourceTypeCode', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>'DateCreation');
// Add extra fields // Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -584,7 +584,7 @@ class modService extends DolibarrModules
} }
// Add extra fields // Add extra fields
$import_extrafield_sample = array(); $import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0,".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -503,7 +503,7 @@ class modSociete extends DolibarrModules
$this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
} }
// Add extra fields // Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
@ -681,7 +681,7 @@ class modSociete extends DolibarrModules
's.note_public' => "NotePublic" 's.note_public' => "NotePublic"
); );
// Add extra fields // Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on an old database (during a migration for example) if ($resql) { // This can fail when class is used on an old database (during a migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -298,7 +298,7 @@ class modUser extends DolibarrModules
'u.statut'=>'Status' 'u.statut'=>'Status'
); );
// Add extra fields // Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")"; $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'user' AND entity IN (0,".$conf->entity.")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -320,17 +320,22 @@ class doc_generic_odt extends ModeleThirdPartyDoc
foreach ($contact_arrray as $array_key => $contact_id) { foreach ($contact_arrray as $array_key => $contact_id) {
$res_contact = $contactstatic->fetch($contact_id); $res_contact = $contactstatic->fetch($contact_id);
$tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact'); if ((int) $res_contact > 0) {
foreach ($tmparray as $key => $val) { $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact');
try { foreach ($tmparray as $key => $val) {
$listlines->setVars($key, $val, true, 'UTF-8'); try {
} catch (OdfException $e) { $listlines->setVars($key, $val, true, 'UTF-8');
dol_syslog($e->getMessage(), LOG_INFO); } catch (OdfException $e) {
} catch (SegmentException $e) { dol_syslog($e->getMessage(), LOG_INFO);
dol_syslog($e->getMessage(), LOG_INFO); } catch (SegmentException $e) {
dol_syslog($e->getMessage(), LOG_INFO);
}
} }
$listlines->merge();
} else {
$this->error = $contactstatic->error;
dol_syslog($this->error, LOG_WARNING);
} }
$listlines->merge();
} }
$odfHandler->mergeSegment($listlines); $odfHandler->mergeSegment($listlines);
} catch (OdfException $e) { } catch (OdfException $e) {

View File

@ -132,7 +132,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Parametrage du prefix customers // Parametrage du prefix customers
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):</td>'; $texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.$conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER.'"'.$disabled.'>', $tooltip, 1, 1).'</td>'; $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.getDolGlobalString('COMPANY_ELEPHANT_MASK_CUSTOMER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"'.$disabled.'></td>'; $texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
@ -140,7 +140,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Parametrage du prefix suppliers // Parametrage du prefix suppliers
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):</td>'; $texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value2" value="'.$conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER.'"'.$disabled.'>', $tooltip, 1, 1).'</td>'; $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value2" value="'.getDolGlobalString('COMPANY_ELEPHANT_MASK_SUPPLIER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '</tr>'; $texte .= '</tr>';
$texte .= '</table>'; $texte .= '</table>';

View File

@ -86,7 +86,7 @@ foreach ($object->fields as $key => $val) {
$value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key; $value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key;
} }
//var_dump($val.' '.$key.' '.$value); //var_dump($val.' '.$key.' '.$value);
if ($val['noteditable']) { if (!empty($val['noteditable'])) {
print $object->showOutputField($val, $key, $value, '', '', '', 0); print $object->showOutputField($val, $key, $value, '', '', '', 0);
} else { } else {
if ($key == 'lang') { if ($key == 'lang') {

View File

@ -156,7 +156,7 @@ foreach ($object->fields as $key => $val) {
if ($val['type'] == 'text') { if ($val['type'] == 'text') {
print ' wordbreak'; print ' wordbreak';
} }
if ($val['cssview']) { if (!empty($val['cssview'])) {
print ' '.$val['cssview']; print ' '.$val['cssview'];
} }
print '">'; print '">';

View File

@ -53,6 +53,9 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
if (empty($totalarray)) {
$totalarray['nbfield'] = 0;
}
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -219,18 +219,18 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
// Convert date into timestamp format // Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) { if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) {
$datenotinstring = $object->array_options['options_'.$tmpkeyextra]; $datenotinstring = empty($object->array_options['options_'.$tmpkeyextra]) ? '' : $object->array_options['options_'.$tmpkeyextra];
// print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x'; // print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x';
if (!is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility if (!empty($object->array_options['options_'.$tmpkeyextra]) && !is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility
$datenotinstring = $db->jdate($datenotinstring); $datenotinstring = $db->jdate($datenotinstring);
} }
//print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); //print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');
$value = GETPOSTISSET("options_".$tmpkeyextra) ? dol_mktime(12, 0, 0, GETPOST("options_".$tmpkeyextra."month", 'int'), GETPOST("options_".$tmpkeyextra."day", 'int'), GETPOST("options_".$tmpkeyextra."year", 'int')) : $datenotinstring; $value = GETPOSTISSET("options_".$tmpkeyextra) ? dol_mktime(12, 0, 0, GETPOST("options_".$tmpkeyextra."month", 'int'), GETPOST("options_".$tmpkeyextra."day", 'int'), GETPOST("options_".$tmpkeyextra."year", 'int')) : $datenotinstring;
} }
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('datetime'))) { if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('datetime'))) {
$datenotinstring = $object->array_options['options_'.$tmpkeyextra]; $datenotinstring = empty($object->array_options['options_'.$tmpkeyextra]) ? '' : $object->array_options['options_'.$tmpkeyextra];
// print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x'; // print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x';
if (!is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility if (!empty($object->array_options['options_'.$tmpkeyextra]) && !is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility
$datenotinstring = $db->jdate($datenotinstring); $datenotinstring = $db->jdate($datenotinstring);
} }
//print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); //print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2018 ATM Consulting <support@atm-consulting.fr> /* Copyright (C) 2018 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -88,7 +89,7 @@ if ($absolute_discount > 0) {
// Is there credit notes availables ? // Is there credit notes availables ?
if ($absolute_creditnote > 0) { if ($absolute_creditnote > 0) {
// If validated, we show link "add credit note to payment" // If validated, we show link "add credit note to payment"
if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) { if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
$translationKey = !empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; $translationKey = !empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
$text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency".$conf->currency)).'.'; $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency".$conf->currency)).'.';

View File

@ -138,6 +138,7 @@ if (in_array($modulepart, array('facture_paiement', 'unpaid'))) {
*/ */
// If we have a hash public (hashp), we guess the original_file. // If we have a hash public (hashp), we guess the original_file.
$ecmfile='';
if (!empty($hashp)) { if (!empty($hashp)) {
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($db); $ecmfile = new EcmFiles($db);

View File

@ -2093,7 +2093,7 @@ class CommandeFournisseur extends CommonOrder
// Test we can delete // Test we can delete
$this->fetchObjectLinked(null, 'order_supplier'); $this->fetchObjectLinked(null, 'order_supplier');
if (!empty($this->linkedObjects)) { if (!empty($this->linkedObjects) && array_key_exists('reception', $this->linkedObjects)) {
foreach ($this->linkedObjects['reception'] as $element) { foreach ($this->linkedObjects['reception'] as $element) {
if ($element->statut >= 0) { if ($element->statut >= 0) {
$this->errors[] = $langs->trans('ReceptionExist'); $this->errors[] = $langs->trans('ReceptionExist');

View File

@ -882,7 +882,7 @@ $object = new Holiday($db);
$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
$title = $langs->trans('CPTitreMenu'); $title = $langs->trans('Leave');
$help_url = 'EN:Module_Holiday'; $help_url = 'EN:Module_Holiday';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
@ -1088,7 +1088,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("DescCP").'</td>'; print '<td>'.$langs->trans("DescCP").'</td>';
print '<td class="tdtop">'; print '<td class="tdtop">';
$doleditor = new DolEditor('description', GETPOST('description', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('description', GETPOST('description', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
@ -1158,7 +1158,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
setEventMessages($errors, null, 'errors'); setEventMessages($errors, null, 'errors');
} }
// On vérifie si l'utilisateur à le droit de lire cette demande // check if the user has the right to read this request
if ($canread) { if ($canread) {
$head = holiday_prepare_head($object); $head = holiday_prepare_head($object);
@ -1289,7 +1289,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DescCP').'</td>'; print '<td>'.$langs->trans('DescCP').'</td>';
print '<td class="tdtop">'; print '<td class="tdtop">';
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
} }
@ -1433,11 +1433,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) {
if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) {
print '<div class="center">';
if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) {
print '<input type="submit" value="'.$langs->trans("Save").'" class="button button-save">'; print $form->buttonsSaveCancel();
} }
print '</div>';
} }
print '</form>'; print '</form>';
@ -1521,7 +1519,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
$action = 'presend'; $action = 'presend';
} }
if ($action != 'presend') { if ($action != 'presend' && $action != 'edit') {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre

View File

@ -137,8 +137,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$form = new Form($db); $form = new Form($db);
$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
$title = $langs->trans("Leave").' - '.$langs->trans("Files");
$title = $langs->trans('InterventionCard');
llxHeader('', $title); llxHeader('', $title);
@ -347,12 +346,12 @@ if ($object->id) {
print dol_get_fiche_end(); print dol_get_fiche_end();
$modulepart = 'holiday';
$permissiontoadd = $user->rights->holiday->write; $permissiontoadd = $user->rights->holiday->write;
$permtoedit = $user->rights->holiday->write; $permtoedit = $user->rights->holiday->write;
$param = '&id='.$object->id; $param = '&id='.$object->id;
$relativepathwithnofile = $modulepart.'/'.dol_sanitizeFileName($object->ref).'/';
$savingdocmask = dol_sanitizeFileName($object->ref).'-__file__';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else { } else {
print $langs->trans("ErrorUnknown"); print $langs->trans("ErrorUnknown");

View File

@ -78,7 +78,7 @@ $result = restrictedArea($user, 'holiday', $object->id, 'holiday');
$form = new Form($db); $form = new Form($db);
$title = $langs->trans("Holiday")." - ".$langs->trans("Info"); $title = $langs->trans("Leave")." - ".$langs->trans("Info");
$helpurl = ""; $helpurl = "";
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);

View File

@ -113,7 +113,7 @@ class Position extends CommonObject
'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,),
'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,),
'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,),
'commentaire_abandon' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'1', 'position'=>502, 'notnull'=>0, 'visible'=>1,), 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'1', 'position'=>502, 'notnull'=>0, 'visible'=>1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>0,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>0,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
@ -129,7 +129,7 @@ class Position extends CommonObject
public $fk_job; public $fk_job;
public $date_start; public $date_start;
public $date_end; public $date_end;
public $commentaire_abandon; public $abort_comment;
public $note_public; public $note_public;
public $note_private; public $note_private;
public $fk_user_creat; public $fk_user_creat;

View File

@ -256,10 +256,13 @@ $fk_usergroup1 = GETPOST('fk_usergroup1');
</div> </div>
<?php <?php
dol_fiche_end();
print dol_get_fiche_end();
llxFooter(); llxFooter();
/** /**
* *
* Return a html list element with diff between required rank and user rank * Return a html list element with diff between required rank and user rank

View File

@ -465,7 +465,7 @@ if ($step == 2 && $datatoimport) {
print '<table class="border tableforfield centpercent">'; print '<table class="border tableforfield centpercent">';
// Module // Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
print '<td>'; print '<td>';
$titleofmodule = $objimport->array_import_module[0]['module']->getName(); $titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services // Special cas for import common to module/services
@ -571,10 +571,10 @@ if ($step == 3 && $datatoimport) {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<table width="100%" class="border tableforfield">'; print '<table class="border tableforfield centpercent">';
// Module // Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
print '<td>'; print '<td>';
$titleofmodule = $objimport->array_import_module[0]['module']->getName(); $titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services // Special cas for import common to module/services
@ -603,7 +603,7 @@ if ($step == 3 && $datatoimport) {
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
// Source file format // Source file format
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
$text = $objmodelimport->getDriverDescForKey($format); $text = $objmodelimport->getDriverDescForKey($format);
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
@ -733,8 +733,8 @@ if ($step == 3 && $datatoimport) {
$relativepath = $file; $relativepath = $file;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="16">'.img_mime($file).'</td>';
print '<td>'; print '<td>';
print img_mime($file, '', 'pictofixedwidth');
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=3'.$param.'" target="_blank">'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=3'.$param.'" target="_blank">';
print $file; print $file;
print '</a>'; print '</a>';
@ -876,7 +876,7 @@ if ($step == 4 && $datatoimport) {
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
// Module // Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
print '<td>'; print '<td>';
$titleofmodule = $objimport->array_import_module[0]['module']->getName(); $titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services // Special cas for import common to module/services
@ -905,7 +905,7 @@ if ($step == 4 && $datatoimport) {
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
// Source file format // Source file format
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
print '<td>'; print '<td>';
$text = $objmodelimport->getDriverDescForKey($format); $text = $objmodelimport->getDriverDescForKey($format);
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
@ -926,8 +926,8 @@ if ($step == 4 && $datatoimport) {
print $langs->trans("Separator").' : '; print $langs->trans("Separator").' : ';
print '<input type="text" size="1" name="separator" value="'.dol_escape_htmltag($separator).'"/>'; print '<input type="text" size="1" name="separator" value="'.dol_escape_htmltag($separator).'"/>';
print '&nbsp;&nbsp;&nbsp;&nbsp;'.$langs->trans("Enclosure").' : '; print '&nbsp;&nbsp;&nbsp;&nbsp;'.$langs->trans("Enclosure").' : ';
print '<input type="text" size="1" name="enclosure" value="'.dol_escape_htmltag($enclosure).'"/>'; print '<input type="text" size="1" name="enclosure" value="'.dol_escape_htmltag($enclosure).'"/> ';
print '<input name="update" type="submit" value="'.$langs->trans('Update').'" class="button" />'; print '<input name="update" type="submit" value="'.$langs->trans('Update').'" class="button small" />';
print '</form>'; print '</form>';
print '</td></tr>'; print '</td></tr>';
} }
@ -938,6 +938,7 @@ if ($step == 4 && $datatoimport) {
$modulepart = 'import'; $modulepart = 'import';
$relativepath = GETPOST('filetoimport'); $relativepath = GETPOST('filetoimport');
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
print img_mime($file, '', 'pictofixedwidth');
print $filetoimport; print $filetoimport;
print '</a>'; print '</a>';
print '</td></tr>'; print '</td></tr>';
@ -1385,7 +1386,7 @@ if ($step == 5 && $datatoimport) {
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
// Module // Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
print '<td>'; print '<td>';
$titleofmodule = $objimport->array_import_module[0]['module']->getName(); $titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services // Special cas for import common to module/services
@ -1414,7 +1415,7 @@ if ($step == 5 && $datatoimport) {
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
// Source file format // Source file format
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
print '<td>'; print '<td>';
$text = $objmodelimport->getDriverDescForKey($format); $text = $objmodelimport->getDriverDescForKey($format);
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
@ -1435,6 +1436,7 @@ if ($step == 5 && $datatoimport) {
$modulepart = 'import'; $modulepart = 'import';
$relativepath = GETPOST('filetoimport'); $relativepath = GETPOST('filetoimport');
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
print img_mime($file, '', 'pictofixedwidth');
print $filetoimport; print $filetoimport;
print '</a>'; print '</a>';
print '</td></tr>'; print '</td></tr>';
@ -1509,7 +1511,7 @@ if ($step == 5 && $datatoimport) {
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
// Tables imported // Tables imported
print '<tr><td class="titlefield">'; print '<tr><td class="titlefieldcreate">';
print $langs->trans("TablesTarget"); print $langs->trans("TablesTarget");
print '</td><td>'; print '</td><td>';
$listtables = array(); $listtables = array();
@ -1675,10 +1677,15 @@ if ($step == 5 && $datatoimport) {
print '<div class="center">'.img_picto($langs->trans("OK"), 'tick').' <b>'.$langs->trans("NoError").'</b></div><br><br>'; print '<div class="center">'.img_picto($langs->trans("OK"), 'tick').' <b>'.$langs->trans("NoError").'</b></div><br><br>';
print '<div class="ok">'; print '<div class="ok">';
print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'<br>'; print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'<br>';
print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'<br><br>'; print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'<br>';
print '</div>'; print '</div>';
print '<br>';
} else { } else {
print $langs->trans("NbOfLinesOK", $nbok).'<br><br>'; print '<br>';
print '<div class="info">';
print $langs->trans("NbOfLinesOK", $nbok).'<br>';
print '</div>';
print '<br>';
} }
// Show Errors // Show Errors
@ -1823,7 +1830,7 @@ if ($step == 6 && $datatoimport) {
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
// Module // Module
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
print '<td>'; print '<td>';
$titleofmodule = $objimport->array_import_module[0]['module']->getName(); $titleofmodule = $objimport->array_import_module[0]['module']->getName();
// Special cas for import common to module/services // Special cas for import common to module/services
@ -1852,7 +1859,7 @@ if ($step == 6 && $datatoimport) {
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
// Source file format // Source file format
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
print '<td>'; print '<td>';
$text = $objmodelimport->getDriverDescForKey($format); $text = $objmodelimport->getDriverDescForKey($format);
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
@ -1875,6 +1882,7 @@ if ($step == 6 && $datatoimport) {
$modulepart = 'import'; $modulepart = 'import';
$relativepath = GETPOST('filetoimport'); $relativepath = GETPOST('filetoimport');
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
print img_mime($file, '', 'pictofixedwidth');
print $filetoimport; print $filetoimport;
print '</a>'; print '</a>';
print '</td></tr>'; print '</td></tr>';

View File

@ -66,58 +66,55 @@
************************/ ************************/
class httpException extends Exception class httpException extends Exception
{ {
protected $errno; protected $errno;
public function __construct ($msg, $errno = null) public function __construct($msg, $errno = null)
{ {
parent::__construct ($msg); parent::__construct($msg);
$this->errno = $errno; $this->errno = $errno;
} }
public function getErrorFormatted () public function getErrorFormatted()
{ {
return sprintf ("[http_class]: %s -- "._(" file %s, line %s"), return sprintf("[http_class]: %s -- "._(" file %s, line %s"),
$this->getMessage (), $this->getFile (), $this->getLine ()); $this->getMessage(), $this->getFile(), $this->getLine());
} }
public function getErrno () public function getErrno()
{ {
return $this->errno; return $this->errno;
} }
} }
function error2string($value) function error2string($value)
{ {
$level_names = array( $level_names = array(
E_ERROR => 'E_ERROR', E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING', E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE', E_PARSE => 'E_PARSE',
E_NOTICE => 'E_NOTICE', E_NOTICE => 'E_NOTICE',
E_CORE_ERROR => 'E_CORE_ERROR', E_CORE_ERROR => 'E_CORE_ERROR',
E_CORE_WARNING => 'E_CORE_WARNING', E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR', E_COMPILE_ERROR => 'E_COMPILE_ERROR',
E_COMPILE_WARNING => 'E_COMPILE_WARNING', E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_ERROR => 'E_USER_ERROR', E_USER_ERROR => 'E_USER_ERROR',
E_USER_WARNING => 'E_USER_WARNING', E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE' E_USER_NOTICE => 'E_USER_NOTICE'
); );
if(defined('E_STRICT')) { if (defined('E_STRICT')) {
$level_names[E_STRICT]='E_STRICT'; $level_names[E_STRICT]='E_STRICT';
} }
$levels=array(); $levels=array();
if(($value&E_ALL)==E_ALL) if (($value&E_ALL)==E_ALL) {
{ $levels[]='E_ALL';
$levels[]='E_ALL'; $value&=~E_ALL;
$value&=~E_ALL; }
} foreach ($level_names as $level=>$name) {
foreach($level_names as $level=>$name) if (($value&$level)==$level) {
{ $levels[]=$name;
if(($value&$level)==$level) }
{ }
$levels[]=$name; return implode(' | ', $levels);
}
}
return implode(' | ',$levels);
} }
/*********************** /***********************
@ -127,486 +124,427 @@ function error2string($value)
************************/ ************************/
class http_class class http_class
{ {
// variables declaration // variables declaration
public $debug; public $debug;
public $html_debug; public $html_debug;
public $timeout = 30; // time waiting for connection, seconds public $timeout = 30; // time waiting for connection, seconds
public $data_timeout = 30; // time waiting for data, milliseconds public $data_timeout = 30; // time waiting for data, milliseconds
public $data_chunk_timeout = 1; // time waiting between data chunks, millisecond public $data_chunk_timeout = 1; // time waiting between data chunks, millisecond
public $force_multipart_form_post; public $force_multipart_form_post;
public $username; public $username;
public $password; public $password;
public $request_headers = array (); public $request_headers = array ();
public $request_body = "Not a useful information"; public $request_body = "Not a useful information";
public $status; public $status;
public $window_size = 1024; // chunk size of data public $window_size = 1024; // chunk size of data
public $with_exceptions = 0; // compatibility mode for old scripts public $with_exceptions = 0; // compatibility mode for old scripts
public $port; public $port;
public $host; public $host;
private $default_port = 631; private $default_port = 631;
private $headers; private $headers;
private $reply_headers = array (); private $reply_headers = array ();
private $reply_body = array (); private $reply_body = array ();
private $connection; private $connection;
private $arguments; private $arguments;
private $bodystream = array (); private $bodystream = array ();
private $last_limit; private $last_limit;
private $connected; private $connected;
private $nc = 1; private $nc = 1;
private $user_agent = "PRINTIPP/0.81+CVS"; private $user_agent = "PRINTIPP/0.81+CVS";
private $readed_bytes = 0; private $readed_bytes = 0;
public function __construct () public function __construct()
{ {
true; true;
} }
/********************* /*********************
* *
* Public functions * Public functions
* *
**********************/ **********************/
public function GetRequestArguments ($url, &$arguments) public function GetRequestArguments($url, &$arguments)
{ {
$this->arguments = array (); $this->arguments = array ();
$this->arguments["URL"] = $arguments["URL"] = $url; $this->arguments["URL"] = $arguments["URL"] = $url;
$this->arguments["RequestMethod"] = $arguments["RequestMethod"] = "POST"; $this->arguments["RequestMethod"] = $arguments["RequestMethod"] = "POST";
$this->headers["Content-Length"] = 0; $this->headers["Content-Length"] = 0;
$this->headers["Content-Type"] = "application/octet-stream"; $this->headers["Content-Type"] = "application/octet-stream";
$this->headers["Host"] = $this->host; $this->headers["Host"] = $this->host;
$this->headers["User-Agent"] = $this->user_agent; $this->headers["User-Agent"] = $this->user_agent;
//$this->headers["Expect"] = "100-continue"; //$this->headers["Expect"] = "100-continue";
} }
public function Open ($arguments) public function Open($arguments)
{ {
$this->connected = false; $this->connected = false;
$url = $arguments["URL"]; $url = $arguments["URL"];
$port = $this->default_port; $port = $this->default_port;
#$url = split (':', $url, 2); // $url = split (':', $url, 2);
$url = preg_split ('#:#', $url, 2); $url = preg_split('#:#', $url, 2);
$transport_type = $url[0]; $transport_type = $url[0];
$unix = false; $unix = false;
switch ($transport_type) switch ($transport_type) {
{ case 'http':
case 'http': $transport_type = 'tcp://';
$transport_type = 'tcp://'; break;
break;
case 'https': case 'https':
$transport_type = 'tls://'; $transport_type = 'tls://';
break; break;
case 'unix': case 'unix':
$transport_type = 'unix://'; $transport_type = 'unix://';
$port = 0; $port = 0;
$unix = true; $unix = true;
break; break;
default: default:
$transport_type = 'tcp://'; $transport_type = 'tcp://';
break; break;
} }
$url = $url[1]; $url = $url[1];
if (!$unix) if (!$unix) {
{ // $url = split ("/", preg_replace ("#^/{1,}#", '', $url), 2);
#$url = split ("/", preg_replace ("#^/{1,}#", '', $url), 2); $url = preg_split("#/#", preg_replace("#^/{1,}#", '', $url), 2);
$url = preg_split ("#/#", preg_replace ("#^/{1,}#", '', $url), 2); $url = $url[0];
$url = $url[0]; $port = $this->port;
$port = $this->port; $error = sprintf(_("Cannot resolve url: %s"), $url);
$error = sprintf (_("Cannot resolve url: %s"), $url); $ip = gethostbyname($url);
$ip = gethostbyname ($url); $ip = @gethostbyaddr($ip);
$ip = @gethostbyaddr ($ip); if (!$ip) {
if (!$ip) return $this->_HttpError($error, E_USER_WARNING);
{ }
return $this->_HttpError ($error, E_USER_WARNING); if (strstr($url, ":")) { // we got an ipv6 address
} if (!strstr($url, "[")) { // it is not escaped
if (strstr ($url, ":")) // we got an ipv6 address $url = sprintf("[%s]", $url);
{ }
if (!strstr ($url, "[")) // it is not escaped }
{ }
$url = sprintf ("[%s]", $url); $this->connection = @fsockopen($transport_type.$url, $port, $errno, $errstr, $this->timeout);
} $error =
} sprintf(_('Unable to connect to "%s%s port %s": %s'), $transport_type,
} $url, $port, $errstr);
$this->connection = @fsockopen ($transport_type.$url, $port, $errno, $errstr, $this->timeout); if (!$this->connection) {
$error = return $this->_HttpError($error, E_USER_WARNING);
sprintf (_('Unable to connect to "%s%s port %s": %s'), $transport_type, }
$url, $port, $errstr); $this->connected = true;
if (!$this->connection) return array (true, "success");
{ }
return $this->_HttpError ($error, E_USER_WARNING);
}
$this->connected = true;
return array (true, "success");
}
public function SendRequest ($arguments) public function SendRequest($arguments)
{ {
$error = $error =
sprintf (_('Streaming request failed to %s'), $arguments['RequestURI']); sprintf(_('Streaming request failed to %s'), $arguments['RequestURI']);
$result = self::_StreamRequest ($arguments); $result = self::_StreamRequest($arguments);
if (!$result[0]) if (!$result[0]) {
{ return $this->_HttpError($error." ".$result[1], E_USER_WARNING);
return $this->_HttpError ($error." ".$result[1], E_USER_WARNING); }
} self::_ReadReply();
self::_ReadReply (); if (!preg_match('#http/1.1 401 unauthorized#', $this->status)) {
if (!preg_match ('#http/1.1 401 unauthorized#', $this->status)) return array (true, "success");
{ }
return array (true, "success"); $headers = array_keys($this->reply_headers);
} $error = _("need authentication but no mechanism provided");
$headers = array_keys ($this->reply_headers); if (!in_array("www-authenticate", $headers)) {
$error = _("need authentication but no mechanism provided"); return $this->_HttpError($error, E_USER_WARNING);
if (!in_array ("www-authenticate", $headers)) }
{ // $authtype = split (' ', $this->reply_headers["www-authenticate"]);
return $this->_HttpError ($error, E_USER_WARNING); $authtype = preg_split('# #', $this->reply_headers["www-authenticate"]);
} $authtype = strtolower($authtype[0]);
#$authtype = split (' ', $this->reply_headers["www-authenticate"]); switch ($authtype) {
$authtype = preg_split ('# #', $this->reply_headers["www-authenticate"]); case 'basic':
$authtype = strtolower ($authtype[0]); $pass = base64_encode($this->user.":".$this->password);
switch ($authtype) $arguments["Headers"]["Authorization"] = "Basic ".$pass;
{ break;
case 'basic':
$pass = base64_encode ($this->user.":".$this->password);
$arguments["Headers"]["Authorization"] = "Basic ".$pass;
break;
case 'digest': case 'digest':
$arguments["Headers"]["Authorization"] = self::_BuildDigest (); $arguments["Headers"]["Authorization"] = self::_BuildDigest();
break; break;
default: default:
$error = $error =
sprintf (_("need '%s' authentication mechanism, but have not"), sprintf(_("need '%s' authentication mechanism, but have not"),
$authtype[0]); $authtype[0]);
return $this->_HttpError ($error, E_USER_WARNING); return $this->_HttpError($error, E_USER_WARNING);
break; break;
} }
self::Close (); self::Close();
self::Open ($arguments); self::Open($arguments);
$error = sprintf(_('Streaming request failed to %s after a try to authenticate'), $arguments['RequestURI']); $error = sprintf(_('Streaming request failed to %s after a try to authenticate'), $arguments['RequestURI']);
$result = self::_StreamRequest ($arguments); $result = self::_StreamRequest($arguments);
if (!$result[0]) if (!$result[0]) {
{ return $this->_HttpError($error.": ".$result[1], E_USER_WARNING);
return $this->_HttpError ($error.": ".$result[1], E_USER_WARNING); }
} self::_ReadReply();
self::_ReadReply (); return array (true, "success");
return array (true, "success"); }
}
public function ReadReplyHeaders (&$headers) public function ReadReplyHeaders(&$headers)
{ {
$headers = $this->reply_headers; $headers = $this->reply_headers;
} }
public function ReadReplyBody (&$body, $chunk_size) public function ReadReplyBody(&$body, $chunk_size)
{ {
$body = substr ($this->reply_body, $this->last_limit, $chunk_size); $body = substr($this->reply_body, $this->last_limit, $chunk_size);
$this->last_limit += $chunk_size; $this->last_limit += $chunk_size;
} }
public function Close () public function Close()
{ {
if (!$this->connected) if (!$this->connected) {
{ return;
return; }
} fclose($this->connection);
fclose ($this->connection); }
}
/********************* /*********************
* *
* Private functions * Private functions
* *
*********************/ *********************/
private function _HttpError ($msg, $level, $errno = null) private function _HttpError($msg, $level, $errno = null)
{ {
$trace = ''; $trace = '';
$backtrace = debug_backtrace(); $backtrace = debug_backtrace();
foreach ($backtrace as $trace) foreach ($backtrace as $trace) {
{ $trace .= sprintf("in [file: '%s'][function: '%s'][line: %s];\n", $trace['file'], $trace['function'], $trace['line']);
$trace .= sprintf ("in [file: '%s'][function: '%s'][line: %s];\n", $trace['file'], $trace['function'],$trace['line']); }
} $msg = sprintf( '%s\n%s: [errno: %s]: %s',
$msg = sprintf ( '%s\n%s: [errno: %s]: %s', $trace, error2string($level), $errno, $msg);
$trace, error2string ($level), $errno, $msg); if ($this->with_exceptions) {
if ($this->with_exceptions) throw new httpException($msg, $errno);
{ } else {
throw new httpException ($msg, $errno); trigger_error($msg, $level);
} return array (false, $msg);
else }
{ }
trigger_error ($msg, $level);
return array (false, $msg);
}
}
private function _streamString ($string) private function _streamString($string)
{ {
$success = fwrite ($this->connection, $string); $success = fwrite($this->connection, $string);
if (!$success) if (!$success) {
{ return false;
return false; }
} return true;
return true; }
}
private function _StreamRequest ($arguments) private function _StreamRequest($arguments)
{ {
$this->status = false; $this->status = false;
$this->reply_headers = array (); $this->reply_headers = array ();
$this->reply_body = ""; $this->reply_body = "";
if (!$this->connected) if (!$this->connected) {
{ return $this->_HttpError(_("not connected"), E_USER_WARNING);
return $this->_HttpError (_("not connected"), E_USER_WARNING); }
} $this->arguments = $arguments;
$this->arguments = $arguments; $content_length = 0;
$content_length = 0; foreach ($this->arguments["BodyStream"] as $argument) {
foreach ($this->arguments["BodyStream"] as $argument) // list ($type, $value) = each ($argument);
{ $type = key($argument);
list ($type, $value) = each ($argument); $value = current($argument);
reset ($argument); reset($argument);
if ($type == "Data") if ($type == "Data") {
{ $length = strlen($value);
$length = strlen ($value); } elseif ($type == "File") {
} if (is_readable($value)) {
elseif ($type == "File") $length = filesize($value);
{ } else {
if (is_readable ($value)) $length = 0;
{ return $this->_HttpError(sprintf(_("%s: file is not readable"), $value), E_USER_WARNING);
$length = filesize ($value); }
} } else {
else $length = 0;
{ return $this->_HttpError(sprintf(_("%s: not a valid argument for content"), $type), E_USER_WARNING);
$length = 0; }
return $this->_HttpError (sprintf (_("%s: file is not readable"), $value), E_USER_WARNING); $content_length += $length;
} }
} $this->request_body = sprintf(_("%s Bytes"), $content_length);
else $this->headers["Content-Length"] = $content_length;
{ $this->arguments["Headers"] = array_merge($this->headers, $this->arguments["Headers"]);
$length = 0; if ($this->arguments["RequestMethod"] != "POST") {
return $this->_HttpError (sprintf(_("%s: not a valid argument for content"), $type), E_USER_WARNING); return $this->_HttpError(sprintf(_("%s: method not implemented"), $arguments["RequestMethod"]), E_USER_WARNING);
} }
$content_length += $length; $string = sprintf("POST %s HTTP/1.1\r\n", $this->arguments["RequestURI"]);
} $this->request_headers[$string] = '';
$this->request_body = sprintf (_("%s Bytes"), $content_length); if (!$this->_streamString($string)) {
$this->headers["Content-Length"] = $content_length; return $this->_HttpError(_("Error while puts POST operation"), E_USER_WARNING);
$this->arguments["Headers"] = array_merge ($this->headers, $this->arguments["Headers"]); }
if ($this->arguments["RequestMethod"] != "POST") foreach ($this->arguments["Headers"] as $header => $value) {
{ $string = sprintf("%s: %s\r\n", $header, $value);
return $this->_HttpError (sprintf(_("%s: method not implemented"), $arguments["RequestMethod"]), E_USER_WARNING); $this->request_headers[$header] = $value;
} if (!$this->_streamString($string)) {
$string = sprintf ("POST %s HTTP/1.1\r\n", $this->arguments["RequestURI"]); return $this->_HttpError(_("Error while puts HTTP headers"), E_USER_WARNING);
$this->request_headers[$string] = ''; }
if (!$this->_streamString ($string)) }
{ $string = "\r\n";
return $this->_HttpError (_("Error while puts POST operation"), E_USER_WARNING); if (!$this->_streamString($string)) {
} return $this->_HttpError(_("Error while ends HTTP headers"), E_USER_WARNING);
foreach ($this->arguments["Headers"] as $header => $value) }
{ foreach ($this->arguments["BodyStream"] as $argument) {
$string = sprintf ("%s: %s\r\n", $header, $value); // list ($type, $value) = each ($argument);
$this->request_headers[$header] = $value; $type = key($argument);
if (!$this->_streamString ($string)) $value = current($argument);
{ reset($argument);
return $this->_HttpError (_("Error while puts HTTP headers"), E_USER_WARNING); if ($type == "Data") {
} $streamed_length = 0;
} while ($streamed_length < strlen($value)) {
$string = "\r\n"; $string = substr($value, $streamed_length, $this->window_size);
if (!$this->_streamString ($string)) if (!$this->_streamString($string)) {
{ return $this->_HttpError(_("error while sending body data"), E_USER_WARNING);
return $this->_HttpError (_("Error while ends HTTP headers"), E_USER_WARNING); }
} $streamed_length += $this->window_size;
foreach ($this->arguments["BodyStream"] as $argument) }
{ } elseif ($type == "File") {
list ($type, $value) = each ($argument); if (is_readable($value)) {
reset ($argument); $file = fopen($value, 'rb');
if ($type == "Data") while (!feof($file)) {
{ if (gettype($block = @fread($file, $this->window_size)) != "string") {
$streamed_length = 0; return $this->_HttpError(_("cannot read file to upload"), E_USER_WARNING);
while ($streamed_length < strlen ($value)) }
{ if (!$this->_streamString($block)) {
$string = substr ($value, $streamed_length, $this->window_size); return $this->_HttpError(_("error while sending body data"), E_USER_WARNING);
if (!$this->_streamString ($string)) }
{ }
return $this->_HttpError (_("error while sending body data"), E_USER_WARNING); }
} }
$streamed_length += $this->window_size; }
} return array (true, "success");
} }
elseif ($type == "File")
{
if (is_readable ($value))
{
$file = fopen ($value, 'rb');
while (!feof ($file))
{
if (gettype ($block = @fread ($file, $this->window_size)) != "string")
{
return $this->_HttpError (_("cannot read file to upload"), E_USER_WARNING);
}
if (!$this->_streamString ($block))
{
return $this->_HttpError (_("error while sending body data"), E_USER_WARNING);
}
}
}
}
}
return array (true, "success");
}
private function _ReadReply () private function _ReadReply()
{ {
if (!$this->connected) if (!$this->connected) {
{ return array (false, _("not connected"));
return array (false, _("not connected")); }
} $this->reply_headers = array ();
$this->reply_headers = array (); $this->reply_body = "";
$this->reply_body = ""; $headers = array ();
$headers = array (); $body = "";
$body = ""; while (!feof($this->connection)) {
while (!feof ($this->connection)) $line = fgets($this->connection, 1024);
{ if (strlen(trim($line)) == 0) {
$line = fgets ($this->connection, 1024); break;
if (strlen (trim($line)) == 0) } // \r\n => end of headers
{ if (preg_match('#^[[:space:]]#', $line)) {
break; $headers[-1] .= sprintf(' %s', trim($line));
} // \r\n => end of headers continue;
if (preg_match ('#^[[:space:]]#', $line)) }
{ $headers[] = trim($line);
$headers[-1] .= sprintf(' %s', trim ($line)); }
continue; $this->status = isset($headers[0]) ? strtolower($headers[0]) : false;
} foreach ($headers as $header) {
$headers[] = trim ($line); $header = preg_split("#: #", $header);
} $header[0] = strtolower($header[0]);
$this->status = isset ($headers[0]) ? strtolower ($headers[0]) : false; if ($header[0] !== "www-authenticate") {
foreach ($headers as $header) $header[1] = isset($header[1]) ? strtolower($header[1]) : "";
{ }
$header = preg_split ("#: #", $header); if (!isset($this->reply_headers[$header[0]])) {
$header[0] = strtolower ($header[0]); $this->reply_headers[$header[0]] = $header[1];
if ($header[0] !== "www-authenticate") }
{ }
$header[1] = isset ($header[1]) ? strtolower ($header[1]) : ""; self::_ReadStream();
} return true;
if (!isset ($this->reply_headers[$header[0]])) }
{
$this->reply_headers[$header[0]] = $header[1];
}
}
self::_ReadStream ();
return true;
}
private function _ReadStream () private function _ReadStream()
{ {
if (! array_key_exists ("content-length", $this->reply_headers)) if (! array_key_exists("content-length", $this->reply_headers)) {
{ stream_set_blocking($this->connection, 0);
stream_set_blocking($this->connection, 0); $this->reply_body = stream_get_contents($this->connection);
$this->reply_body = stream_get_contents($this->connection); return true;
return true; }
} stream_set_blocking($this->connection, 1);
stream_set_blocking($this->connection, 1); $content_length = $this->reply_headers["content-length"];
$content_length = $this->reply_headers["content-length"]; $this->reply_body = stream_get_contents($this->connection, $content_length);
$this->reply_body = stream_get_contents($this->connection,$content_length); return true;
return true; }
}
private function _BuildDigest () private function _BuildDigest()
{ {
$auth = $this->reply_headers["www-authenticate"]; $auth = $this->reply_headers["www-authenticate"];
#list ($head, $auth) = split (" ", $auth, 2); // list ($head, $auth) = split (" ", $auth, 2);
list ($head, $auth) = preg_split ("# #", $auth, 2); list ($head, $auth) = preg_split("# #", $auth, 2);
#$auth = split (", ", $auth); // $auth = split (", ", $auth);
$auth = preg_split ("#, #", $auth); $auth = preg_split("#, #", $auth);
foreach ($auth as $sheme) foreach ($auth as $sheme) {
{ // list ($sheme, $value) = split ('=', $sheme);
#list ($sheme, $value) = split ('=', $sheme); list ($sheme, $value) = preg_split('#=#', $sheme);
list ($sheme, $value) = preg_split ('#=#', $sheme); $fields[$sheme] = trim(trim($value), '"');
$fields[$sheme] = trim (trim ($value), '"'); }
} $nc = sprintf('%x', $this->nc);
$nc = sprintf ('%x', $this->nc); $prepend = "";
$prepend = ""; while ((strlen($nc) + strlen($prepend)) < 8)
while ((strlen ($nc) + strlen ($prepend)) < 8) $prependi .= "0";
$prependi .= "0"; $nc = $prepend.$nc;
$nc = $prepend.$nc; $cnonce = "printipp";
$cnonce = "printipp"; $username = $this->user;
$username = $this->user; $password = $this->password;
$password = $this->password; $A1 = $username.":".$fields["realm"].":".$password;
$A1 = $username.":".$fields["realm"].":".$password; if (array_key_exists("algorithm", $fields)) {
if (array_key_exists ("algorithm", $fields)) $algorithm = strtolower($fields["algorithm"]);
{ switch ($algorithm) {
$algorithm = strtolower ($fields["algorithm"]); case "md5":
switch ($algorithm) break;
{
case "md5":
break;
case "md5-sess": case "md5-sess":
$A1 = $A1 =
$username.":".$fields["realm"].":".$password.":". $username.":".$fields["realm"].":".$password.":".
$fields['nonce'].":".$cnonce; $fields['nonce'].":".$cnonce;
break; break;
default: default:
return $this->_HttpError( return $this->_HttpError(
sprintf (_("digest Authorization: algorithm '%s' not implemented"), sprintf(_("digest Authorization: algorithm '%s' not implemented"),
$algorithm), $algorithm),
E_USER_WARNING); E_USER_WARNING);
return false; return false;
break; break;
} }
} }
$A2 = "POST:".$this->arguments["RequestURI"]; $A2 = "POST:".$this->arguments["RequestURI"];
if (array_key_exists ("qop", $fields)) if (array_key_exists("qop", $fields)) {
{ $qop = strtolower($fields["qop"]);
$qop = strtolower ($fields["qop"]); // $qop = split (" ", $qop);
#$qop = split (" ", $qop); $qop = preg_split("# #", $qop);
$qop = preg_split ("# #", $qop); if (in_array("auth", $qop)) {
if (in_array ("auth", $qop)) $qop = "auth";
{ } else {
$qop = "auth"; self::_HttpError(
} sprintf(_("digest Authorization: algorithm '%s' not implemented"),
else $qop),
{ E_USER_WARNING);
self::_HttpError( return false;
sprintf (_("digest Authorization: algorithm '%s' not implemented"), }
$qop), }
E_USER_WARNING); $response = md5(md5($A1).":".$fields["nonce"].":".md5($A2));
return false; if (isset($qop) && ($qop == "auth")) {
} $response =
} md5(md5($A1).":".$fields["nonce"].":".$nc.":".$cnonce.":".$qop.
$response = md5 (md5 ($A1).":".$fields["nonce"].":".md5 ($A2)); ":".$A2);
if (isset ($qop) && ($qop == "auth")) }
{ $auth_scheme =
$response = sprintf('Digest username="%s", realm="%s", nonce="%s", uri="%s", response="%s"',
md5 (md5 ($A1).":".$fields["nonce"].":".$nc.":".$cnonce.":".$qop. $username, $fields["realm"], $fields['nonce'],
":".$A2); $this->arguments["RequestURI"], $response);
} if (isset($algorithm)) {
$auth_scheme = $auth_scheme .= sprintf(', algorithm="%s"', $algorithm);
sprintf }
('Digest username="%s", realm="%s", nonce="%s", uri="%s", response="%s"', if (isset($qop)) {
$username, $fields["realm"], $fields['nonce'], $auth_scheme .= sprintf(', cnonce="%s"', $cnonce);
$this->arguments["RequestURI"], $response); }
if (isset ($algorithm)) if (array_key_exists("opaque", $fields)) {
{ $auth_scheme .= sprintf(', opaque="%s"', $fields['opaque']);
$auth_scheme .= sprintf (', algorithm="%s"', $algorithm); }
} if (isset($qop)) {
if (isset ($qop)) $auth_scheme .= sprintf(', qop="%s"', $qop);
{ }
$auth_scheme .= sprintf (', cnonce="%s"', $cnonce); $auth_scheme .= sprintf(', nc=%s', $nc);
} $this->nc++;
if (array_key_exists ("opaque", $fields)) return $auth_scheme;
{ }
$auth_scheme .= sprintf (', opaque="%s"', $fields['opaque']);
}
if (isset ($qop))
{
$auth_scheme .= sprintf (', qop="%s"', $qop);
}
$auth_scheme .= sprintf (', nc=%s', $nc);
$this->nc++;
return $auth_scheme;
}
} }

View File

@ -87,6 +87,9 @@ ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0;
ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL; ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL;
ALTER TABLE llx_holiday ADD COLUMN fk_user_approve integer DEFAULT NULL; ALTER TABLE llx_holiday ADD COLUMN fk_user_approve integer DEFAULT NULL;
ALTER TABLE llx_ticket MODIFY COLUMN progress integer;
ALTER TABLE llx_emailcollector_emailcollectoraction MODIFY COLUMN actionparam TEXT; ALTER TABLE llx_emailcollector_emailcollectoraction MODIFY COLUMN actionparam TEXT;
ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN lang varchar(6); ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN lang varchar(6);
@ -157,24 +160,23 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', '
-- START GRH/HRM MODULE -- START GRH/HRM MODULE
CREATE TABLE llx_hrm_evaluation( CREATE TABLE llx_hrm_evaluation
-- BEGIN MODULEBUILDER FIELDS (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL, ref varchar(128) DEFAULT '(PROV)' NOT NULL,
label varchar(255), label varchar(255),
description text, description text,
note_public text, note_public text,
note_private text, note_private text,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp, tms timestamp,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
import_key varchar(14), import_key varchar(14),
status smallint NOT NULL, status smallint NOT NULL,
date_eval date, date_eval date,
fk_user integer NOT NULL, fk_user integer NOT NULL,
fk_job integer NOT NULL fk_job integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_rowid (rowid); ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_rowid (rowid);
ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_ref (ref); ALTER TABLE llx_hrm_evaluation ADD INDEX idx_hrm_evaluation_ref (ref);
@ -193,19 +195,19 @@ create table llx_hrm_evaluation_extrafields
ALTER TABLE llx_hrm_evaluation_extrafields ADD INDEX idx_evaluation_fk_object(fk_object); ALTER TABLE llx_hrm_evaluation_extrafields ADD INDEX idx_evaluation_fk_object(fk_object);
CREATE TABLE llx_hrm_evaluationdet( CREATE TABLE llx_hrm_evaluationdet
(
-- BEGIN MODULEBUILDER FIELDS -- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp, tms timestamp,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
fk_skill integer NOT NULL, fk_skill integer NOT NULL,
fk_evaluation integer NOT NULL, fk_evaluation integer NOT NULL,
rank integer NOT NULL, rankorder integer NOT NULL,
required_rank integer NOT NULL, required_rank integer NOT NULL,
import_key varchar(14) import_key varchar(14)
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_rowid (rowid); ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_rowid (rowid);
@ -226,20 +228,18 @@ ALTER TABLE llx_hrm_evaluationdet_extrafields ADD INDEX idx_evaluationdet_fk_obj
CREATE TABLE llx_hrm_job
CREATE TABLE llx_hrm_job( (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, label varchar(255) NOT NULL,
label varchar(255) NOT NULL, description text,
description text, date_creation datetime NOT NULL,
date_creation datetime NOT NULL, tms timestamp,
tms timestamp, deplacement varchar(255),
deplacement varchar(255), note_public text,
note_public text, note_private text,
note_private text, fk_user_creat integer,
fk_user_creat integer, fk_user_modif integer
fk_user_modif integer
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_rowid (rowid); ALTER TABLE llx_hrm_job ADD INDEX idx_hrm_job_rowid (rowid);
@ -259,23 +259,21 @@ ALTER TABLE llx_hrm_job_extrafields ADD INDEX idx_job_fk_object(fk_object);
CREATE TABLE llx_hrm_job_user( CREATE TABLE llx_hrm_job_user(
-- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, -- ref varchar(128) NOT NULL,
-- ref varchar(128) NOT NULL, description text,
description text, date_creation datetime NOT NULL,
date_creation datetime NOT NULL, tms timestamp,
tms timestamp, fk_contrat integer,
fk_contrat integer, fk_user integer NOT NULL,
fk_user integer NOT NULL, fk_job integer NOT NULL,
fk_job integer NOT NULL, date_start date,
date_start date, date_end date,
date_end date, abort_comment varchar(255),
commentaire_abandon varchar(255), note_public text,
note_public text, note_private text,
note_private text, fk_user_creat integer,
fk_user_creat integer, fk_user_modif integer
fk_user_modif integer
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_rowid (rowid); ALTER TABLE llx_hrm_job_user ADD INDEX idx_hrm_job_user_rowid (rowid);
@ -294,22 +292,21 @@ ALTER TABLE llx_hrm_job_user_extrafields ADD INDEX idx_position_fk_object(fk_obj
CREATE TABLE llx_hrm_skill( CREATE TABLE llx_hrm_skill
-- BEGIN MODULEBUILDER FIELDS (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
label varchar(255), label varchar(255),
description text, description text,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp, tms timestamp,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
required_level integer NOT NULL, required_level integer NOT NULL,
date_validite integer NOT NULL, date_validite integer NOT NULL,
temps_theorique double(24,8) NOT NULL, temps_theorique double(24,8) NOT NULL,
skill_type integer NOT NULL, skill_type integer NOT NULL,
note_public text, note_public text,
note_private text note_private text
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_rowid (rowid); ALTER TABLE llx_hrm_skill ADD INDEX idx_hrm_skill_rowid (rowid);
@ -327,15 +324,14 @@ create table llx_hrm_skill_extrafields
ALTER TABLE llx_hrm_skill_extrafields ADD INDEX idx_skill_fk_object(fk_object); ALTER TABLE llx_hrm_skill_extrafields ADD INDEX idx_skill_fk_object(fk_object);
CREATE TABLE llx_hrm_skilldet( CREATE TABLE llx_hrm_skilldet
-- BEGIN MODULEBUILDER FIELDS (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
description text, description text,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
fk_skill integer NOT NULL, fk_skill integer NOT NULL,
rank integer rankorder integer
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_skilldet ADD INDEX idx_hrm_skilldet_rowid (rowid); ALTER TABLE llx_hrm_skilldet ADD INDEX idx_hrm_skilldet_rowid (rowid);
@ -352,18 +348,17 @@ create table llx_hrm_skilldet_extrafields
ALTER TABLE llx_hrm_skilldet_extrafields ADD INDEX idx_skilldet_fk_object(fk_object); ALTER TABLE llx_hrm_skilldet_extrafields ADD INDEX idx_skilldet_fk_object(fk_object);
CREATE TABLE llx_hrm_skillrank( CREATE TABLE llx_hrm_skillrank
-- BEGIN MODULEBUILDER FIELDS (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_skill integer NOT NULL, fk_skill integer NOT NULL,
rank integer NOT NULL, rankorder integer NOT NULL,
fk_object integer NOT NULL, fk_object integer NOT NULL,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
objecttype varchar(128) NOT NULL objecttype varchar(128) NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_rowid (rowid); ALTER TABLE llx_hrm_skillrank ADD INDEX idx_hrm_skillrank_rowid (rowid);
@ -429,4 +424,3 @@ ALTER TABLE llx_socpeople DROP COLUMN googleplus;
ALTER TABLE llx_socpeople DROP COLUMN youtube; ALTER TABLE llx_socpeople DROP COLUMN youtube;
ALTER TABLE llx_socpeople DROP COLUMN whatsapp; ALTER TABLE llx_socpeople DROP COLUMN whatsapp;

View File

@ -16,8 +16,8 @@
-- along with this program. If not, see https://www.gnu.org/licenses/. -- along with this program. If not, see https://www.gnu.org/licenses/.
CREATE TABLE llx_hrm_evaluationdet( CREATE TABLE llx_hrm_evaluationdet
-- BEGIN MODULEBUILDER FIELDS (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp, tms timestamp,
@ -25,8 +25,7 @@ CREATE TABLE llx_hrm_evaluationdet(
fk_user_modif integer, fk_user_modif integer,
fk_skill integer NOT NULL, fk_skill integer NOT NULL,
fk_evaluation integer NOT NULL, fk_evaluation integer NOT NULL,
rank integer NOT NULL, rankorder integer NOT NULL,
required_rank integer NOT NULL, required_rank integer NOT NULL,
import_key varchar(14) import_key varchar(14)
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;

View File

@ -27,7 +27,7 @@ CREATE TABLE llx_hrm_job_user(
fk_job integer NOT NULL, fk_job integer NOT NULL,
date_start datetime, date_start datetime,
date_end datetime, date_end datetime,
commentaire_abandon varchar(255), abort_comment varchar(255),
note_public text, note_public text,
note_private text, note_private text,
fk_user_creat integer, fk_user_creat integer,

View File

@ -17,12 +17,10 @@
CREATE TABLE llx_hrm_skilldet( CREATE TABLE llx_hrm_skilldet(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
description text, description text,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
fk_skill integer NOT NULL, fk_skill integer NOT NULL,
rank integer rankorder integer
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;

View File

@ -15,16 +15,15 @@
-- along with this program. If not, see https://www.gnu.org/licenses/. -- along with this program. If not, see https://www.gnu.org/licenses/.
CREATE TABLE llx_hrm_skillrank( CREATE TABLE llx_hrm_skillrank
-- BEGIN MODULEBUILDER FIELDS (
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_skill integer NOT NULL, fk_skill integer NOT NULL,
rank integer NOT NULL, rankorder integer NOT NULL,
fk_object integer NOT NULL, fk_object integer NOT NULL,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,
fk_user_modif integer, fk_user_modif integer,
objecttype varchar(128) NOT NULL objecttype varchar(128) NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;

View File

@ -29,7 +29,7 @@ CREATE TABLE llx_ticket
message text, message text,
fk_statut integer, fk_statut integer,
resolution integer, resolution integer,
progress varchar(100), progress integer DEFAULT 0, -- progression 0 - 100 or null
timing varchar(20), timing varchar(20),
type_code varchar(32), type_code varchar(32),
category_code varchar(32), category_code varchar(32),

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -104,7 +104,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array(); $fieldstosearchall = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
if ($val['searchall']) { if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label']; $fieldstosearchall['t.'.$key] = $val['label'];
} }
} }
@ -444,6 +444,7 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$searchkey = empty($search[$key]) ? '' : $search[$key];
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'status') { if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
@ -458,9 +459,9 @@ foreach ($object->fields as $key => $val) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $searchkey, $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, $searchkey, '', '', 'search_', 'maxwidth125', 1);
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -469,9 +470,9 @@ foreach ($object->fields as $key => $val) {
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>'; print '</div>';
} elseif ($key == 'lang') { } elseif ($key == 'lang') {
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); print $formadmin->select_language($searchkey, 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
} else { } else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($searchkey).'">';
} }
print '</td>'; print '</td>';
} }
@ -522,7 +523,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line // Detect if we need a fetch on each output line
$needToFetchEachLine = 0; $needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) { if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object $needToFetchEachLine++; // There is at least one compute field that use $object

View File

@ -501,6 +501,7 @@ WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to se
WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other. WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other.
WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: <strong>%s</strong>. WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: <strong>%s</strong>.
WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: <strong>%s</strong>. WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: <strong>%s</strong>.
ActualMailSPFRecordFound=Actual SPF record found : %s
ClickToShowDescription=Click to show description ClickToShowDescription=Click to show description
DependsOn=This module needs the module(s) DependsOn=This module needs the module(s)
RequiredBy=This module is required by module(s) RequiredBy=This module is required by module(s)

View File

@ -271,6 +271,12 @@ ProfId3RU=Prof Id 3 (KPP)
ProfId4RU=Prof Id 4 (OKPO) ProfId4RU=Prof Id 4 (OKPO)
ProfId5RU=- ProfId5RU=-
ProfId6RU=- ProfId6RU=-
ProfId1UA=Prof Id 1 (EDRPOU)
ProfId2UA=Prof Id 2 (DRFO)
ProfId3UA=Prof Id 3 (INN)
ProfId4UA=Prof Id 4 (Certificate)
ProfId5UA=Prof Id 5 (RNOKPP)
ProfId6UA=Prof Id 6 (TRDPAU)
ProfId1DZ=RC ProfId1DZ=RC
ProfId2DZ=Art. ProfId2DZ=Art.
ProfId3DZ=NIF ProfId3DZ=NIF

View File

@ -6,6 +6,7 @@ CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Autom
Salary=Salary Salary=Salary
Salaries=Salaries Salaries=Salaries
NewSalary=New salary NewSalary=New salary
AddSalary=Add salary
NewSalaryPayment=New salary card NewSalaryPayment=New salary card
AddSalaryPayment=Add salary payment AddSalaryPayment=Add salary payment
SalaryPayment=Salary payment SalaryPayment=Salary payment

View File

@ -63,6 +63,7 @@ RuleForWarehouse=Rule for warehouses
WarehouseAskWarehouseOnThirparty=Set a warehouse on Third-parties WarehouseAskWarehouseOnThirparty=Set a warehouse on Third-parties
WarehouseAskWarehouseDuringPropal=Set a warehouse on Commercial proposals WarehouseAskWarehouseDuringPropal=Set a warehouse on Commercial proposals
WarehouseAskWarehouseDuringOrder=Set a warehouse on Sales Orders WarehouseAskWarehouseDuringOrder=Set a warehouse on Sales Orders
WarehouseAskWarehouseDuringProject=Set a warehouse on Projects
UserDefaultWarehouse=Set a warehouse on Users UserDefaultWarehouse=Set a warehouse on Users
MainDefaultWarehouse=Default warehouse MainDefaultWarehouse=Default warehouse
MainDefaultWarehouseUser=Use a default warehouse for each user MainDefaultWarehouseUser=Use a default warehouse for each user

View File

@ -354,13 +354,14 @@ if ($action == 'edit') {
$result = $c->fetch($conf->global->{$constname}); $result = $c->fetch($conf->global->{$constname});
if ($result < 0) { if ($result < 0) {
setEventMessages(null, $c->errors, 'errors'); setEventMessages(null, $c->errors, 'errors');
} elseif ($result > 0 ) {
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} }
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} elseif (preg_match('/thirdparty_type/', $val['type'])) { } elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) { if ($conf->global->{$constname}==2) {
print $langs->trans("Prospect"); print $langs->trans("Prospect");

View File

@ -2178,8 +2178,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>'; print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
print $object->getLibStatut(0, 2); print $object->getLibStatut(0, 2);
print '</td></tr>'; print '</td></tr>';
if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) { || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) {
print '<tr><td>'.$langs->trans("ManageLotMask").'</td><td>'; print '<tr><td>'.$langs->trans("ManageLotMask").'</td><td>';
print $object->batch_mask; print $object->batch_mask;
print '</td></tr>'; print '</td></tr>';
@ -2689,7 +2689,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
// Documents // Documents
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$relativepath = $comref.'/'.$objectref.'.pdf';
if (!empty($conf->product->multidir_output[$object->entity])) { if (!empty($conf->product->multidir_output[$object->entity])) {
$filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities $filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities
} else { } else {
@ -2699,7 +2698,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
$genallowed = $usercanread; $genallowed = $usercanread;
$delallowed = $usercancreate; $delallowed = $usercancreate;
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $langs->getDefaultLang(), '', $object);
$somethingshown = $formfile->numoffiles; $somethingshown = $formfile->numoffiles;
print '</div><div class="fichehalfright">'; print '</div><div class="fichehalfright">';

View File

@ -931,7 +931,7 @@ END;
'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY), 'checked'=>0, 'position'=>4), 'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY), 'checked'=>0, 'position'=>4),
'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5), 'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5),
'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9), 'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9),
'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => $conf->multicurrency->enabled, 'checked'=>0, 'position'=>10), 'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => (!empty($conf->multicurrency->enabled)), 'checked'=>0, 'position'=>10),
'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13), 'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13),
'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14), 'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14),
'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>15), 'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>15),
@ -942,14 +942,19 @@ END;
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["product_fournisseur_price"])) {
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if (!empty($extralabels)) { if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) { foreach ($extralabels as $key => $value) {
// Show field if not hidden // Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
$extratitle = $langs->trans($value); $extratitle = $langs->trans($value);
$arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position'] + 1), 'langfile'=>$extrafields->attributes["product_fournisseur_price"]['langfile'][$key], 'help'=>$extrafields->attributes["product_fournisseur_price"]['help'][$key]); $arrayfields['ef.' . $key] = array('label' => $extratitle, 'checked' => 0,
'position' => (end($arrayfields)['position'] + 1),
'langfile' => $extrafields->attributes["product_fournisseur_price"]['langfile'][$key],
'help' => $extrafields->attributes["product_fournisseur_price"]['help'][$key]);
}
} }
} }
} }
@ -1023,29 +1028,31 @@ END;
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["product_fournisseur_price"])) {
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if (!empty($extralabels)) { if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) { foreach ($extralabels as $key => $value) {
// Show field if not hidden // Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) { if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) {
$langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
} }
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) { if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) {
$extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
} else { } else {
$extratitle = $langs->trans($value); $extratitle = $langs->trans($value);
} }
if (!empty($arrayfields['ef.'.$key]['checked'])) { if (!empty($arrayfields['ef.' . $key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.'.$key, '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.' . $key, '', $param, '', $sortfield, $sortorder, 'right ');
}
} }
} }
} }
} }
if (is_object($hookmanager)) { if (is_object($hookmanager)) {
$parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id); $parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
} }
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@ -1213,7 +1220,7 @@ END;
} }
if (is_object($hookmanager)) { if (is_object($hookmanager)) {
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>$id_fourn, 'prod_id'=>$object->id); $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);
} }

View File

@ -178,7 +178,7 @@ $arrayofmode = array(
'facture' => 'Facture' 'facture' => 'Facture'
); );
$title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1); $title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1);
$title .= ' <input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">'; $title .= ' <input type="submit" class="button small" name="refresh" value="'.$langs->trans("Refresh").'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -198,7 +198,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print "<tr class=\"liste_titre\">"; print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); 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('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);

View File

@ -45,6 +45,7 @@ $ref = GETPOST('ref', 'alpha');
$mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit'); $mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit');
$search_year = GETPOST('search_year', 'int'); $search_year = GETPOST('search_year', 'int');
$search_categ = GETPOST('search_categ', 'int'); $search_categ = GETPOST('search_categ', 'int');
$notab = GETPOST('notab', 'int');
$error = 0; $error = 0;
$mesg = ''; $mesg = '';
@ -56,7 +57,7 @@ if (!empty($user->socid)) {
} }
// Security check // Security check
$fieldvalue = (!empty($id) ? $id : $ref); $fieldvalue = ($id > 0 ? $id : $ref);
$fieldtype = (!empty($ref) ? 'ref' : 'rowid'); $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // 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 = ""; $moreforfilter = "";
$object = new Product($db);
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
}
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); $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); $form = new Form($db);
$htmlother = new FormOther($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")); llxHeader("", $langs->trans("ProductStatistics"));
$type = GETPOST('type', 'int'); $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); $head = product_prepare_head($object);
$titre = $langs->trans("CardProduct".$object->type); $titre = $langs->trans("CardProduct".$object->type);
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
@ -145,11 +152,11 @@ if ($result && (!empty($id) || !empty($ref))) {
print dol_get_fiche_end(); print dol_get_fiche_end();
} }
if (empty($id) && empty($ref)) { if ((!($id > 0) && empty($ref)) || $notab) {
$h = 0; $h = 0;
$head = array(); $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][1] = $langs->trans("Chart");
$head[$h][2] = 'chart'; $head[$h][2] = 'chart';
$h++; $h++;
@ -162,7 +169,7 @@ if (empty($id) && empty($ref)) {
$title = $langs->trans("ListProductByPopularity"); $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][1] = $langs->trans("ProductsPerPopularity");
$head[$h][2] = 'popularity'; $head[$h][2] = 'popularity';
$h++; $h++;
@ -171,21 +178,29 @@ if (empty($id) && empty($ref)) {
} }
if ($result || empty($id)) { if ($result || !($id > 0)) {
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$id.'">'; if (empty($id) || $notab) {
print '<input type="hidden" name="notab" value="1">';
}
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
if (empty($id)) { if (!($id > 0) || $notab) {
// Type // Type
print '<tr><td class="titlefield">'.$langs->trans("ProductsAndServices").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
$array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); $array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
print $form->selectarray('type', $array, $type); print $form->selectarray('type', $array, $type);
print '</td></tr>'; print '</td></tr>';
// Product
print '<tr><td class="titlefield">'.$langs->trans("ProductOrService").'</td><td>';
print img_picto('', 'product', 'class="pictofixedwidth"');
print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, 'maxwidth500');
print '</td></tr>';
// Tag // Tag
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
@ -194,6 +209,8 @@ if ($result || empty($id)) {
print $moreforfilter; print $moreforfilter;
print '</td></tr>'; print '</td></tr>';
} }
} else {
print '<input type="hidden" name="id" value="'.$id.'">';
} }
// Year // Year
@ -224,7 +241,7 @@ if ($result || empty($id)) {
} }
if ($mode == 'bynumber') { if ($mode == 'bynumber') {
print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id') ?GETPOST('id') : $object->id).($type != '' ? '&type='.$type : '').'&mode=byunit&search_year='.$search_year.'">'; print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(($type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&mode=byunit&search_year='.((int) $search_year).($notab ? '&notab='.$notab : '').'">';
} else { } else {
print '<span class="a-mesure marginleftonly marginrightonly">'; print '<span class="a-mesure marginleftonly marginrightonly">';
} }
@ -240,7 +257,7 @@ if ($result || empty($id)) {
} }
if ($mode == 'byunit') { if ($mode == 'byunit') {
print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id') ?GETPOST('id') : $object->id).($type != '' ? '&type='.$type : '').'&mode=bynumber&search_year='.$search_year.'">'; print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(($type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&mode=bynumber&search_year='.((int) $search_year).($notab ? '&notab='.$notab : '').'">';
} else { } else {
print '<span class="a-mesure marginleftonly marginrightonly">'; print '<span class="a-mesure marginleftonly marginrightonly">';
} }
@ -258,9 +275,7 @@ if ($result || empty($id)) {
} }
print '<br>'; print '<br>';
//print '<table width="100%">'; // Generation of graphs
// Generation des graphs
$dir = (!empty($conf->product->multidir_temp[$object->entity]) ? $conf->product->multidir_temp[$object->entity] : $conf->service->multidir_temp[$object->entity]); $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 ($object->id > 0) { // We are on statistics for a dedicated product
if (!file_exists($dir.'/'.$object->id)) { if (!file_exists($dir.'/'.$object->id)) {
@ -385,7 +400,7 @@ if ($result || empty($id)) {
$px->SetShading(3); $px->SetShading(3);
//print 'x '.$key.' '.$graphfiles[$key]['file']; //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 ? '&notab='.$notab : '');
$px->draw($dir."/".$graphfiles[$key]['file'], $url); $px->draw($dir."/".$graphfiles[$key]['file'], $url);
$graphfiles[$key]['total'] = $px->total(); $graphfiles[$key]['total'] = $px->total();
@ -446,7 +461,9 @@ if ($result || empty($id)) {
} else { } else {
$dategenerated = ($mesg ? '<span class="error">'.$mesg.'</span>' : $langs->trans("ChartNotGenerated")); $dategenerated = ($mesg ? '<span class="error">'.$mesg.'</span>' : $langs->trans("ChartNotGenerated"));
} }
$linktoregenerate = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id') ?GETPOST('id') : $object->id).((string) $type != '' ? '&type='.$type : '').'&action=recalcul&mode='.$mode.'&search_year='.$search_year.'&search_categ='.$search_categ.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh').'</a>'; $linktoregenerate = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(((string) $type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&action=recalcul&mode='.urlencode($mode).'&search_year='.((int) $search_year).($search_categ > 0 ? '&search_categ='.((int) $search_categ) : '').'">';
$linktoregenerate .= img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh');
$linktoregenerate .= '</a>';
// Show graph // Show graph
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -480,7 +497,7 @@ if ($result || empty($id)) {
} }
} }
if (!$id) { if (!($id > 0)) {
print dol_get_fiche_end(); print dol_get_fiche_end();
} }

View File

@ -195,6 +195,7 @@ $now = dol_now();
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks'; $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$title = $langs->trans("ListOfWarehouses"); $title = $langs->trans("ListOfWarehouses");
$totalarray = array();
// Build and execute select // Build and execute select
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@ -566,7 +567,6 @@ print '</tr>'."\n";
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array();
$warehouse = new Entrepot($db); $warehouse = new Entrepot($db);

View File

@ -358,12 +358,14 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; $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').')'; //$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) { 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).')'; $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 // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook $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 dol_get_fiche_head($head, 'replenish', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n"; print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
//$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n"; print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n";
} }

View File

@ -1,13 +1,13 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat> * Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr> * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -164,7 +164,7 @@ if ($id == '' && $ref == '') {
exit(); 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 //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db); $object = new Project($db);
@ -366,19 +366,19 @@ $listofreferent = array(
'class'=>'Entrepot', 'class'=>'Entrepot',
'table'=>'entrepot', 'table'=>'entrepot',
'datefieldname'=>'date_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', 'lang'=>'entrepot',
'buttonnew'=>'AddWarehouse', 'buttonnew'=>'AddWarehouse',
'project_field'=>'fk_project', 'project_field'=>'fk_project',
'testnew'=>$user->rights->stock->creer, '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( 'propal'=>array(
'name'=>"Proposals", 'name'=>"Proposals",
'title'=>"ListProposalsAssociatedProject", 'title'=>"ListProposalsAssociatedProject",
'class'=>'Propal', 'class'=>'Propal',
'table'=>'propal', 'table'=>'propal',
'datefieldname'=>'datep', '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', 'lang'=>'propal',
'buttonnew'=>'AddProp', 'buttonnew'=>'AddProp',
'testnew'=>$user->rights->propal->creer, 'testnew'=>$user->rights->propal->creer,
@ -389,7 +389,7 @@ $listofreferent = array(
'class'=>'Commande', 'class'=>'Commande',
'table'=>'commande', 'table'=>'commande',
'datefieldname'=>'date_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', 'lang'=>'orders',
'buttonnew'=>'CreateOrder', 'buttonnew'=>'CreateOrder',
'testnew'=>$user->rights->commande->creer, 'testnew'=>$user->rights->commande->creer,
@ -401,7 +401,7 @@ $listofreferent = array(
'margin'=>'add', 'margin'=>'add',
'table'=>'facture', 'table'=>'facture',
'datefieldname'=>'datef', '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', 'lang'=>'bills',
'buttonnew'=>'CreateBill', 'buttonnew'=>'CreateBill',
'testnew'=>$user->rights->facture->creer, 'testnew'=>$user->rights->facture->creer,
@ -412,7 +412,7 @@ $listofreferent = array(
'class'=>'FactureRec', 'class'=>'FactureRec',
'table'=>'facture_rec', 'table'=>'facture_rec',
'datefieldname'=>'datec', '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', 'lang'=>'bills',
'buttonnew'=>'CreateBill', 'buttonnew'=>'CreateBill',
'testnew'=>$user->rights->facture->creer, 'testnew'=>$user->rights->facture->creer,
@ -423,7 +423,7 @@ $listofreferent = array(
'class'=>'SupplierProposal', 'class'=>'SupplierProposal',
'table'=>'supplier_proposal', 'table'=>'supplier_proposal',
'datefieldname'=>'date_valid', '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', 'lang'=>'supplier_proposal',
'buttonnew'=>'AddSupplierProposal', 'buttonnew'=>'AddSupplierProposal',
'testnew'=>$user->rights->supplier_proposal->creer, 'testnew'=>$user->rights->supplier_proposal->creer,
@ -434,7 +434,7 @@ $listofreferent = array(
'class'=>'CommandeFournisseur', 'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur', 'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande', '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', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierOrder', 'buttonnew'=>'AddSupplierOrder',
'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer), 'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer),
@ -446,7 +446,7 @@ $listofreferent = array(
'margin'=>'minus', 'margin'=>'minus',
'table'=>'facture_fourn', 'table'=>'facture_fourn',
'datefieldname'=>'datef', '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', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierInvoice', 'buttonnew'=>'AddSupplierInvoice',
'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), 'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer),
@ -457,7 +457,7 @@ $listofreferent = array(
'class'=>'Contrat', 'class'=>'Contrat',
'table'=>'contrat', 'table'=>'contrat',
'datefieldname'=>'date_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', 'lang'=>'contracts',
'buttonnew'=>'AddContract', 'buttonnew'=>'AddContract',
'testnew'=>$user->rights->contrat->creer, 'testnew'=>$user->rights->contrat->creer,
@ -470,7 +470,7 @@ $listofreferent = array(
'datefieldname'=>'date_valid', 'datefieldname'=>'date_valid',
'disableamount'=>0, 'disableamount'=>0,
'margin'=>'minus', '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', 'lang'=>'interventions',
'buttonnew'=>'AddIntervention', 'buttonnew'=>'AddIntervention',
'testnew'=>$user->rights->ficheinter->creer, 'testnew'=>$user->rights->ficheinter->creer,
@ -481,7 +481,7 @@ $listofreferent = array(
'class'=>'Expedition', 'class'=>'Expedition',
'table'=>'expedition', 'table'=>'expedition',
'datefieldname'=>'date_valid', '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', 'lang'=>'sendings',
'buttonnew'=>'CreateShipment', 'buttonnew'=>'CreateShipment',
'testnew'=>0, 'testnew'=>0,
@ -492,7 +492,7 @@ $listofreferent = array(
'class'=>'Mo', 'class'=>'Mo',
'table'=>'mrp_mo', 'table'=>'mrp_mo',
'datefieldname'=>'date_valid', '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', 'lang'=>'mrp',
'buttonnew'=>'CreateMO', 'buttonnew'=>'CreateMO',
'testnew'=>'$user->rights->mrp->write', 'testnew'=>'$user->rights->mrp->write',
@ -506,7 +506,7 @@ $listofreferent = array(
'datefieldname'=>'dated', 'datefieldname'=>'dated',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>1, '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', 'lang'=>'trips',
'buttonnew'=>'AddTrip', 'buttonnew'=>'AddTrip',
'testnew'=>$user->rights->deplacement->creer, 'testnew'=>$user->rights->deplacement->creer,
@ -519,7 +519,7 @@ $listofreferent = array(
'datefieldname'=>'date', 'datefieldname'=>'date',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>0, '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', 'lang'=>'trips',
'buttonnew'=>'AddTrip', 'buttonnew'=>'AddTrip',
'testnew'=>$user->rights->expensereport->creer, 'testnew'=>$user->rights->expensereport->creer,
@ -532,7 +532,7 @@ $listofreferent = array(
'table'=>'don', 'table'=>'don',
'datefieldname'=>'datedon', 'datefieldname'=>'datedon',
'disableamount'=>0, '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', 'lang'=>'donations',
'buttonnew'=>'AddDonation', 'buttonnew'=>'AddDonation',
'testnew'=>$user->rights->don->creer, 'testnew'=>$user->rights->don->creer,
@ -545,7 +545,7 @@ $listofreferent = array(
'table'=>'loan', 'table'=>'loan',
'datefieldname'=>'datestart', 'datefieldname'=>'datestart',
'disableamount'=>0, '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', 'lang'=>'loan',
'buttonnew'=>'AddLoan', 'buttonnew'=>'AddLoan',
'testnew'=>$user->rights->loan->write, 'testnew'=>$user->rights->loan->write,
@ -558,7 +558,7 @@ $listofreferent = array(
'table'=>'chargesociales', 'table'=>'chargesociales',
'datefieldname'=>'date_ech', 'datefieldname'=>'date_ech',
'disableamount'=>0, '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', 'lang'=>'compta',
'buttonnew'=>'AddSocialContribution', 'buttonnew'=>'AddSocialContribution',
'testnew'=>$user->rights->tax->charges->lire, 'testnew'=>$user->rights->tax->charges->lire,
@ -571,7 +571,7 @@ $listofreferent = array(
'table'=>'projet_task', 'table'=>'projet_task',
'datefieldname'=>'task_date', 'datefieldname'=>'task_date',
'disableamount'=>0, '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', 'buttonnew'=>'AddTimeSpent',
'testnew'=>$user->rights->projet->creer, 'testnew'=>$user->rights->projet->creer,
'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
@ -588,13 +588,13 @@ $listofreferent = array(
'name'=>"Salaries", 'name'=>"Salaries",
'title'=>"ListSalariesAssociatedProject", 'title'=>"ListSalariesAssociatedProject",
'class'=>'Salary', 'class'=>'Salary',
'table'=>'payment_salary', 'table'=>'salary',
'datefieldname'=>'datev', 'datefieldname'=>'datesp',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>0, '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', 'lang'=>'salaries',
'buttonnew'=>'AddSalaryPayment', 'buttonnew'=>'AddSalary',
'testnew'=>$user->rights->salaries->write, 'testnew'=>$user->rights->salaries->write,
'test'=>$conf->salaries->enabled && $user->rights->salaries->read), 'test'=>$conf->salaries->enabled && $user->rights->salaries->read),
'variouspayment'=>array( 'variouspayment'=>array(
@ -605,7 +605,7 @@ $listofreferent = array(
'datefieldname'=>'datev', 'datefieldname'=>'datev',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>0, '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', 'lang'=>'banks',
'buttonnew'=>'AddVariousPayment', 'buttonnew'=>'AddVariousPayment',
'testnew'=>$user->rights->banque->modifier, 'testnew'=>$user->rights->banque->modifier,
@ -618,7 +618,7 @@ $listofreferent = array(
'table'=>'actioncomm', 'table'=>'actioncomm',
'datefieldname'=>'datep', 'datefieldname'=>'datep',
'disableamount'=>1, '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', 'lang'=>'agenda',
'buttonnew'=>'AddEvent', 'buttonnew'=>'AddEvent',
'testnew'=>$user->rights->agenda->myactions->create, 'testnew'=>$user->rights->agenda->myactions->create,
@ -814,7 +814,7 @@ foreach ($listofreferent as $key => $value) {
} }
// Define $total_ht_by_line // 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; $total_ht_by_line = $element->amount;
} elseif ($tablename == 'fichinter') { } elseif ($tablename == 'fichinter') {
$total_ht_by_line = $element->getAmount(); $total_ht_by_line = $element->getAmount();
@ -856,7 +856,7 @@ foreach ($listofreferent as $key => $value) {
} }
// Define $total_ttc_by_line // 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; $total_ttc_by_line = $element->amount;
} elseif ($tablename == 'fichinter') { } elseif ($tablename == 'fichinter') {
$total_ttc_by_line = $element->getAmount(); $total_ttc_by_line = $element->getAmount();
@ -1073,7 +1073,7 @@ foreach ($listofreferent as $key => $value) {
print ''; // if $key == 'project_task', we don't want details per user print ''; // if $key == 'project_task', we don't want details per user
} elseif (in_array($tablename, array('payment_various'))) { } elseif (in_array($tablename, array('payment_various'))) {
print ''; // if $key == 'payment_various', we don't have any thirdparty 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"); print $langs->trans("User");
} else { } else {
print $langs->trans("ThirdParty"); print $langs->trans("ThirdParty");
@ -1231,8 +1231,8 @@ foreach ($listofreferent as $key => $value) {
$date = $element->date; // No draft status on lines $date = $element->date; // No draft status on lines
} elseif ($tablename == 'stock_mouvement') { } elseif ($tablename == 'stock_mouvement') {
$date = $element->datem; $date = $element->datem;
} elseif ($tablename == 'payment_salary') { } elseif ($tablename == 'salary') {
$date = $element->datev; $date = $element->datesp;
} elseif ($tablename == 'payment_various') { } elseif ($tablename == 'payment_various') {
$date = $element->datev; $date = $element->datev;
} elseif ($tablename == 'chargesociales') { } elseif ($tablename == 'chargesociales') {
@ -1290,7 +1290,7 @@ foreach ($listofreferent as $key => $value) {
$tmpuser = new User($db); $tmpuser = new User($db);
$tmpuser->fetch($expensereport->fk_user_author); $tmpuser->fetch($expensereport->fk_user_author);
print $tmpuser->getNomUrl(1, '', 48); print $tmpuser->getNomUrl(1, '', 48);
} elseif ($tablename == 'payment_salary') { } elseif ($tablename == 'salary') {
$tmpuser = new User($db); $tmpuser = new User($db);
$tmpuser->fetch($element->fk_user); $tmpuser->fetch($element->fk_user);
print $tmpuser->getNomUrl(1, '', 48); print $tmpuser->getNomUrl(1, '', 48);
@ -1318,7 +1318,7 @@ foreach ($listofreferent as $key => $value) {
if (empty($value['disableamount'])) { if (empty($value['disableamount'])) {
$total_ht_by_line = null; $total_ht_by_line = null;
$othermessage = ''; $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; $total_ht_by_line = $element->amount;
} elseif ($tablename == 'fichinter') { } elseif ($tablename == 'fichinter') {
$total_ht_by_line = $element->getAmount(); $total_ht_by_line = $element->getAmount();
@ -1372,7 +1372,7 @@ foreach ($listofreferent as $key => $value) {
// Amount inc tax // Amount inc tax
if (empty($value['disableamount'])) { if (empty($value['disableamount'])) {
$total_ttc_by_line = null; $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; $total_ttc_by_line = $element->amount;
} elseif ($tablename == 'fichinter') { } elseif ($tablename == 'fichinter') {
$total_ttc_by_line = $element->getAmount(); $total_ttc_by_line = $element->getAmount();

View File

@ -67,10 +67,12 @@ $search_task_user = GETPOST('search_task_user', 'int');
$search_task_progress = GETPOST('search_task_progress'); $search_task_progress = GETPOST('search_task_progress');
$search_task_budget_amount = GETPOST('search_task_budget_amount'); $search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_societe = GETPOST('search_societe'); $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) { if ($mine) {
$search_task_user = $user->id; $mine = 0; $search_task_user = $user->id;
$mine = 0;
} }
$search_date_startday = GETPOST('search_date_startday', 'int'); $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'])) { 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"; $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)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
} }
if ($search_project_user > 0) { if ($search_project_user > 0) {
@ -604,7 +606,9 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">'; if (!empty($type)) {
print '<input type="hidden" name="type" value="'.$type.'">';
}
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
// Show description of content // Show description of content
@ -634,7 +638,7 @@ if ($search_all) {
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
} }
$morehtmlfilter = ''; $moreforfilter = '';
// Filter on categories // Filter on categories
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { 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'])) { if (!empty($arrayfields['t.billed']['checked'])) {
print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); 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 // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // 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 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) { if (!empty($arrayfields['t.datec']['checked'])) {
@ -887,7 +915,6 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
} }
$i = 0; $i = 0;
$totalarray = array();
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -1148,7 +1175,7 @@ while ($i < min($num, $limit)) {
} }
$totalarray['val']['t.budget_amount'] += $obj->budget_amount; $totalarray['val']['t.budget_amount'] += $obj->budget_amount;
if (!$i) { if (!$i) {
$totalarray['totalbudget_amount'] = $totalarray['nbfield']; $totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
} }
$totalarray['totalbudgetamount'] += $obj->budget_amount; $totalarray['totalbudgetamount'] += $obj->budget_amount;
print '</td>'; print '</td>';
@ -1269,7 +1296,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
print '<td class="center">'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).'</td>'; print '<td class="center">'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).'</td>';
} elseif ($totalarray['totalbilledfield'] == $i) { } elseif ($totalarray['totalbilledfield'] == $i) {
print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>'; print '<td class="center">'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'</td>';
} elseif ($totalarray['totalbudget_amount'] == $i) { } elseif ($totalarray['totalbudget_amountfield'] == $i) {
print '<td class="center">'.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).'</td>'; print '<td class="center">'.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).'</td>';
} else { } else {
print '<td></td>'; print '<td></td>';

View File

@ -268,6 +268,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
} else { } else {
// Need to create a confattendee // Need to create a confattendee
$confattendee->date_creation = dol_now(); $confattendee->date_creation = dol_now();
$confattendee->date_subscription = dol_now();
$confattendee->email = $email; $confattendee->email = $email;
$confattendee->fk_project = $project->id; $confattendee->fk_project = $project->id;
$confattendee->fk_actioncomm = $id; $confattendee->fk_actioncomm = $id;

View File

@ -224,8 +224,9 @@ class FormResource
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 3) { } elseif ($format == 3) {
$value = $arraytypes['code']; $value = $arraytypes['code'];
} elseif (empty($value)) {
print '&nbsp;';
} }
print $value ? $value : '&nbsp;';
print '</option>'; print '</option>';
} }
} }

View File

@ -48,6 +48,8 @@ $id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
$label = GETPOST('label', 'alphanohtml'); $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 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('salarycard', 'globalcard')); $hookmanager->initHooks(array('salarycard', 'globalcard'));
$object = new Salary($db);
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref); $object->fetch($id, $ref);
@ -98,6 +99,7 @@ $socid = GETPOSTINT('socid');
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
restrictedArea($user, 'salaries', $object->id, 'salary', ''); restrictedArea($user, 'salaries', $object->id, 'salary', '');
@ -105,9 +107,39 @@ restrictedArea($user, 'salaries', $object->id, 'salary', '');
* Actions * Actions
*/ */
if ($cancel) { $parameters = array();
header("Location: list.php"); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
exit; 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 // Link to a project
@ -405,8 +437,7 @@ llxHeader("", $title, $help_url);
$form = new Form($db); $form = new Form($db);
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
if ($id) { if ($id > 0) {
$object = new Salary($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result <= 0) { if ($result <= 0) {
dol_print_error($db); dol_print_error($db);
@ -440,6 +471,12 @@ if ($action == 'create') {
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print load_fiche_titre($langs->trans("NewSalary"), '', 'salary'); print load_fiche_titre($langs->trans("NewSalary"), '', 'salary');

View File

@ -746,7 +746,7 @@ if (!$conf->use_javascript_ajax) {
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
); );
print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'COMPANY_USE_SEARCH_TO_SELECT')?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td><td class="right">'; print '</td><td class="right">';
print '<input type="submit" class="button reposition" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button reposition" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print "</td>"; print "</td>";
@ -767,7 +767,7 @@ if (!$conf->use_javascript_ajax) {
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
); );
print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'CONTACT_USE_SEARCH_TO_SELECT')?$conf->global->CONTACT_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td><td class="right">'; print '</td><td class="right">';
print '<input type="submit" class="button reposition" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button reposition" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print "</td>"; print "</td>";
@ -870,7 +870,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("DefaultCustomerType").'</td>'; print '<td>'.$langs->trans("DefaultCustomerType").'</td>';
print '<td>'; print '<td>';
print $formcompany->selectProspectCustomerType($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT, 'defaultcustomertype', 'defaultcustomertype', 'admin'); print $formcompany->selectProspectCustomerType((property_exists($conf->global, 'THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')?$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT:''), 'defaultcustomertype', 'defaultcustomertype', 'admin');
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<input type="submit" class="button reposition" name="THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button reposition" name="THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT" value="'.$langs->trans("Modify").'">';

View File

@ -50,6 +50,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
} // If $page is not defined, or '' or -1 } // If $page is not defined, or '' or -1
@ -160,16 +162,16 @@ if ($object->client) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb; $nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer"); $thirdTypeArray['customer'] = $langs->trans("customer");
if ($conf->propal->enabled && $user->rights->propal->lire) { if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
} }
if ($conf->commande->enabled && $user->rights->commande->lire) { if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
} }
if ($conf->facture->enabled && $user->rights->facture->lire) { if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
} }
if ($conf->contrat->enabled && $user->rights->contrat->lire) { if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
} }
} }
@ -219,6 +221,7 @@ print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?socid='.$socid.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
$sql_select = ''; $sql_select = '';
$documentstaticline = '';
/*if ($type_element == 'action') /*if ($type_element == 'action')
{ // Customer : show products from invoices { // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -232,7 +235,8 @@ $sql_select = '';
if ($type_element == 'fichinter') { // Customer : show products from invoices if ($type_element == 'fichinter') { // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$documentstatic = new Fichinter($db); $documentstatic = new Fichinter($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, '; $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, NULL as paid, ';
$sql_select .= 'NULL as fk_product, NULL as info_bits, NULL as date_start, NULL as date_end, NULL as prod_qty, NULL as total_ht, ';
$tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines.
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND f.entity = ".$conf->entity; $where .= " AND f.entity = ".$conf->entity;
@ -242,7 +246,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
if ($type_element == 'invoice') { // Customer : show products from invoices if ($type_element == 'invoice') { // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic = new Facture($db); $documentstatic = new Facture($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, d.fk_remise_except, ';
$tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_facture = f.rowid"; $where .= " AND d.fk_facture = f.rowid";
@ -254,7 +258,7 @@ if ($type_element == 'invoice') { // Customer : show products from invoices
if ($type_element == 'propal') { if ($type_element == 'propal') {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$documentstatic = new Propal($db); $documentstatic = new Propal($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, '; $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, NULL as paid,';
$tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_propal = c.rowid"; $where .= " AND d.fk_propal = c.rowid";
@ -266,7 +270,7 @@ if ($type_element == 'propal') {
if ($type_element == 'order') { if ($type_element == 'order') {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic = new Commande($db); $documentstatic = new Commande($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, '; $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, NULL as paid, ';
$tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_commande = c.rowid"; $where .= " AND d.fk_commande = c.rowid";
@ -290,7 +294,7 @@ if ($type_element == 'supplier_invoice') { // Supplier : Show products from inv
if ($type_element == 'supplier_proposal') { if ($type_element == 'supplier_proposal') {
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$documentstatic = new SupplierProposal($db); $documentstatic = new SupplierProposal($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, NULL as paid, ';
$tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d"; $tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_supplier_proposal = c.rowid"; $where .= " AND d.fk_supplier_proposal = c.rowid";
@ -302,7 +306,7 @@ if ($type_element == 'supplier_proposal') {
if ($type_element == 'supplier_order') { // Supplier : Show products from orders. if ($type_element == 'supplier_order') { // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic = new CommandeFournisseur($db); $documentstatic = new CommandeFournisseur($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, NULL as paid, ';
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_commande = c.rowid"; $where .= " AND d.fk_commande = c.rowid";
@ -315,7 +319,7 @@ if ($type_element == 'contract') { // Order
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$documentstatic = new Contrat($db); $documentstatic = new Contrat($db);
$documentstaticline = new ContratLigne($db); $documentstaticline = new ContratLigne($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, NULL as paid,';
$tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_contrat = c.rowid"; $where .= " AND d.fk_contrat = c.rowid";
@ -341,7 +345,7 @@ if (!empty($sql_select)) {
$sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
} }
if ($type_element != 'fichinter') { if ($type_element != 'fichinter') {
$sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; $sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity, ';
} }
$sql .= " s.rowid as socid "; $sql .= " s.rowid as socid ";
if ($type_element != 'fichinter') { if ($type_element != 'fichinter') {
@ -423,7 +427,7 @@ if ($sql_select) {
if ($year) { if ($year) {
$param .= "&year=".urlencode($year); $param .= "&year=".urlencode($year);
} }
if ($optioncss != '') { if ($optioncss) {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);
} }
@ -567,6 +571,7 @@ if ($sql_select) {
</a> </a>
<?php <?php
if ($objp->description) { if ($objp->description) {
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) { if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except); $discount->fetch($objp->fk_remise_except);
@ -652,7 +657,10 @@ if ($sql_select) {
$total_qty += $objp->prod_qty; $total_qty += $objp->prod_qty;
print '<td class="right"><span class="amount">'.price($objp->total_ht).'</span></td>'; print '<td class="right"><span class="amount">'.price($objp->total_ht).'</span></td>';
$total_ht += $objp->total_ht; if (empty($total_ht)) {
$total_ht = 0;
}
$total_ht += (float) $objp->total_ht;
print '<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).'</td>'; print '<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).'</td>';

View File

@ -776,16 +776,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb; $nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer"); $thirdTypeArray['customer'] = $langs->trans("customer");
if ($conf->propal->enabled && $user->rights->propal->lire) { if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
} }
if ($conf->commande->enabled && $user->rights->commande->lire) { if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
} }
if ($conf->facture->enabled && $user->rights->facture->lire) { if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
} }
if ($conf->contrat->enabled && $user->rights->contrat->lire) { if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
} }
@ -1305,7 +1305,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
} }
print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre('', '', '', '', '', '', '', '', 'center '); print_liste_field_titre('', '', '', '', '', '', '', '', 'center ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
foreach ($rib_list as $rib) { foreach ($rib_list as $rib) {
@ -1394,7 +1394,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$out = ''; $out = '';
if (is_array($modellist) && count($modellist)) { if (is_array($modellist) && count($modellist)) {
$out .= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">'; $out .= '<form action="'.$_SERVER["PHP_SELF"].(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
$out .= '<input type="hidden" name="action" value="builddocrib">'; $out .= '<input type="hidden" name="action" value="builddocrib">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">'; $out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="socid" value="'.$object->id.'">'; $out .= '<input type="hidden" name="socid" value="'.$object->id.'">';
@ -1408,14 +1408,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$modelselected = $conf->global->BANKADDON_PDF; $modelselected = $conf->global->BANKADDON_PDF;
} }
$out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); $out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out .= ajax_combobox('modelrib'.$rib->id); $out .= ajax_combobox('modelrib'.$rib->id);
$allowgenifempty = 0;
// Language code (if multilang) // Language code (if multilang)
if ($conf->global->MAIN_MULTILANGS) { if ($conf->global->MAIN_MULTILANGS) {
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); $defaultlang = $langs->getDefaultLang();
$morecss = 'maxwidth150'; $morecss = 'maxwidth150';
if ($conf->browser->layout == 'phone') { if ($conf->browser->layout == 'phone') {
$morecss = 'maxwidth100'; $morecss = 'maxwidth100';

View File

@ -1121,14 +1121,24 @@ if ($resql) {
} }
$hookmanager->initHooks(array('takeposfrontend')); $hookmanager->initHooks(array('takeposfrontend'));
$reshook = $hookmanager->executeHooks('ActionButtons'); $parameters = array('menus'=>$menus);
if (!empty($reshook)) { $reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
if (is_array($reshook) && !isset($reshook['title'])) { if ($reshook == 0) { //add buttons
foreach ($reshook as $reshook) { if (is_array($hookmanager->resArray) ) {
$menus[$r++] = $reshook; 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;
} }
} }

View File

@ -581,7 +581,7 @@ if ($action == "freezone") {
if ($action == "addnote") { if ($action == "addnote") {
$desc = GETPOST('addnote', 'alpha'); $desc = GETPOST('addnote', 'alpha');
if ($idline==0) { if ($idline==0) {
$invoice->update_note_public($desc); $invoice->update_note($desc, '_public');
} else foreach ($invoice->lines as $line) { } else foreach ($invoice->lines as $line) {
if ($line->id == $idline) { if ($line->id == $idline) {
$result = $invoice->updateline($line->id, $desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); $result = $invoice->updateline($line->id, $desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
@ -1159,7 +1159,7 @@ $( document ).ready(function() {
$result = $adh->fetch('', '', $invoice->socid); $result = $adh->fetch('', '', $invoice->socid);
if ($result > 0) { if ($result > 0) {
$adh->ref = $adh->getFullName($langs); $adh->ref = $adh->getFullName($langs);
if (empty($adh->statut)) { if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED ) {
$s .= "<s>"; $s .= "<s>";
} }
$s .= $adh->getFullName($langs); $s .= $adh->getFullName($langs);
@ -1175,7 +1175,7 @@ $( document ).ready(function() {
$s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated $s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
} }
} }
if (empty($adh->statut)) { if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED) {
$s .= "</s>"; $s .= "</s>";
} }
} else { } else {

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io> /* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -232,6 +233,12 @@ if (empty($reshook)) {
} }
// Link ticket to project // Link ticket to project
if (GETPOST('origin', 'alpha') == 'projet') {
$projectid = GETPOST('originid', 'int');
} else {
$projectid = GETPOST('projectid', 'int');
}
if ($projectid > 0) { if ($projectid > 0) {
$object->setProject($projectid); $object->setProject($projectid);
} }
@ -611,7 +618,7 @@ if (empty($reshook)) {
if ($ret > 0) { if ($ret > 0) {
$log_action = $langs->trans('TicketInitialMessageModified')." \n"; $log_action = $langs->trans('TicketInitialMessageModified')." \n";
// include the Diff class // include the Diff class
dol_include_once('/ticket/class/utils_diff.class.php'); include_once DOL_DOCUMENT_ROOT.'/core/class/utils_diff.class.php';
// output the result of comparing two files as plain text // output the result of comparing two files as plain text
$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message))); $log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message)));
@ -1041,11 +1048,11 @@ if ($action == 'create' || $action == 'presend') {
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans("AssignedTo"); print $langs->trans("AssignedTo");
if ($object->fk_statut < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { if ($object->fk_statut < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a></td>'; print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
} }
print '</tr></table>'; print '</td></tr></table>';
print '</td><td>'; print '</td><td>';
if ($object->fk_user_assign > 0) { if (GETPOST('set', 'alpha') != "assign_ticket" && $object->fk_user_assign > 0) {
$userstat->fetch($object->fk_user_assign); $userstat->fetch($object->fk_user_assign);
print $userstat->getNomUrl(-1); print $userstat->getNomUrl(-1);
} }
@ -1056,30 +1063,30 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="assign_user">'; print '<input type="hidden" name="action" value="assign_user">';
print '<input type="hidden" name="track_id" value="'.$object->track_id.'">'; print '<input type="hidden" name="track_id" value="'.$object->track_id.'">';
print '<label for="fk_user_assign">'.$langs->trans("AssignUser").'</label> '; //print '<label for="fk_user_assign">'.$langs->trans("AssignUser").'</label> ';
print $form->select_dolusers($user->id, 'fk_user_assign', 1); print $form->select_dolusers($user->id, 'fk_user_assign', 1);
print ' <input type="submit" class="button" name="btn_assign_user" value="'.$langs->trans("Validate").'" />'; print ' <input type="submit" class="button small" name="btn_assign_user" value="'.$langs->trans("Validate").'" />';
print '</form>'; print '</form>';
} }
print '</td></tr>'; print '</td></tr>';
// Progression // Progression
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('Progression').'</td><td class="left">'; print $langs->trans('Progression').'</td><td class="left">';
print '</td>'; print '</td>';
if ($action != 'progression' && $object->fk_statut < $object::STATUS_CLOSED && !$user->socid) { if ($action != 'progression' && $object->fk_statut < $object::STATUS_CLOSED && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=progression&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=progression&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="5">'; print '</td><td>';
if ($user->rights->ticket->write && $action == 'progression') { if ($user->rights->ticket->write && $action == 'progression') {
print '<form action="'.$url_page_current.'" method="post">'; print '<form action="'.$url_page_current.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">'; print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<input type="hidden" name="action" value="set_progression">'; print '<input type="hidden" name="action" value="set_progression">';
print '<input type="text" class="flat" size="20" name="progress" value="'.$object->progress.'">'; print '<input type="text" class="flat width75" name="progress" value="'.$object->progress.'">';
print ' <input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">'; print ' <input type="submit" class="button button-edit small" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} else { } else {
print($object->progress > 0 ? $object->progress : '0').'%'; print($object->progress > 0 ? $object->progress : '0').'%';
@ -1088,32 +1095,53 @@ if ($action == 'create' || $action == 'presend') {
print '</tr>'; print '</tr>';
// Timing (Duration sum of linked fichinter) // Timing (Duration sum of linked fichinter)
if ($conf->ficheinter->enabled) { if (!empty($conf->ficheinter->enabled)) {
$object->fetchObjectLinked(); $object->fetchObjectLinked();
$num = count($object->linkedObjects); $num = count($object->linkedObjects);
$timing = 0; $timing = 0;
$foundinter = 0;
if ($num) { if ($num) {
foreach ($object->linkedObjects as $objecttype => $objects) { foreach ($object->linkedObjects as $objecttype => $objects) {
if ($objecttype = "fichinter") { if ($objecttype = "fichinter") {
foreach ($objects as $fichinter) { foreach ($objects as $fichinter) {
$foundinter++;
$timing += $fichinter->duration; $timing += $fichinter->duration;
} }
} }
} }
} }
print '<tr><td valign="top">'; print '<tr><td>';
print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1); print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1);
print '</td><td>'; print '</td><td>';
print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); print $foundinter ? convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY) : '';
print '</td></tr>'; print '</td></tr>';
} }
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
// Fin colonne gauche et début colonne droite
print '</div><div class="fichehalfright">';
print '<form method="post" name="formticketproperties" action="'.$url_page_current.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="change_property">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<div class="underbanner clearboth"></div>';
// Categories // Categories
if ($conf->categorie->enabled) { if ($conf->categorie->enabled) {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="border tableforfield centpercent noborderbottom">';
print '<tr>'; print '<tr>';
print '<td class="valignmiddle">'; print '<td class="valignmiddle titlefield">';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans("Categories"); print $langs->trans("Categories");
if ($action != 'categories' && !$user->socid) { if ($action != 'categories' && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=categories&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=categories&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
@ -1123,7 +1151,7 @@ if ($action == 'create' || $action == 'presend') {
if ($user->rights->ticket->write && $action == 'categories') { if ($user->rights->ticket->write && $action == 'categories') {
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
if (count($cate_arbo)) { if (is_array($cate_arbo)) {
// Categories // Categories
print '<td colspan="3">'; print '<td colspan="3">';
print '<form action="'.$url_page_current.'" method="post">'; print '<form action="'.$url_page_current.'" method="post">';
@ -1139,7 +1167,7 @@ if ($action == 'create' || $action == 'presend') {
} }
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Save').'">'; print '<input type="submit" class="button button-edit small" value="'.$langs->trans('Save').'">';
print '</form>'; print '</form>';
print "</td>"; print "</td>";
} }
@ -1148,27 +1176,15 @@ if ($action == 'create' || $action == 'presend') {
print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1); print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
print "</td></tr>"; print "</td></tr>";
} }
print '</table>';
} }
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
// Fin colonne gauche et début colonne droite
print '</div><div class="fichehalfright">';
// View Original message // View Original message
$actionobject->viewTicketOriginalMessage($user, $action, $object); $actionobject->viewTicketOriginalMessage($user, $action, $object);
// Classification of ticket // Classification of ticket
print '<form method="post" name="formticketproperties" action="'.$url_page_current.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="change_property">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder tableforfield centpercent margintable">'; print '<table class="noborder tableforfield centpercent margintable">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -1177,11 +1193,11 @@ if ($action == 'create' || $action == 'presend') {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) { if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
print '<input type="submit" class="button" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />'; print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} else { } else {
// Button to edit Properties // Button to edit Properties
if ($object->fk_statut < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) { if ($object->fk_statut < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
print '<a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>'; print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
} }
} }
print '</td>'; print '</td>';
@ -1191,7 +1207,7 @@ if ($action == 'create' || $action == 'presend') {
print '<tr>'; print '<tr>';
// Type // Type
print '<td class="titlefield">'; print '<td class="titlefield">';
print $langs->trans('TicketChangeType'); print $langs->trans('Type');
print '</td><td>'; print '</td><td>';
$formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2); $formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2);
print '</td>'; print '</td>';
@ -1199,15 +1215,15 @@ if ($action == 'create' || $action == 'presend') {
// Group // Group
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print $langs->trans('TicketChangeCategory'); print $langs->trans('TicketCategory');
print '</td><td>'; print '</td><td>';
$formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2); $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2, 0, 0, 0, 'maxwidth500');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Severity // Severity
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print $langs->trans('TicketChangeSeverity'); print $langs->trans('TicketSeverity');
print '</td><td>'; print '</td><td>';
$formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2); $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2);
print '</td>'; print '</td>';

View File

@ -271,7 +271,7 @@ class Ticket extends CommonObject
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2), 'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'),
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1), 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1),
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')), 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
@ -1258,12 +1258,12 @@ class Ticket extends CommonObject
/** /**
* Return status label of object * Return status label of object
* *
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->libStatut($this->fk_statut, $mode); return $this->libStatut($this->fk_statut, $mode, 0, $this->progress);
} }
@ -1274,9 +1274,10 @@ class Ticket extends CommonObject
* @param string $status Id status * @param string $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $notooltip 1=No tooltip * @param int $notooltip 1=No tooltip
* @param int $progress Progression (0 to 100)
* @return string Label * @return string Label
*/ */
public function LibStatut($status, $mode = 0, $notooltip = 0) public function LibStatut($status, $mode = 0, $notooltip = 0, $progress = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1312,7 +1313,15 @@ class Ticket extends CommonObject
$params = array('tooltip' => 'no'); $params = array('tooltip' => 'no');
} }
return dolGetStatus($langs->transnoentitiesnoconv($labelStatus), $langs->transnoentitiesnoconv($labelStatusShort), '', $statusType, $mode, '', $params); $labelStatus = $langs->transnoentitiesnoconv($labelStatus);
$labelStatusShort = $langs->transnoentitiesnoconv($labelStatusShort);
if ($status == self::STATUS_IN_PROGRESS && $progress > 0) {
$labelStatus .= ' ('.round($progress).'%)';
$labelStatusShort .= ' ('.round($progress).'%)';
}
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
} }

View File

@ -334,20 +334,18 @@ $title = $langs->trans('TicketList');
// Build and execute select // Build and execute select
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$sql = 'SELECT '; $sql = 'SELECT ';
foreach ($object->fields as $key => $val) { $sql .= $object->getFieldList('t');
$sql .= "t.".$key.", ";
}
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : ''); $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
} }
} }
// Add fields from hooks // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
@ -383,15 +381,16 @@ foreach ($search as $key => $val) {
$sql .= natural_search($key, join(',', $newarrayofstatus), 2); $sql .= natural_search($key, join(',', $newarrayofstatus), 2);
} }
continue; continue;
} } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') {
if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') {
if ($search[$key] > 0) { if ($search[$key] > 0) {
$sql .= natural_search($key, $search[$key], 2); $sql .= natural_search($key, $search[$key], 2);
} }
continue; continue;
} }
$mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0); $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0);
if ($search[$key] != '') { // $search[$key] can be an array of values, or a string. We add filter if array not empty or if it is a string.
if ((is_array($search[$key]) && !empty($search[$key])) || (!is_array($search[$key]) && $search[$key] != '')) {
$sql .= natural_search($key, $search[$key], $mode_search); $sql .= natural_search($key, $search[$key], $mode_search);
} }
} }
@ -423,7 +422,6 @@ if ($search_dateclose_end) {
$sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'"; $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'";
} }
if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
$sql .= " AND (t.fk_user_assign = ".((int) $user->id); $sql .= " AND (t.fk_user_assign = ".((int) $user->id);
if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
@ -674,8 +672,6 @@ $arrayofmassactions = array(
); );
if ($user->rights->ticket->write) { if ($user->rights->ticket->write) {
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close"); $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close");
}
if ($user->rights->ticket->write) {
$arrayofmassactions['reopen'] = img_picto('', 'folder-open', 'class="pictofixedwidth"').$langs->trans("ReOpen"); $arrayofmassactions['reopen'] = img_picto('', 'folder-open', 'class="pictofixedwidth"').$langs->trans("ReOpen");
} }
if ($user->rights->ticket->delete) { if ($user->rights->ticket->delete) {
@ -767,18 +763,22 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'fk_statut') { if ($key == 'fk_statut') {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
if ($key == 'type_code') { if ($key == 'progress') {
print '<td class="liste_titre right'.($cssforfield ? ' '.$cssforfield : '').'">';
print '<input type="text" class="flat maxwidth50" name="search_'.$key.'" value="'.dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]).'">';
print '</td>';
} elseif ($key == 'type_code') {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
$formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150')); $formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, ($val['css'] ? $val['css'] : 'maxwidth150'));
print '</td>'; print '</td>';
@ -872,24 +872,33 @@ print '</tr>'."\n";
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'fk_statut' || $key == 'severity_code') { if ($key == 'fk_statut' || $key == 'severity_code') {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
} }
} }
$totalarray = array(
'nbfield' => 0,
);
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // 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 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n";
@ -910,7 +919,7 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array();
$cacheofoutputfield = array(); $cacheofoutputfield = array();
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -945,15 +954,17 @@ while ($i < min($num, $limit)) {
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'; print '<td';
if ($cssforfield || $val['css']) { if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print ' class="'; print ' class="';
} }
print $cssforfield; print $cssforfield;
if ($cssforfield && $val['css']) { if ($cssforfield && array_key_exists('css', $val) && $val['css']) {
print ' '; print ' ';
} }
print $val['css']; if (array_key_exists('css', $val)) {
if ($cssforfield || $val['css']) { print $val['css'];
}
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print '"'; print '"';
} }
print '>'; print '>';

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