Merge branch 'develop' into NEW/element_time_code_integration

This commit is contained in:
atm-gauthier 2023-03-10 19:27:43 +01:00 committed by GitHub
commit fd41ab77c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 3079 additions and 2644 deletions

View File

@ -329,6 +329,7 @@ class Lettering extends BookKeeping
// Update request // Update request
$now = dol_now(); $now = dol_now();
$affected_rows = 0;
if (!$error) { if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
@ -341,6 +342,8 @@ class Lettering extends BookKeeping
if (!$resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} else {
$affected_rows = $this->db->affected_rows($resql);
} }
} }
@ -352,7 +355,7 @@ class Lettering extends BookKeeping
} }
return -1 * $error; return -1 * $error;
} else { } else {
return 1; return $affected_rows;
} }
} }
@ -387,7 +390,7 @@ class Lettering extends BookKeeping
} }
return -1 * $error; return -1 * $error;
} else { } else {
return 1; return $this->db->affected_rows($resql);
} }
} }
@ -482,7 +485,7 @@ class Lettering extends BookKeeping
else $result = $this->updateLettering($bookkeeping_lines); else $result = $this->updateLettering($bookkeeping_lines);
if ($result < 0) { if ($result < 0) {
$group_error++; $group_error++;
} else { } elseif ($result > 0) {
$nb_lettering++; $nb_lettering++;
} }
} }

View File

@ -805,6 +805,12 @@ if (!$error && $action == 'writebookkeeping') {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
if ($nb_lettering < 0) {
$error++;
$errorforline++;
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
}
} }
} }
} }

View File

@ -381,6 +381,12 @@ if ($action == 'writebookkeeping') {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
if ($nb_lettering < 0) {
$error++;
$errorforline++;
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
}
} }
} }
} }

View File

@ -463,7 +463,15 @@ if ($action == 'writebookkeeping') {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
if ($nb_lettering < 0) {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'other';
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
}
} }
} }
} }

View File

@ -1809,7 +1809,7 @@ if ($action == 'create') {
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script>
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
console.log("We have changed the company - Reload page"); console.log("We have changed the company - Reload page");

View File

@ -246,7 +246,9 @@ class PropaleStats extends Stats
global $user; global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from." INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; $sql .= " FROM ".$this->from;
$sql .= " INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (empty($user->rights->societe->client->voir) && !$user->socid) { if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
} }

View File

@ -63,9 +63,9 @@ if (!$error) {
} }
// Security check // Security check
$socid = '';
if (!empty($user->socid)) { if (!empty($user->socid)) {
$socid = $user->socid; $socid = $user->socid;
$object->id = $user->socid;
} }
restrictedArea($user, 'propal', $object->id); restrictedArea($user, 'propal', $object->id);

View File

@ -45,13 +45,6 @@ $confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
// Security check
$socid = '';
if (!empty($user->socid)) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'propal', $id);
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -84,9 +77,9 @@ $object->fetch($id, $ref);
$permissiontoadd = $user->rights->propal->creer; $permissiontoadd = $user->rights->propal->creer;
// Security check // Security check
$socid = '';
if (!empty($user->socid)) { if (!empty($user->socid)) {
$socid = $user->socid; $socid = $user->socid;
$object->id = $user->socid;
} }
restrictedArea($user, 'propal', $object->id); restrictedArea($user, 'propal', $object->id);

View File

@ -49,9 +49,9 @@ if ($id > 0 || !empty($ref)) {
} }
// Security check // Security check
$socid = '';
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
$object->id = $user->socid;
} }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@ -1788,7 +1788,7 @@ if ($action == 'create' && $usercancreate) {
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script>
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
console.log("We have changed the company - Reload page"); console.log("We have changed the company - Reload page");
@ -1850,13 +1850,13 @@ if ($action == 'create' && $usercancreate) {
// Terms of payment // Terms of payment
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'payment', 'class="pictofixedwidth"'); print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id')?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print $form->getSelectConditionsPaiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0)?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id')?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0)?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account

View File

@ -3203,7 +3203,7 @@ if ($action == 'create') {
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
// Option to reload page to retrieve customer informations. // Option to reload page to retrieve customer informations.
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script>
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
/* /*
@ -3671,7 +3671,7 @@ if ($action == 'create') {
// Payment term // Payment term
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
print img_picto('', 'payment', 'class="pictofixedwidth"'); print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
print '</td></tr>'; print '</td></tr>';
@ -3728,7 +3728,7 @@ if ($action == 'create') {
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0)? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account

View File

@ -576,7 +576,7 @@ $sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_so
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,'; $sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
$sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,'; $sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.code_client as code_client, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
$sql .= " s.parent as fk_parent,"; $sql .= " s.parent as fk_parent,";
$sql .= " s2.nom as name2,"; $sql .= " s2.nom as name2,";
$sql .= ' typent.code as typent_code,'; $sql .= ' typent.code as typent_code,';
@ -1862,7 +1862,6 @@ if ($resql) {
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias; $companystatic->name_alias = $obj->alias;
$companystatic->code_client = $obj->code_client;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
$companystatic->fournisseur = $obj->fournisseur; $companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;

View File

@ -55,7 +55,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['purchasejournallist']);
/* /*
* Actions * Actions
@ -192,7 +192,7 @@ if ($result) {
/* /*
* Show result array * Show result array
*/ */
print "<table class=\"noborder\" width=\"100%\">"; print '<table class="liste noborder centpercent">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
///print "<td>".$langs->trans("JournalNum")."</td>"; ///print "<td>".$langs->trans("JournalNum")."</td>";
print "<td>".$langs->trans("Date")."</td>"; print "<td>".$langs->trans("Date")."</td>";

View File

@ -57,6 +57,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['selljournallist']);
/* /*
* Actions * Actions
@ -237,7 +238,7 @@ if ($result) {
*/ */
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
//print "<td>".$langs->trans("JournalNum")."</td>"; //print "<td>".$langs->trans("JournalNum")."</td>";
print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>'; print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>';

View File

@ -110,7 +110,7 @@ if (empty($local)) {
accessforbidden('Parameter localTaxType is missing'); accessforbidden('Parameter localTaxType is missing');
exit; exit;
} }
$hookmanager->initHooks(['customerlocaltaxlist']);
$calc = 0; $calc = 0;
/* /*
@ -185,7 +185,7 @@ $vatcust = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_cod
$vatsup = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code); $vatsup = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
// IRPF that the customer has retained me // IRPF that the customer has retained me
if ($calc == 0 || $calc == 2) { if ($calc == 0 || $calc == 2) {

View File

@ -155,7 +155,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['customersupplierreportlist']);
/* /*
* View * View
@ -254,7 +254,7 @@ if ($date_endyear) {
$param .= '&date_endyear='.$date_endyear; $param .= '&date_endyear='.$date_endyear;
} }
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if ($modecompta == 'BOOKKEEPING') { if ($modecompta == 'BOOKKEEPING') {

View File

@ -158,7 +158,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['resultreportlist']);
/* /*
* View * View

View File

@ -46,7 +46,7 @@ if (isModEnabled('comptabilite')) {
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
$hookmanager->initHooks(['cabyuserreportlist']);
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (GETPOST("modecompta")) { if (GETPOST("modecompta")) {

View File

@ -203,7 +203,7 @@ $vatexpensereport = $langs->trans("VATPaid");
// VAT Received and paid // VAT Received and paid
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="liste noborder centpercent">';
$y = $year_current; $y = $year_current;
$i = 0; $i = 0;

View File

@ -0,0 +1,69 @@
<?php
/* Copyright (C) 2022 Florian HENRY <florian.henry@scopen.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 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/>.
*/
/**
* \file htdocs/core/ajax/ajaxinvoiceline.php
* \brief File to load contacts combobox
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
$invoice_id = GETPOST('id', 'int'); // id of thirdparty
$action = GETPOST('action', 'aZ09');
$htmlname = GETPOST('htmlname', 'alpha');
// Security check
restrictedArea($user, 'facture', $invoice_id, '', '', 'fk_soc', 'rowid');
/*
* View
*/
top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
// Load original field value
if (!empty($invoice_id) && !empty($action) && !empty($htmlname)) {
$formProject = new FormProjets($db);
$return = array();
if (empty($showempty)) {
$showempty = 0;
}
$return['value'] = $formProject->selectInvoiceAndLine($invoice_id, 0, 'invoiceid', 'invoicelineid', 'maxwidth500', array(), 1);
//$return['num'] = $form->num;
//$return['error'] = $form->error;
echo json_encode($return);
}

View File

@ -2089,10 +2089,6 @@ abstract class CommonObject
$id_field = 'rowid'; $id_field = 'rowid';
} }
$error = 0;
$this->db->begin();
// Special case // Special case
if ($table == 'product' && $field == 'note_private') { if ($table == 'product' && $field == 'note_private') {
$field = 'note'; $field = 'note';
@ -2101,6 +2097,32 @@ abstract class CommonObject
$fk_user_field = 'fk_user_mod'; $fk_user_field = 'fk_user_mod';
} }
if ($trigkey) {
$oldvalue = null;
$sql = "SELECT " . $field;
$sql .= " FROM " . MAIN_DB_PREFIX . $table;
$sql .= " WHERE " . $id_field . " = " . ((int) $id);
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
if ($format == 'date') {
$oldvalue = $this->db->jdate($obj->$field);
} else {
$oldvalue = $obj->$field;
}
}
} else {
$this->error = $this->db->lasterror();
return -1;
}
}
$error = 0;
$this->db->begin();
$sql = "UPDATE ".$this->db->prefix().$table." SET "; $sql = "UPDATE ".$this->db->prefix().$table." SET ";
if ($format == 'text') { if ($format == 'text') {
@ -2133,6 +2155,11 @@ abstract class CommonObject
} else { } else {
$result = $this->fetchCommon($id); $result = $this->fetchCommon($id);
} }
$this->oldcopy = clone $this;
if (property_exists($this->oldcopy, $field)) {
$this->oldcopy->$field = $oldvalue;
}
if ($result >= 0) { if ($result >= 0) {
$result = $this->call_trigger($trigkey, (!empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors $result = $this->call_trigger($trigkey, (!empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors
} }

View File

@ -903,6 +903,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return combo list of activated countries, into language of user * Return combo list of activated countries, into language of user
* *
@ -1038,6 +1039,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of incoterms * Return select list of incoterms
* *
@ -1126,6 +1128,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of types of lines (product or service) * Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module) * Example: 0=product, 1=service, 9=other (for external module)
@ -1187,6 +1190,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into cache cache_types_fees, array of types of fees * Load into cache cache_types_fees, array of types of fees
* *
@ -1234,6 +1238,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of types of notes * Return list of types of notes
* *
@ -1278,6 +1283,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html form to select a third party * Output html form to select a third party
* *
@ -1350,6 +1356,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html form to select a third party. * Output html form to select a third party.
* Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company. * Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company.
@ -1579,6 +1586,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return HTML combo list of absolute discounts * Return HTML combo list of absolute discounts
* *
@ -1665,6 +1673,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of all contacts (for a third party or all) * Return list of all contacts (for a third party or all)
* *
@ -1915,6 +1924,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return the HTML select list of users * Return the HTML select list of users
* *
@ -1937,6 +1947,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of users * Return select list of users
* *
@ -2090,7 +2101,8 @@ class Form
$disableline = ($enableonlytext ? $enableonlytext : '1'); $disableline = ($enableonlytext ? $enableonlytext : '1');
} }
$labeltoshow = ''; $labeltoshowhtml = ''; $labeltoshow = '';
$labeltoshowhtml = '';
// $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0) // $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0)
$fullNameMode = 0; $fullNameMode = 0;
@ -2105,7 +2117,8 @@ class Form
} }
// Complete name with a more info string like: ' (info1 - info2 - ...)' // Complete name with a more info string like: ' (info1 - info2 - ...)'
$moreinfo = ''; $moreinfohtml = ''; $moreinfo = '';
$moreinfohtml = '';
if (!empty($conf->global->MAIN_SHOW_LOGIN)) { if (!empty($conf->global->MAIN_SHOW_LOGIN)) {
$moreinfo .= ($moreinfo ? ' - ' : ' ('); $moreinfo .= ($moreinfo ? ' - ' : ' (');
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">('); $moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(');
@ -2192,6 +2205,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of users. Selected users are stored into session. * Return select list of users. Selected users are stored into session.
* List of users are provided into $_SESSION['assignedtouser']. * List of users are provided into $_SESSION['assignedtouser'].
@ -2288,6 +2302,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list * Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
* *
@ -2525,6 +2540,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of products for a customer. * Return list of products for a customer.
* Called by select_produits. * Called by select_produits.
@ -3216,6 +3232,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list) * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)
* *
@ -3262,6 +3279,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of suppliers products * Return list of suppliers products
* *
@ -3691,6 +3709,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of suppliers prices for a product * Return list of suppliers prices for a product
* *
@ -3800,6 +3819,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of delivery address * Return list of delivery address
* *
@ -3848,6 +3868,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into cache list of payment terms * Load into cache list of payment terms
* *
@ -3896,6 +3917,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load int a cache property th elist of possible delivery delays. * Load int a cache property th elist of possible delivery delays.
* *
@ -4076,6 +4098,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Charge dans cache la liste des types de paiements possibles * Charge dans cache la liste des types de paiements possibles
* *
@ -4127,6 +4150,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* print list of payment modes. * print list of payment modes.
* Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want.
@ -4243,6 +4267,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of payment methods * Return list of payment methods
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want. * Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
@ -4385,6 +4410,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load in cache list of transport mode * Load in cache list of transport mode
* *
@ -4700,6 +4726,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return a HTML select list of bank accounts * Return a HTML select list of bank accounts
* *
@ -4893,6 +4920,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of categories having choosed type * Return list of categories having choosed type
* *
@ -4987,6 +5015,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a confirmation HTML form or AJAX popup * Show a confirmation HTML form or AJAX popup
* *
@ -5431,6 +5460,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form to select a project * Show a form to select a project
* *
@ -5486,6 +5516,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form to select payment conditions * Show a form to select payment conditions
* *
@ -5546,6 +5577,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form to select a delivery delay * Show a form to select a delivery delay
* *
@ -5613,6 +5645,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a form + html select a date * Show a form + html select a date
* *
@ -5662,6 +5695,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a select form to choose a user * Show a select form to choose a user
* *
@ -5698,6 +5732,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show form with payment mode * Show form with payment mode
* *
@ -5775,6 +5810,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show form with multicurrency code * Show form with multicurrency code
* *
@ -5801,6 +5837,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show form with multicurrency rate * Show form with multicurrency rate
* *
@ -5840,6 +5877,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a select box with available absolute discounts * Show a select box with available absolute discounts
* *
@ -5941,6 +5979,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show forms to select a contact * Show forms to select a contact
* *
@ -5983,6 +6022,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output html select to select thirdparty * Output html select to select thirdparty
* *
@ -6033,6 +6073,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne la liste des devises, dans la langue de l'utilisateur * Retourne la liste des devises, dans la langue de l'utilisateur
* *
@ -6167,6 +6208,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into the cache vat rates of a country * Load into the cache vat rates of a country
* *
@ -6237,6 +6279,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output an HTML select vat rate. * Output an HTML select vat rate.
* The name of this function should be selectVat. We keep bad name for compatibility purpose. * The name of this function should be selectVat. We keep bad name for compatibility purpose.
@ -6435,6 +6478,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes.
* Fields are preselected with : * Fields are preselected with :
@ -6991,6 +7035,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to show a form to select a duration on a page * Function to show a form to select a duration on a page
* *
@ -8913,7 +8958,8 @@ class Form
'perms' => 1, 'perms' => 1,
'label' => 'LinkToContract', 'label' => 'LinkToContract',
'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'), FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "contrat as t, " . $this->db->prefix() . "contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('contract') . ') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
),
'fichinter' => array( 'fichinter' => array(
'enabled' => isModEnabled('ficheinter'), 'enabled' => isModEnabled('ficheinter'),
'perms' => 1, 'perms' => 1,
@ -8988,7 +9034,9 @@ class Form
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Ref") . '</td>'; print '<td>' . $langs->trans("Ref") . '</td>';
print '<td><input type="text" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;<input type="submit" class="button valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; print '<td><input type="text" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
print '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
@ -9143,6 +9191,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of export templates * Return list of export templates
* *
@ -9643,6 +9692,7 @@ class Form
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return select list of groups * Return select list of groups
* *
@ -10032,7 +10082,7 @@ class Form
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids. * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
* @param string $showproject 'all' = Show project info, ''=Hide project info * @param string $showproject 'all' = Show project info, ''=Hide project info
* @param User $usertofilter User object to use for filtering * @param User $usertofilter User object to use for filtering
* @return int Nbr of project if OK, <0 if KO * @return string HTML Select Invoice
*/ */
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
{ {
@ -10159,13 +10209,12 @@ class Form
$out .= '</select>'; $out .= '</select>';
} }
print $out; return $out;
$this->db->free($resql); $this->db->free($resql);
return $num;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
return -1; return '';
} }
} }

View File

@ -56,6 +56,7 @@ class FormProjets
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Output a combo list with projects qualified for a third party / user * Output a combo list with projects qualified for a third party / user
* *
@ -124,6 +125,7 @@ class FormProjets
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns an array with projects qualified for a third party * Returns an array with projects qualified for a third party
* *
@ -508,6 +510,7 @@ class FormProjets
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Build a HTML select list of element of same thirdparty to suggest to link them to project * Build a HTML select list of element of same thirdparty to suggest to link them to project
* *
@ -748,4 +751,130 @@ class FormProjets
return -1; return -1;
} }
} }
/**
* Output a combo list with invoices and lines qualified for a project
*
* @param int $selectedInvoiceId Id invoice preselected
* @param int $selectedLineId Id invoice line preselected
* @param string $htmlNameInvoice Name of HTML select for Invoice
* @param int $htmlNameInvoiceLine Name of HTML select for Invoice Line
* @param string $morecss More css added to the select component
* @param array $filters Array of filters
* @param int $lineOnly return only option for line
* @return string HTML Select
*/
public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0, $htmlNameInvoice = 'invoiceid', $htmlNameInvoiceLine = 'invoicelineid', $morecss = 'maxwidth500', $filters = array(), $lineOnly = 0)
{
global $user, $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$out = '';
if (empty($lineOnly)) {
// Search Invoice
$sql = "SELECT f.rowid, f.ref as fref,";
$sql .= ' s.nom as name';
$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'facture as f ON f.fk_projet = p.rowid';
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
if (!empty($filters)) {
foreach ($filters as $key => $value) {
if ($key == 'p.rowid') {
$sql .= " AND p.rowid=" . (int) $value;
}
if ($key == 'f.rowid') {
$sql .= " AND f.rowid=" . (int) $value;
}
}
}
$sql .= " ORDER BY p.ref, f.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlNameInvoice, array(array('method'=>'getLines', 'url'=>dol_buildpath('/core/ajax/ajaxinvoiceline.php', 1), 'htmlname'=>$htmlNameInvoiceLine)), 0, 0);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlNameInvoice . '" name="' . $htmlNameInvoice . '">';
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$labeltoshow = $obj->fref; // Invoice ref
if ($obj->name) {
$labeltoshow .= ' - ' . $obj->name;
}
$out .= '<option value="' . $obj->rowid . '" ';
if (!empty($selectedInvoiceId) && $selectedInvoiceId == $obj->rowid) {
$out .= ' selected ';
}
$out .= '>' . $labeltoshow . '</option>';
}
}
$out .= '</select>';
} else {
dol_print_error($this->db->lasterror);
return '';
}
}
// Search Invoice Line
$sql = "SELECT fd.rowid, fd.label, fd.description";
$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'facture as f ON f.fk_projet = p.rowid';
$sql .= ' INNER JOIN ' . $this->db->prefix() . 'facturedet as fd ON fd.fk_facture = f.rowid';
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
if (!empty($filters)) {
foreach ($filters as $key => $value) {
if ($key == 'p.rowid') {
$sql .= " AND p.rowid=" . (int) $value;
}
}
}
if (!empty($selectedInvoiceId)) {
$sql .= " AND f.rowid=" . (int) $selectedInvoiceId;
}
$sql .= " ORDER BY p.ref, f.ref ASC";
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (empty($lineOnly)) {
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlNameInvoiceLine, '', 0, 0);
$out .= $comboenhancement;
$morecss = 'minwidth200imp maxwidth500';
}
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlNameInvoiceLine . '" name="' . $htmlNameInvoiceLine . '">';
}
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$labeltoshow .= $obj->description; // Invoice ref
$out .= '<option value="' . $obj->rowid . '" ';
if (!empty($selectedLineId) && $selectedLineId == $obj->rowid) {
$out .= ' selected ';
}
$out .= '>' . $labeltoshow . '</option>';
}
}
if (empty($lineOnly)) {
$out .= '</select>';
}
} else {
dol_print_error($this->db->lasterror);
return '';
}
return $out;
}
} }

View File

@ -419,7 +419,7 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
} else { } else {
if (isset($this->withreadid) && $this->withreadid > 0) { if (isset($this->withreadid) && $this->withreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title;
} else { } else {
$subject = GETPOST('subject', 'alpha'); $subject = GETPOST('subject', 'alpha');
} }

View File

@ -48,17 +48,13 @@ function report_header($reportname, $notused, $period, $periodlink, $description
$varlink = '?'.$varlink; $varlink = '?'.$varlink;
} }
$head = array(); $title = $langs->trans("Report");
$h = 0; print_barre_liste($title, '', '');
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].$varlink.'">'."\n";
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'."\n"; print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
print dol_get_fiche_head($head, 'report'); print dol_get_fiche_head();
foreach ($moreparam as $key => $value) { foreach ($moreparam as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n"; print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n";

View File

@ -444,7 +444,7 @@ function dolWebsiteIncrementCounter($websiteid, $websitepagetype, $websitepageid
$sql .= " pageviews_total = pageviews_total + 1,"; $sql .= " pageviews_total = pageviews_total + 1,";
$sql .= " pageviews_month = pageviews_month + 1,"; $sql .= " pageviews_month = pageviews_month + 1,";
// if last access was done during previous month, we save pageview_month into pageviews_previous_month // if last access was done during previous month, we save pageview_month into pageviews_previous_month
$sql .= " pageviews_previous_month = ".$db->ifsql("lastaccess < '".$db->idate(dol_mktime(0, 0, 0, $tmpnow['month'], 1, $tmpnow['year'], 'gmt', 0), 'gmt')."'", 'pageviews_month', 'pageviews_previous_month').","; $sql .= " pageviews_previous_month = ".$db->ifsql("lastaccess < '".$db->idate(dol_mktime(0, 0, 0, $tmpnow['mon'], 1, $tmpnow['year'], 'gmt', 0), 'gmt')."'", 'pageviews_month', 'pageviews_previous_month').",";
$sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'"; $sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'";
$sql .= " WHERE rowid = ".((int) $websiteid); $sql .= " WHERE rowid = ".((int) $websiteid);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -83,7 +83,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest"));
$tooltip .= $langs->trans("GenericMaskCodes5"); $tooltip .= $langs->trans("GenericMaskCodes5");
$mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); $mask = getDolGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK');
// Parametrage du prefix // Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';

View File

@ -51,7 +51,7 @@ if (!is_object($website)) {
$website->fetch(0, $websitekey); $website->fetch(0, $websitekey);
} }
// Define $websitepage if we have $websitepagefile defined // Define $websitepage if we have $websitepagefile defined
if (!$pageid && !empty($websitepagefile)) { if (empty($pageid) && !empty($websitepagefile)) {
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile)); $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
if ($pageid == 'index.php') { if ($pageid == 'index.php') {
$pageid = $website->fk_default_home; $pageid = $website->fk_default_home;

View File

@ -529,7 +529,7 @@ class CommandeFournisseur extends CommonOrder
$this->lines = array(); $this->lines = array();
$sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; $sql = "SELECT l.rowid, l.fk_commande, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,";
$sql .= " l.vat_src_code, l.tva_tx, l.remise_percent, l.subprice,"; $sql .= " l.vat_src_code, l.tva_tx, l.remise_percent, l.subprice,";
$sql .= " l.localtax1_tx, l. localtax2_tx, l.localtax1_type, l. localtax2_type, l.total_localtax1, l.total_localtax2,"; $sql .= " l.localtax1_tx, l. localtax2_tx, l.localtax1_type, l. localtax2_type, l.total_localtax1, l.total_localtax2,";
$sql .= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,"; $sql .= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,";
@ -559,6 +559,7 @@ class CommandeFournisseur extends CommonOrder
$line = new CommandeFournisseurLigne($this->db); $line = new CommandeFournisseurLigne($this->db);
$line->id = $objp->rowid; $line->id = $objp->rowid;
$line->fk_commande = $objp->fk_commande;
$line->desc = $objp->description; $line->desc = $objp->description;
$line->description = $objp->description; $line->description = $objp->description;
$line->qty = $objp->qty; $line->qty = $objp->qty;

View File

@ -1704,6 +1704,7 @@ if ($action == 'create') {
$("input[name=action]").val("create"); $("input[name=action]").val("create");
$("form[name=add]").submit(); $("form[name=add]").submit();
}); });
});
</script>'; </script>';
} }
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>'; print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
@ -1731,13 +1732,13 @@ if ($action == 'create') {
// Payment term // Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'payment', 'class="pictofixedwidth"'); print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id'); print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
$form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0) ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Planned delivery date // Planned delivery date
@ -2086,7 +2087,7 @@ if ($action == 'create') {
} }
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>';
print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : ''; print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : '';
if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) { if ($object->hasDelay() && !empty($object->delivery_date) && !empty($object->date_commande)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }
print "</td></tr>"; print "</td></tr>";
@ -2256,7 +2257,7 @@ if ($action == 'create') {
$usehourmin = 1; $usehourmin = 1;
} }
print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison");
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button button-edit smallpaddingimp valign middle" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} else { } else {
$usehourmin = 'day'; $usehourmin = 'day';
@ -2264,7 +2265,7 @@ if ($action == 'create') {
$usehourmin = 'dayhour'; $usehourmin = 'dayhour';
} }
print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : '&nbsp;'; print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : '&nbsp;';
if ($object->hasDelay() && !empty($object->delivery_date)) { if ($object->hasDelay() && !empty($object->delivery_date) && ($object->statut == $object::STATUS_ORDERSENT || $object->statut == $object::STATUS_RECEIVED_PARTIALLY)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }
} }

View File

@ -2,7 +2,7 @@
ContractsArea=Contracts area ContractsArea=Contracts area
ListOfContracts=List of contracts ListOfContracts=List of contracts
AllContracts=All contracts AllContracts=All contracts
ContractCard=Contract card ContractCard=Contract
ContractStatusNotRunning=Not running ContractStatusNotRunning=Not running
ContractStatusDraft=Draft ContractStatusDraft=Draft
ContractStatusValidated=Validated ContractStatusValidated=Validated

View File

@ -207,7 +207,7 @@ if ($cancel) {
$action = ''; $action = '';
} }
$createbarcode = empty($conf->barcode->enabled) ? 0 : 1; $createbarcode = isModEnabled('barcode');
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->creer_advance)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->creer_advance)) {
$createbarcode = 0; $createbarcode = 0;
} }
@ -1419,7 +1419,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
} }
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1; $showbarcode = isModEnabled('barcode');
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
$showbarcode = 0; $showbarcode = 0;
} }
@ -1984,7 +1984,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
// Barcode // Barcode
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1; $showbarcode = isModEnabled('barcode');
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
$showbarcode = 0; $showbarcode = 0;
} }
@ -2312,7 +2312,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} else { } else {
// Fiche en mode visu // Fiche en mode visu
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1; $showbarcode = isModEnabled('barcode');
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
$showbarcode = 0; $showbarcode = 0;
} }

View File

@ -375,7 +375,7 @@ if ($mode != 'future') {
print img_picto('', 'stock', 'class="pictofixedwidth"').$langs->trans("Warehouse").' :'; print img_picto('', 'stock', 'class="pictofixedwidth"').$langs->trans("Warehouse").' :';
print '</span> '; print '</span> ';
$selected = ((GETPOSTISSET('search_fk_warehouse') || GETPOSTISSET('fk_warehouse')) ? $search_fk_warehouse : 'ifonenodefault'); $selected = ((GETPOSTISSET('search_fk_warehouse') || GETPOSTISSET('fk_warehouse')) ? $search_fk_warehouse : 'ifonenodefault');
print $formproduct->selectWarehouses($selected, 'search_fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref', 1); print $formproduct->selectWarehouses($selected, 'search_fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, 'minwidth200', null, 1, false, 'e.ref', 1);
} }
print '</div>'; print '</div>';

View File

@ -130,6 +130,8 @@ class Task extends CommonObjectLine
public $timespent_thm; public $timespent_thm;
public $timespent_note; public $timespent_note;
public $timespent_fk_product; public $timespent_fk_product;
public $timespent_invoiceid;
public $timespent_invoicelineid;
public $comments = array(); public $comments = array();
@ -1717,6 +1719,8 @@ class Task extends CommonObjectLine
$timespent->fk_user = $this->timespent_fk_user; $timespent->fk_user = $this->timespent_fk_user;
$timespent->fk_product = $this->timespent_fk_product; $timespent->fk_product = $this->timespent_fk_product;
$timespent->note = $this->timespent_note; $timespent->note = $this->timespent_note;
$timespent->invoice_id = $this->timespent_invoiceid;
$timespent->invoice_line_id = $this->timespent_invoicelineid;
dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG);
if ($timespent->update($user) > 0) { if ($timespent->update($user) > 0) {

View File

@ -310,6 +310,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
} }
$object->timespent_fk_user = GETPOST("userid_line", 'int'); $object->timespent_fk_user = GETPOST("userid_line", 'int');
$object->timespent_fk_product = GETPOST("fk_product", 'int'); $object->timespent_fk_product = GETPOST("fk_product", 'int');
$object->timespent_invoiceid = GETPOST("invoiceid", 'int');
$object->timespent_invoicelineid = GETPOST("invoicelineid", 'int');
$result = 0; $result = 0;
if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
@ -337,8 +339,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
} }
$object->timespent_fk_user = GETPOST("userid_line", 'int'); $object->timespent_fk_user = GETPOST("userid_line", 'int');
$object->timespent_fk_product = GETPOST("fk_product", 'int'); $object->timespent_fk_product = GETPOST("fk_product", 'int');
$object->timespent_invoiceid = GETPOST("invoiceid", 'int');
$object->timespent_invoicelineid = GETPOST("invoicelineid", 'int');
$result = 0; $result = 0;
if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
$result = $object->updateTimeSpent($user); $result = $object->updateTimeSpent($user);
@ -1469,7 +1473,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print $langs->trans('InvoiceToUse'); print $langs->trans('InvoiceToUse');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->selectInvoice($projectstatic->thirdparty->id, '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all'); print $form->selectInvoice($projectstatic->thirdparty->id, '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
/*print '<tr>'; /*print '<tr>';
@ -1554,6 +1558,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,"; $sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,";
$sql .= " il.fk_facture as invoice_id, inv.fk_statut,"; $sql .= " il.fk_facture as invoice_id, inv.fk_statut,";
$sql .= " p.fk_soc,s.name_alias,"; $sql .= " p.fk_soc,s.name_alias,";
$sql .= " t.invoice_line_id";
// Add fields from hooks // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
@ -2345,7 +2350,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if ($task_time->invoice_id) { if ($task_time->invoice_id) {
$result = $tmpinvoice->fetch($task_time->invoice_id); $result = $tmpinvoice->fetch($task_time->invoice_id);
if ($result > 0) { if ($result > 0) {
if ($action=='editline' && $_GET['lineid'] == $task_time->rowid) {
print $formproject->selectInvoiceAndLine($task_time->invoice_id, $task_time->invoice_line_id, 'invoiceid', 'invoicelineid', 'maxwidth500', array('p.rowid'=>$projectstatic->id));
} else {
print $tmpinvoice->getNomUrl(1); print $tmpinvoice->getNomUrl(1);
if (!empty($task_time->invoice_line_id)) {
$invoiceLine = new FactureLigne($db);
$invoiceLine->fetch($task_time->invoice_line_id);
if (!empty($invoiceLine->id)) {
print '<br>'.$langs->trans('Qty').':'.$invoiceLine->qty;
print ' '.$langs->trans('TotalHT').':'.price($invoiceLine->total_ht);
}
}
}
} }
} else { } else {
print $langs->trans("No"); print $langs->trans("No");

View File

@ -604,7 +604,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} else { } else {
print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; //print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY];
print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.'">'; print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.'">';
} }

View File

@ -34,6 +34,11 @@ if (is_numeric($entity)) {
define("DOLENTITY", $entity); define("DOLENTITY", $entity);
} }
// So log file will have a suffix
if (!defined('USESUFFIXINLOG')) {
define('USESUFFIXINLOG', '_stripeipn');
}
// Load Dolibarr environment // Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

View File

@ -255,12 +255,18 @@ if ($object->id > 0) {
print '/'; print '/';
print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("None")."</a>"; print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("None")."</a>";
print '</td>'; print '</td>';
} else {
print '<td></td>';
} }
print '<td class="center" width="24">&nbsp;</td>'; print '<td class="center" width="24"></td>';
print '<td>'.$langs->trans("Permissions").'</td>'; //print '<td>'.$langs->trans("Permissions").'</td>';
if ($user->admin) { print '<td class="center"></td>';
print '<td class="right"></td>';
} print '<td class="right nowrap">';
print '<a class="showallperms" title="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span></a>';
print ' | ';
print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" href="#">'.img_picto('', 'folder', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span></a>';
print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault"; $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
@ -275,9 +281,12 @@ if ($object->id > 0) {
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;$j = 0;
$oldmod = ''; $oldmod = '';
$cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
$cookietohidegrouparray = explode(',', $cookietohidegroup);
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -289,48 +298,78 @@ if ($object->id > 0) {
$objMod = $modules[$obj->module]; $objMod = $modules[$obj->module];
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
$ishidden = GETPOST('forbreakperms_'.$obj->module, 'int');
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
$ishidden = 1;
} else {
$ishidden = 0;
}
$isexpanded = ! $ishidden;
// Break found, it's a new module to catch // Break found, it's a new module to catch
if (isset($obj->module) && ($oldmod <> $obj->module)) { if (isset($obj->module) && ($oldmod <> $obj->module)) {
$oldmod = $obj->module; $oldmod = $obj->module;
$j++;
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
$ishidden = GETPOST('forbreakperms_'.$obj->module, 'int');
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
$ishidden = 1;
} else {
$ishidden = 0;
}
$isexpanded = ! $ishidden;
// Break detected, we get objMod // Break detected, we get objMod
$objMod = $modules[$obj->module]; $objMod = $modules[$obj->module];
$picto = ($objMod->picto ? $objMod->picto : 'generic'); $picto = ($objMod->picto ? $objMod->picto : 'generic');
// Show break line // Show break line
print '<tr class="oddeven trforbreak">'; print '<tr class="oddeven trforbreakperms" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'; // Picto and label of module
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone tdforbreakperms" data-hide-perms="'.$obj->module.'">';
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName(); print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'"></a>'; print '<a name="'.$objMod->getName().'"></a>';
print '</td>'; print '</td>';
// Permission and tick (2 columns)
if ($caneditperms) { if ($caneditperms) {
print '<td class="center nowrap">'; print '<td class="center wraponsmartphone">';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.$langs->trans("All").'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&module='.$obj->module.'&token='.newToken().'">'.$langs->trans("All")."</a>"; print '<span class="permtohide_'.$obj->module.'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
print ' / '; print ' / ';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.$langs->trans("None").'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&module='.$obj->module.'&token='.newToken().'">'.$langs->trans("None")."</a>"; print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
print '</span>';
print '</td>';
print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'">';
print '</td>'; print '</td>';
} else { } else {
print '<td>&nbsp;</td>'; print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
} }
print '<td>&nbsp;</td>'; // Description of permission (2 columns)
print '<td>&nbsp;</td>'; print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.$obj->module.'">';
// Permission id print '<div class="switchfolderperms folderperms_'.$obj->module.'"'.($isexpanded ? ' style="display:none;"' : '').'>';
if ($user->admin) { print img_picto('', 'folder', 'class="marginright"');
print '<td class="right"></td>'; print '</div>';
} print '<div class="switchfolderperms folderopenperms_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
print img_picto('', 'folder-open', 'class="marginright"');
print '</div>';
print '</td>'; //Add picto + / - when open en closed
print '</tr>'."\n"; print '</tr>'."\n";
} }
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n"; print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven trtohide_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none"' : '').'>';
// Picto and label of module // Picto and label of module
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'; print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
//print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName(); //print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print '</td>'; print '</td>';
// Permission and tick (2 columns)
if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) { if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
if (in_array($obj->id, $permsgroupbyentity[$entity])) { if (in_array($obj->id, $permsgroupbyentity[$entity])) {
// Own permission by group // Own permission by group
@ -360,11 +399,13 @@ if ($object->id > 0) {
//print img_edit_add($langs->trans("Add")); //print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off'); print img_picto($langs->trans("Add"), 'switch_off');
print '</a></td>'; print '</a></td>';
} else {
print '<td>&nbsp;</td>';
} }
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
// Description of permission // Description of permission (2 columns)
$permlabel = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label))); $permlabel = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
print '<td>'; print '<td>';
print $permlabel; print $permlabel;
@ -383,6 +424,8 @@ if ($object->id > 0) {
print $form->textwithpicto('', $htmltext); print $form->textwithpicto('', $htmltext);
//print '<span class="opacitymedium">'.$obj->id.'</span>'; //print '<span class="opacitymedium">'.$obj->id.'</span>';
print '</td>'; print '</td>';
} else {
print '<td>&nbsp;</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";
@ -393,6 +436,82 @@ if ($object->id > 0) {
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<script>';
print '$(".tdforbreakperms:not(.alink)").on("click", function(){
console.log("Click on tdforbreakperms");
moduletohide = $(this).data("hide-perms");
j = $(this).data("j");
if ($("#idforbreakperms_"+moduletohide).val() == 1) {
console.log("idforbreakperms_"+moduletohide+" has value hidden=1");
$(".trtohide_"+moduletohide).show();
$(".permtoshow_"+moduletohide).hide();
$(".permtohide_"+moduletohide).show();
$(".folderperms_"+moduletohide).hide();
$(".folderopenperms_"+moduletohide).show();
$("#idforbreakperms_"+moduletohide).val("0");
} else {
console.log("idforbreakperms_"+moduletohide+" has value hidden=0");
$(".trtohide_"+moduletohide).hide();
$(".folderopenperms_"+moduletohide).hide();
$(".folderperms_"+moduletohide).show();
$(".permtoshow_"+moduletohide).show();
$(".permtohide_"+moduletohide).hide();
$("#idforbreakperms_"+moduletohide).val("1");
}
// Now rebuild the value for cookie
var hideuserperm="";
$(".trforbreakperms").each(function(index) {
//console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
if ($("input[data-j="+(index+1)+"]").val() == 1) {
hideuserperm=hideuserperm+","+(index+1);
}
});
// set cookie by js
date = new Date(); date.setTime(date.getTime()+(30*86400000));
if (hideuserperm) {
console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
} else {
console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
}
});';
// Button expand / collapse all
print '$(".showallperms").on("click", function(){
console.log("Click on showallperms");
console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
$(".tdforbreakperms").each( function(){
moduletohide = $(this).data("hide-perms");
//console.log(moduletohide);
if ($("#idforbreakperms_"+moduletohide).val() != 0) {
$(this).trigger("click"); // emulate the click, so the cooki will be resaved
}
})
});
$(".hideallperms").on("click", function(){
console.log("Click on hideallperms");
$(".tdforbreakperms").each( function(){
moduletohide = $(this).data("hide-perms");
//console.log(moduletohide);
if ($("#idforbreakperms_"+moduletohide).val() != 1) {
$(this).trigger("click"); // emulate the click, so the cooki will be resaved
}
})
});';
print "\n";
print '</script>';
print '<style>';
print '.switchfolderperms{
cursor: pointer;
}';
print '</style>';
print '</div>'; print '</div>';
$parameters = array(); $parameters = array();

View File

@ -377,7 +377,7 @@ llxHeader("", $title);
if (!empty($id) || !empty($ref)) { if (!empty($id) || !empty($ref)) {
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1; $showbarcode = isModEnabled('barcode');
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
$showbarcode = 0; $showbarcode = 0;
} }