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

fix_add_ldap_hash_type_select
This commit is contained in:
Regis Houssin 2021-11-12 10:10:04 +01:00
commit 084a3f48c1
161 changed files with 1700 additions and 767 deletions

View File

@ -12,8 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Reporting a Vulnerability
To report a vulnerability, please use GitHub security advisory at https://github.com/Dolibarr/dolibarr/security/advisories/new (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
To report a vulnerability, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
## Hunting vulnerabilities on Dolibarr
@ -23,7 +22,7 @@ If you believe you've found a security bug in our service, we are happy to work
Any type of denial of service attacks is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure.
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: https://www.dolibarr.org/download) to get access on every side of application.
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: [https://www.dolibarr.org/download](https://www.dolibarr.org/download)) to get access on every side of application.
### User Agent
@ -31,8 +30,7 @@ If you try to find bug on Dolibarr, we recommend to append to your user-agent he
### Account access
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from https://www.dolibarr.org/download
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from [https://www.dolibarr.org/download](https://www.dolibarr.org/download)
## Eligibility and Responsible Disclosure
@ -46,7 +44,6 @@ You must avoid tests that could cause degradation or interruption of our service
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
## Scope for qualified vulnerabilities
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
@ -64,7 +61,6 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for reporting
* Remote code execution (RCE)
@ -81,7 +77,6 @@ Scope is the web application (back office) and the APIs.
* Software version disclosure (for non admin users only)
* Stack traces or path disclosure (for non admin users only)
## Non-qualifying vulnerabilities for reporting
* "Self" XSS
@ -99,4 +94,3 @@ Scope is the web application (back office) and the APIs.
* Software version or private IP disclosure when logged user is admin
* Stack traces or path disclosure when logged user is admin
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".

View File

@ -4,7 +4,7 @@
*
* 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,

View File

@ -4,7 +4,7 @@
*
* 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,

View File

@ -6,7 +6,7 @@
*
* 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,

View File

@ -5,7 +5,7 @@
*
* 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,

View File

@ -87,11 +87,11 @@ class AccountancyExport
*
* @param DoliDb $db Database handler
*/
public function __construct(DoliDB &$db)
public function __construct(DoliDB $db)
{
global $conf;
$this->db = &$db;
$this->db = $db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
}
@ -928,17 +928,18 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
$refInvoice = '';
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$invoice = new Facture($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$invoice = new FactureFournisseur($db);
$invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref_supplier;
@ -1054,17 +1055,18 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
$refInvoice = '';
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$invoice = new Facture($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$invoice = new FactureFournisseur($db);
$invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref_supplier;

View File

@ -6,7 +6,7 @@
*
* 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,

View File

@ -184,6 +184,8 @@ if ($action == 'validatehistory') {
} else {
$num_lines = $db->num_rows($result);
$facture_static = new Facture($db);
$isSellerInEEC = isInEEC($mysoc);
$thirdpartystatic = new Societe($db);
@ -266,6 +268,18 @@ if ($action == 'validatehistory') {
}
}
// Manage Deposit
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
$accountdeposittoventilated = new AccountingAccount($db);
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
$objp->code_sell_l = $accountdeposittoventilated->ref;
$objp->code_sell_p = '';
$objp->code_sell_t = '';
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
}
}
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);

View File

@ -413,6 +413,9 @@ if ($result) {
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
if ($search_label) {
$param .= '&search_label='.urlencode($search_label);
}
if ($search_desc) {
$param .= '&search_desc='.urlencode($search_desc);
}
@ -491,7 +494,7 @@ if ($result) {
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
@ -539,7 +542,7 @@ if ($result) {
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta = $objp->company_code_sell;
$thirdpartystatic->code_compta_company = $objp->company_code_sell;
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@ -558,7 +561,7 @@ if ($result) {
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype;
$facture_static->date = $objp->datef;
$facture_static->date = $db->jdate($objp->datef);
$facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht;
@ -589,7 +592,28 @@ if ($result) {
}
//var_dump($return);
if (!empty($code_sell_p)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
// Manage Deposit
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
$accountdeposittoventilated = new AccountingAccount($db);
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
$objp->code_sell_l = $accountdeposittoventilated->ref;
$objp->code_sell_p = '';
$objp->code_sell_t = '';
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
}
}
if (!empty($objp->code_sell_p)) {
// Value was defined previously
} else {
$code_sell_p_notset = 'color:orange';
@ -613,7 +637,7 @@ if ($result) {
// Ref Invoice
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
print '<td class="center">'.dol_print_date($db->jdate($facture_static->date), 'day').'</td>';
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
// Ref Product
print '<td class="tdoverflowmax150">';
@ -707,7 +731,7 @@ if ($result) {
// Column with checkbox
print '<td class="center">';
if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
if (!empty($suggestedid) && $suggestedaccountingaccountfor <> '') {
$ischecked=1;
} elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
$ischecked = 0;

View File

@ -291,7 +291,7 @@ if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
}
if (strlen(trim($search_label))) {
$sql .= natural_search("f.libelle", $search_label);
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
}
if (strlen(trim($search_desc))) {
$sql .= natural_search("l.description", $search_desc);
@ -546,7 +546,7 @@ if ($result) {
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta_fournisseur = $objp->company_code_buy;
$thirdpartystatic->code_compta_company = $objp->company_code_buy;
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@ -566,10 +566,11 @@ if ($result) {
$facturefourn_static->id = $objp->facid;
$facturefourn_static->type = $objp->ftype;
$facturefourn_static->label = $objp->invoice_label;
$facturefourn_static->date = $db->jdate($objp->datef);
$facturefourn_static_det->id = $objp->rowid;
$facturefourn_static_det->total_ht = $objp->total_ht;
$facturefourn_static_det->tva_tx_line = $objp->tva_tx_line;
$facturefourn_static_det->tva_tx = $objp->tva_tx_line;
$facturefourn_static_det->vat_src_code = $objp->vat_src_code;
$facturefourn_static_det->product_type = $objp->type_l;
$facturefourn_static_det->desc = $objp->description;
@ -608,6 +609,9 @@ if ($result) {
if (empty($code_buy_l) && empty($code_buy_p)) {
$code_buy_p_notset = 'color:red';
}
/*if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
$code_sell_p_notset = 'color:orange';
}*/
// $code_buy_l is now default code of product/service
// $code_buy_p is now code of product/service
@ -626,15 +630,15 @@ if ($result) {
print '</td>';
*/
print '<td class="center">'.dol_print_date($db->jdate($facturefourn_static_det->datef), 'day').'</td>';
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
// Ref Product
print '<td class="tdoverflowmax150">';
if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
}
if ($product_static->product_label) {
print '<br><span class="opacitymedium small">'.$product_static->product_label.'</span>';
if ($product_static->label) {
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
}
print '</td>';
@ -650,11 +654,12 @@ if ($result) {
print '</td>';
// Vat rate
$code_vat_differ='';
if ($objp->vat_tx_l != $objp->vat_tx_p && ! empty($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
}
print '<td style="'.$code_vat_differ.'" class="right">';
print vatrate($facturefourn_static_det->tva_tx_line.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print '</td>';
// Thirdparty
@ -671,7 +676,7 @@ if ($result) {
// Found accounts
print '<td class="small">';
$s = '1. '.(($facturefourn_static_det->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC");

View File

@ -2703,7 +2703,7 @@ class Adherent extends CommonObject
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
}
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
}
} elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') {
// Set LDAP password if possible
@ -2714,7 +2714,7 @@ class Adherent extends CommonObject
if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
// Create OpenLDAP MD5 password from Dolibarr MD5 password
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dolGetLdapHash($this->pass_indatabase_crypted, 'md5frommd5');
}
}
} elseif (!empty($this->pass_indatabase)) {
@ -2723,7 +2723,7 @@ class Adherent extends CommonObject
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
}
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
}
}
}

View File

@ -90,7 +90,7 @@ class AdherentType extends CommonObject
public $subscription;
/**
* @var float amount for subscription
* @var float|string Amount for subscription (null or '' means not defined)
*/
public $amount;

View File

@ -314,7 +314,7 @@ if (!empty($search_categ) || !empty($catid)) {
}
$sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql .= " d.note_private, d.note_public,";
$sql .= " s.nom,";

View File

@ -195,9 +195,7 @@ foreach ($data as $val) {
}
print '<tr class="oddeven" height="24">';
print '<td class="center">';
//print '<a href="month.php?year='.$year.'">';
print $year;
//print '</a>';
print '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?date_select='.((int) $year).'">'.$year.'</a>';
print '</td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right amount nowraponall"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';

View File

@ -943,8 +943,10 @@ if ($rowid > 0) {
}
if (!$datefrom) {
$datefrom = $object->datevalid;
if ($object->datefin > 0) {
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
} else {
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
}
}
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);

View File

@ -275,8 +275,7 @@ print '<br><br>';
/*
* Document templates generators
*/
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{
print load_fiche_titre($langs->trans("BankAccountModelModule"), '', '');
// Load array def with activated templates
@ -466,8 +465,7 @@ print '<br><br>';
/*
* Document templates generators
*/
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{
print load_fiche_titre($langs->trans("Other"), '', '');
print "<table class=\"noborder\" width=\"100%\">\n";

View File

@ -176,6 +176,71 @@ foreach ($dirbarcode as $reldir) {
}
}
// Select barcode numbering module
if ($conf->product->enabled) {
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
foreach ($dirbarcodenum as $dirroot) {
$dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
$file = substr($file, 0, dol_strlen($file) - 4);
try {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
}
$modBarCode = new $file();
print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs);
print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td class="center">';
$s = $modBarCode->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
print "</table>\n";
print '</div>';
}
/*
* CHOIX ENCODAGE
*/
@ -189,6 +254,7 @@ if (empty($conf->use_javascript_ajax)) {
print '<input type="hidden" name="action" value="updateengine">';
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
@ -211,8 +277,9 @@ if ($resql) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td width="100">';
print $obj->label;
print '<tr class="oddeven">';
print '<td width="100">';
print dol_escape_htmltag($obj->label);
print "</td><td>\n";
print $langs->trans('BarcodeDesc'.$obj->encoding);
//print "L'EAN se compose de 8 caracteres, 7 chiffres plus une cle de controle.<br>";
@ -270,6 +337,7 @@ if ($resql) {
}
}
print "</table>\n";
print '</div>';
if (empty($conf->use_javascript_ajax)) {
print $form->buttonsSaveCancel("Save", '');
@ -287,6 +355,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.newToken().'">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -304,7 +373,9 @@ if (!isset($_SERVER['WINDIR'])) {
$langs->load("errors");
print '<br><span class="error">'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).'</span>';
}
print '</td></tr>';
print '</td>';
print '<td>&nbsp;</td>';
print '</tr>';
}
// Module products
@ -313,7 +384,9 @@ if (!empty($conf->product->enabled)) {
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
print '<td width="60" class="right">';
print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1);
print '</td></tr>';
print '</td>';
print '<td>&nbsp;</td>';
print '</tr>';
}
// Module thirdparty
@ -322,10 +395,14 @@ if (!empty($conf->societe->enabled)) {
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
print '<td width="60" class="right">';
print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1);
print '</td></tr>';
print '</td>';
print '<td>&nbsp;</td>';
print '</tr>';
}
print "</table>\n";
print '</div>';
print '<div class="tabsAction">';
print '<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans("Modify").'">';
print "</div>";
@ -334,71 +411,6 @@ print '</form>';
print '<br>';
// Select barcode numbering module
if ($conf->product->enabled) {
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
foreach ($dirbarcodenum as $dirroot) {
$dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
$file = substr($file, 0, dol_strlen($file) - 4);
try {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
}
$modBarCode = new $file();
print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs);
print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td class="center">';
$s = $modBarCode->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
print "</table>\n";
}
//print '</form>';
print "<br>";
// End of page
llxFooter();
$db->close();

View File

@ -350,17 +350,15 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
$disabled = ' disabled="disabled"';
}
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
print "</td>\n";
print '</tr>';
print '</td>'."\n";
print '</tr>'."\n";
$result=$object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
if (!is_array($result) && $result<0) {
if (!is_array($result) && $result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} elseif (count($result)>0) {
foreach ($result as $key=>$defaultvalue) {
print "\n";
} elseif (is_array($result) && count($result) > 0) {
foreach ($result as $key => $defaultvalue) {
print '<tr class="oddeven">';
// Page
@ -378,11 +376,6 @@ if (!is_array($result) && $result<0) {
// Value
if ($mode != 'focus' && $mode != 'mandatory') {
print '<td>';
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value);
else print '<input type="text" name="value" value="'.dol_escape_htmltag($defaultvalue->value).'">';
print '</td>';
@ -405,8 +398,6 @@ if (!is_array($result) && $result<0) {
print '</td>';
print "</tr>\n";
print "\n";
$i++;
}
}

View File

@ -509,8 +509,8 @@ $tabcond[30] = !empty($conf->label->enabled);
$tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled));
$tabcond[33] = !empty($conf->hrm->enabled);
$tabcond[34] = !empty($conf->hrm->enabled);
$tabcond[35] = !empty($conf->expensereport->enabled);
$tabcond[36] = !empty($conf->expensereport->enabled);
$tabcond[35] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
$tabcond[36] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
$tabcond[37] = !empty($conf->product->enabled);
$tabcond[38] = !empty($conf->socialnetworks->enabled);
$tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
@ -2107,7 +2107,7 @@ if ($id) {
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
print '<a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';

View File

@ -5,7 +5,7 @@
*
* 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,

View File

@ -6,7 +6,7 @@
*
* 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,

View File

@ -79,10 +79,12 @@ if ($action == 'update') {
if (!empty($max_rank)) {
$static_skill = new Skill($db);
$TAllSkills = $static_skill->fetchAll();
foreach ($TAllSkills as &$skill) {
if (empty($skill->lines)) $skill->fetchLines();
if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
$skill->createSkills(count($skill->lines) + 1);
if (is_array($TAllSkills)) {
foreach ($TAllSkills as &$skill) {
if (empty($skill->lines)) $skill->fetchLines();
if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
$skill->createSkills(count($skill->lines) + 1);
}
}
}
}

View File

@ -851,8 +851,11 @@ if ($action == 'edit') {
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$dnsinfo = false;
if (!empty($companyemail) && function_exists('dns_get_record')) {
$domain = array_pop(explode('@', $companyemail));
$dnsinfo = dns_get_record($domain, DNS_TXT);
$arrayofemailparts = explode('@', $companyemail);
if (count($arrayofemailparts) == 2) {
$domain = $arrayofemailparts[1];
$dnsinfo = dns_get_record($domain, DNS_TXT);
}
}
if (!empty($dnsinfo) && is_array($dnsinfo)) {
foreach ($dnsinfo as $info) {

View File

@ -542,7 +542,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1);
$moreforfilter .= '</div>';
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
$array_version['deprecated'] = $langs->trans("Deprecated");

View File

@ -297,7 +297,7 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified) {

View File

@ -100,7 +100,7 @@ if (empty($conf->use_javascript_ajax)) {
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
print '</td>';
print '<td class="right">';
print '<input type="submit" class="button" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print '</td>';
}
print '</tr>';
@ -108,7 +108,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
print '<td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
print '</td>';
print '<td></td>';
@ -117,7 +117,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('DisabledResourceLinkContact').'</td>';
print '<td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print '</td>';
print '<td></td>';
@ -126,7 +126,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
print '<td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print '</td>';
print '<td></td>';

View File

@ -187,8 +187,6 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $user->entity) {
}
//print "conf->global->MAIN_FEATURES_LEVEL = ".$conf->global->MAIN_FEATURES_LEVEL."<br><br>\n";
// Output mode
print load_fiche_titre($langs->trans("SyslogOutput"), '', '');
@ -207,7 +205,7 @@ foreach ($syslogModules as $moduleName) {
$moduleactive = (int) $module->isActive();
//print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."<br>\n";
if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (($moduleactive == -1) && getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0) {
continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
}

View File

@ -207,6 +207,9 @@ if (in_array($type, array('mysql', 'mysqli'))) {
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
print '</div>';
print '<br>';
print '</fieldset>';
}

View File

@ -556,7 +556,7 @@ if ($mode == 'searchkey') {
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("TranslationOverwriteKey")).'</a>';
}
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$transifexlangfile = '$'; // $ means 'All'
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;

View File

@ -2679,7 +2679,7 @@ if ($action == 'create') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
// Show online signature link
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
$useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
print '<br><!-- Link to sign -->';

View File

@ -1345,10 +1345,25 @@ if ($resql) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
$totalarray = array(
'nbfield' => 0,
'val' => array(
'c.total_ht' => 0,
'c.total_tva' => 0,
'c.total_ttc' => 0,
),
'pos' => array(),
);
// 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['c.datec']['checked'])) {
@ -1388,7 +1403,6 @@ if ($resql) {
$generic_product = new Product($db);
$userstatic = new User($db);
$i = 0;
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);

View File

@ -57,12 +57,12 @@ $date_start = GETPOST('date_start', 'alpha');
$date_startDay = GETPOST('date_startday', 'int');
$date_startMonth = GETPOST('date_startmonth', 'int');
$date_startYear = GETPOST('date_startyear', 'int');
$date_start = ($date_startDay ? dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel') : dol_stringtotime($date_start));
$date_start = dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel');
$date_stop = GETPOST('date_stop', 'alpha');
$date_stopDay = GETPOST('date_stopday', 'int');
$date_stopMonth = GETPOST('date_stopmonth', 'int');
$date_stopYear = GETPOST('date_stopyear', 'int');
$date_stop = ($date_stopDay ? dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel') : dol_stringtotime($date_stop));
$date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel');
$action = GETPOST('action', 'aZ09');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -348,8 +348,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$nofile = array();
$nofile['id'] = $objd->id;
$nofile['entity'] = $objd->entity;
$nofile['date'] = $db->idate($objd->date);
$nofile['date_due'] = $db->idate($objd->date_due);
$nofile['date'] = $db->jdate($objd->date);
$nofile['date_due'] = $db->jdate($objd->date_due);
$nofile['paid'] = $objd->paid;
$nofile['amount_ht'] = $objd->total_ht;
$nofile['amount_ttc'] = $objd->total_ttc;
@ -368,8 +368,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
foreach ($files as $key => $file) {
$file['id'] = $objd->id;
$file['entity'] = $objd->entity;
$file['date'] = $db->idate($objd->date);
$file['date_due'] = $db->idate($objd->date_due);
$file['date'] = $db->jdate($objd->date);
$file['date_due'] = $db->jdate($objd->date_due);
$file['paid'] = $objd->paid;
$file['amount_ht'] = $objd->total_ht;
$file['amount_ttc'] = $objd->total_ttc;
@ -460,7 +460,7 @@ if ($result && $action == "dl" && !$error) {
$log .= ','.$langs->transnoentitiesnoconv("Country");
$log .= ','.$langs->transnoentitiesnoconv("VATIntra");
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
dol_delete_file($zipname);
@ -608,10 +608,14 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.currentToken().'">';
echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day');
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
print '<input type="hidden" name="date_stopday" value="'.GETPOST('date_stopday', 'int').'" />';
print '<input type="hidden" name="date_stopmonth" value="'.GETPOST('date_stopmonth', 'int').'" />';
print '<input type="hidden" name="date_stopyear" value="'.GETPOST('date_stopyear', 'int').'" />';
foreach ($listofchoices as $choice => $val) {
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
}
@ -741,19 +745,19 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td aling="left">'.$data['paid'].'</td>';
// Total ET
print '<td align="right">'.price($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'])."</td>\n";
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
// Total IT
print '<td align="right">'.price($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'])."</td>\n";
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
// Total VAT
print '<td align="right">'.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."</td>\n";
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
print '<td class="tdoverflowmax150" title="'.$data['thirdparty_name'].'">'.$data['thirdparty_name']."</td>\n";
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
print '<td class="center">'.$data['country_code']."</td>\n";
print '<td align="right">'.$data['vatnum']."</td>\n";
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
if ($data['sens']) {
$totalET_credit += $data['amount_ht'];

View File

@ -8,7 +8,7 @@
*
* 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,

View File

@ -178,7 +178,6 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
@ -270,13 +269,15 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
if (!$error) {
$param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
$param .= '&search_conciliated='.urlencode($search_conciliated);
if ($page) {
$param .= '&page='.urlencode($page);
}
if ($offset) {
$param .= '&offset='.urlencode($offset);
}
if ($search_conciliated != '' && $search_conciliated != '-1') {
$param .= '&search_conciliated='.urlencode($search_conciliated);
}
if ($search_thirdparty_user) {
$param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
}
@ -419,7 +420,6 @@ $banklinestatic = new AccountLine($db);
$now = dol_now();
// Must be before button action
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
@ -757,7 +757,7 @@ if ($resql) {
// Confirmation delete
if ($action == 'delete') {
$text = $langs->trans('ConfirmDeleteTransaction');
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid", 'int'), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
}
// Lines of title fields
@ -1200,7 +1200,7 @@ if ($resql) {
$objforbalance = $db->fetch_object($resqlforbalance);
if ($objforbalance) {
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
} else {
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
@ -1285,8 +1285,7 @@ if ($resql) {
}
}
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
} else {

View File

@ -7,7 +7,7 @@
*
* 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,

View File

@ -61,8 +61,8 @@ if ($action == 'add') {
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT', 2);
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT', 2);
if (!$label) {
$error++;

View File

@ -128,7 +128,7 @@ if (GETPOST('cancel', 'alpha')) {
if ($action == "reopen") {
$result = $object->setStatut($object::STATUS_DRAFT, null, '', 'CASHFENCE_REOPEN');
if ($result < 0) {
dol_print_error($db, $object->error, $object->error);
setEventMessages($object->error, $object->error, 'errors');
}
$action = 'view';
@ -312,7 +312,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
} elseif ($syear && $smonth && $sday) {
$sql .= " AND dateo < '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."'";
} else {
dol_print_error('', 'Year not defined');
setEventMessages($langs->trans('YearNotDefined'), null, 'errors');
}
$resql = $db->query($sql);
@ -356,7 +356,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
} elseif ($syear && $smonth && $sday) {
$sql .= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
} else {
dol_print_error('', 'Year not defined');
setEventMessages($langs->trans('YearNotDefined'), null, 'errors');
}
$resql = $db->query($sql);

View File

@ -3857,13 +3857,14 @@ if ($action == 'create') {
$totalpaye = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
// print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
@ -4091,10 +4092,10 @@ if ($action == 'create') {
}
// Confirmation du classement paye
if ($action == 'paid' && $resteapayer <= 0) {
if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
}
if ($action == 'paid' && $resteapayer > 0) {
if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) {
$close = array();
// Code
$i = 0;
@ -5120,10 +5121,9 @@ if ($action == 'create') {
// Remainder to pay
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche >= 0) {
print $langs->trans('RemainderToPay');
} else {
print $langs->trans('ExcessReceived');
print $langs->trans('RemainderToPay');
if ($resteapayeraffiche < 0) {
print ' ('.$langs->trans('NegativeIfExcessReceived').')';
}
print '</span>';
print '</td>';
@ -5133,10 +5133,9 @@ if ($action == 'create') {
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche >= 0) {
print $langs->trans('RemainderToPayMulticurrency');
} else {
print $langs->trans('ExcessReceivedMulticurrency');
print $langs->trans('RemainderToPayMulticurrency');
if ($resteapayeraffiche < 0) {
print ' ('.$langs->trans('NegativeIfExcessReceived').')';
}
print '</span>';
print '</td>';
@ -5164,33 +5163,33 @@ if ($action == 'create') {
print ' :</td><td align="right">'.price($retainedWarranty).'</td><td>&nbsp;</td></tr>';
}
} else { // Credit note
$resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
// Total already paid back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print $langs->trans('AlreadyPaidBack');
print ' :</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td>&nbsp;</td></tr>';
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
// Remainder to pay back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print $langs->trans('RemainderToPayBack');
print '<span class="opacitymedium">'.$langs->trans('RemainderToPayBack');
if ($resteapayeraffiche > 0) {
print ' ('.$langs->trans('ExcessPaid').')';
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
}
print ' :</td>';
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td><td>&nbsp;</td></tr>';
print '</span></td>';
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopayback' : (' '.$cssforamountpaymentcomplete)).'">'.price($sign * $resteapayeraffiche).'</td>';
print '<td class="nowrap">&nbsp;</td></tr>';
// Remainder to pay back Multicurrency
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche <= 0) {
print $langs->trans('RemainderToPayBackMulticurrency');
} else {
print $langs->trans('ExcessPaidMulticurrency');
print '<span class="opacitymedium">'.$langs->trans('RemainderToPayBackMulticurrency');
if ($resteapayeraffiche > 0) {
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
}
print '</span>';
print '</td>';
@ -5450,14 +5449,17 @@ if ($action == 'create') {
}
// Classify paid
if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (
($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) ||
($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer)))
)
) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaid').'</a>';
}
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment) {
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';

View File

@ -3299,8 +3299,8 @@ class Facture extends CommonInvoice
$this->line->desc = $desc;
$this->line->ref_ext = $ref_ext;
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
@ -3309,11 +3309,11 @@ class Facture extends CommonInvoice
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
$this->line->fk_product = $fk_product;
$this->line->product_type = $product_type;
@ -3340,10 +3340,11 @@ class Facture extends CommonInvoice
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
$this->line->multicurrency_code = $this->multicurrency_code;
$this->line->multicurrency_subprice = $pu_ht_devise;
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
$this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
$this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
$this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
$this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;

View File

@ -492,7 +492,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$url = DOL_URL_ROOT.'/contrat/card.php?action=create';
if (!empty($socid)) {
$url .= '&socid='.$socid;
$url .= '&socid='.((int) $socid);
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
@ -600,11 +600,11 @@ if (!empty($arrayfields['s.email']['checked'])) {
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
@ -795,11 +795,12 @@ while ($i < min($num, $limit)) {
print '</td>';
}
// Ref thirdparty
if (!empty($arrayfields['c.ref_customer']['checked'])) {
print '<td>'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag(dol_string_nohtmltag($contracttmp->getFormatedCustomerRef($obj->ref_customer))).'">'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).'</td>';
}
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
print '<td>'.$obj->ref_supplier.'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">'.dol_escape_htmltag($obj->ref_supplier).'</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax150">';
@ -809,8 +810,9 @@ while ($i < min($num, $limit)) {
}
print '</td>';
}
// Email
if (!empty($arrayfields['s.email']['checked'])) {
print '<td>'.$obj->email.'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->email).'">'.dol_print_email($obj->email, 0, $obj->socid, 0, 0, 1, 1).'</td>';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {

View File

@ -110,7 +110,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
}
// Validation of fields values
if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
if (!$object->validateField($object->fields, $key, $value)) {
$error++;
@ -226,7 +226,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
// Validation of fields values
if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
if (!$object->validateField($object->fields, $key, $value)) {
$error++;

View File

@ -1295,7 +1295,14 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) {
$langs->load("errors");
$nbignored++;
$resaction .= '<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'</div><br>';
$TMsg[] = '<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'</div><br>';
continue;
}
if (method_exists($objecttmp, 'is_erasable') && $objecttmp->is_erasable() <= 0) {
$langs->load("errors");
$nbignored++;
$TMsg[] = '<div class="error">'.$langs->trans('ErrorRecordHasChildren').' '.$objecttmp->ref.'</div><br>';
continue;
}
@ -1556,6 +1563,7 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
}
}
// Approve for leave only
if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $confirm == 'yes')) && $permissiontoapprove) {
$db->begin();

View File

@ -146,9 +146,6 @@ class box_graph_invoices_permonth extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
if ($mode == 'supplier') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
}
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
@ -189,10 +186,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$endyear.'.png';
}
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
@ -251,7 +245,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow .= '<br>';
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow .= '<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
$stringtoshow .= '</form>';
$stringtoshow .= '</div>';
if ($shownb && $showtot) {

View File

@ -125,9 +125,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
if (empty($year)) {
$year = $nowarray['year'];
}
if (empty($endyear)) {
$endyear = $nowarray['year'];
}
@ -143,12 +140,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if ($shownb) {
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$endyear.".png";
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
if ($mode == 'supplier') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessuppliernbinyear-'.$year.'.png';
}
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
@ -186,12 +180,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if ($showtot) {
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$endyear.".png";
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
if ($mode == 'supplier') {
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&amp;file=invoicessupplieramountinyear-'.$year.'.png';
}
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
@ -273,17 +264,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
}
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"', 'textnoformat'=>$stringtoshow);
} else {
$this->info_box_contents[0][0] = array(
'tr'=>'class="oddeven nohover"',
'td' => 'class="nohover left"',
'maxlength'=>500,
'text' => $mesg,
);
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover left"', 'maxlength'=>500, 'text' => $mesg);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
'td' => 'class="nohover left"',
'text' => '<span class="opacitymedium">'.$langs->trans("ReadPermissionNotAllowed").'</span>'
);
}
}

View File

@ -111,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y", 'gmt');
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription;

View File

@ -399,7 +399,7 @@ abstract class CommonDocGenerator
$sumpayed = $sumdeposit = $sumcreditnote = '';
$already_payed_all = 0;
$remain_to_pay = 0;
if ($object->element == 'facture') {
$invoice_source = new Facture($this->db);
if ($object->fk_facture_source > 0) {
@ -409,7 +409,6 @@ abstract class CommonDocGenerator
$sumdeposit = $object->getSumDepositsUsed();
$sumcreditnote = $object->getSumCreditNotesUsed();
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
if ($object->fk_account > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -421,79 +420,79 @@ abstract class CommonDocGenerator
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date);
$resarray = array(
$array_key.'_id'=>$object->id,
$array_key.'_ref'=>$object->ref,
$array_key.'_ref_ext'=>$object->ref_ext,
$array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
$array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
$array_key.'_source_invoice_ref'=>$invoice_source->ref,
// Dates
$array_key.'_hour'=>dol_print_date($date, 'hour'),
$array_key.'_date'=>dol_print_date($date, 'day'),
$array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
$array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
$array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
$array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
$array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
$array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
$array_key.'_date_delivery_planed'=>(!empty($object->date_livraison) ?dol_print_date($object->date_livraison, 'day') : ''),
$array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
$array_key.'_id'=>$object->id,
$array_key.'_ref'=>$object->ref,
$array_key.'_ref_ext'=>$object->ref_ext,
$array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
$array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
$array_key.'_source_invoice_ref'=>$invoice_source->ref,
// Dates
$array_key.'_hour'=>dol_print_date($date, 'hour'),
$array_key.'_date'=>dol_print_date($date, 'day'),
$array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
$array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
$array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
$array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
$array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
$array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
$array_key.'_date_delivery_planed'=>(!empty($object->date_livraison) ?dol_print_date($object->date_livraison, 'day') : ''),
$array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
$array_key.'_payment_mode_code'=>$object->mode_reglement_code,
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
$array_key.'_payment_mode_code'=>$object->mode_reglement_code,
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
$array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
$array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
$array_key.'_bank_iban'=>$bank_account->iban,
$array_key.'_bank_bic'=>$bank_account->bic,
$array_key.'_bank_label'=>$bank_account->label,
$array_key.'_bank_number'=>$bank_account->number,
$array_key.'_bank_proprio'=>$bank_account->proprio,
$array_key.'_bank_iban'=>$bank_account->iban,
$array_key.'_bank_bic'=>$bank_account->bic,
$array_key.'_bank_label'=>$bank_account->label,
$array_key.'_bank_number'=>$bank_account->number,
$array_key.'_bank_proprio'=>$bank_account->proprio,
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
$array_key.'_total_ht'=>price2num($object->total_ht),
$array_key.'_total_vat'=>(!empty($object->total_vat) ?price2num($object->total_vat) : price2num($object->total_tva)),
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
$array_key.'_total_ttc'=>price2num($object->total_ttc),
$array_key.'_total_ht'=>price2num($object->total_ht),
$array_key.'_total_vat'=>(!empty($object->total_vat) ?price2num($object->total_vat) : price2num($object->total_tva)),
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
$array_key.'_total_ttc'=>price2num($object->total_ttc),
$array_key.'_multicurrency_code' => $object->multicurrency_code,
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
$array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
$array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
$array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
$array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
$array_key.'_multicurrency_code' => $object->multicurrency_code,
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
$array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
$array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
$array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
$array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
$array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
$array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
$array_key.'_note_private'=>$object->note,
$array_key.'_note_public'=>$object->note_public,
$array_key.'_note'=>$object->note_public, // For backward compatibility
$array_key.'_note_private'=>$object->note,
$array_key.'_note_public'=>$object->note_public,
$array_key.'_note'=>$object->note_public, // For backward compatibility
// Payments
$array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
$array_key.'_already_payed'=>price2num($sumpayed),
$array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
$array_key.'_already_deposit'=>price2num($sumdeposit),
$array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
// Payments
$array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
$array_key.'_already_payed'=>price2num($sumpayed),
$array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
$array_key.'_already_deposit'=>price2num($sumdeposit),
$array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
$array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
$array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
// Remain to pay with all know information (except open direct debit requests)
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs),
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT')
// Remain to pay with all known information (except open direct debit requests)
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $already_payed_all, 'MT'), 0, $outputlangs),
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $already_payed_all, 'MT')
);
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Propal', 'Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
$resarray[$array_key.'_total_discount_ht_locale'] = price($object->getTotalDiscount(), 0, $outputlangs);
$resarray[$array_key.'_total_discount_ht'] = price2num($object->getTotalDiscount());
} else {
@ -517,8 +516,9 @@ abstract class CommonDocGenerator
// Add vat by rates
if (is_array($object->lines) && count($object->lines) > 0) {
$totalUp = 0;
// Set substitution keys for different VAT rates
foreach ($object->lines as $line) {
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward compatibility
// $line->tva_tx format depends on database field accuracy, no reliable. This is kept for backward compatibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) {
$resarray[$array_key.'_total_vat_'.$line->tva_tx] = 0;
}
@ -539,7 +539,7 @@ abstract class CommonDocGenerator
// Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object)
$resarray['object_total_up'] = $totalUp;
$resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs);
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Propal', 'Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
$totalDiscount = $object->getTotalDiscount();
} else {
$totalDiscount = 0;

View File

@ -7874,11 +7874,6 @@ abstract class CommonObject
$out .= ($display_type=='card' ? '</td>' : '</div>');
/*for($ii = 0; $ii < ($colspan - 1); $ii++)
{
$out .='<td class="'.$this->element.'_extras_'.$key.'"></td>';
}*/
if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) {
$out .= ($display_type=='card' ? '</tr>' : '</div>');
} else {
@ -8887,7 +8882,7 @@ abstract class CommonObject
$sql = "SELECT ".$objectline->getFieldList('l');
$sql .= " FROM ".MAIN_DB_PREFIX.$objectline->table_element." as l";
$sql .= " WHERE l.fk_".$this->element." = ".((int) $this->id);
$sql .= " WHERE l.fk_".$this->db->escape($this->element)." = ".((int) $this->id);
if ($morewhere) {
$sql .= $morewhere;
}

View File

@ -107,10 +107,12 @@ class DolGraph
global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor;
// Some default values for the case it is not defined into the theme later.
$this->bordercolor = array(235, 235, 224);
$this->datacolor = array(array(120, 130, 150), array(160, 160, 180), array(190, 190, 220));
$this->bgcolor = array(235, 235, 224);
// Load color of the theme
$color_file = DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
if (is_readable($color_file)) {
include $color_file;
@ -1415,13 +1417,13 @@ class DolGraph
$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
} else { // We do not use a 'group by'
if (!empty($this->bordercolor[$i]) && is_array($this->datacolor[$i])) {
if (!empty($this->datacolor[$i]) && is_array($this->datacolor[$i])) {
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)';
} else {
$color = $this->datacolor[$i];
}
if (!empty($this->bordercolor[$i]) && is_array($this->bordercolor[$i])) {
$color = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
$bordercolor = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
} else {
if ($type != 'horizontalBar') {
$bordercolor = $color;
@ -1429,6 +1431,14 @@ class DolGraph
$bordercolor = $this->bordercolor[$i];
}
}
// For negative colors, we invert border and background
$tmp = str_replace('#', '', $color);
if (strpos($tmp, '-') !== false) {
$foundnegativecolor++;
$bordercolor = str_replace('-', '', $color);
$color = '#FFFFFF'; // If $val is '-123'
}
}
if ($i > 0) {
$this->stringtoshow .= ', ';

View File

@ -222,7 +222,7 @@ class FileUpload
protected function setFileDeleteUrl($file)
{
$file->delete_url = $this->options['script_url']
.'?file='.rawurlencode($file->name).'&fk_element='.$this->fk_element.'&element='.$this->element;
.'?file='.urlencode($file->name).'&fk_element='.urlencode($this->fk_element).'&element='.urlencode($this->element);
$file->delete_type = $this->options['delete_type'];
if ($file->delete_type !== 'DELETE') {
$file->delete_url .= '&_method=DELETE';

View File

@ -229,7 +229,8 @@ class HookManager
'showLinkToObjectBlock',
'setContentSecurityPolicy',
'setHtmlTitle',
'completeTabsHead'
'completeTabsHead',
'formDolBanner'
)
)) {
$hooktype = 'addreplace';

View File

@ -1926,7 +1926,7 @@ class Form
$sql .= " WHERE u.entity IS NOT NULL";
}
} else {
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " ON ug.fk_user = u.rowid";
$sql .= " WHERE ug.entity = ".$conf->entity;

View File

@ -304,7 +304,7 @@ class FormAdmin
if (preg_match('/\.lib/i', $filelib)) {
continue;
}
if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0 && in_array($file, $expdevmenu)) {
continue;
}

View File

@ -1373,7 +1373,7 @@ class FormFile
}
// Preview link
if (!$editline) {
print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
print $this->showPreview($file, $modulepart, $filepath, 0, 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
}
print "</td>\n";

View File

@ -542,7 +542,6 @@ class FormOther
$resql_usr = $this->db->query($sql_usr);
if ($resql_usr) {
$userstatic = new User($this->db);
$showstatus = 1;
while ($obj_usr = $this->db->fetch_object($resql_usr)) {
$userstatic->id = $obj_usr->rowid;

View File

@ -37,7 +37,7 @@ class InfoBox
{
global $conf;
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
return array(
0 => 'Home',
1 => 'UsersHome',

View File

@ -196,6 +196,8 @@ class Ldap
$connected = 0;
$this->bind = 0;
$this->error = 0;
$this->connectedServer = '';
// Check parameters
if (count($this->server) == 0 || empty($this->server[0])) {
@ -280,7 +282,7 @@ class Ldap
}
// Try in anonymous
if (!$this->bind) {
dol_syslog(get_class($this)."::connect_bind try bind on ".$host, LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
$result = $this->bind();
if ($result) {
$this->bind = $this->result;
@ -295,6 +297,8 @@ class Ldap
if (!$connected) {
$this->unbind();
} else {
$this->connectedServer = $host;
}
}
}
@ -307,7 +311,7 @@ class Ldap
$return = -1;
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
}
$this->connectedServer = $host;
return $return;
}

View File

@ -464,20 +464,26 @@ class SMTPs
$host = 'tls://'.$host;
}
$hosth = $host;
$hosth = $host; // so for example 'localhost' or 'smtp-relay.gmail.com'
if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
// If the from to is 'aaa <bbb@ccc.com>', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*</', '', $hosth);
$hosth = preg_replace('/>.*$/', '', $hosth);
$hosth = preg_replace('/.*@/', '', $hosth);
if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
$hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
} else {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is 1, we use the domain in the from.
// So if the from to is 'aaa <bbb@ccc.com>', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*</', '', $hosth);
$hosth = preg_replace('/>.*$/', '', $hosth);
$hosth = preg_replace('/.*@/', '', $hosth);
}
}
if ($_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
if ($usetls) {
/*
The following dialog illustrates how a client and server can start a TLS STARTTLS session
The following dialog illustrates how a client and server can start a TLS STARTTLS session:
S: <waits for connection on TCP port 25>
C: <opens connection>
S: 220 mail.imc.org SMTP service ready
@ -494,6 +500,39 @@ class SMTPs
S: 250-server-domain.com
S: 250 AUTH LOGIN
C: <continues by sending an SMTP command
Another example here:
S: 220 smtp.server.com Simple Mail Transfer Service Ready
C: EHLO client.example.com
S: 250-smtp.server.com Hello client.example.com
S: 250-SIZE 1000000
S: 250-AUTH LOGIN PLAIN CRAM-MD5
S: 250-STARTTLS
S: 250 HELP
C: STARTTLS
S: 220 TLS go ahead
C: EHLO client.example.com *
S: 250-smtp.server.com Hello client.example.com
S: 250-SIZE 1000000
S: 250-AUTH LOGIN PLAIN CRAM-MD5
S: 250 HELP
C: AUTH LOGIN
S: 334 VXNlcm5hbWU6
C: adlxdkej
S: 334 UGFzc3dvcmQ6
C: lkujsefxlj
S: 235 2.7.0 Authentication successful
C: MAIL FROM:<mail@samlogic.com>
S: 250 OK
C: RCPT TO:<john@mail.com>
S: 250 OK
C: DATA
S: 354 Send message, end with a "." on a line by itself
C: <The message data (body text, subject, e-mail header, attachments etc) is sent>
S .
S: 250 OK, message accepted for delivery: queued as 12345
C: QUIT
S: 221 Bye
*/
if (!$_retVal = $this->socket_send_str('STARTTLS', 220)) {
$this->_setErr(131, 'STARTTLS connection is not supported.');
@ -517,10 +556,10 @@ class SMTPs
$this->_setErr(132, 'STARTTLS connection failed.');
return $_retVal;
}
// Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
// Most servers expect a 2nd pass of EHLO after TLS is established to get another time
// the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
if (!$_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
$this->_setErr(126, '"'.$hosth.'" does not support authenticated connections.');
if (! $_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
$this->_setErr(126, '"'.$hosth.'" does not support authenticated connections. Error after sending EHLO '.$hosth);
return $_retVal;
}
}
@ -560,7 +599,7 @@ class SMTPs
$this->_setErr(130, 'Invalid Authentication Credentials.');
}
} else {
$this->_setErr(126, '"'.$host.'" does not support authenticated connections.');
$this->_setErr(126, '"'.$host.'" does not support authenticated connections. Error after sending EHLO '.$hosth);
}
return $_retVal;
@ -603,11 +642,17 @@ class SMTPs
$hosth = $host;
if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
// If the from to is 'aaa <bbb@ccc.com>', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*</', '', $hosth);
$hosth = preg_replace('/>.*$/', '', $hosth);
$hosth = preg_replace('/.*@/', '', $hosth);
if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
$hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
} else {
// If value of MAIL_SMTP_USE_FROM_FOR_HELO is 1, we use the domain in the from.
// If the from to is 'aaa <bbb@ccc.com>', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*</', '', $hosth);
$hosth = preg_replace('/>.*$/', '', $hosth);
$hosth = preg_replace('/.*@/', '', $hosth);
}
}
$_retVal = $this->socket_send_str('HELO '.$hosth, '250');

View File

@ -589,7 +589,7 @@ class Translate
}
/* Disabled. There is too many cases where translation of $newstr is not defined is normal (like when output with setEventMessage an already translated string)
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2)
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2)
{
dol_syslog(__METHOD__." MAIN_FEATURES_LEVEL=DEVELOP: missing translation for key '".$newstr."' in ".$_SERVER["PHP_SELF"], LOG_DEBUG);
}*/

View File

@ -233,7 +233,7 @@ abstract class DoliDB implements Database
* Define sort criteria of request
*
* @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb'
* @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC';
* @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'. Note: If the quantity fo sortorder values is lower than sortfield, we used the last value for missing values.
* @return string String to provide syntax of a sort sql string
*/
public function order($sortfield = null, $sortorder = null)
@ -318,10 +318,10 @@ abstract class DoliDB implements Database
/**
* Return first result from query as object
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
* Dont add LIMIT to your query, it will be added by this method.
* Dont add LIMIT to your query, it will be added by this method
*
* @param string $sql The sql query string
* @return bool|object Result of fetch_object
* @param string $sql The sql query string
* @return bool|int|object False on failure, 0 on empty, object on success
*/
public function getRow($sql)
{
@ -329,14 +329,19 @@ abstract class DoliDB implements Database
$res = $this->query($sql);
if ($res) {
return $this->fetch_object($res);
$obj = $this->fetch_object($res);
if ($obj) {
return $obj;
} else {
return 0;
}
}
return false;
}
/**
* return all results from query as an array of objects
* Return all results from query as an array of objects
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
* be carefull with this method use it only with some limit of results to avoid performences loss.
*

View File

@ -663,9 +663,13 @@ class DoliDBMysqli extends DoliDB
$like = '';
if ($table) {
$like = "LIKE '".$table."'";
$tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table);
$like = "LIKE '".$this->escape($tmptable)."'";
}
$sql = "SHOW TABLES FROM ".$database." ".$like.";";
$tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database);
$sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";";
//print $sql;
$result = $this->query($sql);
if ($result) {
@ -688,7 +692,9 @@ class DoliDBMysqli extends DoliDB
// phpcs:enable
$infotables = array();
$sql = "SHOW FULL COLUMNS FROM ".$table.";";
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "SHOW FULL COLUMNS FROM ".$tmptable.";";
dol_syslog($sql, LOG_DEBUG);
$result = $this->query($sql);
@ -794,7 +800,9 @@ class DoliDBMysqli extends DoliDB
public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "DROP TABLE ".$tmptable;
if (!$this->query($sql)) {
return -1;
@ -925,8 +933,9 @@ class DoliDBMysqli extends DoliDB
public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
dol_syslog(get_class($this)."::DDLDropField ".$sql, LOG_DEBUG);
$tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name);
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`";
if ($this->query($sql)) {
return 1;
}

View File

@ -937,7 +937,9 @@ class DoliDBPgsql extends DoliDB
$escapedlike = '';
if ($table) {
$escapedlike = " AND table_name LIKE '".$this->escape($table)."'";
$tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table);
$escapedlike = " AND table_name LIKE '".$this->escape($tmptable)."'";
}
$result = pg_query($this->db, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'".$escapedlike." ORDER BY table_name");
if ($result) {
@ -973,8 +975,8 @@ class DoliDBPgsql extends DoliDB
$sql .= " '' as \"Extra\",";
$sql .= " '' as \"Privileges\"";
$sql .= " FROM information_schema.columns infcol";
$sql .= " WHERE table_schema='public' ";
$sql .= " AND table_name='".$this->escape($table)."'";
$sql .= " WHERE table_schema = 'public' ";
$sql .= " AND table_name = '".$this->escape($table)."'";
$sql .= " ORDER BY ordinal_position;";
dol_syslog($sql, LOG_DEBUG);
@ -1078,7 +1080,9 @@ class DoliDBPgsql extends DoliDB
public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "DROP TABLE ".$tmptable;
if (!$this->query($sql)) {
return -1;
@ -1236,8 +1240,9 @@ class DoliDBPgsql extends DoliDB
public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
dol_syslog($sql, LOG_DEBUG);
$tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name);
$sql = "ALTER TABLE ".$table." DROP COLUMN ".$tmp_field_name;
if (!$this->query($sql)) {
$this->error = $this->lasterror();
return -1;

View File

@ -875,9 +875,13 @@ class DoliDBSqlite3 extends DoliDB
$like = '';
if ($table) {
$like = "LIKE '".$table."'";
$tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table);
$like = "LIKE '".$this->escape($tmptable)."'";
}
$sql = "SHOW TABLES FROM ".$database." ".$like.";";
$tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database);
$sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";";
//print $sql;
$result = $this->query($sql);
if ($result) {
@ -901,7 +905,9 @@ class DoliDBSqlite3 extends DoliDB
// phpcs:enable
$infotables = array();
$sql = "SHOW FULL COLUMNS FROM ".$table.";";
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "SHOW FULL COLUMNS FROM ".$tmptable.";";
dol_syslog($sql, LOG_DEBUG);
$result = $this->query($sql);
@ -1002,7 +1008,9 @@ class DoliDBSqlite3 extends DoliDB
public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "DROP TABLE ".$tmptable;
if (!$this->query($sql)) {
return -1;
@ -1112,8 +1120,9 @@ class DoliDBSqlite3 extends DoliDB
public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
dol_syslog(get_class($this)."::DDLDropField ".$sql, LOG_DEBUG);
$tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name);
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`";
if (!$this->query($sql)) {
$this->error = $this->lasterror();
return -1;

View File

@ -83,8 +83,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli .= " ".DOL_VERSION;
}
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
$appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$appli .= "<br>".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
}
$logouttext = '';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -66,7 +67,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'graph';
$h++;
if ($object->courant != Account::TYPE_CASH) {
if ($object->courant != Account::TYPE_CASH || !empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) {
$nbReceipts = 0;
// List of all standing receipts

View File

@ -106,7 +106,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
*/
function getEntity($element, $shared = 1, $currentobject = null)
{
global $conf, $mc, $hookmanager, $object, $action;
global $conf, $mc, $hookmanager, $object, $action, $db;
if (! is_object($hookmanager)) {
$hookmanager = new HookManager($db);
@ -144,10 +144,10 @@ function getEntity($element, $shared = 1, $currentobject = null)
$reshook = $hookmanager->executeHooks('hookGetEntity', $parameters, $currentobject, $action); // Note that $action and $object may have been modified by some hooks
if (is_numeric($reshook)) {
if ($reshook == 0 && !empty($hookmanager->resprints)) {
$out .= ','.$hookmanager->resprints; // add
if ($reshook == 0 && !empty($hookmanager->resPrint)) {
$out .= ','.$hookmanager->resPrint; // add
} elseif ($reshook == 1) {
$out = $hookmanager->resprints; // replace
$out = $hookmanager->resPrint; // replace
}
}
@ -1845,7 +1845,7 @@ function dol_get_fiche_end($notab = 0)
*/
function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $onlybanner = 0, $morehtmlright = '')
{
global $conf, $form, $user, $langs;
global $conf, $form, $user, $langs, $hookmanager, $action;
$error = 0;
@ -2116,6 +2116,17 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlref .= '</div>';
}
$parameters=array('morehtmlref'=>$morehtmlref);
$reshook = $hookmanager->executeHooks('formDolBanner', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif (empty($reshook)) {
$morehtmlref .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$morehtmlref = $hookmanager->resPrint;
}
print '<div class="'.($onlybanner ? 'arearefnobottom ' : 'arearef ').'heightref valignmiddle centpercent">';
print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
print '</div>';
@ -4526,7 +4537,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
if ($_SERVER['DOCUMENT_ROOT']) { // Mode web
$out .= $langs->trans("DolibarrHasDetectedError").".<br>\n";
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) {
$out .= "You use an experimental or develop level of features, so please do NOT report any bugs or vulnerability, except if problem is confirmed after moving option MAIN_FEATURES_LEVEL back to 0.<br>\n";
}
$out .= $langs->trans("InformationToHelpDiagnose").":<br>\n";
@ -4534,7 +4545,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
$out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n";
$out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION." - https://www.dolibarr.org<br>\n";
if (isset($conf->global->MAIN_FEATURES_LEVEL)) {
$out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".dol_htmlentities($conf->global->MAIN_FEATURES_LEVEL, ENT_COMPAT)."<br>\n";
$out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".getDolGlobalInt('MAIN_FEATURES_LEVEL')."<br>\n";
}
if (function_exists("phpversion")) {
$out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
@ -5367,13 +5378,16 @@ function price2num($amount, $rounding = '', $option = 0)
if ($thousand != ',' && $thousand != '.') {
$amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
}
$amount = str_replace(' ', '', $amount); // To avoid spaces
$amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
$amount = str_replace($dec, '.', $amount);
$amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example.
}
//print ' XX'.$amount.' '.$rounding;
// Now, make a rounding if required
// Now, $amount is a real PHP float number. We make a rounding if required.
if ($rounding) {
$nbofdectoround = '';
if ($rounding == 'MU') {
@ -5413,9 +5427,12 @@ function price2num($amount, $rounding = '', $option = 0)
if ($thousand != ',' && $thousand != '.') {
$amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
}
$amount = str_replace(' ', '', $amount); // To avoid spaces
$amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
$amount = str_replace($dec, '.', $amount);
$amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example.
}
return $amount;
@ -7217,6 +7234,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : '');
$substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl;
if (is_object($object) && $object->element == 'propal') {
$substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref);
}
if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') {
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element);
} else {

View File

@ -17,8 +17,8 @@
*/
/**
* \file htdocs/core/lib/memory.lib.php
* \brief Set of function for memory/cache management
* \file htdocs/core/lib/modulebuilder.lib.php
* \brief Set of function for modulebuilder management
*/

View File

@ -979,6 +979,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$outputlangs->load("dict");
$line = '';
$reg = array();
$dims = $pdf->getPageDimensions();
@ -1273,6 +1274,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos
// Fix bug of some HTML editors that replace links <img src="http://localhostgit/viewimage.php?modulepart=medias&file=image/efd.png" into <img src="http://localhostgit/viewimage.php?modulepart=medias&amp;file=image/efd.png"
// We make the reverse, so PDF generation has the real URL.
$nbrep = 0;
$labelproductservice = preg_replace('/(<img[^>]*src=")([^"]*)(&amp;)([^"]*")/', '\1\2&\4', $labelproductservice, -1, $nbrep);
//var_dump($labelproductservice);exit;
@ -2214,48 +2216,6 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0)
return $result;
}
/**
* Return total quantity of products and/or services
*
* @param Object $object Object
* @param string $type Type
* @param Translate $outputlangs Object langs for output
* @return integer
* @deprecated Not used by Dolibarr core, so will be removed.
*/
function pdf_getTotalQty($object, $type, $outputlangs)
{
global $hookmanager;
$total = 0;
$nblines = count($object->lines);
// Loop on each lines
for ($i = 0; $i < $nblines; $i++) {
if ($object->lines[$i]->special_code != 3) {
if ($type == 'all') {
$total += $object->lines[$i]->qty;
} elseif ($type == 9 && is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || !empty($object->lines[$i]->fk_parent_line))) {
$special_code = $object->lines[$i]->special_code;
if (!empty($object->lines[$i]->fk_parent_line)) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$hidedetails = '';
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getTotalQty', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
return $hookmanager->resPrint;
} elseif ($type == 0 && $object->lines[$i]->product_type == 0) {
$total += $object->lines[$i]->qty;
} elseif ($type == 1 && $object->lines[$i]->product_type == 1) {
$total += $object->lines[$i]->qty;
}
}
}
return $total;
}
/**
* Return linked objects to use for document generation.
* Warning: To save space, this function returns only one link per link type (all links are concated on same record string). This function is used by pdf_writeLinkedObjects
@ -2287,13 +2247,11 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
} elseif ($objecttype == 'commande' || $objecttype == 'supplier_order') {
$outputlangs->load('orders');
if (count($objects) > 1) {
$object->note_public .= dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefOrder").' : <br>');
if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) {
$object->note_public = dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefOrder").' : <br>');
foreach ($objects as $elementobject) {
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '').' ');
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : ');
$object->note_public .= dol_concatdesc($object->note_public, dol_print_date($elementobject->date, 'day', '', $outputlangs));
$object->note_public .= dol_concatdesc($object->note_public, '<br>');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '').' ');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs).'<br>');
}
} elseif (count($objects) == 1) {
$elementobject = array_shift($objects);
@ -2323,8 +2281,11 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
if (count($objects) > 1) {
$order = null;
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') $object->note_public .= dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' : <br>');
else $object->note_public .= dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefSending").' : <br>');
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') {
$object->note_public = dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' : <br>');
} else {
$object->note_public = dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefSending").' : <br>');
}
// We concat this record info into fields xxx_value. title is overwrote.
foreach ($objects as $elementobject) {
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { // There is not already a link to order and object is not the order, so we show also info with order
@ -2340,12 +2301,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
}
if (! is_object($order)) {
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref));
$object->note_public .= dol_concatdesc($object->note_public, '<br>');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref));
$object->note_public = dol_concatdesc($object->note_public, '<br>');
} else {
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''));
$object->note_public .= dol_concatdesc($object->note_public, ' / '.$outputlangs->transnoentities($elementobject->ref));
$object->note_public .= dol_concatdesc($object->note_public, '<br>');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''));
$object->note_public = dol_concatdesc($object->note_public, ' / '.$outputlangs->transnoentities($elementobject->ref));
$object->note_public = dol_concatdesc($object->note_public, '<br>');
}
}
} elseif (count($objects) == 1) {

View File

@ -471,14 +471,6 @@ function project_timesheet_prepare_head($mode, $fuser = null)
$h++;
}
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perline.php".($param?'?'.$param:'');
$head[$h][1] = $langs->trans("InputDetail");
$head[$h][2] = 'inputperline';
$h++;
}*/
complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet');
complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet', 'remove');
@ -517,7 +509,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'attributes_task';
$h++;
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$langs->load("members");
$head[$h][0] = DOL_URL_ROOT.'/projet/admin/website.php';

View File

@ -111,7 +111,7 @@ function dol_hash($chain, $type = '0')
}
// Salt value
if (!empty($conf->global->MAIN_SECURITY_SALT) && $type != '4' && $type !== 'md5openldap') {
if (!empty($conf->global->MAIN_SECURITY_SALT) && $type != '4' && $type !== 'openldap') {
$chain = $conf->global->MAIN_SECURITY_SALT.$chain;
}
@ -121,8 +121,8 @@ function dol_hash($chain, $type = '0')
return sha1(md5($chain));
} elseif ($type == '3' || $type == 'md5') {
return md5($chain);
} elseif ($type == '4' || $type == 'md5openldap') {
return '{md5}'.base64_encode(pack("H*", md5($chain))); // For OpenLdap with md5 (based on an unencrypted password in base)
} elseif ($type == '4' || $type == 'openldap') {
return dolGetLdapHash($chain, getDolGlobalString('LDAP_PASSWORD_HASH_TYPE', 'md5'), getDolGlobalString('MAIN_SECURITY_SALT'));
} elseif ($type == '5' || $type == 'sha256') {
return hash('sha256', $chain);
} elseif ($type == '6' || $type == 'password_hash') {
@ -167,6 +167,45 @@ function dol_verifyHash($chain, $hash, $type = '0')
return dol_hash($chain, $type) == $hash;
}
/**
* Returns a specific ldap hash of a string.
*
* @param string $chain String to hash
* @param string $type Type of hash
* @return string Hash of string
*/
function dolGetLdapHash($chain, $type = 'md5')
{
if (empty($type)) {
$type = 'md5';
}
if ($type === 'md5') {
return '{MD5}' . base64_encode(pack("H*", md5($chain))); // For OpenLdap with md5 (based on an unencrypted password in base)
} elseif ($type === 'md5frommd5') {
return '{MD5}' . base64_encode(hex2bin($chain)); // Create OpenLDAP MD5 password from Dolibarr MD5 password
} elseif ($type === 'smd5') {
mt_srand((double)microtime()*1000000);
$salt = pack("CCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand());
return "{SMD5}" . base64_encode(pack("H*", md5($chain . $salt)) . $salt);
} elseif ($type === 'sha') {
return '{SHA}' . base64_encode(sha1($chain), true);
} elseif ($type === 'ssha') {
mt_srand((double)microtime()*1000000);
$salt = pack("CCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand());
return "{SSHA}" . base64_encode(pack("H*", sha1($chain . $salt)) . $salt);
} elseif ($type === 'crypt') {
// Generate salt
$salt = "";
$pattern = '0123456789'.'abcdefghijklmnopqrstuvwxyz'.'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.'./';
mt_srand((double)microtime() * 1000000);
while (strlen($salt) < 2) {
$salt .= substr($pattern, (rand() % strlen($pattern)), 1);
}
return '{CRYPT}' . crypt($chain, $salt);
}
}
/**
* Check permissions of a user to show a page and an object. Check read permission.
* If GETPOST('action','aZ09') defined, we also check write and delete permission.

View File

@ -215,15 +215,20 @@ if (!function_exists('dol_loginfunction')) {
}
// Execute hook getLoginPageOptions (for table)
$parameters = array('entity' => GETPOST('entity', 'int'));
$parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
$morelogincontent = $hookmanager->resPrint;
// Execute hook getLoginPageExtraOptions (eg for js)
$parameters = array('entity' => GETPOST('entity', 'int'));
$parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
$moreloginextracontent = $hookmanager->resPrint;
//Redirect after connection
$parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
$reshook = $hookmanager->executeHooks('redirectAfterConnection', $parameters); // Note that $action and $object may have been modified by some hooks.
$php_self = $hookmanager->resPrint;
// Login
$login = (!empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin));
$password = $demopassword;

View File

@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2014-2020 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2014-2021 Frederic 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
@ -108,10 +108,10 @@ class printing_printipp extends PrintingDriver
global $conf;
$this->db = $db;
$this->host = $conf->global->PRINTIPP_HOST;
$this->port = $conf->global->PRINTIPP_PORT;
$this->user = $conf->global->PRINTIPP_USER;
$this->password = $conf->global->PRINTIPP_PASSWORD;
$this->host = getDolGlobalString('PRINTIPP_HOST');
$this->port = getDolGlobalString('PRINTIPP_PORT');
$this->user = getDolGlobalString('PRINTIPP_USER');
$this->password = getDolGlobalString('PRINTIPP_PASSWORD');
$this->conf[] = array('varname'=>'PRINTIPP_HOST', 'required'=>1, 'example'=>'localhost', 'type'=>'text');
$this->conf[] = array('varname'=>'PRINTIPP_PORT', 'required'=>1, 'example'=>'631', 'type'=>'text');
$this->conf[] = array('varname'=>'PRINTIPP_USER', 'required'=>0, 'example'=>'', 'type'=>'text', 'moreattributes'=>'autocomplete="off"');
@ -159,8 +159,8 @@ class printing_printipp extends PrintingDriver
$ipp->setCopies($obj->copy);
} else {
if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) {
dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".$conf->global->PRINTIPP_URI_DEFAULT);
$ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT);
dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".getDolGlobalString('PRINTIPP_URI_DEFAULT'));
$ipp->setPrinterURI(getDolGlobalString('PRINTIPP_URI_DEFAULT'));
} else {
$this->errors[] = 'NoDefaultPrinterDefined';
$error++;

View File

@ -104,7 +104,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskcredit" value="'.$conf->global->SUPPLIER_CREDIT_TULIP_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '</tr>';
if ($conf->global->MAIN_FEATURE_LEVEL >= 2) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
// Parametrage du prefix des replacement
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskreplacement" value="'.$conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK.'">', $tooltip, 1, 1).'</td>';

View File

@ -57,7 +57,7 @@ if (!empty($conf->dol_use_jmobile)) {
$conf->use_javascript_ajax = 1;
}
$php_self = dol_escape_htmltag($_SERVER['PHP_SELF']);
$php_self = empty($php_self) ? dol_escape_htmltag($_SERVER['PHP_SELF']) : $php_self;
$php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
if (!preg_match('/mainmenu=/', $php_self)) {
$php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home';

View File

@ -269,11 +269,11 @@ class DataPolicy
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
if ($message) {
if ($sendtocc) {
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
}
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
$actionmsg .= dol_concatdesc($actionmsg, $message);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
$actionmsg = dol_concatdesc($actionmsg, $message);
}
// Send mail
@ -311,7 +311,6 @@ class DataPolicy
$sendto = $adherent->email;
$code = md5($adherent->email);
if (!empty($adherent->default_lang)) {
$l = $adherent->default_lang;
@ -343,11 +342,11 @@ class DataPolicy
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
if ($message) {
if ($sendtocc) {
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
}
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
$actionmsg .= dol_concatdesc($actionmsg, $message);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
$actionmsg = dol_concatdesc($actionmsg, $message);
}

View File

@ -118,6 +118,7 @@ $permissiontoadd = $user->rights->expensereport->creer; // Used by the include o
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
$projectRequired = $conf->projet->enabled && ! empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED);
$fileRequired = !empty($conf->global->EXPENSEREPORT_FILE_IS_REQUIRED);
if ($object->id > 0) {
// Check current user can read this expense report
@ -1157,6 +1158,12 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors');
}
// If no file associated
if ($fileRequired && $fk_ecm_files == 0) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
}
if (!$error) {
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees

View File

@ -151,7 +151,6 @@ $sqlusedforexport = '';
$head = array();
$upload_dir = $conf->export->dir_temp.'/'.$user->id;
//$usefilters=($conf->global->MAIN_FEATURES_LEVEL > 1);
$usefilters = 1;
// Security check

View File

@ -1008,7 +1008,7 @@ class CommandeFournisseur extends CommonOrder
if (empty($secondlevel)) { // standard or first level approval
$sql .= " date_approve='".$this->db->idate($now)."',";
$sql .= " fk_user_approve = ".$user->id;
if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $this->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
if (empty($this->user_approve_id2)) {
$movetoapprovestatus = false; // second level approval not done
$comment = ' (first level)';

View File

@ -1957,8 +1957,8 @@ class FactureFournisseur extends CommonInvoice
$this->line->desc = $desc;
$this->line->ref_supplier = $ref_supplier;
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
@ -1967,11 +1967,11 @@ class FactureFournisseur extends CommonInvoice
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva);
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax1) : $total_localtax1);
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax2) : $total_localtax2);
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc);
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
$this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
$this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
$this->line->fk_product = $fk_product;
$this->line->product_type = $type;
@ -1992,10 +1992,11 @@ class FactureFournisseur extends CommonInvoice
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
$this->line->multicurrency_code = $this->multicurrency_code;
$this->line->multicurrency_subprice = $pu_ht_devise;
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
$this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
$this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
$this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
$this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;

View File

@ -10,19 +10,18 @@
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Christophe Battarel <christophe@altairis.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
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**

21
htdocs/fourn/facture/card.php Normal file → Executable file
View File

@ -2563,11 +2563,11 @@ if ($action == 'create') {
}
// Confirmation set paid
if ($action == 'paid' && $resteapayer <= 0) {
if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1);
}
if ($action == 'paid' && $resteapayer > 0) {
if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) {
$close = array();
// Code
$i = 0;
@ -2721,8 +2721,12 @@ if ($action == 'create') {
}
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
$facusing = new FactureFournisseur($db);
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
if ($object->fk_facture_source > 0) {
$facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
} else {
print ' ('.$langs->transnoentities("CorrectedInvoiceNotFound").')';
}
}
$facidavoir = $object->getListIdAvoirFromInvoice();
@ -3496,14 +3500,17 @@ if ($action == 'create') {
}
// Classify paid
if (($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|| ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && empty($discount->id))
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (
($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) ||
($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer)))
)
) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaid').'</a>';
}
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0) {
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $object->total_ttc != $resteapayer)) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';

View File

@ -975,13 +975,13 @@ if ($resql) {
// Ref
if (!empty($arrayfields['f.ref']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.$search_ref.'">';
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
// Ref supplier
if (!empty($arrayfields['f.ref_supplier']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat maxwidth50" type="text" name="search_refsupplier" value="'.$search_refsupplier.'">';
print '<input class="flat maxwidth75" type="text" name="search_refsupplier" value="'.dol_escape_htmltag($search_refsupplier).'">';
print '</td>';
}
// Type
@ -1006,7 +1006,7 @@ if ($resql) {
// Label
if (!empty($arrayfields['f.label']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat maxwidth75" type="text" name="search_label" value="'.$search_label.'">';
print '<input class="flat maxwidth75" type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'">';
print '</td>';
}
// Date invoice
@ -1037,11 +1037,11 @@ if ($resql) {
}
// Project
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.$search_project.'"></td>';
print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'"></td>';
}
// Thirpdarty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.$search_company.'"></td>';
print '<td class="liste_titre"><input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
@ -1096,13 +1096,13 @@ if ($resql) {
if (!empty($arrayfields['f.total_localtax1']['checked'])) {
// Amount tax 1
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.$search_montant_localtax1.'">';
print '<input class="flat" type="text" size="5" name="search_montant_localtax1" value="'.dol_escape_htmltag($search_montant_localtax1).'">';
print '</td>';
}
if (!empty($arrayfields['f.total_localtax2']['checked'])) {
// Amount tax 2
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.$search_montant_localtax2.'">';
print '<input class="flat" type="text" size="5" name="search_montant_localtax2" value="'.dol_escape_htmltag($search_montant_localtax2).'">';
print '</td>';
}
if (!empty($arrayfields['f.total_ttc']['checked'])) {

View File

@ -349,7 +349,7 @@ if ($object->id) {
$permissiontoadd = $user->rights->holiday->write;
$permtoedit = $user->rights->holiday->write;
$param = '&id='.$object->id;
$relativepathwithnofile = $modulepart.'/'.dol_sanitizeFileName($object->ref).'/';
$relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
$savingdocmask = dol_sanitizeFileName($object->ref).'-__file__';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -6,7 +6,7 @@
*
* 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,

View File

@ -111,7 +111,7 @@ class Evaluationline extends CommonObject
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
'fk_skill' => array('type'=>'integer:Skill:hrm/class/skill.class.php:1', 'label'=>'Skill', 'enabled'=>'1', 'position'=>3, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'fk_evaluation' => array('type'=>'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label'=>'Evaluation', 'enabled'=>'1', 'position'=>3, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>'1', 'position'=>4, 'notnull'=>1, 'visible'=>1,),
'rankorder' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>'1', 'position'=>4, 'notnull'=>1, 'visible'=>1,),
'required_rank' => array('type'=>'integer', 'label'=>'requiredRank', 'enabled'=>'1', 'position'=>5, 'notnull'=>1, 'visible'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
);

View File

@ -104,7 +104,7 @@ class Skilldet extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'rank' => array('type'=>'integer', 'label'=>'rank', 'enabled'=>'1', 'position'=>2, 'notnull'=>0, 'visible'=>2,),
'rankorder' => array('type'=>'integer', 'label'=>'rank', 'enabled'=>'1', 'position'=>2, 'notnull'=>0, 'visible'=>2,),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>0,),

View File

@ -57,11 +57,6 @@ $domData .= ' data-id="'.$line->id.'"';
$domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';
$sign = 1;
if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && in_array($object->element, array('facture', 'invoice_supplier')) && $object->type == $object::TYPE_CREDIT_NOTE) {
$sign = -1;
}
$coldisplay = 0;
?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->

View File

@ -79,7 +79,7 @@ class Odf
// Create tmp direcoty (will be deleted in destructor)
if (!file_exists($this->tmpdir)) {
$result=mkdir($this->tmpdir);
$result = mkdir($this->tmpdir);
}
// Load zip proxy
@ -329,6 +329,7 @@ class Odf
$tempHtml = $html;
while (strlen($tempHtml) > 0) {
$matches = array();
// Check if the string includes a html tag
if (preg_match_all('/<([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/', $tempHtml, $matches)) {
$tagOffset = strpos($tempHtml, $matches[0][0]);
@ -342,6 +343,7 @@ class Odf
$tempHtml = substr($tempHtml, $tagOffset);
}
// Extract the attribute data from the html tag
$explodedAttributes = array();
preg_match_all('/([0-9A-Za-z]+(?:="[0-9A-Za-z\:\-\s\,\;\#]*")?)+/', $matches[2][0], $explodedAttributes);
$explodedAttributes = array_filter($explodedAttributes[0]);
$attributes = array();
@ -447,32 +449,6 @@ class Odf
return $value;
}
/**
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
*
* @return int 0
*/
public function phpEval()
{
preg_match_all('/[\{\<]\?(php)?\s+(?P<content>.+)\?[\}\>]/iU', $this->contentXml, $matches); // detecting all {?php code ?} or <?php code ? >
$nbfound=count($matches['content']);
for ($i=0; $i < $nbfound; $i++) {
try {
$ob_output = ''; // flush the output for each code. This var will be filled in by the eval($code) and output buffering : any print or echo or output will be redirected into this variable
$code = $matches['content'][$i];
ob_start();
eval($code);
$ob_output = ob_get_contents(); // send the content of the buffer into $ob_output
$this->contentXml = str_replace($matches[0][$i], $ob_output, $this->contentXml);
ob_end_clean();
} catch (Exception $e) {
ob_end_clean();
$this->contentXml = str_replace($matches[0][$i], 'ERROR: there was a problem while evaluating this portion of code, please fix it: '.$e, $this->contentXml);
}
}
return 0;
}
/**
* Assign a template variable as a picture
*
@ -515,10 +491,12 @@ IMG;
// Search all possible rows in the document
$reg1 = "#<table:table-row[^>]*>(.*)</table:table-row>#smU";
$matches = array();
preg_match_all($reg1, $this->contentXml, $matches);
for ($i = 0, $size = count($matches[0]); $i < $size; $i++) {
// Check if the current row contains a segment row.*
$reg2 = '#\[!--\sBEGIN\s(row.[\S]*)\s--\](.*)\[!--\sEND\s\\1\s--\]#sm';
$matches2 = array();
if (preg_match($reg2, $matches[0][$i], $matches2)) {
$balise = str_replace('row.', '', $matches2[1]);
// Move segment tags around the row
@ -665,6 +643,7 @@ IMG;
}
// $reg = "#\[!--\sBEGIN\s$segment\s--\]<\/text:p>(.*)<text:p\s.*>\[!--\sEND\s$segment\s--\]#sm";
$reg = "#\[!--\sBEGIN\s$segment\s--\](.*)\[!--\sEND\s$segment\s--\]#sm";
$m = array();
if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) {
throw new OdfException("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file.");
}
@ -1005,6 +984,7 @@ IMG;
public function getvalue($valuename)
{
$searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
$matches = array();
preg_match($searchreg, $this->contentXml, $matches);
$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
return $matches[1];

View File

@ -539,9 +539,9 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= '<div class="info-box-line">';
if (!empty($board->labelShort)) {
$infoName = '<span title="'.$board->label.'">'.$board->labelShort.'</span>';
$infoName = '<span class="marginrightonly" title="'.$board->label.'">'.$board->labelShort.'</span>';
} else {
$infoName = $board->label;
$infoName = '<span class="marginrightonly">'.$board->label.'</span>';
}
$textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate);
@ -561,9 +561,11 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$nbtodClass = '';
if ($board->nbtodo > 0) {
$nbtodClass = 'badge badge-info';
} else {
$nbtodClass = 'opacitymedium';
}
$openedDashBoard .= ' <a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.'<span class="classfortooltip'.($nbtodClass ? ' '.$nbtodClass : '').'" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
if ($textLate) {
if ($board->url_late) {
$openedDashBoard .= '</a>';
@ -576,7 +578,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= '</a>'."\n";
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' '.price($board->total).'</a>';
}
$openedDashBoard .= '</div>'."\n";
}

View File

@ -27,6 +27,8 @@
delete from llx_c_availability;
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (1, 'AV_NOW', 'Immediate', 1, 10);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40);
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (5, 'AV_4W', '4 weeks', 1, 50);

View File

@ -6,7 +6,7 @@
--
-- 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,

View File

@ -87,6 +87,26 @@ DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', '
-- For v14
--Fix bad sign on multicompany column for customer invoice lines
UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicurrency column for supplier invoice lines
UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
UPDATE llx_c_ticket_type set label = 'Issue or bug' WHERE code = 'ISSUE';
INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL);

View File

@ -78,8 +78,32 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,<br /><br />__(OrganizationEventBulkMailToSpeakers)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
--Fix bad sign on multicompany column for customer invoice lines
UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicurrency column for supplier invoice lines
UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
-- v15
ALTER TABLE llx_c_partnership_type ADD UNIQUE INDEX uk_c_partnership_type(entity, code);
ALTER TABLE llx_partnership ADD COLUMN fk_type integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_c_holiday_types CHANGE COLUMN newByMonth newbymonth double(8,5) DEFAULT 0 NOT NULL;
ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0;

View File

@ -501,6 +501,25 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS
-- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL;
--Fix bad sign on multicompany column for customer invoice lines
UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicurrency column for supplier invoice lines
UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
--Fix bad sign on multicompany column for customer invoices
UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL;

View File

@ -5,7 +5,7 @@
--
-- 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,

View File

@ -5,7 +5,7 @@
--
-- 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,

View File

@ -0,0 +1,19 @@
-- ========================================================================
-- Copyright (C) 2021 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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 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
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ========================================================================
ALTER TABLE llx_c_partnership_type ADD UNIQUE INDEX uk_c_partnership_type(entity, code);

View File

@ -30,6 +30,6 @@ create table llx_c_partnership_type
entity integer DEFAULT 1 NOT NULL,
code varchar(32) NOT NULL,
label varchar(64) NOT NULL,
active tinyint DEFAULT 1 NOT NULL
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;

View File

@ -2,7 +2,7 @@
--
-- 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,

View File

@ -3,7 +3,7 @@
--
-- 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,

View File

@ -2,7 +2,7 @@
--
-- 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,

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