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

This commit is contained in:
Laurent Destailleur 2022-12-20 11:16:00 +01:00
commit 7eedcdd115
400 changed files with 6935 additions and 4619 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ default.properties
*.orig
Thumbs.db
/dolibarr_genesis.mp4
.phpunit.result.cache
# Log files
dolibarr_install.log
upgrade.log

View File

@ -49,7 +49,6 @@ NEW: Add employment anniversary in birthday box
NEW: Add extrafield type "IP" to store IP addresses
NEW: Add fail2ban rules examples to limit access to /public pages
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
NEW: Add free membership amounts at the membership type level
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
NEW: Add IMAP port setting on email collector module
NEW: Adding JAPAN Chart-of-Account and regions/departments
@ -67,7 +66,6 @@ NEW: Add option --force on CLI cron_run_jobs.php
NEW: Add option "Show price on the generated documents for receptions"
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
NEW: Add picto property on sub-module for password generation
NEW: Add price to product box in TakePOS
NEW: add redirect on action confirm addconsumedline and addproduceline
NEW: Add a new advanced permission "read price"
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
@ -89,18 +87,11 @@ NEW: Can set a commercial discount by entering amount including VAT
NEW: Can set a monthly frequency (or multiple) in cron tasks.
NEW: Can set start and end dates and comment on button "Activate all services"
NEW: can sort and preselected best supplier price
NEW: Website Can delete a whole website if disabled
NEW: Website Can remove a website template
NEW: Website can set header "Strict-Transport-Security" in web sites.
NEW: Website Can switch status of website and page from the website toolbar
NEW: Website Templates of websites are now directories and not zip into core repo
NEW: Website Add 4 other templates in website module
NEW: Can use products categories to make inventory
NEW: Change filter type on tickets list into a multiselect combo
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
NEW: constant PROPAL_NEW_AS_SIGNED
NEW: show date delivery planned on orders linked to company and product
NEW: default_lang for members
NEW: Default template of contract is not mandatory
NEW: Default values in extrafields are not more limited to 255 char.
NEW: display currency in takepos menu
@ -108,11 +99,21 @@ NEW: Enable online signature for interventions
NEW: Encrypt all sensitive constants in llx_const
NEW: extrafield price with currency
NEW: filter on reception dates (from / to) in cheque paiement card
NEW: TakePOS Header Scroll in TakePOS
NEW: TakePOS Add setup parameters, can setup terminal name
NEW: TakePOS support of Stripe Terminal with Takepos
NEW: TakePOS Receipt preview in TakePOS setup
NEW: TakePOS different product list on smartphone
NEW: Members: default_lang for members
NEW: Members: Table of membership types
NEW: Members: add free membership amounts at the membership type level
NEW: TakePOS: Header Scroll in TakePOS
NEW: TakePOS: add price to product box in TakePOS
NEW: TakePOS: add setup parameters, can setup terminal name
NEW: TakePOS: support of Stripe Terminal with TakePOS
NEW: TakePOS: Receipt preview in TakePOS setup
NEW: TakePOS: different product list on smartphone
NEW: Website: can delete a whole website if disabled
NEW: Website: can remove a website template
NEW: Website: can set header "Strict-Transport-Security" in web sites.
NEW: Website: can switch status of website and page from the website toolbar
NEW: Website: Templates of websites are now directories and not zip into core repo
NEW: Website: add 4 other templates in website module
NEW: If we select another view list mode, we keep it
NEW: Init module bookcal
NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
@ -121,7 +122,7 @@ NEW: invoice export : add accounting affectation
NEW: label on products categories filter
NEW: The link "add to bookmark" is always on top in the bookmark popup
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: Make module WebservicesClient deprecated. Use module WebHook instead
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
NEW: manage no email with thirdparties (better for GDPR)
NEW: Manage Position (Rank) on Contract Lines
NEW: Manage VAT on all lines on purchases cycle
@ -159,7 +160,6 @@ NEW: SMTP using oauth2 authentication
NEW: can substitue project title in mail template
NEW: Supplier order list - Add column private and public note
NEW: Support IP type in extrafields
NEW: Table of membership types
NEW: The purge of files can purge only if older than a number of seconds
NEW: Update ActionComm type_code on email message ticket
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
@ -209,6 +209,32 @@ Following changes may create regressions for some external modules, but were nec
* Rename the substitution for project label instead of project title in substitution variables
***** ChangeLog for 16.0.3 compared to 16.0.2 *****
FIX: $sign is useless
FIX: #18304 Member subscription confirmation email sent even if mandatory fields are missing
FIX: #19828
FIX: #19877
FIX: #22509 default value on integer fields don't retrieve by setSaveQuery
FIX: #22786
FIX: #22813
FIX: #22824 Accountancy - Journal - Search on subledger when list of subledger is disabled
FIX: Backup using the low memory mode
FIX: Bankaccounts API fetch with 'id' and 'socid'
FIX: base64_decode should be forbiden in dol_eval
FIX: Broken Permissions check, $object is null.
FIX: compute next value when year is on one digit for reset counter
FIX: copy same behaviour in other accountancy files
FIX: Fix the position of the verification condition of the test field in case of multi entities
FIX: for #22882
FIX: for #22952
FIX: merge errors on mailing card
FIX: PaymentBankTransfer Type page management with Select and Input on create.php
FIX: remove not initialized variable
FIX: SQL request parenthesis
FIX: Use the Hook addMoreActionsButtons resPrint
FIX: Wrong Extrafields Element For Assets
***** ChangeLog for 16.0.2 compared to 16.0.1 *****
FIX: 16.0 - computed extrafields are not displayed if the object has no other extrafields

View File

@ -6,9 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported |
| ---------- | ---------------------- |
| <= 15.0.0 | :x: |
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
| >= 16.0.0 | :white_check_mark: |
| <= 16.0.2 | :x: |
| >= 16.0.3 | :white_check_mark: |
| >= develop | :white_check_mark: |
## Reporting a Vulnerability

View File

@ -1,2 +0,0 @@
htdocs/install/doctemplates/websites/website_template-corporate.zip
htdocs/install/doctemplates/websites/website_template-stellar.zip

View File

@ -1,3 +1,3 @@
# Use bzip2 instead of gzip
compression = "bzip2"
compression-level = 9
# Force use of gzip compression by dpkg-buildpackage
compression = "gzip"
#compression-level = 9

View File

@ -678,7 +678,7 @@ if ($nboftargetok) {
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
print "Remove target $FILENAMETGZ.tgz...\n";
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
@ -1064,7 +1064,8 @@ if ($nboftargetok) {
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`;
#$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option
$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
next;
}
@ -1146,7 +1147,8 @@ if ($nboftargetok) {
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
#"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,15 @@
<VirtualHost *:80>
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
# Add this to use a custom apparmor profile when using apache php handler
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
ServerName myvirtualalias
@ -35,8 +36,8 @@
#AuthUserFile /etc/apache2/.htpasswd
#require valid-user
</Directory>
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
# Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
AuthType None
Require all granted

View File

@ -617,6 +617,7 @@ if ($action == 'create') {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// List of movements
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
@ -644,8 +645,8 @@ if ($action == 'create') {
print_liste_field_titre("AccountAccountingShort");
print_liste_field_titre("SubledgerAccount");
print_liste_field_titre("LabelOperation");
print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"');
print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"');
if (empty($object->date_validation)) {
print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
} else {
@ -664,14 +665,14 @@ if ($action == 'create') {
}
foreach ($object->linesmvt as $line) {
print '<tr class="oddeven">';
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
$total_debit += $line->debit;
$total_credit += $line->credit;
if ($action == 'update' && $line->id == $id) {
print '<!-- td columns in edit mode -->';
print '<td>';
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -697,7 +698,7 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') {
print '<!-- td columns in add mode -->';
print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -714,7 +715,7 @@ if ($action == 'create') {
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>';
}
} else {
print '<!-- td columns in display mode -->';
@ -732,8 +733,8 @@ if ($action == 'create') {
}
print '</td>';
print '<td>'.$line->label_operation.'</td>';
print '<td class="right nowraponall amount">'.price($line->debit).'</td>';
print '<td class="right nowraponall amount">'.price($line->credit).'</td>';
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
print '<td class="center nowraponall">';
if (empty($line->date_export) && empty($line->date_validation)) {

View File

@ -192,8 +192,8 @@ $arrayfields = array(
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
@ -942,7 +942,7 @@ if (count($filter)) {
$buttonLabel = $langs->trans("ExportList");
}
$parameters = array();
$parameters = array('param' => $param);
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -163,8 +163,8 @@ $arrayfields = array(
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
@ -642,7 +642,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$parameters = array();
$parameters = array('param' => $param);
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -844,7 +844,7 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
}
if (!empty($arrayfields['t.code_journal']['checked'])) {
print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
@ -1024,7 +1024,7 @@ while ($i < min($num, $limit)) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1120,7 +1120,7 @@ while ($i < min($num, $limit)) {
// Amount debit
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="right nowraponall amount">'.($line->debit ? price($line->debit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1132,7 +1132,7 @@ while ($i < min($num, $limit)) {
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="right nowraponall amount">'.($line->credit ? price($line->credit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -452,56 +452,6 @@ class AccountancyCategory // extends CommonObject
}
}
/**
* Function to fill ->lines_cptbk with accounting account used (into bookkeeping) and not yet into a custom group
*
* @param int $id Id of custom group
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*
public function getCptBK($id)
{
global $conf;
$sql = "SELECT DISTINCT t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte NOT IN ("; // account not into a custom group
$sql .= " SELECT t.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".((int) $id)." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN ("; // account into current chart of account
$sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity.")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
$this->lines_cptbk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
return $num;
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return -1;
}
}
*/
/**
* Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group
*
@ -743,7 +693,7 @@ class AccountancyCategory // extends CommonObject
}
$listofaccount .= "'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount).")";
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
} else {
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
}

View File

@ -987,8 +987,8 @@ class AccountingJournal extends CommonObject
$langs->transnoentitiesnoconv("LedgerAccount"),
$langs->transnoentitiesnoconv("SubledgerAccount"),
$langs->transnoentitiesnoconv("Label"),
$langs->transnoentitiesnoconv("Debit"),
$langs->transnoentitiesnoconv("Credit"),
$langs->transnoentitiesnoconv("AccountingDebit"),
$langs->transnoentitiesnoconv("AccountingCredit"),
$langs->transnoentitiesnoconv("Journal"),
$langs->transnoentitiesnoconv("Note"),
);
@ -998,8 +998,8 @@ class AccountingJournal extends CommonObject
$langs->transnoentitiesnoconv("Piece"),
$langs->transnoentitiesnoconv("AccountAccounting"),
$langs->transnoentitiesnoconv("LabelOperation"),
$langs->transnoentitiesnoconv("Debit"),
$langs->transnoentitiesnoconv("Credit"),
$langs->transnoentitiesnoconv("AccountingDebit"),
$langs->transnoentitiesnoconv("AccountingCredit"),
);
} elseif ($this->nature == 1) {
$header = array(
@ -1007,8 +1007,8 @@ class AccountingJournal extends CommonObject
$langs->transnoentitiesnoconv("Piece"),
$langs->transnoentitiesnoconv("AccountAccounting"),
$langs->transnoentitiesnoconv("LabelOperation"),
$langs->transnoentitiesnoconv("Debit"),
$langs->transnoentitiesnoconv("Credit"),
$langs->transnoentitiesnoconv("AccountingDebit"),
$langs->transnoentitiesnoconv("AccountingCredit"),
);
}

View File

@ -189,7 +189,7 @@ print '<script type="text/javascript">
/*
* Customer Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
@ -199,7 +199,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " s.code_compta as code_compta_client,";
$sql .= " s.code_compta_fournisseur,";
}
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
} else {

View File

@ -496,7 +496,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
@ -912,8 +912,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
print "\n";
@ -1136,8 +1136,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("PaymentMode")."</td>";
print '<td class="right">'.$langs->trans("Debit")."</td>";
print '<td class="right">'.$langs->trans("Credit")."</td>";
print '<td class="right">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
@ -1162,19 +1162,24 @@ if (empty($action) || $action == 'view') {
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
// Date
print "<td>".$date."</td>";
print "<td>".$ref."</td>";
// Ref
print "<td>".dol_escape_htmltag($ref)."</td>";
// Ledger account
print "<td>";
$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
} else {
print $accounttoshow;
$accounttoshow = '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
print '<td class="maxwidth300">';
/*$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
@ -1182,9 +1187,12 @@ if (empty($action) || $action == 'view') {
}
else print $accounttoshow;*/
print "</td>";
print "<td>";
print $reflabel;
// Label operation
print '<td>';
print $reflabel; // This is already html escaped content
print "</td>";
print '<td class="center">'.$val["type_payment"]."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
@ -1208,10 +1216,14 @@ if (empty($action) || $action == 'view') {
print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
// Date
print "<td>".$date."</td>";
print "<td>".$ref."</td>";
// Ref
print "<td>".dol_escape_htmltag($ref)."</td>";
// Ledger account
print "<td>";
$account_ledger = $k;
// Try to force general ledger account depending on type
if ($tabtype[$key] == 'payment') {
@ -1240,9 +1252,9 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'unknown') {
// We will accept writing, but into a waiting account
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') {
print '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
$accounttoshow = '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
} else {
print '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
$accounttoshow = '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
}
} else {
// We will refuse writing
@ -1265,15 +1277,15 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'member') {
$errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
}
print '<span class="error small">'.$langs->trans($errorstring).'</span>';
$accounttoshow = '<span class="error small">'.$langs->trans($errorstring).'</span>';
}
} else {
print $accounttoshow;
}
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
$accounttoshowsubledger = '';
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payments that uses a subledger
$accounttoshowsubledger = length_accounta($k);
if ($accounttoshow != $accounttoshowsubledger) {
@ -1285,18 +1297,20 @@ if (empty($action) || $action == 'view') {
if (!empty($tabcompany[$key]['code_compta'])) {
if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {
// For such case, if subledger is not defined, we won't use subledger accounts.
print '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
} else {
print '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
}
} else {
print '<span class="error small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
$accounttoshowsubledger = '<span class="error small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
}
} else {
print $accounttoshowsubledger;
}
} else {
$accounttoshowsubledger = '';
}
}
print '<td class="maxwidth300">';
print $accounttoshowsubledger;
print "</td>";
print "<td>".$reflabel."</td>";
@ -1401,9 +1415,19 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = '';
if ($typerecord == 'payment') {
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]);
if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
$sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref";
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
$sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture";
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture";
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
} else {
$sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref";
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
$sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
}
$ref = $langs->transnoentitiesnoconv("Invoice");
} elseif ($typerecord == 'payment_supplier') {
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';

View File

@ -445,8 +445,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$langs->transnoentitiesnoconv("Piece").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("LabelOperation").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep;
print "\n";
foreach ($taber as $key => $val) {
@ -569,8 +569,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="right">'.$langs->trans("Debit")."</td>";
print '<td class="right">'.$langs->trans("Credit")."</td>";
print '<td class="right">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';

View File

@ -833,8 +833,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("Debit")."</td>";
print '<td class="center">'.$langs->trans("Credit")."</td>";
print '<td class="center">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';

View File

@ -776,8 +776,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("Debit")."</td>";
print '<td class="center">'.$langs->trans("Credit")."</td>";
print '<td class="center">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';

View File

@ -286,8 +286,8 @@ print '<td>' . $langs->trans("AccountAccounting") . '</td>';
print '<td>' . $langs->trans("SubledgerAccount") . '</td>';
print '<td>' . $langs->trans("LabelOperation") . '</td>';
if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank
print '<td class="right">' . $langs->trans("Debit") . '</td>';
print '<td class="right">' . $langs->trans("Credit") . '</td>';
print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>';
print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>';
print "</tr>\n";
if (is_array($journal_data) && !empty($journal_data)) {

View File

@ -49,7 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
$search_lineid = GETPOST('search_lineid', 'int');
$search_ref = GETPOST('search_ref', 'alpha');
$search_invoice = GETPOST('search_invoice', 'alpha');
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
//$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
@ -113,7 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_ref_supplier = '';
//$search_ref_supplier = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
@ -194,9 +194,9 @@ print '<script type="text/javascript">
/*
* Supplier Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.type as ftype, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
$sql .= " aa.rowid as fk_compte, aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
@ -236,11 +236,11 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
}
if (strlen(trim($search_ref_supplier))) {
/*if (strlen(trim($search_ref_supplier))) {
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
}
}*/
if (strlen(trim($search_label))) {
$sql .= natural_search("f.libelle", $search_label);
}
@ -333,9 +333,9 @@ if ($result) {
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
}
if ($search_ref_supplier) {
/*if ($search_ref_supplier) {
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
}
}*/
if ($search_label) {
$param .= "&search_label=".urlencode($search_label);
}
@ -400,7 +400,7 @@ if ($result) {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
@ -416,11 +416,11 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
@ -429,7 +429,7 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -478,8 +478,8 @@ if ($result) {
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
$accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label_account;
@ -492,12 +492,18 @@ if ($result) {
print '<td>'.$objp->rowid.'</td>';
// Ref Invoice
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1);
if ($objp->ref_supplier) {
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
}
print '</td>';
// Ref supplier invoice
/*
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '</td>';
*/
// Supplier invoice label
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';

View File

@ -289,14 +289,14 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
}
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
}
if (strlen(trim($search_ref_supplier))) {
/*if (strlen(trim($search_ref_supplier))) {
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
}
}*/
if (strlen(trim($search_label))) {
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
}
@ -490,7 +490,7 @@ if ($result) {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
@ -506,7 +506,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
@ -521,7 +521,7 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -648,16 +648,20 @@ if ($result) {
print '<td>'.$facturefourn_static_det->id.'</td>';
// Ref Invoice
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
// Ref supplier invoice
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
if ($objp->ref_supplier) {
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
}
print '</td>';
// Ref supplier invoice
/*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '</td>';*/
// Supplier invoice label
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print $objp->invoice_label;
print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print dol_escape_htmltag($objp->invoice_label);
print '</td>';
// Date
@ -669,11 +673,11 @@ if ($result) {
print $product_static->getNomUrl(1);
}
if ($product_static->label) {
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
}
print '</td>';
// Description
// Description of line
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -686,11 +690,11 @@ if ($result) {
// Vat rate
$code_vat_differ = '';
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($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 = 'warning bold';
}
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($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 = 'warning bold';
//}
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
print vatrate($facturefourn_static_det->tva_tx.($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.')' : ''), false, 0, 0, 1);
print '</td>';
// Thirdparty

View File

@ -234,7 +234,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
// Can edit
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("CanEditAmount");
print $langs->trans("CanEditAmountDetail");
print '</td><td>';
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
print "</td></tr>\n";

View File

@ -620,7 +620,8 @@ if (empty($reshook)) {
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->delete($id, $user);
if ($result > 0) {
if (!empty($backtopage)) {
setEventMessages($langs->trans("RecordDeleted"), null, 'errors');
if (!empty($backtopage) && !preg_match('/'.preg_quote($_SERVER["PHP_SELF"], '/').'/', $backtopage)) {
header("Location: ".$backtopage);
exit;
} else {

View File

@ -319,7 +319,7 @@ class AdherentType extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->morphy)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog("Adherent_type::create", LOG_DEBUG);

View File

@ -383,14 +383,18 @@ class Members extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (!$member->delete($member->id, DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting member');
$res = $member->delete($member->id, DolibarrApiAccess::$user);
if ($res < 0) {
throw new RestException(500, "Can't delete, error occurs");
} elseif ($res == 0) {
throw new RestException(409, "Can't delete, that product is probably used");
}
return array(
'success' => array(
'code' => 200,
'message' => 'member deleted'
'message' => 'Member deleted'
)
);
}

View File

@ -229,14 +229,17 @@ class MembersTypes extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (!$membertype->delete()) {
throw new RestException(401, 'error when deleting member type');
$res = $membertype->delete();
if ($res < 0) {
throw new RestException(500, "Can't delete, error occurs");
} elseif ($res == 0) {
throw new RestException(409, "Can't delete, that product is probably used");
}
return array(
'success' => array(
'code' => 200,
'message' => 'member type deleted'
'message' => 'Member type deleted'
)
);
}

View File

@ -215,14 +215,17 @@ class Subscriptions extends DolibarrApi
throw new RestException(404, 'Subscription not found');
}
if (!$subscription->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting subscription');
$res = $subscription->delete(DolibarrApiAccess::$user);
if ($res < 0) {
throw new RestException(500, "Can't delete, error occurs");
} elseif ($res == 0) {
throw new RestException(409, "Can't delete, that product is probably used");
}
return array(
'success' => array(
'code' => 200,
'message' => 'subscription deleted'
'message' => 'Subscription deleted'
)
);
}

View File

@ -843,7 +843,7 @@ if (!empty($arrayfields['d.statut']['checked'])) {
Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"),
Adherent::STATUS_EXCLUDED =>$langs->trans("MemberStatusExcludedShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -3);
print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
print '</td>';
}
if (!empty($arrayfields['d.import_key']['checked'])) {

View File

@ -101,14 +101,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
$canadduser = ($user->admin || $user->hasRight("user", "user", "creer"));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "creer"))
|| (($user->id != $object->user_id) && $user->hasRight("user", "user", "creer")));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "password"))
|| (($user->id != $object->user_id) && $user->hasRight("user", "user", "password")));
}
}
@ -641,7 +641,7 @@ if ($rowid > 0) {
print '</td>';
if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) {
print '<td class="right">';
if ($user->rights->user->user->creer) {
if ($user->hasRight("user", "user", "creer")) {
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
}
print '</td>';

View File

@ -81,6 +81,7 @@ $duration_unit = GETPOST('duration_unit', 'alpha');
$vote = GETPOST("vote", "int");
$comment = GETPOST("comment", 'restricthtml');
$mail_valid = GETPOST("mail_valid", 'restricthtml');
$caneditamount = GETPOSTINT("caneditamount");
// Security check
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
@ -124,11 +125,11 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
$object->status = (int) $status;
$object->subscription = (int) $subscription;
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
$object->caneditamount = GETPOSTINT("caneditamount");
$object->caneditamount = $caneditamount;
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
$object->note_public = trim($comment);
$object->note_private = '';
$object->mail_valid = trim($mail_valid);
$object->vote = (int) $vote;
@ -142,7 +143,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
} else {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle = '".$db->escape($object->label)."'";
$sql .= " WHERE entity IN (".getEntity('member_type').")";
$result = $db->query($sql);
$num = null;
@ -183,8 +184,8 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->caneditamount = $caneditamount;
$object->duration_value = $duration_value;
$object->duration_unit = $duration_unit;
$object->note = trim($comment);
$object->note_public = trim($comment);
$object->note_private = '';
$object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote);
@ -390,8 +391,8 @@ if ($action == 'create') {
print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
print '</td></tr>';
print '<tr><td>'.$langs->trans("CanEditAmount").'</td><td>';
print $form->selectyesno("caneditamount", 0, 1);
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
@ -832,7 +833,7 @@ if ($rowid > 0) {
print '</td></tr>';
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
print $form->selectyesno("caneditamount", $object->caneditamount);
print $form->selectyesno("caneditamount", $object->caneditamount, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';

View File

@ -279,13 +279,13 @@ while ($i <= $MAXAGENDA) {
print '</td>';
// Calendar active by default
print '<td class="nowrap right">';
if ($conf->use_javascript_ajax) {
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
} else {
if (empty($conf->global->{$default})) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
} else {
if (getDolGlobalString($default)) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Enabled"), 'on') . '</a>';
}
}
print '</td>';

View File

@ -0,0 +1,114 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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/admin/bomline_extrafields.php
* \ingroup bom
* \brief Page to setup extra fields of BOM
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/bom/lib/bom.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array('mrp', 'admin'));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'bom_bomline';
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
require DOL_DOCUMENT_ROOT . '/core/actions_extrafields.inc.php';
/*
* View
*/
$help_url = '';
llxHeader('', $langs->trans("BOMLinesSetup"), $help_url);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("BOMLinesSetup"), $linkback, 'title_setup');
$head = bomAdminPrepareHead();
print dol_get_fiche_head($head, 'bomline_extrafields', $langs->trans("ExtraFields"), -1, 'account');
require DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '<div class="tabsAction">';
print '<a class="butAction reposition" href="' . $_SERVER["PHP_SELF"] . '?action=create">' . $langs->trans("NewAttribute") . '</a>';
print "</div>";
}
/*
* Creation of an optional field
*/
if ($action == 'create') {
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php';
}
/*
* Edition of an optional field
*/
if ($action == 'edit' && !empty($attrname)) {
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page
llxFooter();
$db->close();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -357,7 +357,7 @@ foreach ($boxtoadd as $box) {
// For each possible position, an activation link is displayed if the box is not already active for that position
print '<td class="center">';
print $form->selectarray("boxid[".$box->box_id."][pos]", $arrayofhomepages, -1, 1, 0, 0, '', 1)."\n";
print $form->selectarray("boxid[".$box->box_id."][pos]", $arrayofhomepages, -1, 1, 0, 0, '', 1, 0, 0, '', 'minwidth75', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';

View File

@ -94,6 +94,7 @@ $head = company_admin_prepare_head();
print dol_get_fiche_head($head, 'socialnetworks', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."</span><br>\n";
print '<span class="opacitymedium">'.$langs->trans("MoreNetworksAvailableWithModule")."</span><br>\n";
print "<br>\n";

View File

@ -518,7 +518,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowOnlineSign").'</td>';
print '<td class="center">';
if ($conf->global->CONTRACT_ALLOW_ONLINESIGN) {
if (getDolGlobalString('CONTRACT_ALLOW_ONLINESIGN')) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=allowonlinesign&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activited"), 'switch_on');
print '</a>';

View File

@ -1966,7 +1966,7 @@ if ($id > 0) {
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
}
} elseif ($value == 'recuperableonly' || $value == 'deductible' || $value == 'category_type') {
$valuetoshow = yn($valuetoshow);
$valuetoshow = yn($valuetoshow ? 1 : 0);
$class = "center";
} elseif ($value == 'type_cdr') {
if (empty($valuetoshow)) {

View File

@ -110,11 +110,11 @@ print dol_get_fiche_head($head, 'audit', '', -1);
print '<br>';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print getTitleFieldOfList("TrackableSecurityEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print "</tr>\n";
print '</tr>'."\n";
// Loop on each event type
foreach ($eventstolog as $key => $arr) {
if ($arr['id']) {
@ -129,12 +129,12 @@ foreach ($eventstolog as $key => $arr) {
}
print '</table>';
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" name="save" class="button button-save" value="'.$langs->trans("Save").'">';
print '</div>';
print dol_get_fiche_end();
print "</form>\n";
// End of page

View File

@ -743,7 +743,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";

View File

@ -100,7 +100,7 @@ foreach ($modules as $const => $desc) {
exit;
}
if ($action == 'disable_'.strtolower($const)) {
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const, $conf->entity);
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "0", 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
@ -172,7 +172,7 @@ if (empty($conf->use_javascript_ajax)) {
print '<br><span class="warning">'.$langs->trans("FCKeditorForProductDetails2").'</span>';
}
print '</td>';
print '<td class="center" width="100">';
print '<td class="center centpercent">';
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
if ($value == 0) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';

View File

@ -51,8 +51,19 @@ if ($action == 'setvalue') {
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO', 'alpha');
$checkread = GETPOST('value', 'alpha');
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY', 'alpha');
$mailingdelay = GETPOST('MAILING_DELAY', 'int');
$contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int');
if (GETPOST('MAILING_DELAY', 'alpha') != '') {
$mailingdelay = price2num(GETPOST('MAILING_DELAY', 'alpha'), 3); // Not less than 1 millisecond.
} else {
$mailingdelay = '';
}
// Clean data
if ((float) $mailingdelay > 10) {
$mailingdelay = 10;
}
if (GETPOST('MAILING_DELAY', 'alpha') != '' && GETPOST('MAILING_DELAY', 'alpha') != '0' && (float) $mailingdelay < 0.001) {
$mailingdelay = 0.001;
}
$res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
@ -148,7 +159,7 @@ print '<td class="hideonsmartphone"><span class="opacitymedium">webmaster@exampl
print '</tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MailingDelay").'</td><td>';
print $form->textwithpicto($langs->trans("MailingDelay"), $langs->trans("IfDefinedUseAValueBeetween", '0.001', '10')).'</td><td>';
print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
print '</td>';
print '<td class="hideonsmartphone"></td>';

View File

@ -246,17 +246,17 @@ if ($reshook == 0) {
}
}
$id = 25;
$acceptlocallinktomedia = (acceptLocalLinktoMedia() > 0 ? 1 : 0);
// Security
if (!empty($user->socid)) {
accessforbidden();
}
$permissiontoadd = 1;
//asort($elementList);
$id = 25;
$permissiontodelete = 1;
@ -294,8 +294,8 @@ if (empty($reshook)) {
$search_array_options = array();
}
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
// Actions add or modify an email template
if ((GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) && $permissiontoadd) {
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
@ -512,7 +512,7 @@ if (empty($reshook)) {
}
}
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontodelete) { // delete
$rowidcol = "rowid";
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid);
@ -531,7 +531,7 @@ if (empty($reshook)) {
}
// activate
if ($action == $acts[0]) {
if ($action == $acts[0] && $permissiontoadd) {
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
@ -543,7 +543,7 @@ if (empty($reshook)) {
}
// disable
if ($action == $acts[1]) {
if ($action == $acts[1] && $permissiontoadd) {
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
@ -828,7 +828,8 @@ if ($action == 'create') {
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$okforextended = false;
}
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1);
}
print '</td>';
@ -912,17 +913,17 @@ foreach ($fieldlist as $field => $value) {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') {
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>';
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150', 1);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth125', 1);
print '</td>';
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
} elseif ($value == 'type_template') {
print '<td class="liste_titre center">';
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100 maxwidth125', 1, '', 0, 1);
print '</td>';
} elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>';
@ -1061,46 +1062,13 @@ if ($num) {
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
}
// If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email).
// Note that local link to a file into medias are replaced with a real link by email in CMailFile.class.php with value $urlwithroot defined like this:
// $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
// $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$acceptlocallinktomedia = getDolGlobalInt('MAIN_DISALLOW_MEDIAS_IN_EMAIL_TEMPLATES') ? 0 : 1;
if ($acceptlocallinktomedia) {
global $dolibarr_main_url_root;
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
// Parse $newUrl
$newUrlArray = parse_url($urlwithouturlroot);
$hosttocheck = $newUrlArray['host'];
$hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6
if (function_exists('gethostbyname')) {
$iptocheck = gethostbyname($hosttocheck);
} else {
$iptocheck = $hosttocheck;
}
//var_dump($iptocheck.' '.$acceptlocallinktomedia);
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
// If ip of public url is an private network IP, we do not allow this.
$acceptlocallinktomedia = 0;
// TODO Show a warning
}
if (preg_match('/http:/i', $urlwithouturlroot)) {
// If public url is not a https, we do not allow to add medias link. It will generate security alerts when email will be sent.
$acceptlocallinktomedia = 0;
// TODO Show a warning
}
}
if ($tmpfieldlist == 'content') {
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$okforextended = false;
}
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
}

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
$langs->loadLangs(array('admin', 'companies', 'languages', 'members', 'other', 'products', 'stocks', 'trips'));
if (!$user->admin) {
accessforbidden();
@ -276,7 +276,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
if (empty($selected)) {

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips'));
if (!$user->admin) {
accessforbidden();
@ -69,6 +70,9 @@ if ($action == 'update') {
dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
}
if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
@ -135,7 +139,7 @@ if (isModEnabled('facture')) {
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
@ -159,11 +163,21 @@ if (isModEnabled('facture')) {
}
print '</td></tr>';
// Mention category of operations
// French Decret n°2099-1299 2022-10-07
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
print '</td><td>';
$arrval = array('0'=>$langs->trans("No"),
'1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
'2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
);
print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, $conf->global->INVOICE_CATEGORY_OF_OPERATION, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
@ -181,7 +195,7 @@ if (isModEnabled('reception')) {
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");

View File

@ -271,8 +271,8 @@ print '</div>';
print '</form>';
//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
// Patter for Password Perso
// Pattern for Password Perso
if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
print '<br>';
@ -320,10 +320,10 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
print '</table>';
print '<br>';
print '<div class="center">';
print '<a class="button button-save" id="linkChangePattern">'.$langs->trans("Save").'</a>';
print '</div>';
print '<br><br>';
print '<script type="text/javascript">';
@ -392,7 +392,7 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
print '<td class="center">'.$langs->trans("Activated").'</td>';
print '<td class="center">'.$langs->trans("Action").'</td>';
print '<td class="center"></td>';
print '</tr>';
// Disable clear password in database

View File

@ -115,15 +115,15 @@ print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent nomarginbottom">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("MaxSizeForUploadedFiles").'.';
print '<td>'.$langs->trans("MaxSizeForUploadedFiles").'.';
$max = @ini_get('upload_max_filesize');
if (isset($max)) {
print ' '.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.';
print '<br><span class="opacitymedium">'.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.</span>';
} else {
print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.';
}
@ -135,8 +135,8 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UMask").'</td><td class="right">';
print $form->textwithpicto('', $langs->trans("UMaskExplanation"));
print '<td>';
print $form->textwithpicto($langs->trans("UMask"), $langs->trans("UMaskExplanation"));
print '</td>';
print '<td class="nowrap">';
print '<input class="flat" name="MAIN_UMASK" type="text" size="6" value="'.dol_escape_htmltag($conf->global->MAIN_UMASK).'">';
@ -146,7 +146,7 @@ print '</tr>';
// Use anti virus
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("AntiVirusCommand").'<br>';
print '<td>'.$langs->trans("AntiVirusCommand").'<br>';
print '<span class="opacitymedium">'.$langs->trans("AntiVirusCommandExample").'</span>';
// Check command in inside safe_mode
print '</td>';
@ -170,7 +170,7 @@ print '</tr>';
// Use anti virus
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
print '<td>'.$langs->trans("AntiVirusParam").'<br>';
print '<span class="opacitymedium">'.$langs->trans("AntiVirusParamExample").'</span>';
print '</td>';
print '<td>';
@ -198,7 +198,9 @@ $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestF
// List of document
$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1);
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
if (count($filearray) > 0) {
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
}
// End of page
llxFooter();

View File

@ -180,7 +180,7 @@ if (ini_get("session.gc_probability") == 0) {
}
print '</td>';
print '<td class="nowrap">';
print '<input class="flat right width50" name="MAIN_SESSION_TIMEOUT" type="text" value="'.dol_escape_htmltag($conf->global->MAIN_SESSION_TIMEOUT).'"> '.strtolower($langs->trans("Seconds"));
print '<input class="flat right width50" name="MAIN_SESSION_TIMEOUT" type="text" value="'.getDolGlobalInt('MAIN_SESSION_TIMEOUT').'"> '.strtolower($langs->trans("Seconds"));
print '</td>';
print '</tr>';
@ -188,7 +188,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MaxNumberOfImagesInGetPost").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT" type="text" value="'.dol_escape_htmltag($conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT).'"> '.strtolower($langs->trans("Images"));
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT" type="text" value="'.getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT').'"> '.strtolower($langs->trans("Images"));
print '</td>';
print '</tr>';
@ -196,7 +196,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000).'">';
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200).'"> '.strtolower($langs->trans("Posts"));
print '</td>';
print '</tr>';
@ -204,7 +204,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MaxNumberOfAttachementOnForms").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).'">';
print '<input class="flat right width50" name="MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS" type="text" value="'.getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).'"> '.strtolower($langs->trans("Files"));
print '</td>';
print '</tr>';

View File

@ -312,6 +312,32 @@ print yn(empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? 0 : 1);
print '<br>';
print '<br>';
$sessiontimeout = ini_get("session.gc_maxlifetime");
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) {
$conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout;
}
print '<strong>'.$langs->trans("SessionTimeOut").'</strong>';
if (ini_get("session.gc_probability") == 0) {
print $form->textwithpicto('', $langs->trans("SessionsPurgedByExternalSystem", ini_get("session.gc_maxlifetime")));
} else {
print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"), ini_get("session.gc_maxlifetime")));
}
print ': '.getDolGlobalInt('MAIN_SESSION_TIMEOUT').' '.strtolower($langs->trans("Seconds"));
print '<br><br>';
print '<strong>'.$langs->trans("MaxNumberOfImagesInGetPost").'</strong>: ';
print getDolGlobalInt('MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT').' '.strtolower($langs->trans("Images"));
print '<br><br>';
print '<strong>'.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").'</strong>: ';
print getDolGlobalInt('MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS', 200).' '.strtolower($langs->trans("Posts"));
print '<br><br>';
print '<strong>'.$langs->trans("MaxNumberOfAttachementOnForms").'</strong>: ';
print getDolGlobalInt("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 10).' '.strtolower($langs->trans("Files"));
print '<br><br>';
print '<strong>'.$langs->trans("DoNotStoreClearPassword").'</strong>: ';
print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' ';
print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1);

View File

@ -506,6 +506,11 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
}
$objectType = $modulepart;
if (! empty($object->id) && ! empty($object->table_element)) {
$objectType = $object->table_element;
}
$filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
if (empty($filearray)) {
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
@ -513,11 +518,14 @@ class Documents extends DolibarrApi
if (($object->id) > 0 && !empty($modulepart)) {
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($this->db);
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id));
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $objectType, 't.src_object_id' => $object->id));
if ($result < 0) {
throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror());
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
$filearray['ecmfiles_infos'] = $ecmfile->lines;
$count = count($filearray);
for ($i = 0 ; $i < $count ; $i++) {
if ($filearray[$i]['name'] == $ecmfile->lines[$i]->filename) $filearray[$i] = array_merge($filearray[$i], (array) $ecmfile->lines[0]);
}
}
}
}

View File

@ -176,9 +176,9 @@ if ($action === 'downloadblockchain') {
if (!$error) {
// Now restart request with all data = no limit(1) in sql request
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
$sql = "SELECT rowid, date_creation, tms, user_fullname, action, amounts, element, fk_object, date_object, ref_object, signature, fk_user, object_data, object_version";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " WHERE entity = ".((int) $conf->entity);
if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0) {
$dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 1);
$datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 12);
@ -204,6 +204,7 @@ if ($action === 'downloadblockchain') {
.';'.$langs->transnoentities('Fingerprint')
.';'.$langs->transnoentities('Status')
.';'.$langs->transnoentities('Note')
.';'.$langs->transnoentities('Version')
.';'.$langs->transnoentities('FullData')
."\n";
@ -226,6 +227,7 @@ if ($action === 'downloadblockchain') {
$block_static->fk_user = $obj->fk_user;
$block_static->signature = $obj->signature;
$block_static->object_data = $block_static->dolDecodeBlockedData($obj->object_data);
$block_static->object_version = $obj->object_version;
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
@ -257,6 +259,7 @@ if ($action === 'downloadblockchain') {
print ';'.$obj->signature;
print ';'.$statusofrecord;
print ';'.$statusofrecordnote;
print ';'.$obj->object_version;
print ';"'.str_replace('"', '""', $obj->object_data).'"';
print "\n";

View File

@ -57,7 +57,7 @@ $langs->loadLangs(array("admin"));
top_httphead();
print '<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
print '<div id="pop-info"><table height="80%" class="border centpercent"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
print '<tbody>';
if ($block->fetch($id) > 0) {

View File

@ -204,6 +204,7 @@ class BlockedLog
}
// Add more action to track from a conf variable
// For example: STOCK_MOVEMENT,...
if (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED)) {
$tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED);
foreach ($tmparrayofmoresupportedevents as $val) {
@ -305,6 +306,15 @@ class BlockedLog
} else {
$this->error++;
}
} elseif ($this->element === 'stockmouvement') {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$object = new MouvementStock($this->db);
if ($object->fetch($this->fk_object) > 0) {
return $object->getNomUrl(1);
} else {
$this->error++;
}
} elseif ($this->action == 'MODULE_SET') {
return '<i class="opacitymedium">'.$langs->trans("BlockedLogEnabled").'</i>';
} elseif ($this->action == 'MODULE_RESET') {
@ -378,9 +388,14 @@ class BlockedLog
$this->date_object = $object->dateh;
} elseif ($object->element == 'cashcontrol') {
$this->date_object = $object->date_creation;
} else {
} elseif (property_exists($object, 'date')) {
// Generic case
$this->date_object = $object->date;
} elseif (property_exists($object, 'datem')) {
// Generic case (second chance, for example for stock movement)
$this->date_object = $object->datem;
}
// ref
$this->ref_object = ((!empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases
// type of object
@ -395,11 +410,18 @@ class BlockedLog
$arrayoffieldstoexclude = array(
'table_element', 'fields', 'ref_previous', 'ref_next', 'origin', 'origin_id', 'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id',
'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged',
'array_languages',
'childtables',
'contact_ids',
'context',
'labelStatus',
'labelStatusShort',
'linkedObjectsIds',
'linkedObjects',
'fk_delivery_address',
'context',
'projet' // There is already ->fk_project
'projet', // There is already ->fk_project
'restrictiononfksoc',
'specimen',
);
// Add more fields to exclude depending on object type
if ($this->element == 'cashcontrol') {
@ -428,7 +450,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->thirdparty->{$key} = $value;
$this->object_data->thirdparty->$key = $value;
}
}
}
@ -448,7 +470,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->mycompany->{$key} = $value;
$this->object_data->mycompany->$key = $value;
}
}
}
@ -486,12 +508,12 @@ class BlockedLog
}
if (!is_object($valueline) && !is_null($valueline) && $valueline !== '') {
$this->object_data->invoiceline[$lineid]->{$keyline} = $valueline;
$this->object_data->invoiceline[$lineid]->$keyline = $valueline;
}
}
}
} elseif (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
@ -509,7 +531,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
@ -601,7 +623,7 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$paymentpart->thirdparty->{$key} = $value;
$paymentpart->thirdparty->$key = $value;
}
}
}
@ -625,11 +647,11 @@ class BlockedLog
}
if (!is_object($value) && !is_null($value) && $value !== '') {
if ($this->element == 'payment_donation') {
$paymentpart->donation->{$key} = $value;
$paymentpart->donation->$key = $value;
} elseif ($this->element == 'payment_various') {
$paymentpart->various->{$key} = $value;
$paymentpart->various->$key = $value;
} else {
$paymentpart->invoice->{$key} = $value;
$paymentpart->invoice->$key = $value;
}
}
}
@ -664,21 +686,30 @@ class BlockedLog
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} else // Generic case
{
} elseif ($this->element == 'stockmouvement') {
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
$this->object_data->$key = $value;
}
}
} else {
// Generic case
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->$key = $value;
}
}
@ -687,6 +718,10 @@ class BlockedLog
}
}
// A trick to be sure all the object_data is an associative array
// json_encode and json_decode are not able to manage mixed object (with array/object, only full arrays or full objects)
$this->object_data = json_decode(json_encode($this->object_data, JSON_FORCE_OBJECT), false);
return 1;
}
@ -754,21 +789,42 @@ class BlockedLog
}
/**
* Encode data
*
* @param string $data Data to serialize
* @param string $mode 0=serialize, 1=json_encode
* @return string Value serialized, an object (stdClass)
*/
public function dolEncodeBlockedData($data, $mode = 0)
{
try {
$aaa = json_encode($data);
} catch (Exception $e) {
//print $e->getErrs);
}
//var_dump($aaa);
return $aaa;
}
/**
* Decode data
*
* @param string $data Data to unserialize
* @param string $mode 0=unserialize, 1=json_decode
* @return string Value unserialized
* @return object Value unserialized, an object (stdClass)
*/
public function dolDecodeBlockedData($data, $mode = 0)
{
try {
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$aaa = unserialize($data);
$aaa = (object) jsonOrUnserialize($data);
} catch (Exception $e) {
//print $e->getErrs);
}
//var_dump($aaa);
return $aaa;
}
@ -833,6 +889,9 @@ class BlockedLog
$this->date_creation = dol_now();
$this->object_version = ((float) DOL_VERSION);
$this->db->begin();
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done
@ -874,7 +933,7 @@ class BlockedLog
$sql .= $this->fk_object.",";
$sql .= "'".$this->db->idate($this->date_object)."',";
$sql .= "'".$this->db->escape($this->ref_object)."',";
$sql .= "'".$this->db->escape(serialize($this->object_data))."',";
$sql .= "'".$this->db->escape($this->dolEncodeBlockedData($this->object_data))."',";
$sql .= "'".$this->db->escape($this->object_version)."',";
$sql .= "0,";
$sql .= $this->fk_user.",";
@ -882,6 +941,14 @@ class BlockedLog
$sql .= ($this->entity ? $this->entity : $conf->entity);
$sql .= ")";
/*
$a = serialize($this->object_data); $a2 = unserialize($a); $a4 = print_r($a2, true);
$b = json_encode($this->object_data); $b2 = json_decode($b); $b4 = print_r($b2, true);
var_dump($a4 == print_r($this->object_data, true) ? 'a=a' : 'a not = a');
var_dump($b4 == print_r($this->object_data, true) ? 'b=b' : 'b not = b');
exit;
*/
$res = $this->db->query($sql);
if ($res) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."blockedlog");
@ -921,7 +988,7 @@ class BlockedLog
$keyforsignature = $this->buildKeyForSignature();
//$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
$signature = dol_hash($previoushash.$keyforsignature, '5');
$signature = dol_hash($previoushash.$keyforsignature, 'sha256');
//var_dump($previoushash); var_dump($keyforsignature); var_dump($signature_line); var_dump($signature);
$res = ($signature === $this->signature);
@ -953,8 +1020,8 @@ class BlockedLog
private function buildKeyForSignature()
{
//print_r($this->object_data);
if (((int) $this->object_version) > 12) {
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true);
if (((int) $this->object_version) >= 18) {
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.json_encode($this->object_data, JSON_FORCE_OBJECT);
} else {
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true);
}
@ -975,7 +1042,7 @@ class BlockedLog
$previoussignature = '';
$sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity=".$conf->entity;
$sql .= " WHERE entity = ".((int) $conf->entity);
if ($beforeid) {
$sql .= " AND rowid < ".(int) $beforeid;
}
@ -1036,7 +1103,7 @@ class BlockedLog
WHERE entity=".$conf->entity." AND certified = 1";
} else {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity." AND element='".$this->db->escape($element)."'";
WHERE entity=".$conf->entity." AND element = '".$this->db->escape($element)."'";
}
if ($fk_object) {

View File

@ -151,6 +151,7 @@ if (empty($reshook)) {
if ($action == 'addline' && $user->rights->bom->write) {
$langs->load('errors');
$error = 0;
$predef = '';
// Set if we used free entry or predefined product
$bom_child_id = (int) GETPOST('bom_id', 'int');
@ -194,7 +195,18 @@ if (empty($reshook)) {
}
if (!$error) {
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit);
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
// Unset extrafield
if (is_array($extralabelsline)) {
// Get extra fields
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_".$key]);
}
}
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options);
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -231,10 +243,21 @@ if (empty($reshook)) {
}
if (!$error) {
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
// Unset extrafield
if (is_array($extralabelsline)) {
// Get extra fields
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_".$key]);
}
}
$bomline = new BOMLine($db);
$bomline->fetch($lineid);
$result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key, $fk_unit);
$result = $object->updateLine($lineid, $qty, (int) $qty_frozen, (int) $disable_stock_change, $efficiency, $bomline->position, $bomline->import_key, $fk_unit, $array_options);
if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -568,9 +568,10 @@ class BOM extends CommonObject
* @param int $fk_bom_child Id of BOM Child
* @param string $import_key Import Key
* @param string $fk_unit Unit
* @param array $array_options extrafields array
* @return int <0 if KO, Id of created object if OK
*/
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '')
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0)
{
global $mysoc, $conf, $langs, $user;
@ -640,6 +641,10 @@ class BOM extends CommonObject
$this->line->position = $rankToUse;
$this->line->fk_unit = $fk_unit;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
}
$result = $this->line->create($user);
if ($result > 0) {
@ -668,10 +673,11 @@ class BOM extends CommonObject
* @param float $efficiency Efficiency in MO
* @param int $position Position of BOM-Line in BOM-Lines
* @param string $import_key Import Key
* @param int $fk_unit Unit of line
* @param int $fk_unit Unit of line
* @param array $array_options extrafields array
* @return int <0 if KO, Id of updated BOM-Line if OK
*/
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0)
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = 0)
{
global $mysoc, $conf, $langs, $user;
@ -745,6 +751,13 @@ class BOM extends CommonObject
$this->line->fk_unit = $fk_unit;
}
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
foreach ($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key];
}
}
$result = $this->line->update($user);
if ($result > 0) {

View File

@ -46,6 +46,11 @@ function bomAdminPrepareHead()
$head[$h][2] = 'bom_extrafields';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/bomline_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'bomline_extrafields';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(

View File

@ -126,6 +126,17 @@ if (!empty($conf->global->BOM_SUB_BOM) && $filtertype!=1) {
// TODO Add component to select a BOM
$form->select_bom();
}
if (is_object($objectline)) {
$temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
print $temps;
print '</div>';
}
}
print '</td>';

View File

@ -93,6 +93,16 @@ if (is_object($hookmanager)) {
$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
}
//Line extrafield
if (is_object($objectline) && !empty($extrafields)) {
$temps = $line->showOptionals($extrafields, 'edit', array('class'=>'tredited'), '', '', 1, 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
print $temps;
print '</div>';
}
}
print '</td>';
/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
@ -160,8 +170,4 @@ print '<input type="submit" class="button buttongen margintoponly marginbottomon
print '</td>';
print '</tr>';
if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1, 'line');
}
print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";

View File

@ -100,6 +100,17 @@ if ($tmpbom->id > 0) {
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
}
// Line extrafield
if (!empty($extrafields)) {
$temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
}
print '</td>';
print '<td class="linecolqty nowrap right">';
@ -309,10 +320,4 @@ if ($total_cost > 0) {
<?php
}
//Line extrafield
if (!empty($extrafields)) {
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1, 'line');
}
print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";

View File

@ -716,15 +716,28 @@ if (empty($reshook) && $action == 'update') {
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
}
if ($object->elementtype == 'ticket') {
if ($object->elementtype == 'ticket') { // code should be TICKET_MSG, TICKET_MSG_PRIVATE, TICKET_MSG_SENTBYMAIL, TICKET_MSG_PRIVATE_SENTBYMAIL
if ($private) {
$object->type_code = 'TICKET_MSG_PRIVATE';
if ($object->code == 'TICKET_MSG') {
$object->code = 'TICKET_MSG_PRIVATE';
}
if ($object->code == 'TICKET_MSG_SENTBYMAIL') {
$object->code = 'TICKET_MSG_PRIVATE_SENTBYMAIL';
}
} else {
$object->type_id = dol_getIdFromCode($db, 'AC_EMAIL', 'c_actioncomm');
if ($object->code == 'TICKET_MSG_PRIVATE') {
$object->code = 'TICKET_MSG';
}
if ($object->code == 'TICKET_MSG_PRIVATE_SENTBYMAIL') {
$object->code = 'TICKET_MSG_SENTBYMAIL';
}
}
// type_id and type_code is not modified
} else {
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->type_code = GETPOST("actioncode", 'aZ09');
}
$object->label = GETPOST("label", "alphanohtml");
$object->datep = $datep;
$object->datef = $datef;
@ -1253,7 +1266,7 @@ if ($action == 'create') {
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>';
// limit date
$repeateventlimitdate = $repeateventlimitdate ? $repeateventlimitdate : '';
$repeateventlimitdate = !empty($repeateventlimitdate) ? $repeateventlimitdate : '';
print '<div class="hidden marginrightonly inline-block repeateventlimitdate">';
print $langs->trans("Until")." ";
print $form->selectDate($repeateventlimitdate, 'limit', 0, 0, 0, "action", 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
@ -1315,11 +1328,6 @@ if ($action == 'create') {
// Date start
print '<tr><td class="nowrap">';
/*
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
*/
print '</td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
@ -1743,7 +1751,9 @@ if ($id > 0) {
// Private
if ($object->elementtype == 'ticket') {
print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? ' checked' : '').'></td></tr>';
print '<tr><td>'.$langs->trans("MarkMessageAsPrivate");
print ' '.$form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
print '</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? ' checked' : '').'></td></tr>';
}
// Title
@ -2207,18 +2217,13 @@ if ($id > 0) {
print '<table class="border tableforfield" width="100%">';
// Type
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != 'ticket') {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
print $object->getTypePicto();
print $langs->trans("Action".$object->type_code);
print '</td></tr>';
}
// Private
if ($object->elementtype == 'ticket') {
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(preg_match('/^TICKET_MSG_PRIVATE/', $object->code) ? 1 : 0, 3).'</td></tr>';
}
// Full day event
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
@ -2340,7 +2345,8 @@ if ($id > 0) {
if (isModEnabled("societe")) {
// Related company
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : ('<span class="opacitymedium">'.$langs->trans("None").'</span>'));
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
print '<td>'.(is_object($object->thirdparty) && $object->thirdparty->id ? $object->thirdparty->getNomUrl(1) : ('<span class="opacitymedium">'.$langs->trans("None").'</span>'));
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') {
if ($object->thirdparty->fetch($object->thirdparty->id)) {
print "<br>".dol_print_phone($object->thirdparty->phone);

View File

@ -423,7 +423,7 @@ class ActionComm extends CommonObject
*/
public function create(User $user, $notrigger = 0)
{
global $langs, $conf, $hookmanager;
global $langs, $conf;
$error = 0;
$now = dol_now();
@ -707,10 +707,9 @@ class ActionComm extends CommonObject
*/
public function createFromClone(User $fuser, $socid)
{
global $db, $conf, $hookmanager;
global $hookmanager;
$error = 0;
$now = dol_now();
$this->db->begin();
@ -1162,12 +1161,8 @@ class ActionComm extends CommonObject
$userownerid = ($this->userownerid ? $this->userownerid : 0);
$userdoneid = ($this->userdoneid ? $this->userdoneid : 0);
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
// If a type_id is set, we must also have the type_code set
if ($this->type_id > 0) {
$sql .= ", fk_action = ".(int) $this->type_id;
if (empty($this->type_code)) {
$cactioncomm = new CActionComm($this->db);
$result = $cactioncomm->fetch($this->type_id);
@ -1176,7 +1171,18 @@ class ActionComm extends CommonObject
}
}
}
$sql .= ", code = " . (isset($this->type_code)? "'".$this->db->escape($this->type_code) . "'":"null");
$code = $this->code;
if (empty($code) || (!empty($this->oldcopy) && $this->oldcopy->type_code != $this->type_code)) { // If code unknown or if we change the type, we reset $code too
$code = $this->type_code;
}
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm";
$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
$sql .= ", fk_action = ".(int) $this->type_id;
$sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null");
$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
@ -1207,7 +1213,7 @@ class ActionComm extends CommonObject
if (!empty($this->status)) {
$sql .= ", status=".($this->status ? (int) $this->status : 0);
}
$sql .= " WHERE id=".$this->id;
$sql .= " WHERE id=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql)) {
@ -1427,7 +1433,7 @@ class ActionComm extends CommonObject
$response->label = $langs->trans("ActionsToDo");
$response->labelShort = $langs->trans("ActionsToDoShort");
$response->url = DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&actioncode=0&status=todo&mainmenu=agenda';
if ($user->rights->agenda->allactions->read) {
if ($user->hasRight("agenda", "allactions", "read")) {
$response->url .= '&filtert=-1';
}
$response->img = img_object('', "action", 'class="inline-block valigntextmiddle"');

View File

@ -274,7 +274,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT)) {
$color = 'AGENDA_EXT_COLOR'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
if (!empty($conf->global->$source) && !empty($conf->global->$name)) {
if (getDolGlobalString($source) && getDolGlobalString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
'src' => getDolGlobalString($source),
@ -299,14 +299,14 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
if (!empty($user->conf->$source) && !empty($user->conf->$name)) {
if (getDolUserString($source) && getDolUserString($name)) {
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array(
'src' => $user->conf->$source,
'name' => dol_string_nohtmltag($user->conf->$name),
'src' => getDolUserString($source),
'name' => dol_string_nohtmltag(getDolUserString($name)),
'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz),
'color' => dol_string_nohtmltag($user->conf->$color),
'default' => dol_string_nohtmltag($user->conf->$default),
'color' => dol_string_nohtmltag(getDolUserString($color)),
'default' => dol_string_nohtmltag(getDolUserString($default)),
'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '')
);
}
@ -1287,7 +1287,7 @@ if (count($listofextcals)) {
}
// Transparency (see https://www.kanzaki.com/docs/ical/transp.html)
if ($icalevent['TRANSP']) {
if (!empty($icalevent['TRANSP'])) {
if ($icalevent['TRANSP'] == "TRANSPARENT") {
$event->transparency = 0; // 0 = available / free
}

View File

@ -72,7 +72,12 @@ if ($user->socid > 0) {
} else {
$id = 0;
}
restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
//restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
if (!$user->hasRight('propal', 'read') && !$user->hasRight('supplier_proposal', 'read') && !$user->hasRight('commande', 'read') && !$user->hasRight('fournisseur', 'commande', 'read')
&& !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read')) {
accessforbidden();
}
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
@ -517,7 +522,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
/*
* Draft interventionals
* Draft interventions
*/
if (isModEnabled('ficheinter')) {
$sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut";
@ -546,13 +551,12 @@ if (isModEnabled('ficheinter')) {
if ($resql) {
$num = $db->num_rows($resql);
$nbofloop = min($num, $maxofloop);
startSimpleTable("DraftFichinter", "fichinter/list.php", "search_status=".Fichinter::STATUS_DRAFT, 2, $num);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("DraftFichinter").'</th></tr>';
//print '<tr class="liste_titre">';
//print '<th colspan="2">'.$langs->trans("DraftFichinter").'</th></tr>';
if ($num) {
if ($num > 0) {
$i = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql);
@ -585,6 +589,10 @@ if (isModEnabled('ficheinter')) {
$i++;
}
}
addSummaryTableLine(3, $num, $nbofloop, $total, "NoIntervention");
finishSimpleTable(true);
print "</table></div>";
}
}

View File

@ -369,7 +369,7 @@ if (empty($reshook)) {
}
if (!empty($conf->global->MAILING_DELAY)) {
dol_syslog("Wait a delay of MAILING_DELAY=".$conf->global->MAILING_DELAY);
dol_syslog("Wait a delay of MAILING_DELAY=".((float) $conf->global->MAILING_DELAY));
usleep((float) $conf->global->MAILING_DELAY * 1000000);
}
@ -1093,18 +1093,18 @@ if ($action == 'create') {
}
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>';
}
$htmltext .= '</i>';
$htmltext .= '</span></i>';
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto('<span class="opacitymedium hideonsmartphone">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'helpclickable', '', 0, 2, 'emailsubstitionhelp'), 'generic');
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto('<span class="opacitymedium hideonsmartphone">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'helpclickable', '', 0, 3, 'emailsubstitionhelp'), 'generic');
print dol_get_fiche_head('', '', '', -1);
print '<table class="bordernooddeven" width="100%">';
print '<table class="bordernooddeven tableforfield centpercent">';
// Subject
print '<tr><td class="titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';

View File

@ -647,7 +647,7 @@ if ($object->fetch($id) >= 0) {
print '<td class="tdoverflowmax150">'.img_picto('$obj->email', 'email', 'class="paddingright"').dol_escape_htmltag($obj->email).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
print '<td>'.dol_escape_htmltag($obj->other).'</td>';
print '<td><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>';
print '<td class="center tdoverflowmax150">';
if (empty($obj->source_id) || empty($obj->source_type)) {
print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility

View File

@ -2828,6 +2828,7 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".self::STATUS_DRAFT;
$sql .= ", online_sign_ip = NULL , online_sign_name = NULL";
$sql .= " WHERE rowid = ".((int) $this->id);
$resql = $this->db->query($sql);

View File

@ -93,9 +93,6 @@ class PropaleStats extends Stats
}
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
$this->where .= ($this->where ? ' AND ' : '')."p.entity IN (".getEntity('propal').")";
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($this->socid) {
$this->where .= " AND p.fk_soc = ".((int) $this->socid);
}
@ -128,7 +125,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 .= $this->join;
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -153,7 +150,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 .= $this->join;
$sql .= " WHERE ".$this->where;
@ -177,7 +174,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 .= $this->join;
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -202,7 +199,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 .= $this->join;
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -225,7 +222,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 .= $this->join;
$sql .= " WHERE ".$this->where;
@ -251,7 +248,7 @@ class PropaleStats extends Stats
$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.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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 .= $this->join;
$sql .= " WHERE ".$this->where;

View File

@ -105,7 +105,8 @@ $search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_end_startday = GETPOST('search_date_end_startday', 'int');
$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
$search_date_end_startmonth = GETPOST('se$sql .= $db->plimit($limit + 1, $offset);
arch_date_end_startmonth', 'int');
$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
@ -547,6 +548,9 @@ $companystatic = new Societe($db);
$projectstatic = new Project($db);
$formcompany = new FormCompany($db);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$title = $langs->trans('ListOfProposals');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $title, $help_url);
@ -655,11 +659,15 @@ if ($search_project) {
if ($search_availability) {
$sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')';
}
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_societe_alias) {
$sql .= natural_search('s.name_alias', $search_societe_alias);
if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
} else {
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_societe_alias) {
$sql .= natural_search('s.name_alias', $search_societe_alias);
}
}
if ($search_login) {
$sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login);
@ -793,9 +801,6 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
$sql .= ', p.ref DESC';
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -817,7 +822,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
$sql .= ', p.ref DESC';
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
@ -1430,7 +1439,7 @@ if ($resql) {
// Status
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">';
$formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_statut');
$formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_statut', 'search_status maxwidth125 onrightofpage');
print '</td>';
}
// Action column
@ -1484,22 +1493,22 @@ if ($resql) {
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['country.code_iso']['checked'])) {
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['typent.code']['checked'])) {
print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.date']['checked'])) {
print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.fin_validite']['checked'])) {
print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.date_livraison']['checked'])) {
print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.date_signature']['checked'])) {
print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['ava.rowid']['checked'])) {
print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
@ -1553,7 +1562,7 @@ if ($resql) {
print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
}
if (!empty($arrayfields['u.login']['checked'])) {
print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'class="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['sale_representative']['checked'])) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
@ -1775,7 +1784,7 @@ if ($resql) {
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax150">';
print $companystatic->getNomUrl(1, 'customer');
print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -93,9 +93,6 @@ class CommandeStats extends Stats
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('commande').')';
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($this->socid) {
$this->where .= " AND c.fk_soc = ".((int) $this->socid);
}
@ -127,7 +124,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -152,7 +149,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
@ -176,7 +173,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -201,7 +198,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -224,7 +221,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
@ -248,7 +245,7 @@ class CommandeStats extends Stats
$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.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;

View File

@ -789,6 +789,9 @@ $company_url_list = array();
$formcompany = new FormCompany($db);
$projectstatic = new Project($db);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$title = $langs->trans("Orders");
$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
@ -935,11 +938,15 @@ if ($search_country) {
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
}
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
} else {
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
}
}
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
@ -1046,8 +1053,6 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -1069,7 +1074,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
//print $sql;
$resql = $db->query($sql);
@ -1725,7 +1733,7 @@ if ($resql) {
-2=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -5, 0, 0, '', 0, 0, 0, '', 'maxwidth125', 1);
print $form->selectarray('search_status', $liststatus, $search_status, -5, 0, 0, '', 0, 0, 0, '', 'maxwidth125 onrightofpage', 1);
print '</td>';
}
// Action column
@ -1945,7 +1953,7 @@ if ($resql) {
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
if (!isset($getNomUrl_cache[$obj->socid])) {
$getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer');
$getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
}
$generic_commande->id = $obj->rowid;

View File

@ -39,6 +39,9 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 160);
$id = GETPOST('account') ?GETPOST('account', 'alpha') : GETPOST('id');
$ref = GETPOST('ref');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bankannualreport', 'globalcard'));
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');

View File

@ -1561,6 +1561,7 @@ if ($resql) {
$companylinked_id = 0;
$userlinked_id = 0;
$type_link = "";
//payment line type to define user display and user or company linked
foreach ($links as $key => $value) {

View File

@ -9,6 +9,7 @@
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 JC Prieto <jcprieto@virtual20.com><prietojc@gmail.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -852,7 +853,7 @@ class Account extends CommonObject
$sql .= ",min_allowed = ".($this->min_allowed != '' ? price2num($this->min_allowed) : "null");
$sql .= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
$sql .= ",comment = '".$this->db->escape($this->comment)."'";
$sql .= ",comment = '".$this->db->escape($this->comment)."'";
$sql .= ",state_id = ".($this->state_id > 0 ? ((int) $this->state_id) : "null");
$sql .= ",fk_pays = ".($this->country_id > 0 ? ((int) $this->country_id) : "null");
@ -1926,18 +1927,18 @@ class AccountLine extends CommonObject
$obj = $this->db->fetch_object($result);
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->rowid = $obj->rowid;
$this->ref = $obj->rowid;
$this->datec = $obj->datec;
$this->datev = $obj->datev;
$this->dateo = $obj->dateo;
$this->datec = $obj->datec;
$this->datev = $obj->datev;
$this->dateo = $obj->dateo;
$this->amount = $obj->amount;
$this->label = $obj->label;
$this->note = $obj->note;
$this->label = $obj->label;
$this->note = $obj->note;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_rappro = $obj->fk_user_rappro;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_rappro = $obj->fk_user_rappro;
$this->fk_type = $obj->fk_type; // Type of transaction
$this->rappro = $obj->rappro;
@ -1948,9 +1949,13 @@ class AccountLine extends CommonObject
$this->fk_bordereau = $obj->fk_bordereau;
$this->fk_account = $obj->fk_account;
$this->bank_account_ref = $obj->bank_account_ref;
$this->bank_account_ref = $obj->bank_account_ref;
$this->bank_account_label = $obj->bank_account_label;
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
$ret = 1;
}
$this->db->free($result);
@ -1967,6 +1972,10 @@ class AccountLine extends CommonObject
*/
public function insert()
{
$error = 0;
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (";
$sql .= "datec";
$sql .= ", dateo";
@ -2002,15 +2011,26 @@ class AccountLine extends CommonObject
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
if ($resql) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'bank');
// Actions on extra fields (by external module or standard code)
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
} else {
$error++;
$this->error = $this->db->lasterror();
return -1;
dol_print_error($this->db);
}
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'bank');
return $this->id;
if (!$error) {
$this->db->commit();
return $this->id;
} else {
$this->db->rollback();
return -1 * $error;
}
}
/**
@ -2064,6 +2084,12 @@ class AccountLine extends CommonObject
$nbko++;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_extrafields WHERE fk_object=".(int) $this->rowid;
$result = $this->db->query($sql);
if (!$result) {
$nbko++;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".(int) $this->rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -38,6 +38,9 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bankaccountdocuments', 'globalcard'));
// Security check
if ($user->socid) {
$action = '';

View File

@ -35,6 +35,9 @@ $langs->loadLangs(array('banks', 'categories'));
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768);
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bankstats', 'globalcard'));
// Security check
if (GETPOST('account') || GETPOST('ref')) {
$id = GETPOST('account') ? GETPOST('account') : GETPOST('ref');

View File

@ -35,6 +35,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other'));
@ -77,7 +78,9 @@ if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolida
}
$hookmanager->initHooks(array('bankline'));
$object = new AccountLine($db);
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->element);
/*
* Actions
@ -125,18 +128,17 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban
if ($user->rights->banque->modifier && $action == "update") {
$error = 0;
$acline = new AccountLine($db);
$result = $acline->fetch($rowid);
$result = $object->fetch($rowid);
if ($result <= 0) {
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.
$acline->id = $rowid;
$object->id = $rowid;
}
$acsource = new Account($db);
$acsource->fetch($accountoldid);
$actarget = new Account($db);
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
if (GETPOST('accountid', 'int') > 0 && !$object->rappro && !$object->getVentilExportCompta()) { // We ask to change bank account
$actarget->fetch(GETPOST('accountid', 'int'));
} else {
$actarget->fetch($accountoldid);
@ -173,7 +175,7 @@ if ($user->rights->banque->modifier && $action == "update") {
$sql .= " emetteur='".$db->escape(GETPOST("emetteur"))."',";
}
// Blocked when conciliated
if (!$acline->rappro) {
if (!$object->rappro) {
if (GETPOSTISSET('label')) {
$sql .= " label = '".$db->escape(GETPOST("label"))."',";
}
@ -188,7 +190,7 @@ if ($user->rights->banque->modifier && $action == "update") {
}
}
$sql .= " fk_account = ".((int) $actarget->id);
$sql .= " WHERE rowid = ".((int) $acline->id);
$sql .= " WHERE rowid = ".((int) $object->id);
$result = $db->query($sql);
if (!$result) {
@ -214,6 +216,11 @@ if ($user->rights->banque->modifier && $action == "update") {
}
}
if (!$error) {
$extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
$object->insertExtraFields();
}
if (!$error) {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$db->commit();
@ -601,6 +608,13 @@ if ($result) {
print "</td></tr>";
}
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $bankline, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $bankline->showOptionals($extrafields, ($objp->rappro ? 'view' : 'create'), $parameters);
}
print "</table>";
// Code to adjust value date with plus and less picto using an Ajax call instead of a full reload of page

View File

@ -255,8 +255,6 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -278,7 +276,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if ($resql) {

View File

@ -62,6 +62,9 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha');
$rel = GETPOST("rel", 'alphanohtml');
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bankaccountstatement', 'globalcard'));
// Security check
$fieldid = (!empty($ref) ? $ref : $id);
$fieldname = (!empty($ref) ? 'ref' : 'rowid');

View File

@ -266,8 +266,6 @@ if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -289,7 +287,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if ($resql) {
@ -502,6 +504,7 @@ if ($resql) {
print '</tr>';
print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {

View File

@ -142,7 +142,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
$parameters = array('socid' => $socid);
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -800,8 +800,10 @@ if (empty($reshook)) {
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
$typeinvoice = Facture::TYPE_STANDARD;
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($typeinvoice == Facture::TYPE_STANDARD || $typeinvoice == Facture::TYPE_REPLACEMENT) && $price_min && ((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100) < (float) price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++;
}

View File

@ -2505,12 +2505,12 @@ if (empty($reshook)) {
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usermustrespectpricemin && ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)) {
if ($pu_ht && $price_min && ((price2num($pu_ht) * (1 - $remise_percent / 100)) < price2num($price_min))) {
if ($pu_ht && $price_min && (((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100)) < (float) price2num($price_min))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
$action = 'editline';
} elseif ($pu_ttc && $price_min_ttc && ((price2num($pu_ttc) * (1 - $remise_percent / 100)) < price2num($price_min_ttc))) {
} elseif ($pu_ttc && $price_min_ttc && ((price2num($pu_ttc) * (1 - (float) $remise_percent / 100)) < price2num($price_min_ttc))) {
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min_ttc, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
setEventMessages($mesg, null, 'errors');
$error++;
@ -3066,6 +3066,11 @@ if ($action == 'create') {
$remise_percent = (!empty($expesrc->remise_percent) ? $expesrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
$remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
if (!empty($conf->multicurrency->enabled)) {
$currency_code = (!empty($expesrc->currency_code) ? $expesrc->currency_code : (!empty($soc->currency_code) ? $soc->currency_code : $objectsrc->multicurrency_code));
$currency_tx = (!empty($expesrc->currency_tx) ? $expesrc->currency_tx : (!empty($soc->currency_tx) ? $soc->currency_tx : $objectsrc->currency_tx));
}
//Replicate extrafields
$expesrc->fetch_optionals();
$object->array_options = $expesrc->array_options;

View File

@ -1024,7 +1024,7 @@ class FactureRec extends CommonInvoice
if ($this->db->query($sql)) {
$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX."facturedet_rec");
$this->id = $facid;
$this->update_price();
$this->update_price(1);
return $lineId;
} else {
$this->error = $this->db->lasterror();
@ -1198,7 +1198,7 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
if ($this->db->query($sql)) {
$this->id = $facid;
$this->update_price();
$this->update_price(1);
return 1;
} else {
$this->error = $this->db->lasterror();

View File

@ -171,6 +171,8 @@ class Facture extends CommonInvoice
public $total_ttc;
public $revenuestamp;
public $resteapayer;
/**
* ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other
* ! Closing when no payment: replaced, abandoned

View File

@ -620,7 +620,7 @@ if ($resql) {
1=>$langs->trans("Active"),
-1=>$langs->trans("Disabled"),
);
print $form->selectarray('search_status', $liststatus, $search_status, -2, 0, 0, '', 0, 0, 0, '', 'width100');
print $form->selectarray('search_status', $liststatus, $search_status, -2, 0, 0, '', 0, 0, 0, '', 'width100 onrightofpage');
print '</td>';
}
// Action column

View File

@ -558,6 +558,9 @@ $companystatic = new Societe($db);
$companyparent = new Societe($db);
$company_url_list = array();
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$sql = 'SELECT';
if ($sall || $search_user > 0) {
$sql = 'SELECT DISTINCT';
@ -670,11 +673,15 @@ if ($search_project_ref) {
if ($search_project) {
$sql .= natural_search('p.title', $search_project);
}
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
} else {
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
}
}
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
@ -1585,7 +1592,7 @@ if ($resql) {
if (!empty($arrayfields['f.fk_statut']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0'=>$langs->trans("BillShortStatusDraft"), '0,1'=>$langs->trans("BillShortStatusDraft").'+'.$langs->trans("BillShortStatusNotPaid"), '1'=>$langs->trans("BillShortStatusNotPaid"), '1,2'=>$langs->trans("BillShortStatusNotPaid").'+'.$langs->trans("BillShortStatusPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'width100 onrightofpage', 1);
print '</td>';
}
// Action column
@ -1772,6 +1779,7 @@ if ($resql) {
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array();
$totalarray['val']['f.total_tva'] = 0;
$totalarray['val']['f.total_ht'] = 0;
$totalarray['val']['f.total_ttc'] = 0;
@ -1813,10 +1821,10 @@ if ($resql) {
$facturestatic->close_code = $obj->close_code;
$facturestatic->total_ttc = $obj->total_ttc;
$facturestatic->paye = $obj->paye;
$facturestatic->fk_soc = $obj->fk_soc;
$facturestatic->socid = $obj->fk_soc;
$facturestatic->date = $db->jdate($obj->datef);
$facturestatic->date_valid = $db->jdate($obj->date_valid);
$facturestatic->date_validation = $db->jdate($obj->date_valid);
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
$facturestatic->note_public = $obj->note_public;
@ -1867,7 +1875,7 @@ if ($resql) {
$remaintopay = 0;
$multicurrency_remaintopay = 0;
}
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consummed
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed
$remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote;
$totalpay = price2num($facturestatic->total_ttc - $remaintopay);

View File

@ -369,7 +369,7 @@ if ($object->id > 0) {
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
$morehtmlref .= '<br>';
if (0) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {

View File

@ -378,14 +378,24 @@ foreach ($data as $val) {
print '</tr>';
}
if ($mode == 'supplier') {
$greennb = (empty($val['nb_diff']) || $val['nb_diff'] <= 0);
$greentotal = (empty($val['total_diff']) || $val['total_diff'] <= 0);
$greenavg = (empty($val['avg_diff']) || $val['avg_diff'] <= 0);
} else {
$greennb = (empty($val['nb_diff']) || $val['nb_diff'] >= 0);
$greentotal = (empty($val['total_diff']) || $val['total_diff'] >= 0);
$greenavg = (empty($val['avg_diff']) || $val['avg_diff'] >= 0);
}
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right opacitylow" style="'.((empty($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%</td>';
print '<td class="right opacitylow" style="'.($greennb ? 'color: green;' : 'color: red;').'">'.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%</td>';
print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
print '<td class="right opacitylow" style="'.((empty($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.( !empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>';
print '<td class="right opacitylow" style="'.($greentotal ? 'color: green;' : 'color: red;').'">'.( !empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>';
print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>';
print '<td class="right opacitylow" style="'.((empty($val['avg_diff']) || $val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(!empty($val['avg_diff']) && $val['avg_diff'] < 0 ? '' : '+').round(!empty($val['avg_diff']) ? $val['avg_diff'] : 0).'%</td>';
print '<td class="right opacitylow" style="'.($greenavg ? 'color: green;' : 'color: red;').'">'.(!empty($val['avg_diff']) && $val['avg_diff'] < 0 ? '' : '+').round(!empty($val['avg_diff']) ? $val['avg_diff'] : 0).'%</td>';
print '</tr>';
$oldyear = $year;
}

View File

@ -198,7 +198,9 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Date")."</td>";
print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
print "<td>".$langs->trans("Account")."</td>";
print "<td>".$langs->trans("Type")."</td><td class='right'>".$langs->trans("Debit")."</td><td class='right'>".$langs->trans("Credit")."</td>";
print "<td>".$langs->trans("Type")."</td>";
print "<td class='right'>".$langs->trans("AccountingDebit")."</td>";
print "<td class='right'>".$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";

View File

@ -242,7 +242,9 @@ print '<tr class="liste_titre">';
//print "<td>".$langs->trans("JournalNum")."</td>";
print '<td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Piece').' ('.$langs->trans('InvoiceRef').')</td>';
print '<td>'.$langs->trans('Account').'</td>';
print '<td>'.$langs->trans('Type').'</td><td class="right">'.$langs->trans('Debit').'</td><td class="right">'.$langs->trans('Credit').'</td>';
print '<td>'.$langs->trans('Type').'</td>';
print '<td class="right">'.$langs->trans('AccountingDebit').'</td>';
print '<td class="right">'.$langs->trans('AccountingCredit').'</td>';
print "</tr>\n";

View File

@ -67,12 +67,11 @@ if ($socid && $socid != $object->thirdparty->id) {
$error = 0;
/*
* Actions
*/
if ($action == 'setnote' && $user->rights->facture->paiement) {
if ($action == 'setnote' && $user->hasRight('facture', 'paiement')) {
$db->begin();
$result = $object->update_note(GETPOST('note', 'restricthtml'));
@ -142,13 +141,13 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
$invoice = new Facture($db);
if ($invoice->fetch($objp->facid) <= 0) {
$errors++;
$error++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
$errors++;
$error++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
@ -159,12 +158,12 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
$db->free($resql);
} else {
$errors++;
$error++;
setEventMessages($db->error, $db->errors, 'errors');
}
}
if (! $errors) {
if (! $error) {
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
exit;
}

View File

@ -53,7 +53,7 @@ print load_fiche_titre($langs->trans("ChequesArea"), '', $checkdepositstatic->pi
print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(b.rowid)";
$sql = "SELECT count(b.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= " WHERE ba.rowid = b.fk_account";
@ -70,13 +70,14 @@ print '<th colspan="2">'.$langs->trans("BankChecks")."</th>\n";
print "</tr>\n";
if ($resql) {
if ($row = $db->fetch_row($resql)) {
$num = $row[0];
$num = '';
if ($obj = $db->fetch_object($resql)) {
$num = $obj->nb;
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BankChecksToReceipt").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?leftmenu=customers_bills_checks&action=new">'.$num.'</a>';
print '</td></tr>';
print "</table>\n";
} else {

View File

@ -117,8 +117,6 @@ if ($search_amount) {
}
$sql .= dolSqlDateFilter('bc.date_bordereau', 0, $month, $year);
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -140,7 +138,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
//print "$sql";
$resql = $db->query($sql);

View File

@ -258,7 +258,6 @@ if (GETPOST("orphelins", "alpha")) {
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
@ -281,7 +280,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {

View File

@ -86,7 +86,7 @@ print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransfer").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
print $bprev->nbOfInvoiceToPay('bank-transfer');
print '</a>';
print '</td></tr>';
@ -183,7 +183,8 @@ if ($resql) {
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).'</span></td></tr>';
$titlefortab = $langs->transnoentitiesnoconv("BankTransfer");
print '<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoSupplierInvoiceToWithdraw", $titlefortab, $titlefortab).'</span></td></tr>';
}
print "</table></div><br>";
} else {

View File

@ -54,10 +54,10 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'pl.fk_soc';
$sortfield = 'pl.rowid';
}
if (!$sortorder) {
$sortorder = 'DESC';
$sortorder = 'ASC';
}
$object = new BonPrelevement($db);
@ -343,7 +343,7 @@ if ($id > 0 || $ref) {
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id);
$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.entity = ".$conf->entity;
$sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here
$sql .= " AND pl.fk_soc = s.rowid";
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
@ -375,7 +375,8 @@ if ($id > 0 || $ref) {
$urladd .= '&limit='.urlencode($limit);
}
print '<form method="get" action="'.$_SERVER ['PHP_SELF'].'" name="search_form">'."\n";
print '<form method="POST" action="'.$_SERVER ['PHP_SELF'].'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'"/>';
print '<input type="hidden" name="id" value="'.$id.'"/>';
print '<input type="hidden" name="socid" value="'.$socid.'"/>';
if (!empty($page)) {
@ -395,9 +396,9 @@ if ($id > 0 || $ref) {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder liste" width="100%" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Lines", $_SERVER["PHP_SELF"], "pl.rowid", '', $urladd);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $urladd, 'class="right"');
print_liste_field_titre("Lines", $_SERVER["PHP_SELF"], "pl.rowid", '', $urladd, '', $sortfield, $sortorder);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $urladd, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('');
print "</tr>\n";

View File

@ -1209,7 +1209,7 @@ class BonPrelevement extends CommonObject
$result = '';
$labeltoshow = 'PaymentByDirectDebit';
if ($this->type == 'bank-transfer') {
if (!empty($this->type) && $this->type == 'bank-transfer') {
$labeltoshow = 'PaymentByBankTransfer';
}
@ -1221,7 +1221,7 @@ class BonPrelevement extends CommonObject
}
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
if ($this->type == 'bank-transfer') {
if (!empty($this->type) && $this->type == 'bank-transfer') {
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
}

View File

@ -86,7 +86,7 @@ print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
print '<td class="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0">';
print $bprev->nbOfInvoiceToPay('direct-debit');
print '</a>';
print '</td></tr>';
@ -184,7 +184,7 @@ if ($resql) {
}
} else {
$titlefortab = $langs->transnoentitiesnoconv("StandingOrders");
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw", $titlefortab, $titlefortab).'</td></tr>';
print '<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw", $titlefortab, $titlefortab).'</span></td></tr>';
}
print "</table></div><br>";
} else {

View File

@ -155,8 +155,6 @@ if ($search_company) {
$sql .= natural_search("s.nom", $search_company);
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -178,7 +176,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result) {

View File

@ -114,8 +114,6 @@ if ($search_amount) {
$sql .= natural_search("p.amount", $search_amount, 1);
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -137,7 +135,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result) {

View File

@ -1166,7 +1166,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
print '<tr class="oddeven">';
print '<td>&nbsp;</td>';
print "<td>".$langs->trans("Debit")."</td>\n";
print "<td>".$langs->trans("AccountingDebit")."</td>\n";
print '<td class="right">';
if ($modecompta == 'CREANCES-DETTES') {
print '<span class="amount">'.price(-$obj->amount).'</span>';
@ -1185,7 +1185,7 @@ if ($modecompta == 'BOOKKEEPING') {
$total_ttc_income += $obj->amount;
}
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Credit")."</td>\n";
print "<td>".$langs->trans("AccountingCredit")."</td>\n";
print '<td class="right">';
if ($modecompta == 'CREANCES-DETTES') {
print '<span class="amount">'.price($obj->amount).'</span>';

View File

@ -254,7 +254,6 @@ $sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.
if (isModEnabled('project')) {
$sql .= ", p.rowid, p.ref, p.title";
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
@ -277,7 +276,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$db->free($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
@ -500,7 +503,7 @@ if (!empty($arrayfields['cs.amount']['checked'])) {
if (!empty($arrayfields['cs.paye']['checked'])) {
print '<td class="liste_titre maxwidthonsmartphone right">';
$liststatus = array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid"));
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 onrightofpage', 1);
print '</td>';
}

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