Merge branch 'develop' into fix_php8

This commit is contained in:
Laurent Destailleur 2021-10-31 17:54:32 +01:00 committed by GitHub
commit d21278b0ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
259 changed files with 2795 additions and 1652 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)
## LICENCE
Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure.
## INSTALLER DOLIBARR
### Configuration simple
@ -54,7 +52,6 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg
- Suivez les instructions de l'installateur
## METTRE A JOUR DOLIBARR
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
@ -65,14 +62,12 @@ Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
- Au prochain accès, Dolibarr proposera la page de "mise à jour" des données (si nécessaire).
Si un fichier install.lock existe pour verrouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transférés sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents")
*Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
Note: *Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
## CE QUI EST NOUVEAU
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## CE QUE DOLIBARR PEUT FAIRE
### Modules principaux (tous optionnels)
@ -122,7 +117,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Peux être multi-société par ajout du module externe multi-société.
- Plusieurs thèmes visuels.
- Application simple à utiliser.
- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur https://wiki.dolibarr.org/index.php/Prérequis).
- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur [https://wiki.dolibarr.org/index.php/Prérequis](https://wiki.dolibarr.org/index.php/Prérequis)).
- Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP.
- APIs.
- Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
@ -142,7 +137,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com).
## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE
Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
@ -152,18 +146,15 @@ Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
- Dolibarr n'embarque pas de Webmail intégré nativement.
- Dolibarr ne fait pas le café (pas encore).
## DOCUMENTATION
La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org).
## CONTRIBUER
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
<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
@ -171,7 +162,6 @@ Dolibarr est le résultat du travail de nombreux contributeurs depuis des année
Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT)
## ACTUALITES ET RESEAUX SOCIAUX
Suivez le projet Dolibarr project sur les réseaux francophones

123
README.md
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.
#### Generic install steps:
#### Generic install steps
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
@ -71,86 +71,87 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
- Follow the installer instructions
### Saas/Cloud setup
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See [https://saas.dolibarr.org](https://saas.dolibarr.org)). However, this third solution is not free.
## UPGRADING
Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
- At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
## WHAT'S NEW
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## FEATURES
### Main application/modules (all optional)
- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
- Members/Membership/Foundation management
- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
- Members/Membership/Foundation management
Product Management
- Products and/or Services catalog
- Stock / Warehouse management + Inventory
- Barcodes
- Batches / Lots / Serials
- Product Variants
Product Management
- Products and/or Services catalog
- Stock / Warehouse management + Inventory
- Barcodes
- Batches / Lots / Serials
- Product Variants
- Bill of Materials (BOM)
- Manufacturing Orders
- Manufacturing Orders
Customer/Sales Management
- Customers/Prospects + Contacts management
- Opportunities or Leads management
- Commercial proposals management
- Customer Orders management
- Contracts/Subscription management
- Interventions management
- Ticket System
- Shipping management
- Customer Invoices/Credit notes and payment management
- Point of Sale (POS)
Customer/Sales Management
Supplier/Purchase Management
- Suppliers/Vendors + Contacts
- Supplier (price) requests
- Purchase Orders management
- Delivery/Receiption
- Supplier Invoices/credit notes and payment management
- INCOTERMS
- Customers/Prospects + Contacts management
- Opportunities or Leads management
- Commercial proposals management
- Customer Orders management
- Contracts/Subscription management
- Interventions management
- Ticket System
- Shipping management
- Customer Invoices/Credit notes and payment management
- Point of Sale (POS)
Finance / Accounting
- Invoices / Payments
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Donations management
- Loan management
- Margins
- Reports
Supplier/Purchase Management
Collaboration
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Projects & Tasks management
- Ticket System
- Suppliers/Vendors + Contacts
- Supplier (price) requests
- Purchase Orders management
- Delivery/Receiption
- Supplier Invoices/credit notes and payment management
- INCOTERMS
Finance / Accounting
- Invoices / Payments
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Donations management
- Loan management
- Margins
- Reports
Collaboration
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Projects & Tasks management
- Ticket System
- Surveys
HR
- Employee's leave requests management
- Expense reports
- Recruitment management
- Timesheets
HR
- Employee's leave requests management
- Expense reports
- Recruitment management
- Timesheets
### Other application/modules
@ -171,7 +172,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
(around 100 modules available by default, 1000+ on the addon market place)
### Other general features
- Localization in most major languages
@ -190,27 +190,24 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp
- Argentina invoice numbering using A,B,C...
- Compatible with [European directives] (https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- Compatible with European GDPR rules
- ...
- Flexible PDF & ODT generation for invoices, proposals, orders...
- ...
### System Environment / Requirements
- PHP
- MariaDB, MySQL or PostgreSQL
- MariaDB, MySQL or PostgreSQL
- Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites.
See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)
### Extending
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
## WHAT DOLIBARR CAN'T DO YET
These are features that Dolibarr does **not** yet fully support:
@ -220,21 +217,18 @@ These are features that Dolibarr does **not** yet fully support:
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
- Dolibarr can't do coffee (yet)
## DOCUMENTATION
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
## CONTRIBUTING
This project exists thanks to all the people who contribute.
This project exists thanks to all the people who contribute.
Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
A view on Contributors:
<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
@ -242,7 +236,6 @@ Dolibarr is the work of many contributors over the years and uses some fine PHP
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
## NEWS AND SOCIAL NETWORKS
Follow Dolibarr project on:
@ -253,8 +246,6 @@ Follow Dolibarr project on:
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]

View File

@ -168,6 +168,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
of the function, replace:
$roman = '';
with:
$roman = '';
if ($number >= 4000) {
// do not represent numbers above 4000 in Roman numerals
return strval($number);
}

View File

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

View File

@ -59,7 +59,7 @@ $permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the i
$hookmanager->initHooks(array('subscriptioncard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
/*

View File

@ -83,26 +83,26 @@ if ($action == 'set') {
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
$defaultValues = new DefaultValues($db);
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
if (!is_array($result) && $result<0) {
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
if (!is_array($result) && $result < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} elseif (count($result)>0) {
} elseif (count($result) > 0) {
foreach ($result as $defval) {
$defaultValues->id=$defval->id;
$defaultValues->id = $defval->id;
$resultDel = $defaultValues->delete($user);
if ($resultDel<0) {
if ($resultDel < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
}
}
}
$defaultValues->type='createform';
$defaultValues->entity=$conf->entity;
$defaultValues->user_id=0;
$defaultValues->page='comm/action/card.php';
$defaultValues->param='complete';
$defaultValues->value=GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
$resultCreat=$defaultValues->create($user);
if ($resultCreat<0) {
$defaultValues->type = 'createform';
$defaultValues->entity = $conf->entity;
$defaultValues->user_id = 0;
$defaultValues->page = 'comm/action/card.php';
$defaultValues->param = 'complete';
$defaultValues->value = GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
$resultCreat = $defaultValues->create($user);
if ($resultCreat < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
}
} elseif ($action == 'specimen') { // For orders
@ -355,13 +355,13 @@ print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowrap">'."\n";
$defval='na';
$defval = 'na';
$defaultValues = new DefaultValues($db);
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
if (!is_array($result) && $result<0) {
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
if (!is_array($result) && $result < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} elseif (count($result)>0) {
$defval=reset($result)->value;
} elseif (count($result) > 0) {
$defval = reset($result)->value;
}
$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200');
print '</td></tr>'."\n";

View File

@ -307,7 +307,7 @@ class Dolistore
}
} else {
//need update
$version = '<span class="compatibleafterupdate">'.$langs->trans(
$version = '<span class="compatibleafterupdate">'.$langs->trans(
'CompatibleAfterUpdate',
DOL_VERSION,
$product->dolibarr_min,

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 .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
$sql .= " ORDER BY t.taux ASC";
$resql = $db->query($sql);
if ($resql) {

View File

@ -829,23 +829,23 @@ if ($action == 'edit') {
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) {
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
} else {
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
// List of IP show as record to add in SPF if we use the mail method
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
}
} else {
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
// List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
// TODO Add a key to allow to show the IP/name of server detected dynamically
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
$text .= ($text ? '<br><br>' : '').$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);
}
}

View File

@ -102,11 +102,11 @@ if ($action == "set") {
}
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (! ($res > 0)) {
if (!($res > 0)) {
$error++;
}
if (! $error) {
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {

View File

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

View File

@ -270,7 +270,7 @@ print '</form>';
echo '<div>';
echo '<table class="noborder centpercent">';
echo '<thead>';
echo '<tr class="liste_titre"><th>' . $langs->trans('Parameter') . '</th><th>' . $langs->trans('Value') . '</th></tr>';
echo '<tr class="liste_titre"><th>'.$langs->trans('Parameter').'</th><th>'.$langs->trans('Value').'</th></tr>';
echo '</thead>';
echo '<tbody>';

View File

@ -90,7 +90,7 @@ $_SESSION["commandbackuptorun"] = '';
$_SESSION["commandbackupresult"] = '';
// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit
$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit
if (!empty($ExecTimeLimit)) {
$err = error_reporting();
error_reporting(0); // Disable all errors

View File

@ -26,8 +26,8 @@
require "../main.inc.php";
// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php';
//require_once "../class/myclass.class.php";
// Translations

View File

@ -497,11 +497,11 @@ class Documents extends DolibarrApi
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
} else {
if (($object->id) > 0 && !empty($modulepart)) {
require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($this->db);
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id));
if ($result < 0) {
throw new RestException(503, 'Error when retrieve ecm list : ' . $this->db->lasterror());
throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror());
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
$filearray['ecmfiles_infos'] = $ecmfile->lines;
}

View File

@ -316,8 +316,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);

View File

@ -25,7 +25,7 @@
if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token.
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
}
}
@ -277,10 +277,10 @@ dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
//print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
print '<input type="hidden" name="mode" value="label">';
print '<input type="hidden" name="action" value="builddoc">';
print '<input type="hidden" name="token" value="'.currentToken().'">'; // The page will not renew the token but force download of a file, so we must use here currentToken
print '<input type="hidden" name="token" value="'.currentToken().'">'; // The page will not renew the token but force download of a file, so we must use here currentToken
print '<div class="tagtable">';

View File

@ -1,28 +0,0 @@
<?php
require '../../main.inc.php';
$action = GETPOST('action', 'alphanohtml');
$select_product_val = GETPOST('select_product_val', 'int');
$current_bom_id = GETPOST('current_bom_id', 'int');
global $db;
switch ($action) {
case 'select_BOM':
//Selection of nomenclatures corresponding to the selected product
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product AS p ON b.fk_product=p.rowid';
$sql.= ' WHERE fk_product='.(int) $select_product_val.' AND b.rowid<>'. (int) $current_bom_id;
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
$options = array();
$cpt=0;
while ($obj = $db->fetch_object($resql)) {
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
$cpt++;
}
print json_encode($options);
}
break;
}

View File

@ -243,6 +243,7 @@ if (empty($reshook)) {
}
/*
* View
*/
@ -573,38 +574,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '</table>';
}
?>
<script>
let select_product_val;
let current_bom_id = <?php echo $object->id?>;
//On change on the bom select
$('#idprod').on('change', function () {
select_product_val = $('#idprod').select2().val();
//Ajax to set all options without reloading the page
$.ajax({
url: 'script/interface.php'
, method: 'POST'
, dataType: 'text'
, data: {
action: 'select_BOM'
, select_product_val: select_product_val
, current_bom_id: current_bom_id
}
}).done(function (data) {
//To remove all options of the bom select on change
$('#bom_select').get(0).length = 0;
//To set options for the bom select on change
let options = JSON.parse(data)
for (let key in options) {
let opt = new Option(options[key], key);
$('#bom_select').append(opt)
}
})
})
</script>
<?php
print '</div>';
print "</form>\n";
@ -612,9 +581,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
<script type="text/javascript" language="javascript">
$(document).ready(function() {
// When clicking on collapse
$(".collapse_bom").click(function() {
console.log("We click on collapse");
var id_bom_line = $(this).attr('id').replace('collapse-', '');
if($(this).text().indexOf('+') > 0) {
$('[parentid="'+ id_bom_line +'"]').show();
@ -628,14 +597,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
return false;
});
//To Show all the sub bom lines
// To Show all the sub bom lines
$("#show_all").click(function() {
console.log("We click on show all");
$("[class^=sub_bom_lines]").show();
$("[class^=collapse_bom]").html('(-)&nbsp;');
return false;
});
//To Hide all the sub bom lines
// To Hide all the sub bom lines
$("#hide_all").click(function() {
console.log("We click on hide all");
$("[class^=sub_bom_lines]").hide();
$("[class^=collapse_bom]").html('(+)&nbsp;');
return false;

View File

@ -61,8 +61,6 @@ if ($nolinesbefore) {
print '<td class="linecoldescription minwidth500imp">';
print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
print '</td>';
// Linked BOM
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '<td class="linecoluseunit left">';
@ -90,15 +88,14 @@ print '<td class="bordertop nobottom linecoldescription minwidth500imp">';
// Predefined product/service
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
if ($forceall >= 0 && $freelines) {
echo '<br>';
if (!empty($conf->global->BOM_SUB_BOM)) {
print $langs->trans("Product");
}
echo '<span class="prod_entry_mode_predef">';
$filtertype = '';
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
$filtertype = '1';
$filtertype = 0;
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) {
$filtertype = -1;
}
$statustoshow = -1;
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
// hide products in closed warehouse, but show products for internal transfer
@ -109,11 +106,14 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
echo '</span>';
}
$coldisplay++;
print '<td class="bordertop nobottom linecolbom">';
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
if (!empty($conf->global->BOM_SUB_BOM)) {
print '<br>'.$langs->trans("or").' '.$langs->trans("BOM");
// TODO Add component to select a BOM
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
}
print '</td>';
$coldisplay++;
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';
print '</td>';
@ -134,7 +134,7 @@ print '</td>';
$coldisplay++;
print '<td class="bordertop nobottom nowrap linecollost right">';
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency") ?GETPOST("efficiency", 'alpha') : 1).'">';
print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.((GETPOSTISSET("efficiency") && $action == 'addline') ?GETPOST("efficiency", 'alpha') : 1).'">';
print '</td>';
$coldisplay++;

View File

@ -97,8 +97,6 @@ print '</td>';
*/
$coldisplay++;
// For BOM
print '<td></td>';
print '<td class="nobottom linecolqty right">';
if (($line->info_bits & 2) != 2) {
@ -126,7 +124,7 @@ print '</td>';
$coldisplay++;
print '<td class="nobottom nowrap linecollost right">';
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
$coldisplay++;
print '<td class="nobottom nowrap linecolcostprice right">';
@ -135,9 +133,8 @@ print '</td>';
$coldisplay += $colspan;
print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
$coldisplay += $colspan;
print '<input type="submit" class="button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
print '<br>';
print '<input type="submit" class="button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '</tr>';

View File

@ -39,23 +39,25 @@ if (empty($object) || !is_object($object)) {
exit;
}
print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
// Title line
print "<thead>\n";
print '<tr class="liste_titre nodrag nodrop">';
print '<a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="linecolnum center">&nbsp;</td>';
}
// Description
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
// Linked BOM
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
// Product or sub-bom
print '<td class="linecoldescription">'.$langs->trans('Description');
if (!empty($conf->global->BOM_SUB_BOM)) {
print ' &nbsp; <a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
}
print '</td>';
// Qty
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';

View File

@ -82,19 +82,14 @@ $tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
$res = $tmpbom->fetch($line->fk_bom_child);
if (!empty($tmpbom->id)) {
if ($tmpbom->id > 0) {
print $tmpbom->getNomUrl(1);
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . '&nbsp;</a>';
}
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
print '</td>';
// To show BOM links in the list
if ($res > 0) {
print '<td id="bom_id">'.$tmpbom->getNomUrl(1).'</td>';
} else {
print '<td id="bom_id">&nbsp;</td>';
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
}
print '</td>';
print '<td class="linecolqty nowrap right">';
$coldisplay++;

View File

@ -169,7 +169,11 @@ if ($action == 'create') {
// Target
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
$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>';
// Owner

View File

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

View File

@ -244,7 +244,6 @@ class Categorie extends CommonObject
* @see Categorie::TYPE_ACTIONCOMM
* @see Categorie::TYPE_WEBSITE_PAGE
* @see Categorie::TYPE_TICKET
*/
public $type;
@ -385,8 +384,8 @@ class Categorie extends CommonObject
}
} else {
dol_print_error($this->db);
$this->error=$this->db->lasterror;
$this->errors[]=$this->db->lasterror;
$this->error = $this->db->lasterror;
$this->errors[] = $this->db->lasterror;
return -1;
}
}
@ -1977,6 +1976,12 @@ class Categorie extends CommonObject
if ($type == 'bank_account') {
$type = 'account';
}
if ($type == 'customer') {
$type = 'societe';
}
if ($type == 'supplier') {
$type = 'fournisseur';
}
if (empty($searchList) && !is_array($searchList)) {
return "";

View File

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

View File

@ -972,7 +972,7 @@ if ($action == 'create') {
print '<input type="hidden" name="donotclearsession" value="1">';
print '<input type="hidden" name="page_y" value="">';
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)) {
print '<input type="hidden" name="actioncode" value="'.dol_getIdFromCode($db, 'AC_OTH', 'c_actioncomm').'">';
@ -1909,9 +1909,7 @@ if ($id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}

View File

@ -166,9 +166,7 @@ if ($object->id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}

View File

@ -93,9 +93,7 @@ if (!empty($conf->projet->enabled)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* 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>
*
* This program is free software; you can redistribute it and/or modify
@ -629,14 +629,17 @@ print $nav;
$s = $newtitle;
// Calendars from hooks
$parameters = array(); $object = null;
$parameters = array();
$object = null;
$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
if (empty($reshook)) {
$s .= $hookmanager->resPrint;
} elseif ($reshook > 1) {
$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 .= '<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">';
@ -644,25 +647,25 @@ $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewm
//$viewmode .= '</span>';
$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 .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$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 .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$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 .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$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 .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= '</span>';
@ -671,7 +674,8 @@ $viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsm
$viewmode .= '<span class="marginrightonly"></span>';
// Add more views from hooks
$parameters = array(); $object = null;
$parameters = array();
$object = null;
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$viewmode .= $hookmanager->resPrint;
@ -681,7 +685,7 @@ if (empty($reshook)) {
$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;
$hourminsec = '100000';

View File

@ -377,7 +377,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) {
$s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
$s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s .= '});'."\n";
$s .= '</script>'."\n";
@ -965,8 +964,8 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused) {
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee) { // Is it the day we are looking for when calling function ?
// Scan all event for this date

View File

@ -387,7 +387,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) {
$s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
$s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s .= '});'."\n";
$s .= '</script>'."\n";
@ -802,7 +801,7 @@ $currentdaytoshow = $firstdaytoshow;
echo '<div class="div-table-responsive">';
while ($currentdaytoshow < $lastdaytoshow) {
echo '<table width="100%" class="noborder nocellnopadd cal_month">';
echo '<table class="centpercent noborder nocellnopadd cal_month">';
echo '<tr class="liste_titre">';
echo '<td class="nopaddingtopimp nopaddingbottomimp nowraponsmartphone">';
@ -829,7 +828,7 @@ while ($currentdaytoshow < $lastdaytoshow) {
// Filter on days
print img_picto('', 'clock', 'class="fawidth30 inline-block paddingleft"');
print '<span class="hideonsmartphone" title="'.$langs->trans("VisibleDaysRange").'">'.$langs->trans("DaysOfWeek").'</span>';
print "\n".'<div class="ui-grid-a inline-block"><div class="ui-block-a">';
print "\n".'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
if (empty($conf->dol_use_jmobile)) {
print ' - ';

View File

@ -2014,14 +2014,14 @@ if ($action == 'create') {
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
$morehtmlref .= '<br><span class="hideonsmartphone">'.$langs->trans('ThirdParty').' : </span>'.$object->thirdparty->getNomUrl(1, 'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
}
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
$morehtmlref .= '<br><span class="paddingrightonly">'.$langs->trans('Project').'</span>';
if ($usercancreate) {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
@ -2041,9 +2041,10 @@ if ($action == 'create') {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ': '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -166,9 +166,10 @@ if ($object->id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -159,9 +159,10 @@ if ($object->id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -106,9 +106,10 @@ if (!empty($conf->projet->enabled)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

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

View File

@ -130,9 +130,10 @@ if ($object->id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -2075,9 +2075,10 @@ if ($action == 'create' && $usercancreate) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -161,9 +161,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -153,9 +153,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -106,9 +106,10 @@ if (!empty($conf->projet->enabled)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -125,9 +125,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -578,7 +578,7 @@ print '<br>';
foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) {
continue; // list not qualified
continue; // list not qualified
}
$disabled = '';
if (empty($val['perms'])) {

View File

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

View File

@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
$socid = 0;
if ($user->socid) {
$socid = $user->socid;
}
@ -568,6 +569,12 @@ if ($result) {
// Bank line
print '<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);
$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 "</td></tr>";
}

View File

@ -540,7 +540,7 @@ if ($id) {
array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1),
array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)),
array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)),
array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens") . ' ' . $set_value_help, 'values' => $sensarray, 'default' => $object->sens),
array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens").' '.$set_value_help, 'values' => $sensarray, 'default' => $object->sens),
);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);

View File

@ -1218,9 +1218,10 @@ if ($action == 'create') {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -2846,6 +2846,7 @@ if (empty($reshook)) {
* View
*/
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
@ -3818,8 +3819,16 @@ if ($action == 'create') {
print '</table>';
}
print '</form>';
print "</form>\n";
} 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
*/
@ -4249,9 +4258,10 @@ if ($action == 'create') {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -126,8 +126,8 @@ class FactureRec extends CommonInvoice
public $suspended; // status
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
public $generate_pdf; // 1 to generate PDF on invoice generation (default)
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
public $generate_pdf; // 1 to generate PDF on invoice generation (default)
/**
* @var int 1 if status is draft
@ -712,12 +712,12 @@ class FactureRec extends CommonInvoice
//$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price;
$line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility
$line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $objp->fk_product_fournisseur_price, $objp->pa_ht);
$line->buyprice = $marginInfos[0];
$line->pa_ht = $marginInfos[0]; // For backward compatibility
$line->pa_ht = $marginInfos[0]; // For backward compatibility
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$line->rang = $objp->rang;
@ -1930,14 +1930,14 @@ class FactureLigneRec extends CommonInvoiceLine
public $fk_product_fournisseur_price;
public $fk_fournprice; // For backward compatibility
public $fk_fournprice; // For backward compatibility
public $rang;
public $desc;
public $description;
public $fk_product_type; // Use instead product_type
public $fk_product_type; // Use instead product_type
public $fk_contract_line;

View File

@ -1560,8 +1560,11 @@ class Facture extends CommonInvoice
$hookmanager->initHooks(array('invoicedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -100,6 +100,14 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
* View
*/
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
@ -160,9 +168,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -92,6 +92,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View
*/
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
@ -153,9 +161,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -62,6 +62,14 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
* View
*/
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$form = new Form($db);
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
@ -112,9 +120,10 @@ if (!empty($conf->projet->enabled)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -676,12 +676,6 @@ if (strlen(trim($search_country))) {
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
}
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
}
if ($search_montant_ht != '') {
$sql .= natural_search('f.total_ht', $search_montant_ht, 1);
}

View File

@ -77,6 +77,14 @@ if (empty($reshook)) {
* View
*/
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
@ -129,9 +137,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -371,9 +371,10 @@ if ($object->id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -5,7 +5,7 @@
* Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* 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
* it under the terms of the GNU General Public License as published by
@ -388,7 +388,7 @@ if ($action == 'new') {
$i = 0;
while ($obj = $db->fetch_object($resql)) {
$accounts[$obj->bid] = $obj->label;
$lines[$obj->bid][$i]["date"] = $db->jdate($obj->date);
$lines[$obj->bid][$i]["date"] = $db->jdate($obj->datec);
$lines[$obj->bid][$i]["amount"] = $obj->amount;
$lines[$obj->bid][$i]["emetteur"] = $obj->emetteur;
$lines[$obj->bid][$i]["numero"] = $obj->num_chq;
@ -398,6 +398,7 @@ if ($action == 'new') {
$lines[$obj->bid][$i]["label"] = $obj->transactionlabel;
$lines[$obj->bid][$i]["paymentid"] = $obj->paymentid;
$lines[$obj->bid][$i]["paymentref"] = $obj->paymentref;
$lines[$obj->bid][$i]["paymentdate"] = $db->jdate($obj->date);
$i++;
}
@ -468,6 +469,7 @@ if ($action == 'new') {
print '<td class="center">';
$paymentstatic->id = $value["paymentid"];
$paymentstatic->ref = $value["paymentref"];
$paymentstatic->date = $value["paymentdate"];
if ($paymentstatic->id) {
print $paymentstatic->getNomUrl(1);
} else {

View File

@ -90,10 +90,10 @@ if (empty($reshook)) {
}
}
if ($action == 'create') {
$default_account=($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
$default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
if ($id_bankaccount != $conf->global->{$default_account}) {
$res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); //Set as default
$res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); //Set as default
}
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';

View File

@ -514,9 +514,10 @@ if ($id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -600,7 +600,7 @@ class PaymentSocialContribution extends CommonObject
$result = $acc->add_url_line(
$bank_line_id,
$socialcontrib->fk_user,
DOL_URL_ROOT . '/user/card.php?id=',
DOL_URL_ROOT.'/user/card.php?id=',
$fuser->getFullName($langs),
'user'
);

View File

@ -127,9 +127,10 @@ if ($object->id) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -94,9 +94,10 @@ if (!empty($conf->projet->enabled)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -818,7 +818,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '<tr>';
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)).'</td>';
print '<td>';
print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
print '</td>';
print '</tr>';
}
@ -1095,8 +1097,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '<tr>';
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>';
$useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty).'</td>';
print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty);
print '</td>';
print '</tr>';
}
@ -1323,7 +1327,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print '<tr><td>'.$langs->trans("No_Email").'</td><td>'.yn($object->no_email).'</td></tr>';
print '<tr><td>'.$langs->trans("No_Email").'</td><td>';
if ($object->email) {
print yn($object->no_email);
} else {
print '<span class="opacitymedium">'.$langs->trans("EMailNotDefined").'</span>';
}
print '</td></tr>';
}
print '<tr><td>'.$langs->trans("ContactVisibility").'</td><td>';

View File

@ -204,6 +204,12 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
$arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1);
}
$arrayfields['unsubscribed'] = array(
'label'=>'No_Email',
'checked'=>0,
'enabled'=>(!empty($conf->mailing->enabled)),
'position'=>41);
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if ($value['active']) {
@ -355,7 +361,7 @@ if ($resql) {
}
$sql = "SELECT s.rowid as socid, s.nom as name,";
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.no_email,";
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email,";
$sql .= " p.socialnetworks, p.photo,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
@ -366,6 +372,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
if (!empty($conf->mailing->enabled)) {
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -499,8 +508,11 @@ if (strlen($search_town)) {
if (count($search_roles) > 0) {
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
}
if ($search_no_email != '' && $search_no_email >= 0) {
$sql .= " AND p.no_email = ".((int) $search_no_email);
if ($search_no_email != -1 && $search_no_email > 0) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0";
}
if ($search_no_email != -1 && $search_no_email == 0) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
}
if ($search_status != '' && $search_status >= 0) {
$sql .= " AND p.statut = ".((int) $search_status);
@ -568,75 +580,75 @@ llxHeader('', $title, $help_url);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&amp;contextpage='.$contextpage;
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&amp;limit='.$limit;
$param .= '&limit='.((int) $limit);
}
$param .= '&amp;begin='.urlencode($begin).'&amp;userid='.urlencode($userid).'&amp;contactname='.urlencode($sall);
$param .= '&amp;type='.urlencode($type).'&amp;view='.urlencode($view);
$param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param .= '&type='.urlencode($type).'&view='.urlencode($view);
if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&amp;search_categ='.urlencode($search_categ);
$param .= '&search_categ='.urlencode($search_categ);
}
if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$param .= '&amp;search_categ_thirdparty='.urlencode($search_categ_thirdparty);
$param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
}
if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&amp;search_categ_supplier='.urlencode($search_categ_supplier);
$param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
}
if ($sall != '') {
$param .= '&amp;sall='.urlencode($sall);
$param .= '&sall='.urlencode($sall);
}
if ($search_id > 0) {
$param .= "&amp;search_id=".urlencode($search_id);
$param .= "&search_id=".urlencode($search_id);
}
if ($search_lastname != '') {
$param .= '&amp;search_lastname='.urlencode($search_lastname);
$param .= '&search_lastname='.urlencode($search_lastname);
}
if ($search_firstname != '') {
$param .= '&amp;search_firstname='.urlencode($search_firstname);
$param .= '&search_firstname='.urlencode($search_firstname);
}
if ($search_societe != '') {
$param .= '&amp;search_societe='.urlencode($search_societe);
$param .= '&search_societe='.urlencode($search_societe);
}
if ($search_address != '') {
$param .= '&amp;search_address='.urlencode($search_address);
$param .= '&search_address='.urlencode($search_address);
}
if ($search_zip != '') {
$param .= '&amp;search_zip='.urlencode($search_zip);
$param .= '&search_zip='.urlencode($search_zip);
}
if ($search_town != '') {
$param .= '&amp;search_town='.urlencode($search_town);
$param .= '&search_town='.urlencode($search_town);
}
if ($search_country != '') {
$param .= "&search_country=".urlencode($search_country);
}
if ($search_poste != '') {
$param .= '&amp;search_poste='.urlencode($search_poste);
$param .= '&search_poste='.urlencode($search_poste);
}
if ($search_phone_pro != '') {
$param .= '&amp;search_phone_pro='.urlencode($search_phone_pro);
$param .= '&search_phone_pro='.urlencode($search_phone_pro);
}
if ($search_phone_perso != '') {
$param .= '&amp;search_phone_perso='.urlencode($search_phone_perso);
$param .= '&search_phone_perso='.urlencode($search_phone_perso);
}
if ($search_phone_mobile != '') {
$param .= '&amp;search_phone_mobile='.urlencode($search_phone_mobile);
$param .= '&search_phone_mobile='.urlencode($search_phone_mobile);
}
if ($search_fax != '') {
$param .= '&amp;search_fax='.urlencode($search_fax);
$param .= '&search_fax='.urlencode($search_fax);
}
if ($search_email != '') {
$param .= '&amp;search_email='.urlencode($search_email);
$param .= '&search_email='.urlencode($search_email);
}
if ($search_no_email != '') {
$param .= '&amp;search_no_email='.urlencode($search_no_email);
$param .= '&search_no_email='.urlencode($search_no_email);
}
if ($search_status != '') {
$param .= '&amp;search_status='.urlencode($search_status);
$param .= '&search_status='.urlencode($search_status);
}
if ($search_priv == '0' || $search_priv == '1') {
$param .= "&amp;search_priv=".urlencode($search_priv);
$param .= "&search_priv=".urlencode($search_priv);
}
if ($search_stcomm != '') {
$param .= '&search_stcomm='.urlencode($search_stcomm);
@ -843,7 +855,7 @@ if (!empty($arrayfields['p.email']['checked'])) {
print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">';
print '</td>';
}
if (!empty($arrayfields['p.no_email']['checked'])) {
if (!empty($arrayfields['unsubscribed']['checked'])) {
print '<td class="liste_titre center">';
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
print '</td>';
@ -965,8 +977,8 @@ if (!empty($arrayfields['p.fax']['checked'])) {
if (!empty($arrayfields['p.email']['checked'])) {
print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.no_email']['checked'])) {
print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['unsubscribed']['checked'])) {
print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
@ -1156,8 +1168,14 @@ while ($i < min($num, $limit)) {
}
}
// No EMail
if (!empty($arrayfields['p.no_email']['checked'])) {
print '<td class="center">'.yn($obj->no_email).'</td>';
if (!empty($arrayfields['unsubscribed']['checked'])) {
print '<td class="center">';
if (empty($obj->email)) {
//print '<span class="opacitymedium">'.$langs->trans("NoEmail").'</span>';
} else {
print yn(($obj->unsubscribed > 0) ? 1 : 0);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -194,9 +194,10 @@ if ($id > 0) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -505,8 +505,8 @@ if (empty($reshook)) {
$desc = $prod->description;
//If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time
if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
$product_desc='';
if ($product_desc == $desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
$product_desc = '';
}
if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) {
@ -1335,9 +1335,10 @@ if ($action == 'create') {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -1729,85 +1729,77 @@ class Contrat extends CommonObject
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'";
$sql .= ",price_ht='".price2num($price)."'";
$sql .= ",subprice='".price2num($subprice)."'";
$sql .= ",remise='".price2num($remise)."'";
$sql .= ",remise_percent='".price2num($remise_percent)."'";
$sql .= ",qty='".$qty."'";
$sql .= ",tva_tx='".price2num($tvatx)."'";
$sql .= ",localtax1_tx='".price2num($localtax1tx)."'";
$sql .= ",localtax2_tx='".price2num($localtax2tx)."'";
$sql .= ",localtax1_type='".$this->db->escape($localtax1_type)."'";
$sql .= ",localtax2_type='".$this->db->escape($localtax2_type)."'";
$sql .= ", total_ht='".price2num($total_ht)."'";
$sql .= ", total_tva='".price2num($total_tva)."'";
$sql .= ", total_localtax1='".price2num($total_localtax1)."'";
$sql .= ", total_localtax2='".price2num($total_localtax2)."'";
$sql .= ", total_ttc='".price2num($total_ttc)."'";
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description = '".$this->db->escape($desc)."'";
$sql .= ",price_ht = ".((float) price2num($price));
$sql .= ",subprice = ".((float) price2num($subprice));
$sql .= ",remise = ".((float) price2num($remise));
$sql .= ",remise_percent = ".((float) price2num($remise_percent));
$sql .= ",qty = ".((float) $qty);
$sql .= ",tva_tx = ".((float) price2num($tvatx));
$sql .= ",localtax1_tx = ".((float) price2num($localtax1tx));
$sql .= ",localtax2_tx = ".((float) price2num($localtax2tx));
$sql .= ",localtax1_type='".$this->db->escape($localtax1_type);
$sql .= ",localtax2_type='".$this->db->escape($localtax2_type);
$sql .= ", total_ht = ".((float) price2num($total_ht));
$sql .= ", total_tva = ".((float) price2num($total_tva));
$sql .= ", total_localtax1 = ".((float) price2num($total_localtax1));
$sql .= ", total_localtax2 = ".((float) price2num($total_localtax2));
$sql .= ", total_ttc = ".((float) price2num($total_ttc));
$sql .= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null");
$sql .= ", buy_price_ht='".price2num($pa_ht)."'";
$sql .= ", buy_price_ht = ".((float) price2num($pa_ht));
if ($date_start > 0) {
$sql .= ",date_ouverture_prevue='".$this->db->idate($date_start)."'";
$sql .= ",date_ouverture_prevue = '".$this->db->idate($date_start)."'";
} else {
$sql .= ",date_ouverture_prevue=null";
$sql .= ",date_ouverture_prevue = null";
}
if ($date_end > 0) {
$sql .= ",date_fin_validite='".$this->db->idate($date_end)."'";
$sql .= ",date_fin_validite = '".$this->db->idate($date_end)."'";
} else {
$sql .= ",date_fin_validite=null";
$sql .= ",date_fin_validite = null";
}
if ($date_debut_reel > 0) {
$sql .= ",date_ouverture='".$this->db->idate($date_debut_reel)."'";
$sql .= ",date_ouverture = '".$this->db->idate($date_debut_reel)."'";
} else {
$sql .= ",date_ouverture=null";
$sql .= ",date_ouverture = null";
}
if ($date_fin_reel > 0) {
$sql .= ",date_cloture='".$this->db->idate($date_fin_reel)."'";
$sql .= ",date_cloture = '".$this->db->idate($date_fin_reel)."'";
} else {
$sql .= ",date_cloture=null";
$sql .= ",date_cloture = null";
}
$sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null");
$sql .= ", fk_unit = ".($fk_unit > 0 ? ((int) $fk_unit) : "null");
$sql .= " WHERE rowid = ".((int) $rowid);
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$result = $this->update_statut($user);
if ($result >= 0) {
if (is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used
$contractline = new ContratLigne($this->db);
$contractline->fetch($rowid);
$contractline->fetch_optionals();
if (is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used
$contractline = new ContratLigne($this->db);
$contractline->fetch($rowid);
// We replace values in $contractline->array_options only for entries defined into $array_options
foreach ($array_options as $key => $value) {
$contractline->array_options[$key] = $array_options[$key];
}
$result = $contractline->insertExtraFields();
if ($result < 0) {
$this->error[] = $contractline->error;
$error++;
}
// We replace values in $contractline->array_options only for entries defined into $array_options
foreach ($array_options as $key => $value) {
$contractline->array_options[$key] = $array_options[$key];
}
if (empty($error)) {
// Call trigger
$result = $this->call_trigger('LINECONTRACT_UPDATE', $user);
if ($result < 0) {
$this->db->rollback();
return -3;
}
// End call triggers
$this->db->commit();
return 1;
$result = $contractline->insertExtraFields();
if ($result < 0) {
$this->error[] = $contractline->error;
$error++;
}
} else {
$this->db->rollback();
dol_syslog(get_class($this)."::updateline Erreur -2");
return -2;
}
if (empty($error)) {
// Call trigger
$result = $this->call_trigger('LINECONTRACT_UPDATE', $user);
if ($result < 0) {
$this->db->rollback();
return -3;
}
// End call triggers
$this->db->commit();
return 1;
}
} else {
$this->db->rollback();

View File

@ -177,9 +177,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -167,9 +167,10 @@ if ($object->id) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -134,9 +134,10 @@ if ($id > 0 || !empty($ref)) {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
$morehtmlref .= ' : '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
} else {
$morehtmlref .= '';
}

View File

@ -218,8 +218,8 @@ if ($type == 'directory') {
$parameters = array('modulepart'=>$module);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0) {
$automodules[]=$hookmanager->resArray['module'];
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
$automodules[] = $hookmanager->resArray['module'];
}
// TODO change for multicompany sharing

View File

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

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/core/bookmarks_page.php
* \brief File to return a page with the complete list of bookmarks (all search input fields)
* \brief File to return a page with the complete list of bookmarks
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
@ -45,7 +45,7 @@ if (GETPOST('lang', 'aZ09')) {
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
}
$langs->load("main");
$langs->loadLangs(array("bookmarks"));
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
@ -57,7 +57,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$title = $langs->trans("Bookmarks");
// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
// URL http://mydolibarr/core/bookmarks_page?dol_use_jmobile=1 can be used for tests
$head = '<!-- Bookmarks access -->'."\n";
$arrayofjs = array();
$arrayofcss = array();
@ -69,44 +69,58 @@ print '<body>'."\n";
print '<div>';
//print '<br>';
$nbofsearch = 0;
// Instantiate hooks of thirdparty module
$hookmanager->initHooks(array('bookmarks'));
// Define $bookmarks
$bookmarks = '';
$bookmarkList = '';
$searchForm = '';
$arrayresult = array();
//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
if (empty($conf->bookmarks->enabled)) {
$langs->load("admin");
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).'</span>';
$bookmarkList .= '<br><br>';
} else {
// Menu with list of bookmarks
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity IN (".getEntity('bookmarks').")";
$sql .= " ORDER BY position";
if ($resql = $db->query($sql)) {
$bookmarkList = '<div id="dropdown-bookmarks-list" class="start">';
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= dol_escape_htmltag($obj->title);
$bookmarkList .= '</a>';
$i++;
}
if ($i == 0) {
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("NoBookmarks").'</span>';
$bookmarkList .= '<br><br>';
$i = 0;
$accesskeyalreadyassigned = array();
foreach ($arrayresult as $key => $val) {
$tmp = explode('?', $val['url']);
$urlaction = $tmp[0];
$keysearch = 'search_all';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
$accesskey = '';
if (!$accesskeyalreadyassigned[$val['label'][0]]) {
$accesskey = $val['label'][0];
$accesskeyalreadyassigned[$accesskey] = $accesskey;
$bookmarkList .= '<center>'.$newcardbutton.'</center>';
}
$bookmarkList .= '</div>';
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
} else {
dol_print_error($db);
}
//$bookmarks .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, $val['img'], $showtitlebefore, ($i > 0 ? 0 : 1));
$i++;
}
// Execute hook printSearchForm
$parameters = array('bookmarks'=>$bookmarks);
// Execute hook printBookmarks
$parameters = array('bookmarks'=>$bookmarkList);
$reshook = $hookmanager->executeHooks('printBookmarks', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$bookmarks .= $hookmanager->resPrint;
$bookmarkList .= $hookmanager->resPrint;
} else {
$bookmarks = $hookmanager->resPrint;
$bookmarkList = $hookmanager->resPrint;
}
@ -115,7 +129,7 @@ print "<!-- Begin Bookmarks list -->\n";
print '<div class="center"><div class="center" style="padding: 6px;">';
print '<style>.menu_titre { padding-top: 7px; }</style>';
print '<div id="blockvmenusearch" class="tagtable center searchpage">'."\n";
print $bookmarks;
print $bookmarkList;
print '</div>'."\n";
print '</div></div>';
print "\n<!-- End SearchForm -->\n";

View File

@ -35,7 +35,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
public $boxcode = "customersoutstandingbillreached";
public $boximg = "object_company";
public $boxlabel = "BoxCustomersOutstandingBillReached";
public $depends = array("facture","societe");
public $depends = array("facture", "societe");
/**
* @var DoliDB Database handler.

View File

@ -24,7 +24,7 @@
* \ingroup projet
* \brief Module to show the funnel of prospection
*/
include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
/**
* Class to manage the box to show last projet
@ -91,8 +91,8 @@ class box_funnel_of_prospection extends ModeleBoxes
$badgeStatus7 = '#baa32b';
$badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0';
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php')) {
include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) {
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
}
$listofoppstatus = array();
$listofopplabel = array();
@ -100,7 +100,7 @@ class box_funnel_of_prospection extends ModeleBoxes
$colorseriesstat = array();
$bordercolorseries = array();
$sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_lead_status as cls";
$sql .= " FROM ".MAIN_DB_PREFIX."c_lead_status as cls";
$sql .= " WHERE active=1";
$sql .= " AND cls.code <> 'LOST'";
$sql .= $this->db->order('cls.rowid', 'ASC');
@ -148,14 +148,14 @@ class box_funnel_of_prospection extends ModeleBoxes
$this->max = $max;
$this->info_box_head = array(
'text' => $langs->trans("Statistics") . ' - ' . $langs->trans("BoxTitleFunnelOfProspection"),
'text' => $langs->trans("Statistics").' - '.$langs->trans("BoxTitleFunnelOfProspection"),
'graph' => '1'
);
if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p, " . MAIN_DB_PREFIX . "c_lead_status as cls";
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls";
$sql .= " WHERE p.entity IN (".getEntity('project').")";
$sql .= " AND p.fk_opp_status = cls.rowid";
$sql .= " AND p.fk_statut = 1"; // Opend projects only
$sql .= " AND cls.code NOT IN ('LOST')";
@ -200,14 +200,14 @@ class box_funnel_of_prospection extends ModeleBoxes
$liststatus = array();
$data = array('');
$customlabels = array();
$total=0;
$total = 0;
foreach ($listofstatus as $status) {
$customlabel = '';
$labelStatus = '';
if ($status != 7) {
$code = dol_getIdFromCode($this->db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) {
$labelStatus = $langs->transnoentitiesnoconv("OppStatus" . $code);
$labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
}
if (empty($labelStatus)) {
$labelStatus = $listofopplabel[$status];
@ -218,16 +218,16 @@ class box_funnel_of_prospection extends ModeleBoxes
$liststatus[] = $labelStatus;
if (!$conf->use_javascript_ajax) {
$stringtoprint .= '<tr class="oddeven">';
$stringtoprint .= '<td>' . $labelStatus . '</td>';
$stringtoprint .= '<td class="right"><a href="list.php?statut=' . $status . '">' . price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency) . '</a></td>';
$stringtoprint .= '<td>'.$labelStatus.'</td>';
$stringtoprint .= '<td class="right"><a href="list.php?statut='.$status.'">'.price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency).'</a></td>';
$stringtoprint .= "</tr>\n";
}
}
$customlabels[]=$customlabel;
$customlabels[] = $customlabel;
}
$dataseries[] = $data;
if ($conf->use_javascript_ajax) {
include_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetMinValue(0);
$dolgraph->SetData($dataseries);
@ -273,7 +273,7 @@ class box_funnel_of_prospection extends ModeleBoxes
'tr' => 'class="oddeven"',
'td' => 'class="left "',
'maxlength' => 500,
'text' => $langs->trans("OpportunityTotalAmount") . ' (' . $langs->trans("WonLostExcluded") . ')'
'text' => $langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'
);
$this->info_box_contents[$line][] = array(
'tr' => 'class="oddeven"',
@ -286,7 +286,7 @@ class box_funnel_of_prospection extends ModeleBoxes
'tr' => 'class="oddeven"',
'td' => 'class="left "',
'maxlength' => 500,
'text' => $form->textwithpicto($langs->trans("OpportunityPonderatedAmount") . ' (' . $langs->trans("WonLostExcluded") . ')', $langs->trans("OpportunityPonderatedAmountDesc"), 1)
'text' => $form->textwithpicto($langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')', $langs->trans("OpportunityPonderatedAmountDesc"), 1)
);
$this->info_box_contents[$line][] = array(

View File

@ -80,8 +80,8 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
$badgeStatus7 = '#baa32b';
$badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0';
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php')) {
include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) {
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
}
$this->max = $max;
@ -97,22 +97,22 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
$days = 7;
}
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
$text = $langs->trans("BoxTicketLastXDays", $days).'&nbsp;' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_last_days" class="linkobject"');
$text = $langs->trans("BoxTicketLastXDays", $days).'&nbsp;'.img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_last_days" class="linkobject"');
$this->info_box_head = array(
'text' => $text,
'limit' => dol_strlen($text)
);
$today = date_time_set(date_create(), 0, 0);
$todayformat = date('Y-m-d', date_timestamp_get($today));
$intervaltosub = new DateInterval('P' . dol_escape_htmltag($days - 1) . 'D');
$intervaltosub = new DateInterval('P'.dol_escape_htmltag($days - 1).'D');
$intervaltoadd = new DateInterval('P1D');
$minimumdatec = date_sub($today, $intervaltosub);
$minimumdatecformated = date('Y-m-d', date_timestamp_get($minimumdatec));
if ($user->rights->ticket->read) {
$sql = "SELECT CAST(t.datec AS DATE) as datec, COUNT(t.datec) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
$sql .= " WHERE CAST(t.datec AS DATE) > DATE_SUB(CURRENT_DATE, INTERVAL " . $days . " DAY)";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
$sql .= " WHERE CAST(t.datec AS DATE) > DATE_SUB(CURRENT_DATE, INTERVAL ".$days." DAY)";
$sql .= " GROUP BY CAST(t.datec AS DATE)";
$resql = $this->db->query($sql);
if ($resql) {
@ -148,12 +148,12 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
});
</script>';
$stringtoshow .= '<div class="center hideobject" id="idfilterDOLUSERCOOKIE_ticket_last_days">'; // hideobject is to start hidden
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
$stringtoshow .= '<input type="hidden" name="token" value="' . newToken() . '">';
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
$stringtoshow .= '<input type="hidden" name="action" value="refresh">';
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_ticket_last_days:days">';
$stringtoshow .= ' <input class="flat" size="4" type="text" name="' . $param_day . '" value="' . $days . '">' . $langs->trans("Days");
$stringtoshow .= '<input type="image" alt="' . $langs->trans("Refresh") . '" src="' . img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1) . '">';
$stringtoshow .= ' <input class="flat" size="4" type="text" name="'.$param_day.'" value="'.$days.'">'.$langs->trans("Days");
$stringtoshow .= '<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
$stringtoshow .= '</form>';
$stringtoshow .= '</div>';
@ -181,21 +181,21 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
$px1->mode = 'depth';
$px1->draw('idgraphticketlastxdays');
$graphtoshow= $px1->show($totalnb ? 0 : 1);
$graphtoshow = $px1->show($totalnb ? 0 : 1);
}
if ($totalnb) {
$stringtoshow .= $graphtoshow;
}
$stringtoshow .= '</div>';
if ($totalnb) {
$this->info_box_contents[][]=array(
$this->info_box_contents[][] = array(
'td' => 'center',
'text' => $stringtoshow
);
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="center opacitymedium"',
'text' => $stringtoshow . $langs->trans("BoxNoTicketLastXDays", $days)
'text' => $stringtoshow.$langs->trans("BoxNoTicketLastXDays", $days)
);
}
} else {

View File

@ -970,8 +970,8 @@ abstract class CommonInvoiceLine extends CommonObjectLine
public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation
public $buy_price_ht;
public $buyprice; // For backward compatibility
public $pa_ht; // For backward compatibility
public $buyprice; // For backward compatibility
public $pa_ht; // For backward compatibility
public $marge_tx;
public $marque_tx;

View File

@ -1851,7 +1851,7 @@ abstract class CommonObject
$result = false;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql .= " WHERE ".$field." = '".$key."'";
$sql .= " WHERE ".$field." = '".$this->db->escape($key)."'";
if (!empty($element)) {
$sql .= " AND entity IN (".getEntity($element).")";
} else {

View File

@ -88,7 +88,7 @@ class DefaultValues extends CommonObject
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields=array(
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
'type' =>array('type'=>'varchar(10)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
@ -145,8 +145,12 @@ class DefaultValues extends CommonObject
$this->db = $db;
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
$this->fields['rowid']['visible'] = 0;
}
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
$this->fields['entity']['enabled'] = 0;
}
// Unset fields that are disabled
foreach ($this->fields as $key => $val) {

View File

@ -193,12 +193,12 @@ class Form
* @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value). Use '' to use same than $value
* @param object $extObject External object
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
* @param string $moreparam More param to add on the form action href URL
* @param int $notabletag Do no output table tags
* @param string $formatfunc Call a specific function to output field
* @param string $formatfunc Call a specific function to output field in view mode (For example: 'dol_print_email')
* @param string $paramid Key of parameter for id ('id', 'socid')
* @return string HTML edit field
*/
@ -214,7 +214,7 @@ class Form
}
// When option to edit inline is activated
if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
$ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg);
} else {
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$htmlname);
@ -236,7 +236,7 @@ class Form
} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$valuetoshow = price2num($editvalue ? $editvalue : $value);
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ?price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
@ -5088,8 +5088,7 @@ class Form
if ($selected) {
$projet = new Project($this->db);
$projet->fetch($selected);
//print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$selected.'">'.$projet->title.'</a>';
$out .= $projet->getNomUrl(0, '', 1);
$out .= $projet->getNomUrl(1, '', 1);
} else {
$out .= "&nbsp;";
}
@ -8679,7 +8678,7 @@ class Form
*/
public function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $morehtmlright = '')
{
global $langs, $conf, $hookmanager, $extralanguages;
global $conf, $langs, $hookmanager, $extralanguages;
$ret = '';
if (empty($fieldid)) {
@ -8691,7 +8690,7 @@ class Form
// Preparing gender's display if there is one
$addgendertxt = '';
if (!empty($object->gender)) {
if (property_exists($object, 'gender') && !empty($object->gender)) {
$addgendertxt = ' ';
switch ($object->gender) {
case 'man':
@ -8705,6 +8704,15 @@ class Form
break;
}
}
/*
$addadmin = '';
if (property_exists($object, 'admin')) {
if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
$addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
} elseif (!empty($object->admin)) {
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
}
}*/
// Add where from hooks
if (is_object($hookmanager)) {
@ -8837,7 +8845,7 @@ class Form
$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
}
} elseif (in_array($object->element, array('contact', 'user', 'usergroup'))) {
$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
$ret .= dol_htmlentities($object->getFullName($langs));
} elseif (in_array($object->element, array('action', 'agenda'))) {
$ret .= $object->ref.'<br>'.$object->label;
} elseif (in_array($object->element, array('adherent_type'))) {
@ -9085,7 +9093,7 @@ class Form
}
$ret .= '<table class="nobordernopadding centpercent">';
if ($object->photo) {
$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
}
$ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'></td></tr>';
$ret .= '</table>';

View File

@ -500,7 +500,7 @@ class FormFile
$modellist = array();
if ($modulepart == 'company') {
$showempty = 1; // can have no template active
$showempty = 1; // can have no template active
if (is_array($genallowed)) {
$modellist = $genallowed;
} else {
@ -564,7 +564,7 @@ class FormFile
$modellist = ModelePDFFactures::liste_modeles($this->db);
}
} elseif ($modulepart == 'contract') {
$showempty = 1; // can have no template active
$showempty = 1; // can have no template active
if (is_array($genallowed)) {
$modellist = $genallowed;
} else {
@ -628,7 +628,7 @@ class FormFile
$modellist = ModelePDFSuppliersOrders::liste_modeles($this->db);
}
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') {
$showempty = 1; // can have no template active
$showempty = 1; // can have no template active
if (is_array($genallowed)) {
$modellist = $genallowed;
} else {
@ -1708,7 +1708,7 @@ class FormFile
} else {
$parameters = array('modulepart'=>$modulepart);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0) {
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
if (array_key_exists('classpath', $hookmanager->resArray) && !empty($hookmanager->resArray['classpath'])) {
dol_include_once($hookmanager->resArray['classpath']);
if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) {
@ -1789,9 +1789,9 @@ class FormFile
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : '');
} else {
$parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file);
$parameters = array('modulepart'=>$modulepart, 'fileinfo'=>$file);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0) {
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
if (array_key_exists('ref', $hookmanager->resArray) && !empty($hookmanager->resArray['ref'])) {
$ref = $hookmanager->resArray['ref'];
}

View File

@ -691,9 +691,9 @@ class FormMail extends Form
$out .= '<tr><td class="minwidth200">';
$out .= $langs->trans("GroupEmails");
$out .= '</td><td>';
$out .= ' <input type="checkbox" name="oneemailperrecipient"'.($this->withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> ';
$out .= $langs->trans("OneEmailPerRecipient");
$out .= '<span class="hideonsmartphone">';
$out .= ' <input type="checkbox" id="oneemailperrecipient" name="oneemailperrecipient"'.($this->withoptiononeemailperrecipient > 0 ? ' checked="checked"' : '').'> ';
$out .= '<label for="oneemailperrecipient">'.$langs->trans("OneEmailPerRecipient").'</label>';
$out .= '<span class="hideonsmartphone opacitymedium">';
$out .= ' - ';
$out .= $langs->trans("WarningIfYouCheckOneRecipientPerEmail");
$out .= '</span>';
@ -773,12 +773,11 @@ class FormMail extends Form
if (!empty($this->withmaindocfile)) {
if ($this->withmaindocfile == 1) {
$out .= '<input type="checkbox" name="addmaindocfile" value="1" />';
$out .= '<input type="checkbox" id="addmaindocfile" name="addmaindocfile" value="1" />';
} elseif ($this->withmaindocfile == -1) {
$out .= '<input type="checkbox" id="addmaindocfile" name="addmaindocfile" value="1" checked="checked" />';
}
if ($this->withmaindocfile == -1) {
$out .= '<input type="checkbox" name="addmaindocfile" value="1" checked="checked" />';
}
$out .= ' '.$langs->trans("JoinMainDoc").'.<br>';
$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDoc").'.</label><br>';
}
if (is_numeric($this->withfile)) {

View File

@ -514,7 +514,17 @@ class FormProjets
}
$linkedtothirdparty = false;
if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales', 'entrepot'))) {
if (!in_array($table_element, array(
'don',
'expensereport_det',
'expensereport', 'loan',
'stock_mouvement',
'payment_salary',
'payment_various',
'salary',
'chargesociales',
'entrepot')
)) {
$linkedtothirdparty = true;
}

View File

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

View File

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

View File

@ -151,7 +151,7 @@ class InfoBox
$box->rowid = (empty($obj->rowid) ? '' : $obj->rowid);
$box->id = (empty($obj->box_id) ? '' : $obj->box_id);
$box->position = ((isset($obj->position) && $obj->position == '') ? '' : (isset($obj->position) ? $obj->position : '')); // '0' must stay '0'
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile = $relsourcefile;
$box->class = $boxname;
@ -215,7 +215,7 @@ class InfoBox
/**
* Save order of boxes for area and user
*
* @param DoliDB $dbs Database handler
* @param DoliDB $dbs Database handler
* @param int $zone Name of area (0 for Homepage, ...)
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @param int $userid Id of user

View File

@ -1422,7 +1422,7 @@ class SMTPs
$this->_msgContent[$strType]['dataText'] = $strContentAltText;
if ($this->getMD5flag()) {
$this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3);
$this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3);
}
//}
}
@ -1622,7 +1622,7 @@ class SMTPs
$this->_msgContent['image'][$strImageName]['data'] = $strContent;
if ($this->getMD5flag()) {
$this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3);
$this->_msgContent['image'][$strImageName]['md5'] = dol_hash($strContent, 3);
}
}
}

View File

@ -681,7 +681,7 @@ function dol_get_first_day_week($day, $month, $year, $gm = false)
function getGMTEasterDatetime($year)
{
$base = new DateTime("$year-03-21", new DateTimeZone("UTC"));
$days = easter_days($year); // Return number of days between 21 march and easter day.
$days = easter_days($year); // Return number of days between 21 march and easter day.
$tmp = $base->add(new DateInterval("P{$days}D"));
return $tmp->getTimestamp();
}

View File

@ -108,6 +108,10 @@ function getEntity($element, $shared = 1, $currentobject = null)
{
global $conf, $mc, $hookmanager, $object, $action;
if (! is_object($hookmanager)) {
$hookmanager = new HookManager($db);
}
// fix different element names (France to English)
switch ($element) {
case 'contrat':
@ -2289,6 +2293,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
{
global $conf, $langs;
// If date undefined or "", we return ""
if (dol_strlen($time) == 0) {
return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
}
if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver'));
}
@ -2312,7 +2321,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$user_date_tz = new DateTimeZone($offsettzstring);
$user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz);
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : $time);
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time);
$offsettz = $user_dt->getOffset();
} else { // old method (The 'tzuser' was processed like the 'tzuserrel')
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
@ -2380,11 +2389,6 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$format = str_replace('yyyy', 'yy', $format);
}
// If date undefined or "", we return ""
if (dol_strlen($time) == 0) {
return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
}
// Clean format
if (preg_match('/%b/i', $format)) { // There is some text to translate
// We inhibate translation to text made by strftime functions. We will use trans instead later.
@ -2401,7 +2405,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
// Analyze date
$reg = array();
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
dol_print_error('', "Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
return '';
} elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date
// This part of code should not be used anymore.
@ -3670,9 +3674,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
@ -3682,7 +3686,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house',
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'supplier'=>'building', 'technic'=>'cogs',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt',
'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card',
@ -4473,7 +4477,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
$result = ($nodiv ? '' : '<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) {
$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">
jQuery(document).ready(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.
* 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? $db Database handler
* @param string|string[] $error String or array of errors strings to show
* @param array $errors Array of errors
* @return void
@ -4824,7 +4828,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
* Show a title.
*
* @param string $title Title to show
* @return string Title to show
* @return void
* @deprecated Use load_fiche_titre instead
* @see load_fiche_titre()
*/
@ -5191,7 +5195,7 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
*
* @param float $amount Amount to format
* @param integer $form Type of format, HTML or not (not by default)
* @param Translate $outlangs Object langs for output
* @param Translate? $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 $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)
@ -5852,7 +5856,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
$ret .= ' ('.$obj->default_vat_code.')';
}
}
$db->free($sql);
$db->free($resql);
} else {
dol_print_error($db);
}
@ -6677,7 +6681,7 @@ function dol_html_entity_decode($a, $b, $c = 'UTF-8', $keepsomeentities = 0)
* @param bool $double_encode When double_encode is turned off, PHP will not encode existing html entities
* @return string $ret Encoded string
*/
function dol_htmlentities($string, $flags = null, $encoding = 'UTF-8', $double_encode = false)
function dol_htmlentities($string, $flags = ENT_QUOTES|ENT_SUBSTITUTE, $encoding = 'UTF-8', $double_encode = false)
{
return htmlentities($string, $flags, $encoding, $double_encode);
}
@ -8151,16 +8155,20 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1)
return 'Bad string syntax to evaluate: '.$s;
}
// We block using of php exec or php file functions
$forbiddenphpstrings = array("exec(", "passthru(", "shell_exec(", "system(", "proc_open(", "popen(", "eval(", "dol_eval(", "executeCLI(");
$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('));
// We block use of php exec or php file functions
$forbiddenphpstrings = array('$$');
$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 {
$oldstringtoclean = $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(
} while ($oldstringtoclean != $s);
@ -8818,7 +8826,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
* 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.
* @return string HTML code to set focus
* @return void
*/
function dol_set_focus($selector)
{
@ -10040,7 +10048,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
}
$class = 'btnTitle';
if (in_array($iconClass, array('fa fa-plus-circle', 'fa fa-comment-dots'))) {
if (in_array($iconClass, array('fa fa-plus-circle', 'fa fa-plus-circle size15x', 'fa fa-comment-dots'))) {
$class .= ' btnTitlePlus';
}
$useclassfortooltip = 1;

View File

@ -249,7 +249,10 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
dol_syslog("getURLContent request=".$request);
//dol_syslog("getURLContent response =".response); // This may contains binary data, so we dont output it
if (!empty($conf->global->MAIN_GETURLCONTENT_OUTPUT_RESPONSE)) {
// This may contains binary data, so we dont output reponse by default.
dol_syslog("getURLContent response =".response);
}
dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it
$rep = array();

View File

@ -48,7 +48,7 @@ function import_prepare_head($param, $maxstep = 0)
if ($i < 6) {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
} else {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5
}
$head[$h][1] = $langs->trans("Step")." ".$i;
$head[$h][2] = 'step'.$i;

View File

@ -76,7 +76,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
}
}
if (!empty($conf->memcached->enabled) && class_exists('Memcached')) {
if (!empty($conf->memcached->enabled) && class_exists('Memcached')) {
// Using a memcached server
global $dolmemcache;
if (empty($dolmemcache) || !is_object($dolmemcache)) {
@ -88,7 +88,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
}
}
$memoryid = session_name() . '_' . $memoryid;
$memoryid = session_name().'_'.$memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
$rescode = $dolmemcache->getResultCode();
@ -109,7 +109,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
}
}
$memoryid = session_name() . '_' . $memoryid;
$memoryid = session_name().'_'.$memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
if ($result) {
@ -154,7 +154,7 @@ function dol_getcache($memoryid)
}
}
$memoryid = session_name() . '_' . $memoryid;
$memoryid = session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
//print "Get memoryid=".$memoryid;
$data = $m->get($memoryid);
@ -179,7 +179,7 @@ function dol_getcache($memoryid)
}
}
$memoryid = session_name() . '_' . $memoryid;
$memoryid = session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$data = $m->get($memoryid);
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
@ -187,7 +187,7 @@ function dol_getcache($memoryid)
if ($data) {
return $data;
} else {
return null; // There is no way to make a difference between NOTFOUND and error when using Memcache. So do not use it, use Memcached instead.
return null; // There is no way to make a difference between NOTFOUND and error when using Memcache. So do not use it, use Memcached instead.
}
} elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { // This is a really not reliable cache ! Use Memcached instead.
// Using shmop
@ -252,7 +252,7 @@ function dol_setshmop($memoryid, $data, $expire)
}
$shmkey = dol_getshmopaddress($memoryid);
if (empty($shmkey)) {
return 0; // No key reserved for this memoryid, we can't cache this memoryid
return 0; // No key reserved for this memoryid, we can't cache this memoryid
}
$newdata = serialize($data);
@ -268,7 +268,7 @@ function dol_setshmop($memoryid, $data, $expire)
shmop_close($handle);
return ($shm_bytes_written1 + $shm_bytes_written2);
} else {
print 'Error in shmop_open for memoryid=' . $memoryid . ' shmkey=' . $shmkey . ' 6+size=6+' . $size;
print 'Error in shmop_open for memoryid='.$memoryid.' shmkey='.$shmkey.' 6+size=6+'.$size;
return -1;
}
}
@ -290,7 +290,7 @@ function dol_getshmop($memoryid)
}
$shmkey = dol_getshmopaddress($memoryid);
if (empty($shmkey)) {
return null; // No key reserved for this memoryid, we can't cache this memoryid
return null; // No key reserved for this memoryid, we can't cache this memoryid
}
//print 'dol_getshmop memoryid='.$memoryid." shmkey=".$shmkey."<br>\n";
@ -304,7 +304,7 @@ function dol_getshmop($memoryid)
}
shmop_close($handle);
} else {
return null; // Can't open existing block, so we suppose it was not created, so nothing were cached yet for the memoryid
return null; // Can't open existing block, so we suppose it was not created, so nothing were cached yet for the memoryid
}
return $data;
}

View File

@ -157,8 +157,8 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$localtax1_rate = (float) $obj->localtax1; // Use float to force to get first numeric value when value is x:y:z
$localtax2_rate = (float) $obj->localtax2; // Use float to force to get first numeric value when value is -19:-15:-9
$localtax1_rate = (float) $obj->localtax1; // Use float to force to get first numeric value when value is x:y:z
$localtax2_rate = (float) $obj->localtax2; // Use float to force to get first numeric value when value is -19:-15:-9
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
//var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);
@ -443,7 +443,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// initialize result array
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.(empty($conf->global->MAIN_ROUNDING_RULE_TOT)?'':$conf->global->MAIN_ROUNDING_RULE_TOT).' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.(empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? '' : $conf->global->MAIN_ROUNDING_RULE_TOT).' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
return $result;
}

View File

@ -492,10 +492,14 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->fournisseur->commande->supprimer) {
$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) {
$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') {
if (empty($user->rights->banque->modifier)) {
$deleteok = 0;
@ -618,7 +622,7 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object
$checktask = array('projet_task'); // Test for task object
$checktask = array('projet_task'); // Test for task object
$nocheck = array('barcode', 'stock'); // No test
//$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).

View File

@ -234,7 +234,7 @@ if (!function_exists('dol_loginfunction')) {
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
$width = 128;
} elseif (!empty($mysoc->logo_squarred_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {

View File

@ -1256,7 +1256,9 @@ class pdf_einstein extends ModelePDFCommandes
global $conf, $langs, $hookmanager;
$ltrdirection = 'L';
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
if ($outputlangs->trans("DIRECTION") == 'rtl') {
$ltrdirection = 'R';
}
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies"));

View File

@ -586,18 +586,22 @@ class ImportCsv extends ModeleImports
$arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
$defaultref = '';
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) {
require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php';
$modTask = new $obj;
$defaultref = $modTask->getNextValue(null, null);
}
if (is_numeric($defaultref) && $defaultref <= 0) {
if (strtolower($newval) == 'auto') {
$defaultref = '';
$classModForNumber = $objimport->array_import_convertvalue[0][$val]['class'];
$pathModForNumber = $objimport->array_import_convertvalue[0][$val]['path'];
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
$modForNumber = new $classModForNumber;
$defaultref = $modForNumber->getNextValue(null, null);
}
if (is_numeric($defaultref) && $defaultref <= 0) {
$defaultref = '';
}
$newval = $defaultref;
}
$newval = $defaultref;
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];

View File

@ -627,18 +627,22 @@ class ImportXlsx extends ModeleImports
$arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
$defaultref = '';
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
$modTask = new $obj;
$defaultref = $modTask->getNextValue(null, null);
}
if (is_numeric($defaultref) && $defaultref <= 0) {
if (strtolower($newval) == 'auto') {
$defaultref = '';
$classModForNumber = $objimport->array_import_convertvalue[0][$val]['class'];
$pathModForNumber = $objimport->array_import_convertvalue[0][$val]['path'];
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
$modForNumber = new $classModForNumber;
$defaultref = $modForNumber->getNextValue(null, null);
}
if (is_numeric($defaultref) && $defaultref <= 0) {
$defaultref = '';
}
$newval = $defaultref;
}
$newval = $defaultref;
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];

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