diff --git a/.stickler.yml b/.stickler.yml new file mode 100644 index 00000000000..b68804448b2 --- /dev/null +++ b/.stickler.yml @@ -0,0 +1,10 @@ +--- +linters: + phpcs: + standard: 'dev/setup/codesniffer/ruleset.xml' + extensions: 'php' + tab_width: 4 + fixer: true + +fixers: + enable: true diff --git a/.travis.yml b/.travis.yml index 63e48a051f0..5bbfaabbdd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -304,7 +304,7 @@ script: set -e # Exclusions are defined in the ruleset.xml file #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . + if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo diff --git a/ChangeLog b/ChangeLog index c78ad8674eb..ee409bb7588 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,105 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 10.0.2 compared to 10.0.1 ***** + +FIX: #10460 compatibility with MariaDB 10.4 +FIX: #11401 Adherent unknown language key +FIX: #11422 Can't edit his own events with standard rights +FIX: #11427 require product class (fixes POST /supplierinvoices REST API endpoint) +FIX: #11570 +FIX: #11591 FIX: #11592 +FIX: #11671 CVE-2019-15062 +FIX: #11672 +FIX: #11685 +FIX: #11702 +FIX: #11711 +FIX: #11720 +FIX: #11746 Unable to modify amount of insurance of a loan +FIX: #11752 +FIX: #11789 FIX: #11790 +FIX: #11804 list of tickets from a customer card display ALL tickets +FIX: #11834 +FIX: Add char $ and ; in sanitizing of filenames. +FIX: Add comment before protected functions +FIX: Add log and type of content in dolWebsiteOutput and +FIX: Add repair.php option 'restore' to restore user picture after v10 +FIX: amount opened on thirdparty card dont care of credit note not converted +FIX: Api of documents work with value 'thirdparty' +FIX: author in message / ticket API +FIX: avoid sql error if fk_project is empty during update +FIX: avoid Warning: A non-numeric value encountered +FIX: bad consistency in list of invoice for direct debit order. +FIX: Bad error management in zip compress and web site export +FIX: bad substitution for extrafields type checkbox +FIX: better help message with multicompany +FIX: calculation of $products_dispatched +FIX: Can't add a new chart of account +FIX: Can't delete a draft leave even if it should +FIX: Can't save setup of mailman module +FIX: column jabberid missing +FIX: Confirmation of deletion +FIX: Consistency in direct debit order lists. +FIX: Content send before header warning +FIX: credit note can be split +FIX: credit note used on list +FIX: Css was saved on wrong website. +FIX: delivery extrafields +FIX: Disabling a website does not put it offline +FIX: display only stripe sources for customer +FIX: display payment intent in stripe's charge list +FIX: document list for products in API +FIX: dol_thirdparty_id for stripe PI +FIX: Do not show tooltip if tooltip is empty +FIX: duplicate css tag, decrease padding-bottom for boxes in eldy theme +FIX: duration when creating service +FIX: EDB-ID:47370 +FIX: Enable web site +FIX: error management when adding a property with type real +FIX: Fatal situation if payment removed on expense report. Action +FIX: filepath of generated documents doesn't handle products with special characters +FIX: for MAIN_MAXTABS_IN_CARD = $i card +FIX: gzip and bzip2 must use option -f +FIX: It was possible to create cashfence without entering data. +FIX: javascript error when using dol_use_jmobile=1 +FIX: logout redirect to takepos.php +FIX: Look and feel v10 +FIX: Make protected all pfd models functions +FIX: management of extrafields in modulebuilder +FIX: Missing div for buttons in tax, loan, various payment modules +FIX: missing include (dol_convert_file not found) +FIX: Missing some replacements in website module +FIX: missing test on permission on button to delete ledger record +FIX: Missing the filter fields in export of expense report and leaves +FIX: Missing ticket icon on md theme +FIX: Missing transaction +FIX: Mode smartphone was not triggered when there is too loo menu +FIX: Must escape shell +FIX: Must exclude logs and some dirs for compressed backup +FIX: name and position of hook FIX: #11710 +FIX: Not showing MAIN_INVERT_SENDER_RECIPIENT when edit field +FIX: Nowrap missing on amount in boxes +FIX: Option to use ZipArchive instead of PclZip bugged with large files. +FIX: order or proposals billed if both workflow conf activated +FIX: permission check on API intervention +FIX: phpcs +FIX: placement function +FIX: qty in invoice list on product's stats +FIX: remove disabled product type from product list +FIX: Return code of pdf_einstein.modules.php and proformat +FIX: round for application fee in stripe +FIX: Sens of the balance (Debit - Credit in accountancy not contrary) +FIX: Several pb in export of documents +FIX: SQL syntax error and CSRF check on vat reports +FIX: takepos layout clear or focus search +FIX: too many record in sql request. Whena criteria is a filter, we must +FIX: Translation of month +FIX: USEDOLIBARREDITOR not always set +FIX: VAT number for Monaco (it uses FR) +FIX: vulenrability in uploading file found by 美创科技安全实验室 +FIX: wrong display (and hidden input) for already dispatched quantity +FIX: wrong parameters (same error in branch 9, 10, develop) +FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES ***** ChangeLog for 10.0.1 compared to 10.0.0 ***** FIX: #10930 diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 44a12b76f36..52cb1370cfc 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2016-2019 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -164,7 +164,7 @@ if ($action == 'export_csv') print $object->get_compte_desc($line->numero_compte) . $sep; print price($line->debit) . $sep; print price($line->credit) . $sep; - print price($line->credit - $line->debit) . $sep; + print price($line->debit - $line->credit) . $sep; print "\n"; } @@ -293,9 +293,9 @@ if ($action != 'export_csv') print '' . length_accountg($line->numero_compte) . ''; print '' . $description . ''; - print '' . price($line->debit) . ''; - print '' . price($line->credit) . ''; - print '' . price($line->credit - $line->debit) . ''; + print '' . price($line->debit) . ''; + print '' . price($line->credit) . ''; + print '' . price($line->debit - $line->credit) . ''; print '' . $link; print ''; print "\n"; @@ -305,11 +305,11 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_debit - $sous_total_credit)) . ''; print " \n"; print ''; - print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_credit - $total_debit)) . ''; + print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_debit - $total_credit)) . ''; print " \n"; print ''; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0d3980318a4..9591a24fa78 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -424,7 +424,7 @@ class AdherentType extends CommonObject global $langs; if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } - else return $langs->trans("Physical & Morale"); + else return $langs->trans("MorPhy"); //return $morphy; } diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 1d890ab580f..76d915aee32 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -83,10 +83,10 @@ if ($action == 'dolibarr2ldap') * View */ -llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - $form = new Form($db); +llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); + $head = member_prepare_head($object); dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user'); @@ -98,12 +98,12 @@ dol_banner_tab($object, 'rowid', $linkback); print '
'; print '
'; -print ''; +print '
'; // Login -print ''; +print ''; -// Password not crypted +// If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { print ''; @@ -111,18 +111,11 @@ if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) print "\n"; } -// Password crypted -if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) -{ - print ''; - print ''; - print "\n"; -} +$adht = new AdherentType($db); +$adht->fetch($object->typeid); // Type -print '\n"; - -$langs->load("admin"); +print '\n"; // LDAP DN print '\n"; diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index ce2918cb86a..5f5ab38da61 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -80,7 +80,7 @@ if ($id) print '
'; print '
'; - print '
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("LDAPFieldPasswordNotCrypted").'
'.$langs->trans("LDAPFieldPasswordCrypted").''.$object->pass_crypted.'
'.$langs->trans("Type").''.$object->type."
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
LDAP '.$langs->trans("LDAPMemberDn").''.$conf->global->LDAP_MEMBER_DN."
'; + print '
'; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ab8206c66b8..7663fe6fba3 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -478,7 +478,7 @@ if ($rowid > 0) print '
'; print '
'; - print '
'; + print '
'; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4251ba45ab9..f41275a4c71 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -283,7 +283,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; @@ -822,7 +822,7 @@ if ($rowid > 0) $value = $_POST["options_" . $key]; } } else { - $value = $adht->array_options["options_" . $key]; + $value = $object->array_options["options_" . $key]; } print '
'; if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } - else print $langs->trans("Physical & Morale"); + else print $langs->trans("MorPhy"); print ''.yn($objp->subscription).''.yn($objp->vote).'
'.$label.''; print $extrafields->showInputField($key, $value); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index f68864fcc3d..ee90a0638fb 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array("errors","admin","main","companies","resource","holiday","accountancy","hrm","orders","contracts","projects","propal","bills","interventions")); @@ -1782,7 +1782,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); + $formaccounting = new FormAccounting($db); $withentity=''; @@ -1890,6 +1890,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') elseif (in_array($fieldlist[$field], array('libelle_facture'))) { print ''; $transfound=0; + $transkey=''; // Special case for labels if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 4ee9e214890..a2403315614 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -158,8 +158,10 @@ $head = mailmanspip_admin_prepare_head(); if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { print '
'; + print ''; + print ''; - dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); + dol_fiche_head($head, 'mailman', $langs->trans("Setup"), -1, 'user'); //$link=img_picto($langs->trans("Active"),'tick').' '; $link=''; @@ -227,14 +229,21 @@ else if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { print ''; + print ''; print ''; + print $langs->trans("TestSubscribe").'
'; print $langs->trans("EMail").'
'; + print ''; + print '
'; + print ''; print ''; + print $langs->trans("TestUnSubscribe").'
'; print $langs->trans("EMail").'
'; + print '
'; } diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index e0b4b986969..579363395f3 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -123,8 +123,10 @@ $head = mailmanspip_admin_prepare_head(); if (! empty($conf->global->ADHERENT_USE_SPIP)) { print '
'; + print ''; + print ''; - dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); + dol_fiche_head($head, 'spip', $langs->trans("Setup"), -1, 'user'); //$link=img_picto($langs->trans("Active"),'tick').' '; $link=''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2e934211970..83834aa5861 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -98,14 +98,14 @@ print '
'; print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; $found=0; print ''; print ''; -print ''; print ''; -print ''; print ''; -print ''; print ''; -print '"; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index f86d6570e5c..86eff6613c1 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -316,27 +316,29 @@ class Utils // TODO Replace with executeCLI function if ($execmethod == 1) { - exec($fullcommandclear, $readt, $retval); - $result = $retval; + $output_arr = array(); $retval = null; + exec($fullcommandclear, $output_arr, $retval); if ($retval != 0) { $langs->load("errors"); dol_syslog("Datadump retval after exec=".$retval, LOG_ERR); - $error = 'Error '.$retval; + $errormsg = 'Error '.$retval; $ok=0; } else { $i=0; - if (!empty($readt)) - foreach($readt as $key=>$read) + if (!empty($output_arr)) { - $i++; // output line number - if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; - fwrite($handle, $read.($execmethod == 2 ? '' : "\n")); - if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok=1; - elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok=1; + foreach($output_arr as $key => $read) + { + $i++; // output line number + if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; + fwrite($handle, $read.($execmethod == 2 ? '' : "\n")); + if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok=1; + elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok=1; + } } } } @@ -534,6 +536,7 @@ class Utils if ($execmethod == 1) { + $retval = null; exec($command, $output_arr, $retval); $result = $retval; if ($retval != 0) @@ -545,7 +548,6 @@ class Utils } if ($execmethod == 2) // With this method, there is no way to get the return code, only output { - $ok=0; $handle = fopen($outputfile, 'w+b'); if ($handle) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c6a5cb14426..d2aee3e6a30 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1221,9 +1221,12 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, } } } - else dol_syslog("Failed to remove file ".$filename, LOG_WARNING); - // TODO Failure to remove can be because file was already removed or because of permission - // If error because it does not exists, we should return true, and we should return false if this is a permission problem + else + { + dol_syslog("Failed to remove file ".$filename, LOG_WARNING); + // TODO Failure to remove can be because file was already removed or because of permission + // If error because it does not exists, we should return true, and we should return false if this is a permission problem + } } } else dol_syslog("No files to delete found", LOG_DEBUG); @@ -2062,9 +2065,10 @@ function dol_uncompress($inputfile, $outputdir) * @param string $inputdir Source dir name * @param string $outputfile Target file name (output directory must exists and be writable) * @param string $mode 'zip' + * @param string $excludefiles A regex pattern. For example: '/\.log$|\/temp\//' * @return int <0 if KO, >0 if OK */ -function dol_compress_dir($inputdir, $outputfile, $mode = "zip") +function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '') { $foundhandler=0; @@ -2095,6 +2099,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip") return 1; } else*/ + //if (class_exists('ZipArchive') && ! empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS)) if (class_exists('ZipArchive')) { $foundhandler=1; @@ -2102,6 +2107,13 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip") // Initialize archive object $zip = new ZipArchive(); $result = $zip->open($outputfile, ZipArchive::CREATE | ZipArchive::OVERWRITE); + if (! $result) + { + global $langs, $errormsg; + $langs->load("errors"); + $errormsg=$langs->trans("ErrorFailedToWriteInFile", $outputfile); + return -4; + } // Create recursive directory iterator /** @var SplFileInfo[] $files */ @@ -2118,9 +2130,11 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip") // Get real and relative path for current file $filePath = $file->getRealPath(); $relativePath = substr($filePath, strlen($inputdir) + 1); - - // Add current file to archive - $zip->addFile($filePath, $relativePath); + if (empty($excludefiles) || ! preg_match($excludefiles, $filePath)) + { + // Add current file to archive + $zip->addFile($filePath, $relativePath); + } } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 30267a57ad5..3d7c9ad0ae2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -796,8 +796,10 @@ function dol_size($size, $type = '') */ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) { - // List of special chars for filenames are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - $filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°'); + // List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file + // Char '>' '<' '|' '$' and ';' are special chars for shells. + // Char '/' and '\' are file delimiters. + $filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';'); return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars); } @@ -922,11 +924,15 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0) * @param string $stringtoescape String to escape * @param int $keepb 1=Preserve b tags (otherwise, remove them) * @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value). Set to 1 when escaping for a
".$langs->trans("RuleForStockManagementDecrease")."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("DeStockOnBill").''; +print ''; if (! empty($conf->facture->enabled)) { if ($conf->use_javascript_ajax) { @@ -125,7 +125,7 @@ $found++; print '
'.$langs->trans("DeStockOnValidateOrder").''; +print ''; if (! empty($conf->commande->enabled)) { if ($conf->use_javascript_ajax) { @@ -147,7 +147,7 @@ $found++; print '
'.$langs->trans("DeStockOnShipment").''; +print ''; if (! empty($conf->expedition->enabled)) { if ($conf->use_javascript_ajax) { @@ -167,7 +167,7 @@ $found++; print '
'.$langs->trans("DeStockOnShipmentOnClosing").''; +print ''; if (! empty($conf->expedition->enabled)) { if ($conf->use_javascript_ajax) { @@ -200,14 +200,14 @@ print '
'; print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; $found=0; print ''; print ''; -print ''; print ''; -print ''; - print ''; - print ''; + print ''; - print ''; - print ''; + print ''; print ''; - print '
".$langs->trans("RuleForStockManagementIncrease")."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("ReStockOnBill").''; +print ''; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { @@ -228,7 +228,7 @@ $found++; print '
'.$langs->trans("ReStockOnValidateOrder").''; +print ''; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { @@ -248,8 +248,8 @@ $found++; if (!empty($conf->reception->enabled)) { print '
'.$langs->trans("StockOnReception").''; + print ''.$langs->trans("StockOnReception").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); @@ -263,8 +263,8 @@ if ($conf->use_javascript_ajax) { print '
'.$langs->trans("StockOnReceptionOnClosing").''; + print ''.$langs->trans("StockOnReceptionOnClosing").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); @@ -279,7 +279,7 @@ else { print '
'.$langs->trans("ReStockOnDispatchOrder").''; + print ''; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { @@ -308,16 +308,17 @@ if ($conf->use_javascript_ajax) { print '
'; print '
'; + print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print ''; print ''; - print ''; print ''; - print ''; print ''; - print ''; } @@ -731,7 +731,7 @@ if ($action == 'create') { $datef=dol_time_plus_duree($datep, $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS, 'h'); } - print ''; if (! empty($arrayfields['c.libelle']['checked'])) print ''; if (! empty($arrayfields['a.label']['checked'])) print ''; + if (! empty($arrayfields['a.note']['checked'])) print ''; if (! empty($arrayfields['a.datep']['checked'])) { print ' - - + + diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 5b601441378..29bc1db3593 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -264,12 +264,12 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done } - $parameters = array('obj' => $obj); + $parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'payment' => $paiement); $reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if(empty($reshook)){ - $ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : ''; - $refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : ''; - $paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0; + $ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref; + $refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp; + $paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : $paiement; } $total_ttc = $obj->total_ttc; diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 821e4d05d7e..0a741e7691b 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -156,8 +156,6 @@ $title=$langs->trans("LT".$object->ltt) . " - " . $langs->trans("Card"); $help_url=''; llxHeader("", $title, $helpurl); - - if ($action == 'create') { print load_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment", $mysoc->country_code)); diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 58b1ccd3f21..c4157d81984 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -85,6 +85,12 @@ $socid = GETPOST('socid', 'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +if (empty($local)) +{ + accessforbidden('Parameter localTaxType is missing'); + exit; +} + /* @@ -106,11 +112,12 @@ llxHeader('', '', '', '', 0, 0, '', '', $morequerystring); $name=$langs->transcountry($local==1?"LT1ReportByCustomers":"LT2ReportByCustomers", $mysoc->country_code); -$fsearch.='
'; -$fsearch.=' '; -$fsearch.=' '; -$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; -$fsearch.=' '; +$fsearch =''; +$fsearch.=''; +$fsearch.=''; +$fsearch.=''; +$fsearch.=$langs->trans("SalesTurnoverMinimum").': '; +$fsearch.=''; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; // Affiche en-tete du rapport diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 8d288274049..ef5013c84f6 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -188,6 +188,19 @@ function pt($db, $sql, $date) } } +if (empty($localTaxType)) +{ + accessforbidden('Parameter localTaxType is missing'); + exit; +} + + +/* + * Actions + */ + +// None + /* * View @@ -213,7 +226,11 @@ if($localTaxType==1) { $CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC2; } -$fsearch.=' '; +$fsearch = ''; +$fsearch.= ''; +$fsearch.= ''; +$fsearch.= ''; + $description = $fsearch; // Show report header @@ -528,7 +545,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc $total = $total + $diff; $subtotal = price2num($subtotal + $diff, 'MT'); - print '\n'; + print ''."\n"; print "\n"; print "\n"; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 4bbe5c723e1..c28c5f5f48b 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -97,6 +97,12 @@ $socid = GETPOST('socid', 'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +if (empty($local)) +{ + accessforbidden('Parameter localTaxType is missing'); + exit; +} + /* @@ -122,9 +128,10 @@ foreach ($listofparams as $param) llxHeader('', $langs->trans("LocalTaxReport"), '', '', 0, 0, '', '', $morequerystring); -$fsearch.=' '; -$fsearch.=' '; -$fsearch.=' '; +$fsearch = ''; +$fsearch.= ''; +$fsearch.= ''; +$fsearch.= ''; $name=$langs->transcountry($local==1?"LT1ReportByQuarters":"LT2ReportByQuarters", $mysoc->country_code); $calcmode=''; @@ -161,7 +168,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description.='
'.$langs->trans("DepositsAreNotIncluded"); } */ -if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='
'.$langs->trans("ThisIsAnEstimatedValue"); +if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.=$langs->trans("ThisIsAnEstimatedValue"); // Customers invoices $elementcust=$langs->trans("CustomersInvoices"); @@ -186,15 +193,14 @@ if ($mysoc->tva_assuj) { report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode); - if($local==1){ - $vatcust=$langs->transcountry("LocalTax1", $mysoc->country_code); - $vatsup=$langs->transcountry("LocalTax1", $mysoc->country_code); - $vatexpensereport=$langs->transcountry("LocalTax1", $mysoc->country_code); + $vatcust=$langs->transcountry("LT1", $mysoc->country_code); + $vatsup=$langs->transcountry("LT1", $mysoc->country_code); + $vatexpensereport=$langs->transcountry("LT1", $mysoc->country_code); }else{ - $vatcust=$langs->transcountry("LocalTax2", $mysoc->country_code); - $vatsup=$langs->transcountry("LocalTax2", $mysoc->country_code); - $vatexpensereport=$langs->transcountry("LocalTax2", $mysoc->country_code); + $vatcust=$langs->transcountry("LT2", $mysoc->country_code); + $vatsup=$langs->transcountry("LT2", $mysoc->country_code); + $vatexpensereport=$langs->transcountry("LT2", $mysoc->country_code); } // VAT Received and paid diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 5864d6301bd..bf95a35f1fd 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -239,6 +239,23 @@ if ($id > 0 || $ref) dol_fiche_end(); + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Delete'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); + } + + // Call Hook formConfirm + /*$parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;*/ + + // Print form confirm + print $formconfirm; + if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted') { @@ -298,7 +315,7 @@ if ($id > 0 || $ref) print "id."\">".$langs->trans("ClassCredited").""; } - print "id."\">".$langs->trans("Delete").""; + print "id."\">".$langs->trans("Delete").""; print ""; } @@ -356,8 +373,6 @@ if ($id > 0 || $ref) print_liste_field_titre(''); print "\n"; - $var=false; - $total = 0; while ($i < min($num, $conf->liste_limit)) @@ -406,7 +421,10 @@ if ($id > 0 || $ref) print ''; print ''; print '\n"; print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 1a98c33ab02..10c12d967b3 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -739,14 +739,16 @@ class BonPrelevement extends CommonObject $sql = "SELECT count(f.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql.= " WHERE f.fk_statut = 1"; - $sql.= " AND f.entity IN (".getEntity('invoice').")"; + $sql.= " WHERE f.entity IN (".getEntity('invoice').")"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) + { + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + } $sql.= " AND f.rowid = pfd.fk_facture"; - $sql.= " AND f.paye = 0"; $sql.= " AND pfd.traite = 0"; $sql.= " AND f.total_ttc > 0"; - dol_syslog(get_class($this)."::SommeAPrelever"); + dol_syslog(get_class($this)."::NbFactureAPrelever"); $resql = $this->db->query($sql); if ( $resql ) @@ -759,7 +761,7 @@ class BonPrelevement extends CommonObject } else { - $this->error=get_class($this)."::SommeAPrelever Erreur -1 sql=".$this->db->error(); + $this->error=get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error(); return -1; } } @@ -1630,8 +1632,8 @@ class BonPrelevement extends CommonObject public static function buildRumNumber($row_code_client, $row_datec, $row_drum) { global $langs; - $pre = $langs->trans('RUM').'-'; - return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); + $pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation) + return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index ddbec62e413..34da3336bcc 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'widthdrawals', 'companies', 'bills')); +$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -105,6 +105,7 @@ if (empty($reshook)) /* * View */ + $form = new Form($db); $thirdpartystatic=new Societe($db); @@ -206,9 +207,14 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} +$sql.= " AND f.total_ttc > 0"; $sql.= " AND pfd.traite = 0"; $sql.= " AND pfd.fk_facture = f.rowid"; -if ($socid) $sql.= " AND f.fk_soc = ".$socid; +if ($socid > 0) $sql.= " AND f.fk_soc = ".$socid; $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -292,7 +298,7 @@ if ($resql) $i++; } } - else print ''; + else print ''; print "
".$langs->trans("RuleForStockAvailability")."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("WarehouseAllowNegativeTransfer").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_ALLOW_NEGATIVE_TRANSFER'); } else { @@ -332,7 +333,7 @@ if($conf->invoice->enabled) { print '
'.$langs->trans("StockMustBeEnoughForInvoice").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); } else { @@ -347,7 +348,7 @@ if($conf->order->enabled) { print '
'.$langs->trans("StockMustBeEnoughForOrder").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); } else { @@ -362,7 +363,7 @@ if($conf->expedition->enabled) { print '
'.$langs->trans("StockMustBeEnoughForShipment").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); } else { @@ -386,12 +387,12 @@ if ($virtualdiffersfromphysical) print ''; print ''; print "\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''; print ''; - print ''; print ''; print ''; print "\n"; -$var=false; -//if ($conf->global->MAIN_FEATURES_LEVEL > 0) -//{ - print '\n"; +print '\n"; -//} // Ask for payment bank during supplier order /* Kept as hidden for the moment @@ -564,6 +560,26 @@ print '\n"; +// Option to add a quality/validation step, on products, after reception. +print ''; +print ''; +print ''; +print '\n\n"; + print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UseVirtualStockByDefault").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); } else { @@ -409,12 +410,12 @@ print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print ''; print ''; -print '\n"; print ''; print ''; -print '\n"; print "\n"; -if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { - print ''; - print ''; - print '\n\n"; -} - print '
".$langs->trans("Other")."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UserWarehouseAutoCreate").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_USERSTOCK_AUTOCREATE'); } else { @@ -428,7 +429,7 @@ print '
'; print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); print ''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_SUPPORTS_SERVICES'); } else { @@ -440,7 +441,7 @@ print "
'.$langs->trans("AllowAddLimitStockByWarehouse").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE'); } else { @@ -450,19 +451,6 @@ if ($conf->use_javascript_ajax) { print "
'.$langs->trans("UseDispatchStatus").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("SUPPLIER_ORDER_USE_DISPATCH_STATUS", $arrval, $conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS); -} - print "
'; print '
'; @@ -471,43 +459,45 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''; print ''; print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; // Example with a yes / no select - print ''; + /*print ''; print ''; - print ''; + */ // Example with a yes / no select - print ''; + /*print ''; print ''; - print ''; + print ''; + */ - // Example with a yes / no select + // Example with a yes / no select print ''; - print ''; - print ''; + print ''; print '
'.$langs->trans("Inventory").''.$langs->trans("Status").'
'.$langs->trans("Status").'
'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('INVENTORY_DISABLE_VIRTUAL'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVENTORY_DISABLE_VIRTUAL'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL); + } print '
'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('INVENTORY_USE_MIN_PA_IF_NO_LAST_PA'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA); -} - print '
'; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVENTORY_USE_MIN_PA_IF_NO_LAST_PA'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA); + } + print '
'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT); -} + print ''.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT); + } print '
'; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index e895a0b4005..2fef63ffdd8 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Load translation files required by the page -$langs->loadLangs(array("admin", "other", "orders")); +$langs->loadLangs(array("admin", "other", "orders", "stocks")); if (!$user->admin) accessforbidden(); @@ -494,20 +494,16 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; - print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; - print $langs->trans("IfSetToYesDontForgetPermission"); - print '
'; - print ''; - print ''; - print ''; - print "
'; +print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; +print $langs->trans("IfSetToYesDontForgetPermission"); +print '
'; +print ''; +print ''; +print ''; +print "
'; print ''; print "
'.$langs->trans("UseDispatchStatus").''; +if ($conf->reception->enabled) +{ + print ''.$langs->trans("FeatureNotAvailableWithReceptionModule").''; +} +else +{ + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("SUPPLIER_ORDER_USE_DISPATCH_STATUS", $arrval, $conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS); + } +} +print "

'; print ''; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index c06314daa9a..0bef19dde56 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -50,10 +50,20 @@ if (! $user->admin) if ($action == 'delete') { - $file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); - $ret=dol_delete_file($file, 1); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha'))) + { + $file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); + $ret=dol_delete_file($file, 1); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + } + else + { + $file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha')); + $ret=dol_delete_file($file, 1); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + } $action=''; } @@ -577,7 +587,7 @@ print "\n"; ?>
-
" id="buttonGo" />

diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index c1ddedfea53..4f9e8b933d2 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -112,21 +112,27 @@ $utils = new Utils($db); if ($compression == 'zip') { - $ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression); + $ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/'); if ($ret < 0) { - $errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputfile); + $errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir); } } elseif (in_array($compression, array('gz', 'bz'))) { - $file = substr($file, 0, strrpos($file, '.')); + $userlogin = ($user->login ? $user->login : 'unknown'); + + $outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method + + $file = substr($file, 0, strrpos($file, '.')); $file .= '.tar'; - $cmd = 'tar -cf '.$outputdir."/".$file." --exclude=documents/admin/documents -C ".DOL_DATA_ROOT." ".DOL_DATA_ROOT."/../documents/"; - exec($cmd, $out, $retval); - //var_dump($cmd, DOL_DATA_ROOT);exit; - - if ($retval != 0) + // We also exclude '/temp/' dir and 'documents/admin/documents' + $cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT); + + $result = $utils->executeCLI($cmd, $outputfile); + + $retval = $result['error']; + if ($result['result'] || ! empty($retval)) { $langs->load("errors"); dol_syslog("Documents tar retval after exec=".$retval, LOG_ERR); @@ -136,15 +142,17 @@ elseif (in_array($compression, array('gz', 'bz'))) { if ($compression == 'gz') { - $cmd = "gzip " . $outputdir."/".$file; + $cmd = "gzip -f " . $outputdir."/".$file; } if ($compression == 'bz') { - $cmd = "bzip2 " . $outputdir."/".$file; + $cmd = "bzip2 -f " . $outputdir."/".$file; } - - exec($cmd, $out, $retval); - if ($retval != 0) + + $result = $utils->executeCLI($cmd, $outputfile); + + $retval = $result['error']; + if ($result['result'] || ! empty($retval)) { $errormsg = 'Error '.$compression.' generation return '.$retval; unlink($outputdir."/".$file); diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index b54a2e21b57..290e29c3f2b 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -55,7 +55,7 @@ function bomAdminPrepareHead() //$this->tabs = array( // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'bom'); return $head; } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index eb263bdffae..b9a92f85d5e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -188,10 +188,12 @@ class Categorie extends CommonObject * @var string Color */ public $color; + /** - * @var ??? + * @var int Id of thirdparty when CATEGORY_ASSIGNED_TO_A_CUSTOMER is set */ public $socid; + /** * @var string Category type * diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a7170b799a2..a7a0767c6b5 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -40,7 +40,7 @@ $type = GETPOST('type', 'az09'); $action=GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $removeelem = GETPOST('removeelem', 'int'); -$elemid = GETPOST('elemid', 'alpha'); +$elemid = GETPOST('elemid', 'int'); if ($id == "" && $label == "") { diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index af54186e255..4e5abac75d3 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -221,7 +221,7 @@ if ($action == 'add') } // Initialisation objet cactioncomm - if (! GETPOST('actioncode') > 0) // actioncode is id + if (GETPOSTISSET('actioncode') && ! GETPOST('actioncode', 'aZ09')) // actioncode is '0' { $error++; $donotclearsession=1; $action = 'create'; @@ -229,7 +229,7 @@ if ($action == 'add') } else { - $object->type_code = GETPOST('actioncode'); + $object->type_code = GETPOST('actioncode', 'aZ09'); } if (! $error) @@ -243,7 +243,7 @@ if ($action == 'add') $object->elementtype = GETPOST("elementtype", 'alpha'); if (! GETPOST('label')) { - if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) + if (GETPOST('actioncode', 'aZ09') == 'AC_RDV' && $contact->getFullName($langs)) { $object->label = $langs->transnoentitiesnoconv("TaskRDVWith", $contact->getFullName($langs)); } @@ -426,15 +426,15 @@ if ($action == 'update') $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); - $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm'); - $object->label = GETPOST("label"); + $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); + $object->label = GETPOST("label", "alphanohtml"); $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; - $object->priority = GETPOST("priority"); + $object->priority = GETPOST("priority", "alphanohtml"); $object->fulldayevent= GETPOST("fullday")?1:0; - $object->location = GETPOST('location'); - $object->socid = GETPOST("socid"); + $object->location = GETPOST('location', "alphanohtml"); + $object->socid = GETPOST("socid", "int"); $socpeopleassigned = GETPOST("socpeopleassigned", 'array'); $object->socpeopleassigned = array(); foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid); @@ -446,8 +446,8 @@ if ($action == 'update') $object->fk_project = GETPOST("projectid", 'int'); $object->note = GETPOST("note", "none"); // deprecated $object->note_private= GETPOST("note", "none"); - $object->fk_element = GETPOST("fk_element"); - $object->elementtype = GETPOST("elementtype"); + $object->fk_element = GETPOST("fk_element", "int"); + $object->elementtype = GETPOST("elementtype", "alphanohtml"); if (! $datef && $percentage == 100) { @@ -491,7 +491,7 @@ if ($action == 'update') } // Check parameters - if (! GETPOST('actioncode') > 0) + if (GETPOSTISSET('actioncode') && ! GETPOST('actioncode', 'aZ09')) // actioncode is '0' { $error++; $donotclearsession=1; $action = 'edit'; @@ -499,7 +499,7 @@ if ($action == 'update') } else { - $result=$cactioncomm->fetch(GETPOST('actioncode')); + $result=$cactioncomm->fetch(GETPOST('actioncode', 'aZ09')); } if (empty($object->userownerid)) { @@ -689,7 +689,7 @@ if ($action == 'create') if ($backtopage) print ''; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; - if (GETPOST("actioncode") == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous"), '', 'title_agenda'); + if (GETPOST("actioncode", 'aZ09') == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous"), '', 'title_agenda'); else print load_fiche_titre($langs->trans("AddAnAction"), '', 'title_agenda'); dol_fiche_head(); @@ -701,7 +701,7 @@ if ($action == 'create') { print '
'.$langs->trans("Type").''; $default=(empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)?'':$conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); - $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):($object->type_code?$object->type_code:$default), "actioncode", "systemauto", 0, -1); + $formactions->select_type_actions(GETPOST("actioncode", 'aZ09')?GETPOST("actioncode", 'aZ09'):($object->type_code?$object->type_code:$default), "actioncode", "systemauto", 0, -1); print '
'.$langs->trans("DateActionEnd").''; + print '
'.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); } elseif (GETPOST("afaire") == 2) { @@ -1010,15 +1010,15 @@ if ($id > 0) $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); - $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm'); - $object->label = GETPOST("label"); + $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); + $object->label = GETPOST("label", "alphanohtml"); $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; - $object->priority = GETPOST("priority"); + $object->priority = GETPOST("priority", "alphanohtml"); $object->fulldayevent= GETPOST("fullday")?1:0; - $object->location = GETPOST('location'); - $object->socid = GETPOST("socid"); + $object->location = GETPOST('location', "alpanohtml"); + $object->socid = GETPOST("socid", "int"); $socpeopleassigned = GETPOST("socpeopleassigned", 'array'); foreach ($socpeopleassigned as $tmpid) $object->socpeopleassigned[$id] = array('id' => $tmpid); $object->contactid = GETPOST("contactid", 'int'); @@ -1101,7 +1101,7 @@ if ($id > 0) print '
'.$langs->trans("Type").''; if ($object->type_code != 'AC_OTH_AUTO') { - $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode", "systemauto"); + $formactions->select_type_actions(GETPOST("actioncode", 'aZ09')?GETPOST("actioncode", 'aZ09'):$object->type_code, "actioncode", "systemauto"); } else { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index eb7fb885d8d..5d3290599b9 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -84,7 +84,7 @@ class CActionComm $sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; if (is_numeric($id)) $sql.= " WHERE id=".$id; - else $sql.= " WHERE code='".$id."'"; + else $sql.= " WHERE code='".$this->db->escape($id)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index bd57005b7bf..2ef4c74f765 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -452,6 +452,7 @@ if ($resql) if (! empty($arrayfields['owner']['checked'])) print ''; print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index b6f5d9328f8..88dfcef7d7f 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -835,7 +835,7 @@ else { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // You ensure that every user is using its own SMTP server when using the mass emailing module. - $linktoadminemailbefore=''; + $linktoadminemailbefore=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index d82ec07612d..1538cbd7c81 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -335,15 +335,15 @@ class Mailing extends CommonObject $target_array=array(); - $sql = "SELECT fk_contact, "; - $sql.=" lastname, "; - $sql.=" firstname,"; - $sql.=" email,"; - $sql.=" other,"; - $sql.=" source_url,"; - $sql.=" source_id ,"; - $sql.=" source_type "; - $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles "; + $sql = "SELECT fk_contact,"; + $sql.= " lastname,"; + $sql.= " firstname,"; + $sql.= " email,"; + $sql.= " other,"; + $sql.= " source_url,"; + $sql.= " source_id ,"; + $sql.= " source_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$fromid; $result=$this->db->query($sql); @@ -353,14 +353,16 @@ class Mailing extends CommonObject { while ($obj = $this->db->fetch_object($result)) { - $target_array[]=array('fk_contact'=>$obj->fk_contact, - 'lastname'=>$obj->lastname, - 'firstname'=>$obj->firstname, - 'email'=>$obj->email, - 'other'=>$obj->other, - 'source_url'=>$obj->source_url, - 'source_id'=>$obj->source_id, - 'source_type'=>$obj->source_type); + $target_array[]=array( + 'fk_contact'=>$obj->fk_contact, + 'lastname'=>$obj->lastname, + 'firstname'=>$obj->firstname, + 'email'=>$obj->email, + 'other'=>$obj->other, + 'source_url'=>$obj->source_url, + 'source_id'=>$obj->source_id, + 'source_type'=>$obj->source_type + ); } } } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7331d7a86e9..180f95e2d4e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2500,7 +2500,7 @@ $formquestion = array_merge($formquestion, array( if ($usercansend) { print ''; } else - print ''; + print ''; } // Create an order @@ -2538,7 +2538,14 @@ $formquestion = array_merge($formquestion, array( $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED)) { - print ''; + if ($usercanclose) + { + print ''; + } + else + { + print ''; + } } } diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 74a2243d633..c2fed2895a8 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -81,8 +81,8 @@ if (count($linkedObjectBlock) > 1)
trans("Total"); ?> '.price(price2num($diff, 'MT')).''.price(price2num($diff, 'MT')).' 
'.$langs->trans("Total").' '; - if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); + if (empty($offset) && $num <= $limit) // If we have all record on same page, then the following test/warning can be done + { + if ($total != $object->amount) print img_warning("TotalAmountOfdirectDebitOrderDiffersFromSumOfLines"); + } print price($total); print " 
'.$langs->trans("None").'
'.$langs->trans("None").'
"; print ""; print "
\n"; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 8f9df284291..6c1ea278430 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -35,31 +35,43 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); // Security check $socid = GETPOST('socid', 'int'); +$status = GETPOST('status', 'int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); -// Get supervariables -$page = GETPOST('page', 'int'); -$sortorder = GETPOST('sortorder', 'alpha'); -$sortfield = GETPOST('sortfield', 'alpha'); +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +// Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.ref"; +$massactionbutton = ''; + /* * View */ -llxHeader(); +if (!$status) +{ + $title = $langs->trans("RequestStandingOrderToTreat"); +} +else +{ + $title = $langs->trans("RequestStandingOrderTreated"); +} + +llxHeader('', $title); $thirdpartystatic=new Societe($db); $invoicestatic=new Facture($db); @@ -78,95 +90,129 @@ $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND f.fk_soc = ".$socid; -if (!$statut) $sql.= " AND pfd.traite = 0"; -if ($statut) $sql.= " AND pfd.traite = ".$statut; +if (!$status) $sql.= " AND pfd.traite = 0"; +if ($status) $sql.= " AND pfd.traite = ".$status; +$sql.= " AND f.total_ttc > 0"; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND pfd.fk_facture = f.rowid"; if (dol_strlen(trim(GETPOST('search_societe', 'alpha')))) { $sql.= natural_search("s.nom", 'search_societe'); } -$sql.= " ORDER BY $sortfield $sortorder "; -$sql.= $db->plimit($limit+1, $offset); +$sql.=$db->order($sortfield, $sortorder); -$resql=$db->query($sql); -if ($resql) + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $num = $db->num_rows($resql); - $i = 0; - - if (!$statut) + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 { - print_barre_liste($langs->trans("RequestStandingOrderToTreat"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num); + $page = 0; + $offset = 0; } - else - { - print_barre_liste($langs->trans("RequestStandingOrderTreated"), $page, "demandes.php", $urladd, $sortfield, $sortorder, '', $num); - } - - print '
'; - - print ''; - - print ''; - print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]); - print_liste_field_titre("Company", $_SERVER["PHP_SELF"]); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, 'class="right"'); - print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, 'class="center"'); - print_liste_field_titre(''); - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - // Action column - print ''; - print ''; - - $users = array(); - - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($resql); - - print ''; - - // Ref facture - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - $i++; - } - - print "
'; - $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); - print $searchpicto; - print '
'; - $invoicestatic->id=$obj->rowid; - $invoicestatic->ref=$obj->ref; - print $invoicestatic->getNomUrl(1, 'withdraw'); - print ''; - $thirdpartystatic->id=$obj->socid; - $thirdpartystatic->name=$obj->name; - print $thirdpartystatic->getNomUrl(1, 'customer'); - print ''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->date_demande), 'day').'

"; - - print '
'; +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) +{ + $num = $nbtotalofrecords; } else { - dol_print_error($db); + $sql.= $db->plimit($limit+1, $offset); + + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); } + + +$newcardbutton = ''.$langs->trans("Back").''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + + +print ''; + +print ''; +print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]); +print_liste_field_titre("Company", $_SERVER["PHP_SELF"]); +print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, 'class="right"'); +print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, 'class="center"'); +print_liste_field_titre(''); +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +// Action column +print ''; +print ''; + +$users = array(); + +$i = 0; +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + print ''; + + // Ref facture + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + $i++; +} + +print "
'; +$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); +print $searchpicto; +print '
'; + $invoicestatic->id=$obj->rowid; + $invoicestatic->ref=$obj->ref; + print $invoicestatic->getNomUrl(1, 'withdraw'); + print ''; + $thirdpartystatic->id=$obj->socid; + $thirdpartystatic->name=$obj->name; + print $thirdpartystatic->getNomUrl(1, 'customer'); + print ''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->date_demande), 'day').'

"; + +print '
'; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 1be716f8f61..468d4807c65 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -71,6 +71,7 @@ $thirdpartystatic=new Societe($db); $invoicestatic=new Facture($db); $bprev = new BonPrelevement($db); + print ''; print ''; @@ -100,6 +101,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; +$sql.= " AND f.total_ttc > 0"; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND f.fk_soc = ".$socid; diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index e0775313dd3..969d5322008 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -123,11 +123,11 @@ if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) { llxHeader('', $langs->trans("VATReport"), '', '', 0, 0, '', '', $morequerystring); -$fsearch.='
'; -$fsearch.=' '; -$fsearch.=' '; -$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; -$fsearch.=' '; +$fsearch =''; +$fsearch.=''; +$fsearch.=''; +$fsearch.=$langs->trans("SalesTurnoverMinimum").': '; +$fsearch.=''; // Show report header $name=$langs->trans("VATReportByThirdParties"); diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index f0c96dccdd6..6a83d25070b 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -198,7 +198,11 @@ $form=new Form($db); $company_static=new Societe($db); $tva = new Tva($db); -$description = ''; +$fsearch =''; +$fsearch.=''; +$fsearch.=''; + +$description = $fsearch; // Show report header $name = $langs->trans("ReportByMonth"); @@ -208,7 +212,7 @@ if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption'); if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices'); $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')'; -$description = $langs->trans("VATSummary").'
'; +$description .= $langs->trans("VATSummary").'
'; if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts"); if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts"); if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='
'.$langs->trans("RulesVATDueServices"); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 8b58bde4199..581e9a1d13e 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -122,8 +122,9 @@ llxHeader('', $langs->trans("VATReport"), '', '', 0, 0, '', '', $morequerystring //print load_fiche_titre($langs->trans("VAT"),""); //$fsearch.='
'; -$fsearch.=' '; -$fsearch.=' '; +$fsearch =''; +$fsearch.=''; +$fsearch.=''; //$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; //$fsearch.=' '; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bae8632e289..18da6bf476d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -81,26 +81,11 @@ class Contact extends CommonObject public $civility_id; // In fact we store civility_code public $civility_code; - public $civility; + public $civility; public $address; public $zip; public $town; - /** - * @deprecated - * @see $state_id - */ - public $fk_departement; - /** - * @deprecated - * @see $state_code - */ - public $departement_code; - /** - * @deprecated - * @see $state - */ - public $departement; public $state_id; // Id of department public $state_code; // Code of department public $state; // Label of department diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 1514a2188ff..edcb08c515b 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -80,12 +80,12 @@ if ($action == 'dolibarr2ldap') * View */ +$form = new Form($db); + $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); llxHeader('', $title, 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); -$form = new Form($db); - $head = contact_prepare_head($object); dol_fiche_head($head, 'ldap', $title, -1, 'contact'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5c9ac3375dd..0bf304b96a1 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -433,7 +433,7 @@ if (empty($reshook)) } $qty = GETPOST('qty'.$predef); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0); if ($qty == '') { @@ -566,7 +566,8 @@ if (empty($reshook)) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht)*(1-price2num($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) ) && ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))) { $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1 ; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 995ba93fb64..c313b6c526a 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -256,7 +256,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -340,7 +340,7 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency) ); diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 525562d308d..1928ac7cc94 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -134,7 +134,7 @@ class box_comptes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowraponall"', 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index d1381870338..165b6db0d6b 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -179,12 +179,12 @@ class box_produits_alerte_stock extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowraponall"', 'text' => $price, ); $this->info_box_contents[$line][] = array( - 'td' => 'class="nowrap"', + 'td' => 'class="right"', 'text' => $price_base_type, ); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 34316cd1ad1..6874425db78 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -135,7 +135,7 @@ class box_supplier_orders extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowrap"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index fadd0c02fde..1df572c8a35 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -497,8 +497,16 @@ abstract class CommonDocGenerator $resarray['object_total_up'] = $totalUp; $resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs); if (method_exists($object, 'getTotalDiscount')) { - $resarray['object_total_discount'] = round(100 / $totalUp * $object->getTotalDiscount(), 2); + $totalDiscount=$object->getTotalDiscount(); + } else { + $totalDiscount=0; + } + if (!empty($totalUp) && !empty($totalDiscount)) { + $resarray['object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2); $resarray['object_total_discount_locale'] = price($resarray['object_total_discount'], 0, $outputlangs); + } else { + $resarray['object_total_discount']=''; + $resarray['object_total_discount_locale']=''; } } @@ -766,10 +774,20 @@ abstract class CommonDocGenerator //Add value to store price with currency $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency'])); } - elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') + elseif($extrafields->attribute_type[$key] == 'select') { $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; } + elseif($extrafields->attribute_type[$key] == 'checkbox') { + $valArray=explode(',', $object->array_options['options_'.$key]); + $output=array(); + foreach($extrafields->attribute_param[$key]['options'] as $keyopt=>$valopt) { + if (in_array($keyopt, $valArray)) { + $output[]=$valopt; + } + } + $object->array_options['options_'.$key] = implode(', ', $output); + } elseif($extrafields->attribute_type[$key] == 'date') { if (strlen($object->array_options['options_'.$key])>0) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4e88348c6d0..d20a8d2785b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6450,9 +6450,12 @@ abstract class CommonObject } else { - $csstyle=''; $class=(!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : ''); + $csstyle=''; if (is_array($params) && count($params)>0) { + if (array_key_exists('class', $params)) { + $class.=$params['class'].' '; + } if (array_key_exists('style', $params)) { $csstyle=$params['style']; } @@ -6489,16 +6492,19 @@ abstract class CommonObject $labeltoshow = $langs->trans($label); - $out .= ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; + $out .=''; + /*for($ii = 0; $ii < ($colspan - 1); $ii++) + { + $out .=''; + }*/ + if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; else $out .= ''; $e++; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 80c88e9406c..dce42c79d33 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1152,9 +1152,8 @@ class Form $sql .= ", dictp.code as country_code"; } - $sql.= " FROM (".MAIN_DB_PREFIX ."societe as s"; + $sql.= " FROM ".MAIN_DB_PREFIX ."societe as s"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " )"; if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid=s.fk_pays"; } @@ -1903,6 +1902,15 @@ class Form $price_level = (! empty($price_level) ? $price_level : 0); if (is_null($ajaxoptions)) $ajaxoptions=array(); + if(strval($filtertype) === '' && (!empty($conf->product->enabled) || !empty($conf->service->enabled))){ + if(!empty($conf->product->enabled) && empty($conf->service->enabled)){ + $filtertype = '0'; + } + elseif(empty($conf->product->enabled) && !empty($conf->service->enabled)){ + $filtertype = '1'; + } + } + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { $placeholder=''; @@ -4229,7 +4237,7 @@ class Form $formconfirm.= ''; - $formconfirm.= ''; + $formconfirm.= ''; $formconfirm.= ''."\n"; $formconfirm.= '
'.$langs->trans("Statistics").'
attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired'; $out .= '">'; - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$object->table_element]['help'][$key]); + if (! empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]); else $out .= $labeltoshow; $out .= ''; + //$out .=''; switch($mode) { case "view": @@ -6511,6 +6517,11 @@ abstract class CommonObject $out .= '
'; $formconfirm.= $this->selectyesno("confirm", $newselectedchoice); $formconfirm.= 'trans("Validate").'">
'."\n"; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d271f90720c..9411e8bc824 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1381,7 +1381,7 @@ class FormFile if (! empty($conf->dol_use_jmobile)) $useajax=0; if (empty($conf->use_javascript_ajax)) $useajax=0; if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0; - print ''.img_delete().''; + print ''.img_delete().''; } print "