diff --git a/.travis.yml b/.travis.yml index 1cd0a40bf82..1002216b7cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,15 @@ # We use dist: trusty to have php 5.4+ available os: linux dist: trusty -sudo: required +#sudo: required language: php # Start on every boot services: - memcached +- mysql +- postgresql addons: mariadb: '10.0' @@ -29,60 +31,25 @@ addons: # We need pgloader for import mysql database into pgsql - pgloader -php: -- '5.5' -- '5.6' -- '7.0' -- '7.1' -- '7.2' -- '7.3' -- '7.4' -- nightly - env: global: # Set to true for very verbose output - DEBUG=false - jobs: - # MariaDB overrides MySQL installation so it's not possible to test both yet - #- DB=mysql - - DB=mariadb - - DB=postgresql - # TODO - #- DB=sqlite - # See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP - #- WS=apache - # See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test - #- WS=nginx jobs: fast_finish: true allow_failures: - php: nightly - # We exclude some combinations not usefull to save Travis CPU - exclude: - - php: '5.6' - env: DB=mariadb - - php: '7.0' - env: DB=mariadb - - php: '7.1' - env: DB=mariadb - - php: '7.2' - env: DB=mariadb - - php: '7.3' - env: DB=mariadb - - php: '5.6' - env: DB=postgresql - - php: '7.0' - env: DB=postgresql - - php: '7.1' - env: DB=postgresql - - php: '7.2' - env: DB=postgresql - - php: '7.3' - env: DB=postgresql - - php: nightly - env: DB=postgresql + include: + - if: type = push + php: '5.5' + env: DB=postgresql + - if: type = pull_request OR type = push + php: '7.4' + env: DB=mysql + - if: type = push AND branch = develop + php: nightly + env: DB=mysql notifications: email: @@ -115,11 +82,13 @@ install: echo "Updating Composer" rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.lock + composer -V composer self-update # To have composer making parallel downloads composer global require hirak/prestissimo composer -n init composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes echo - | @@ -148,6 +117,9 @@ install: - | echo "Adding path of binaries tools installed by composer to the PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/vendor + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin echo @@ -174,15 +146,16 @@ before_script: - | echo "Versions information" + echo # Check PHP echo "PHP version" php -i | head - - # Check PHP CodeSniffer installation + # Check PHP CodeSniffer version echo "PHPCS version" which phpcs phpcs --version | head - phpcs -i | head - - # Check PHPUnit installation + # Check PHPUnit version echo "PHPUnit version" which phpunit phpunit --version | head - @@ -263,10 +236,7 @@ before_script: - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - sudo chown -R travis:travis /var/lib/apache2/fastcgi - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm - # configure apache virtual hosts for precise - #- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default - #- sudo cat /etc/apache2/sites-available/default - # configure apache virtual hosts for trusty + # configure apache virtual hosts - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf - sudo cat /etc/apache2/sites-available/000-default.conf @@ -291,17 +261,18 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo - | - echo "Checking coding style (excluding Pull Requests builds)" + echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)" # Ensure we catch errors 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 . - 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 + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; 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 @@ -430,7 +401,7 @@ script: after_script: - | - echo "After script - Output lines of dolibarr.log" + echo "After script - Output last lines of dolibarr.log" ls $TRAVIS_BUILD_DIR/documents #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log @@ -456,7 +427,7 @@ after_failure: # Dolibarr log file echo "Debugging informations for file dolibarr.log (latest 50 lines)" tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - # MariaDB log file + # Database log file echo "Debugging informations for file mysql error.log" sudo tail -n 50 /var/log/mysql/error.log # TODO: PostgreSQL log file diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 48c6bf342a9..169fa27b5bd 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -8,6 +8,7 @@ ALL: Check "@CHANGE" + PrestaShopWebservice: --------------------- Replace @@ -27,6 +28,19 @@ With +DEBUGBAR: +--------- + +Move + this.options = { + bodyMarginBottom: true, + bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')), + }; +few line lower in the + initialize: function() { + + + ESCPOS: ------- Replace diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index e7ec48944e1..7b23ae37d00 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -365,6 +365,7 @@ class AccountancyExport foreach ($objectLines as $line) { $date = dol_print_date($line->doc_date, '%d/%m/%Y'); + print $date.$separator; print $line->code_journal.$separator; print length_accountg($line->numero_compte).$separator; @@ -373,7 +374,7 @@ class AccountancyExport print price($line->debit).$separator; print price($line->credit).$separator; print 'E'.$separator; - print length_accountg($line->subledger_account).$separator; + print length_accounta($line->subledger_account).$separator; print $end_line; } } @@ -708,8 +709,8 @@ class AccountancyExport foreach ($objectLines as $line) { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); - $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); - $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); + $date_document = dol_print_date($line->doc_date, '%Y%m%d'); + $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal.$separator; @@ -721,25 +722,25 @@ class AccountancyExport print $line->piece_num.$separator; // FEC:EcritureDate - print $date_creation.$separator; + print $date_document . $separator; // FEC:CompteNum print $line->numero_compte.$separator; // FEC:CompteLib - print $line->label_compte.$separator; + print dol_string_unaccent($line->label_compte) . $separator; // FEC:CompAuxNum print $line->subledger_account.$separator; // FEC:CompAuxLib - print $line->subledger_label.$separator; + print dol_string_unaccent($line->subledger_label) . $separator; // FEC:PieceRef print $line->doc_ref.$separator; // FEC:PieceDate - print $date_doc.$separator; + print dol_string_unaccent($date_creation) . $separator; // FEC:EcritureLib print $line->label_operation.$separator; @@ -757,7 +758,7 @@ class AccountancyExport print $line->date_lettering.$separator; // FEC:ValidDate - print $date_valid.$separator; + print $date_validation . $separator; // FEC:Montantdevise print $line->multicurrency_amount.$separator; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 699bbf1eebc..415acfbbde0 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -863,7 +863,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $date . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print " " . $sep; print '"' . $reflabel . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; @@ -893,7 +893,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; if ($tabtype[$key] == 'payment_supplier') { print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; } elseif($tabtype[$key] == 'payment') { @@ -903,7 +903,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } elseif($tabtype[$key] == 'payment_salary') { print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep; } else { - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; } print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $reflabel . '"' . $sep; @@ -926,7 +926,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $date . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep; print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; - print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; + print '"' . length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print "" . $sep; print '"' . $reflabel . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; @@ -1130,7 +1130,7 @@ if (empty($action) || $action == 'view') { if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"]; - $accounttoshow = length_accounta($account_ledger); + $accounttoshow = length_accountg($account_ledger); if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { if ($tabtype[$key] == 'unknown') diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 21bcc17bd42..7c86003fd25 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -286,7 +286,7 @@ if (empty($reshook)) $object->firstname = trim(GETPOST("firstname", 'alphanohtml')); $object->lastname = trim(GETPOST("lastname", 'alphanohtml')); $object->gender = trim(GETPOST("gender", 'alphanohtml')); - $object->login = trim(GETPOST("login", 'alpha')); + $object->login = trim(GETPOST("login", 'alphanohtml')); $object->pass = trim(GETPOST("pass", 'alpha')); $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated @@ -459,7 +459,7 @@ if (empty($reshook)) // $facebook=GETPOST("member_facebook", 'alpha'); // $linkedin=GETPOST("member_linkedin", 'alpha'); $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); - $login = GETPOST("member_login", 'alpha'); + $login = GETPOST("member_login", 'alphanohtml'); $pass = GETPOST("password", 'alpha'); $photo = GETPOST("photo", 'alpha'); //$comment=GETPOST("comment",'none'); @@ -941,7 +941,7 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print '
| '; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); @@ -237,7 +250,7 @@ print ' | '; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); @@ -257,7 +270,7 @@ if (!empty($conf->reception->enabled)) print ' | '; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); @@ -272,7 +285,7 @@ if (!empty($conf->reception->enabled)) print ' | ';
if ($conf->use_javascript_ajax) {
- print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE');
+ print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
@@ -288,7 +301,7 @@ else
if (! empty($conf->fournisseur->enabled))
{
if ($conf->use_javascript_ajax) {
- print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER');
+ print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php
index 6bbaeb7c6c8..e168f5fbdc0 100644
--- a/htdocs/admin/tools/dolibarr_export.php
+++ b/htdocs/admin/tools/dolibarr_export.php
@@ -302,7 +302,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print ' '; print ''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 56602502715..e71088da27a 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier '.$langs->trans("SubledgerAccount").' | ';
+ print ''.$langs->trans("SubledgerAccount").'aaaa | ';
print '';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php
index 95d84954490..3198b34a34d 100644
--- a/htdocs/compta/bank/various_payment/list.php
+++ b/htdocs/compta/bank/various_payment/list.php
@@ -58,7 +58,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="v.datep,v.rowid";
-if (! $sortorder) $sortorder="DESC";
+if (! $sortorder) $sortorder="DESC,DESC";
$filtre=GETPOST("filtre", 'alpha');
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index fd6dd0baad0..31c42e5ba9e 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -439,15 +439,36 @@ if (empty($reshook))
$object->fetch($id);
$object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property
- $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
- if ($result < 0) dol_print_error($db, $object->error);
- $old_date_lim_reglement = $object->date_lim_reglement;
- $new_date_lim_reglement = $object->calculate_date_lim_reglement();
- if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement;
- if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
- $result = $object->update($user);
- if ($result < 0) dol_print_error($db, $object->error);
+ $error = 0;
+
+ $db->begin();
+
+ if (! $error) {
+ $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
+ if ($result < 0) {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+
+ if (! $error) {
+ $old_date_lim_reglement = $object->date_lim_reglement;
+ $new_date_lim_reglement = $object->calculate_date_lim_reglement();
+ if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement;
+ if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
+ $result = $object->update($user);
+ if ($result < 0) {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+
+ if ($error) {
+ $db->rollback();
+ } else {
+ $db->commit();
+ }
}
elseif ($action == 'setpaymentterm' && $usercancreate)
@@ -976,6 +997,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate)
{
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
+ $selectedLines = GETPOST('toselect', 'array');
$db->begin();
@@ -1565,8 +1587,11 @@ if (empty($reshook))
$fk_parent_line = 0;
$num = count($lines);
+
for ($i = 0; $i < $num; $i++)
{
+ if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
+
// Don't add lines with qty 0 when coming from a shipment including all order lines
if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
@@ -3626,8 +3651,6 @@ if ($action == 'create')
print '';
print '';
- print "\n";
-
// Show origin lines
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
print ' | '; @@ -3637,12 +3660,12 @@ if ($action == 'create') print ' '; + print "\n"; } elseif ($id > 0 || !empty($ref)) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d3c9ae19721..b41d2eaa9b9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin ';
$limit=5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
+$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")";
$sql.= " ORDER BY datec DESC";
$sql.= $db->plimit($limit);
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index 5bb50d825fc..bb4ddc7c5d0 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -56,6 +56,8 @@ $subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') {
$subcat = true;
}
+$categorie = new Categorie($db);
+
// product/service
$selected_type = GETPOST('search_type', 'int');
if ($selected_type =='') $selected_type = -1;
@@ -233,10 +235,6 @@ if ($modecompta == 'CREANCES-DETTES')
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
}
- elseif ($selected_cat) // Into a specific category
- {
- $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
- }
$sql.= " WHERE l.fk_facture = f.rowid";
$sql.= " AND f.fk_statut in (1,2)";
$sql.= " AND l.product_type in (0,1)";
@@ -257,10 +255,22 @@ if ($modecompta == 'CREANCES-DETTES')
$sql.=" AND cp.fk_product is null";
}
elseif ($selected_cat) { // Into a specific category
- $sql.= " AND (c.rowid = ".$selected_cat;
- if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
- $sql.= ")";
- $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid";
+ if ($subcat) {
+ $TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1);
+
+ $listofcatsql = "";
+ foreach ($TListOfCats as $key => $cat)
+ {
+ if ($key !== 0) $listofcatsql .= ",";
+ $listofcatsql .= $cat['rowid'];
+ }
+ }
+
+ $sql.= " AND (p.rowid IN ";
+ $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE ";
+ if ($subcat) $sql .= "cp.fk_categorie IN (". $listofcatsql.")";
+ else $sql.="cp.fk_categorie = ".$selected_cat;
+ $sql.= "))";
}
if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
$sql.= " AND f.entity IN (".getEntity('invoice').")";
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index f0f65071207..d555c50372a 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -1254,6 +1254,11 @@ else
}
}
+ // Select mail models is same action as presend
+ if (GETPOST('modelselected', 'alpha')) {
+ $action = 'presend';
+ }
+
if (!empty($id) && $action != 'edit' && $action != 'create')
{
$objsoc = new Societe($db);
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index d51399d21a9..e06733615ce 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -410,8 +410,8 @@ else
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
+ $resql = $db->query($sql);
+ $nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
@@ -421,14 +421,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset);
-$result = $db->query($sql);
-if (!$result)
+$resql = $db->query($sql);
+if (! $resql)
{
dol_print_error($db);
exit;
}
-$num = $db->num_rows($result);
+$num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array();
@@ -784,7 +784,7 @@ $i = 0;
$totalarray = array();
while ($i < min($num, $limit))
{
- $obj = $db->fetch_object($result);
+ $obj = $db->fetch_object($resql);
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
$contactstatic->lastname = $obj->lastname;
@@ -984,7 +984,7 @@ while ($i < min($num, $limit))
$i++;
}
-$db->free($result);
+$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 9581d625f80..dbdba874dda 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -9,7 +9,7 @@
* Copyright (C) 2014-2018 Ferran Marcet |