Merge branch '12.0' into FIX_12.0_date_extrafields_are_not_filterable_on_lists

This commit is contained in:
Florian Mortgat 2021-01-08 09:08:52 +01:00
commit 77933de467
135 changed files with 1491 additions and 862 deletions

View File

@ -5,7 +5,7 @@
# We use dist: xenial to have php 5.6+ available # We use dist: xenial to have php 5.6+ available
os: linux os: linux
dist: xenial dist: xenial
sudo: required #dist: bionic
language: php language: php
@ -31,53 +31,25 @@ addons:
# We need pgloader for import mysql database into pgsql # We need pgloader for import mysql database into pgsql
- pgloader - pgloader
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- nightly
env: env:
global: global:
# Set to true for very verbose output # Set to true for very verbose output
- DEBUG=false - DEBUG=false
jobs:
# MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mariadb
- DB=mysql
- DB=postgresql
# 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: jobs:
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- php: nightly - php: nightly
# We exclude some combinations not usefull to save Travis CPU include:
exclude: - if: type = push
- php: '7.0' php: '5.6'
env: DB=postgresql
- if: type = pull_request OR type = push
php: '7.4'
env: DB=mysql env: DB=mysql
- php: '7.1' - if: type = push AND branch = develop
php: nightly
env: DB=mysql env: DB=mysql
- php: '7.2'
env: DB=mysql
- php: '7.3'
env: DB=mysql
- 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
notifications: notifications:
email: email:
@ -110,11 +82,11 @@ install:
echo "Updating Composer" echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock rm $TRAVIS_BUILD_DIR/composer.lock
composer -V
composer self-update composer self-update
# To have composer making parallel downloads
composer global require hirak/prestissimo
composer -n init composer -n init
composer -n config vendor-dir htdocs/includes composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo echo
- | - |
@ -143,6 +115,9 @@ install:
- | - |
echo "Adding path of binaries tools installed by composer to the PATH" echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$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 echo
@ -169,15 +144,20 @@ before_script:
- | - |
echo "Versions information" echo "Versions information"
echo
# Check PHP # Check PHP
echo "PHP version" echo "PHP version"
php -i | head - php -i | head -
# Check PHP CodeSniffer installation # Check Parallel-lint version
echo "Parallel-lint version"
which parallel-lint
parallel-lint -V
# Check PHP CodeSniffer version
echo "PHPCS version" echo "PHPCS version"
which phpcs which phpcs
phpcs --version | head - phpcs --version | head -
phpcs -i | head - phpcs -i | head -
# Check PHPUnit installation # Check PHPUnit version
echo "PHPUnit version" echo "PHPUnit version"
which phpunit which phpunit
phpunit --version | head - phpunit --version | head -
@ -282,17 +262,18 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
#parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes --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 --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --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 dev/initdata/dbf/includes --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 --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e set +e
echo 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 # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # 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" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then
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 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 set +e
echo echo
@ -404,6 +385,7 @@ script:
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log
php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log
php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log
# Enable modules not enabled into original dump # Enable modules not enabled into original dump
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log
echo $? echo $?
@ -424,7 +406,7 @@ script:
after_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 ls $TRAVIS_BUILD_DIR/documents
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log

View File

@ -2,6 +2,102 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook
FIX: regex to remove 'action' parameter: taking feedback from PR#15213 into account
FIX: remove 'action' parameter from redirect URL when reordering lines on a document
FIX: error when displaying lines on order after adding a line if both MAIN_MULTILANGS and MAIN_DISABLE_PDF_AUTOUPDATE are activated
FIX: on survey creation, entity is always set to 1 ⇒ set it to $conf->entity
FIX: set entity to $conf->entity (instead of 1 by default) when creating a survey; otherwise the survey cannot be listed from the entity it was created on unless it is the main entity
FIX: the stringent XSS protection provided by 'alphanohtml' causes problems with some clients who used basic tags (bold, italic, underline) in product labels. Using 'restricthtml' instead could be a good compromise.
FIX: third party of object is not always fetched when initiating the e-mail presend action (e.g. from an order)
FIX: when the cronjob 'params' field is empty, the cron method is called with one empty string param instead of no params at all
FIX: XSS protection too stringent -> replace 'alphanohtml' with 'restricthtml'
FIX: #13067 including opening balance in calculation of displayed balance
FIX: #14326
FIX: #14649
FIX: #14901
FIX: #14927 Change ContratLigne property type to product_type
FIX: #14979
FIX: #15074
FIX: #15111 Fix special characters output in PDF
FIX: #15161 MO translation conflict
FIX: #15163
FIX: #15199
FIX: #15208
FIX: #15303
FIX: #15365 export of extrafields for user and resources
FIX: #15374 : "New" doesn't clear total amounts
FIX: #15501
FIX: #15572
FIX: #15590
FIX: #15618
FIX: supplier proposals as linked objects of events are not correctly fetched
FIX: when users create an event from a supplier proposal, the "linked objects" section says "Deleted"
FIX: Accountancy - Some ajustments on length of the account (general & auxiliary)
FIX: admin conf selected
FIX: also check if there is a method $object->fetch_thirdparty() before calling it
FIX: autofocus on first setup
FIX: Bad rigths to send contract
FIX: Better error message with IMAP when connection fails
FIX: Can create user but not update user with activedirectory
FIX: Can receipt of a product that required lot after disabling stock and
FIX: Can't create shipment for virtual product. Add
FIX: cant empty action comm desc
FIX: CA report by product/service : subcategory filter
FIX: Clean orphan records in llx_ecm_files into repair script.
FIX: default accountancy values and posted values
FIX: Deletion of expensereport + other generated object not complete.
FIX: disabled users must not be available in sales representative list on societe edit mode
FIX: Dol print error : conf usage thirdparty propagate extrafields to
FIX: Don't display inactive users in birthday box and company card
FIX: empty value is needed on filter list
FIX: enable HTML in product labels depending on conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML
FIX: error 500 on cash closure
FIX: excess comma
FIX: Export FEC - Remove line at zero
FIX: extrafield required error after submit
FIX: filter on project list
FIX: force payment mode to withdraw
FIX: formating of prices with foreign languages
FIX: handling $heightforinfotot when he's superior to a page height
FIX: if no PDF default model in admin for expense report, do not create a PDF
FIX: invoice payment terms edition: error management
FIX: list of fields in list of recurring invoices was empty
FIX: load default linked options for linked sellist extra fields
FIX: Loan - Return on list when you cancel create form or delete a loan
FIX: Missing lang trans
FIX: no empty value in required extrafield
FIX: Param joinfiles not sanitized
FIX: Payment by BankTransfer
FIX: pdf_getlinetotalwithtax must show total incl tax
FIX: Problem on supplier payment card
FIX: product auto volume calculation
FIX: product customer prices: missing triggers in CRUD class
FIX: Request on purchase orders in timeout even on very small databases
FIX: set paid on total discount of a product in cash desk
FIX: several warning with the barcode use in ODT templates
FIX: SHIP MODE install v12 bug insert
FIX: stripe for connect mode
FIX: subcat filter
FIX: supplier invoice: automatically calculate payment term when modifying payment condition
FIX: SUPPLIER PROPOSAL v12 bug add
FIX: table making extrafield input too small on advance target mailing
FIX: table making extrafield too small advtagertmailing
FIX: Unable to edit extrafields in expense report
FIX: update margins rates on object line edit
FIX: uses price2numjs
FIX: various payments: bad data handling for subledger account + useless db commit/rollback
FIX: virtual products: displayed value is by unit
FIX: virtual products: supplier discount was not applied in component list
FIX: warning for purchase order delivery late.
FIX: Warning on late purchase order delivery
FIX: WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING must not consider services while STOCK_SUPPORTS_SERVICES is empty
FIX: wrong tab
FIX: Yogosha report 4425 (backport)
FIX: Yogosha report 4434 (backport)
***** ChangeLog for 12.0.3 compared to 12.0.2 ***** ***** ChangeLog for 12.0.3 compared to 12.0.2 *****
FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename
FIX: 11.0 - expenses lines overlapping the total amounts frame FIX: 11.0 - expenses lines overlapping the total amounts frame

View File

@ -320,7 +320,7 @@ SELECT2
Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: https://github.com/select2/select2/issues/5832 Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: https://github.com/select2/select2/issues/5832
.select2-hidden-accessible { .select2-hidden-accessible {
margin: -1px !important; /* line to restore */ margin: -10000px !important; /* line to restore */
} }

View File

@ -77,7 +77,7 @@ $form = new Form($db);
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
{ {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1); $sql .= $db->plimit(1);
$res = $db->query($sql); $res = $db->query($sql);
if ($res->num_rows > 0) { if ($res->num_rows > 0) {
@ -237,7 +237,8 @@ if ($action != 'export_csv')
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">'; print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" colspan="6">'; $colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 6 : 5);
print '<td class="liste_titre" colspan="'.$colspan.'">';
print $langs->trans('From'); print $langs->trans('From');
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
print ' '; print ' ';
@ -254,7 +255,7 @@ if ($action != 'export_csv')
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder); if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
@ -265,12 +266,19 @@ if ($action != 'export_csv')
$total_credit = 0; $total_credit = 0;
$sous_total_debit = 0; $sous_total_debit = 0;
$sous_total_credit = 0; $sous_total_credit = 0;
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
$total_opening_balance = 0;
$sous_total_opening_balance = 0;
}
$displayed_account = ""; $displayed_account = "";
// TODO Debug - In French accounting, this functionality is dangerous, it takes all the entries and adds all the accounts
// without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal.
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features $sql .= " WHERE t.entity = " . $conf->entity; // Never do sharing into accounting features
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; $sql .= " AND t.doc_date < '" . $db->idate($search_date_start) . "'";
$sql .= " GROUP BY t.numero_compte"; $sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -278,7 +286,8 @@ if ($action != 'export_csv')
$opening_balances = array(); $opening_balances = array();
for ($i = 0; $i < $nrows; $i++) { for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array(); $arr = $resql->fetch_array();
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance']; $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
}
} }
foreach ($object->lines as $line) foreach ($object->lines as $line)
@ -288,6 +297,10 @@ if ($action != 'export_csv')
$total_credit += $line->credit; $total_credit += $line->credit;
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account $description = $object->get_compte_desc($line->numero_compte); // Search description of the account
$root_account_description = $object->get_compte_racine($line->numero_compte); $root_account_description = $object->get_compte_racine($line->numero_compte);
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
$opening_balance = isset($opening_balances["'".$line->numero_compte."'"]) ? $opening_balances["'".$line->numero_compte."'"] : 0;
$total_opening_balance += $opening_balance;
}
if (empty($description)) { if (empty($description)) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>'; $link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
} }
@ -298,29 +311,39 @@ if ($action != 'export_csv')
{ {
// Display a sub-total per account // Display a sub-total per account
if ($displayed_account != "") { if ($displayed_account != "") {
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>'; print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print '</tr>'; print '</tr>';
} }
// Show first line of a break // Show first line of a break
print '<tr class="trforbreak">'; print '<tr class="trforbreak">';
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; $colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 7 : 6);
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '</tr>'; print '</tr>';
$displayed_account = $root_account_description; $displayed_account = $root_account_description;
$sous_total_debit = 0; $sous_total_debit = 0;
$sous_total_credit = 0; $sous_total_credit = 0;
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) $sous_total_opening_balance = 0;
} }
// $object->get_compte_racine($line->numero_compte); // $object->get_compte_racine($line->numero_compte);
print '<td>'.length_accountg($line->numero_compte).'</td>'; print '<td>'.length_accountg($line->numero_compte).'</td>';
print '<td>'.$description.'</td>'; print '<td>'.$description.'</td>';
print '<td class="nowraponall right">'.price($opening_balances["'".$line->numero_compte."'"]).'</td>'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>'; print '<td class="nowraponall right">'.price($line->debit).'</td>';
print '<td class="nowraponall right">'.price($line->credit).'</td>'; print '<td class="nowraponall right">'.price($line->credit).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowraponall right">'.price($opening_balance + $line->debit - $line->credit).'</td>';
} else {
print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>'; print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>';
}
print '<td class="center">'.$link; print '<td class="center">'.$link;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -328,13 +351,30 @@ if ($action != 'export_csv')
// Records the sub-total // Records the sub-total
$sous_total_debit += $line->debit; $sous_total_debit += $line->debit;
$sous_total_credit += $line->credit; $sous_total_credit += $line->credit;
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) $sous_total_opening_balance += $opening_balance;
} }
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>'; print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowrap right">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
} else {
print '<td class="nowrap right">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
}
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print '</tr>'; print '</tr>';
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>'; print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
print '<td class="nowrap right">'.price($total_debit).'</td>';
print '<td class="nowrap right">'.price($total_credit).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowrap right">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
} else {
print '<td class="nowrap right">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
}
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print '</tr>'; print '</tr>';

View File

@ -386,6 +386,7 @@ class AccountancyExport
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date.$separator; print $date.$separator;
print $line->code_journal.$separator; print $line->code_journal.$separator;
print length_accountg($line->numero_compte).$separator; print length_accountg($line->numero_compte).$separator;
@ -394,7 +395,7 @@ class AccountancyExport
print price($line->debit).$separator; print price($line->debit).$separator;
print price($line->credit).$separator; print price($line->credit).$separator;
print 'E'.$separator; print 'E'.$separator;
print length_accountg($line->subledger_account).$separator; print length_accounta($line->subledger_account).$separator;
print $end_line; print $end_line;
} }
} }
@ -784,7 +785,7 @@ class AccountancyExport
public function exportFEC($objectLines) public function exportFEC($objectLines)
{ {
$separator = "\t"; $separator = "\t";
$end_line = "\n"; $end_line = "\r\n";
print "JournalCode".$separator; print "JournalCode".$separator;
print "JournalLib".$separator; print "JournalLib".$separator;
@ -807,8 +808,12 @@ class AccountancyExport
print $end_line; print $end_line;
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
} else {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
$date_validation = dol_print_date($line->date_validated, '%Y%m%d'); $date_validation = dol_print_date($line->date_validated, '%Y%m%d');
// FEC:JournalCode // FEC:JournalCode
@ -833,16 +838,16 @@ class AccountancyExport
print $line->subledger_account.$separator; print $line->subledger_account.$separator;
// FEC:CompAuxLib // FEC:CompAuxLib
print dol_string_unaccent($line->subledger_label) . $separator; print dol_string_unaccent($line->subledger_label).$separator;
// FEC:PieceRef // FEC:PieceRef
print $line->doc_ref.$separator; print $line->doc_ref.$separator;
// FEC:PieceDate // FEC:PieceDate
print dol_string_unaccent($date_creation) . $separator; print $date_creation.$separator;
// FEC:EcritureLib // FEC:EcritureLib
print $line->label_operation.$separator; print dol_string_unaccent($line->label_operation).$separator;
// FEC:Debit // FEC:Debit
print price2fec($line->debit).$separator; print price2fec($line->debit).$separator;
@ -854,10 +859,10 @@ class AccountancyExport
print $line->lettering_code.$separator; print $line->lettering_code.$separator;
// FEC:DateLet // FEC:DateLet
print $line->date_lettering.$separator; print $date_lettering.$separator;
// FEC:ValidDate // FEC:ValidDate
print $date_validation . $separator; print $date_validation.$separator;
// FEC:Montantdevise // FEC:Montantdevise
print $line->multicurrency_amount.$separator; print $line->multicurrency_amount.$separator;
@ -868,6 +873,7 @@ class AccountancyExport
print $end_line; print $end_line;
} }
} }
}
/** /**
* Export format : SAGE50SWISS * Export format : SAGE50SWISS

View File

@ -863,7 +863,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep; print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$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 " ".$sep;
print '"'.$reflabel.'"'.$sep; print '"'.$reflabel.'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
@ -893,7 +893,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$key.'"'.$sep; print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$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') { if ($tabtype[$key] == 'payment_supplier') {
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep; print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
} elseif ($tabtype[$key] == 'payment') { } elseif ($tabtype[$key] == 'payment') {
@ -903,7 +903,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
} elseif ($tabtype[$key] == 'payment_salary') { } elseif ($tabtype[$key] == 'payment_salary') {
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep; print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} else { } 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 '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$reflabel.'"'.$sep; print '"'.$reflabel.'"'.$sep;
@ -926,7 +926,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$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_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; print '"'.length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print "".$sep; print "".$sep;
print '"'.$reflabel.'"'.$sep; print '"'.$reflabel.'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$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] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"]; 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 (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{ {
if ($tabtype[$key] == 'unknown') if ($tabtype[$key] == 'unknown')

View File

@ -257,13 +257,18 @@ class Subscription extends CommonObject
{ {
$error = 0; $error = 0;
if (!is_numeric($this->amount)) {
$this->error = 'BadValueForParameterAmount';
return -1;
}
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.","; $sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.","; $sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',"; $sql .= " subscription = ".price2num($this->amount).",";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',"; $sql .= " datec='".$this->db->idate($this->datec)."',";

View File

@ -448,6 +448,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!$connection) if (!$connection)
{ {
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource; $morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
$morehtml .= '<br>'.imap_last_error();
//var_dump(imap_errors())
} }
else else
{ {

View File

@ -293,7 +293,7 @@ if (empty($mysoc->country_code))
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty; print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%'; print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n"; print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
$s = 10 / 3; $qty = 2; $vat = 10; $s = 10 / 3; $qty = 2; $vat = 10;
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);

View File

@ -125,7 +125,7 @@ print '</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("MailingDelay").'</td><td>'; print $langs->trans("MailingDelay").'</td><td>';
print '<input size="32" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">'; print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
print '</td></tr>'; print '</td></tr>';

View File

@ -280,7 +280,7 @@ if (empty($reshook))
elseif ($keycode == 'content') { elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} }
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) { elseif (in_array($keycode, array('joinfiles', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} }
else { else {

View File

@ -39,6 +39,8 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$type = 'paymentorder'; $type = 'paymentorder';
$error = 0;
/* /*
* Actions * Actions
@ -74,35 +76,28 @@ if ($action == "set")
else $error++; else $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (! ($res > 0)) $error++;
if (GETPOST("PRELEVEMENT_USER") > 0) if (GETPOST("PRELEVEMENT_USER") > 0) {
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (! ($res > 0)) $error++;
} }
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") {
{
$res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (! ($res > 0)) $error++;
} }
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") {
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (! ($res > 0)) $error++;
} }
if (GETPOST("PRELEVEMENT_ADDDAYS") || GETPOST("PRELEVEMENT_ADDDAYS") == "")
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (! ($res > 0)) $error++;
} elseif (!$error)
{ if (! $error) {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else
{
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
@ -196,9 +191,10 @@ print '</td></tr>';
//ADDDAYS //ADDDAYS
print '<tr class="oddeven"><td>'.$langs->trans("ADDDAYS").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("ADDDAYS").'</td>';
print '<td class="left">'; print '<td class="left">';
if (!$conf->global->PRELEVEMENT_ADDDAYS) $conf->global->PRELEVEMENT_ADDDAYS = 0; if (empty($conf->global->PRELEVEMENT_ADDDAYS)) $conf->global->PRELEVEMENT_ADDDAYS = 0;
print '<input type="text" name="PRELEVEMENT_ADDDAYS" value="'.$conf->global->PRELEVEMENT_ADDDAYS.'" size="5" ></td>'; print '<input type="text" name="PRELEVEMENT_ADDDAYS" value="'.$conf->global->PRELEVEMENT_ADDDAYS.'" size="5" ></td>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -310,7 +310,7 @@ else
$formsms->withfromreadonly = 0; $formsms->withfromreadonly = 0;
$formsms->withsubstit = 0; $formsms->withsubstit = 0;
$formsms->withfrom = 1; $formsms->withfrom = 1;
$formsms->withto = (isset($_POST['sendto']) ? $_POST['sendto'] : $user->user_mobile ? $user->user_mobile : 1); $formsms->withto = (isset($_POST['sendto']) ? $_POST['sendto'] : ($user->user_mobile ? $user->user_mobile : 1));
$formsms->withbody = (isset($_POST['message']) ? (empty($_POST['message']) ? 1 : $_POST['message']) : $langs->trans("ThisIsATestMessage")); $formsms->withbody = (isset($_POST['message']) ? (empty($_POST['message']) ? 1 : $_POST['message']) : $langs->trans("ThisIsATestMessage"));
$formsms->withbodyreadonly = 0; $formsms->withbodyreadonly = 0;
$formsms->withcancel = 1; $formsms->withcancel = 1;

View File

@ -83,17 +83,23 @@ else
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE)); if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE));
} }
$version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
$newversion = '';
if (function_exists('curl_init')) if (function_exists('curl_init'))
{ {
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
print ' &nbsp; &nbsp; - &nbsp; &nbsp; '; print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
if ($action == 'getlastversion') if ($action == 'getlastversion')
{ {
if ($sfurl) if ($sfurl) {
{ $i = 0;
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
{ {
$title = $sfurl->channel[0]->item[$i]->title; $title = $sfurl->channel[0]->item[$i]->title;
$reg = array();
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
{ {
$newversion = $reg[1]; $newversion = $reg[1];
@ -107,25 +113,23 @@ if (function_exists('curl_init'))
// Show version // Show version
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>'; print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>';
if ($version != '0.0') {
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
} }
else } else {
{
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>'; print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';
} }
} } else {
else
{
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction">'.$langs->trans("Check").'</a>'; print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction">'.$langs->trans("Check").'</a>';
} }
} }
// Now show link to the changelog // Now show link to the changelog
print ' &nbsp; &nbsp; - &nbsp; &nbsp; '; //print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
$version = DOL_VERSION; $version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log. if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
print '<a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
@ -221,7 +225,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezone // Timezone
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n"; $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n";
$txt .= $langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone") ?ini_get("date.timezone") : $langs->trans("NotDefined")).''."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ); $txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
$a = getServerTimeZoneInt('now'); $a = getServerTimeZoneInt('now');

View File

@ -137,7 +137,7 @@ print '</table>';
print '<br>'; print '<br>';
$activatedExtensions = array_map('strtolower', getActivatedExtensions()); $activatedExtensions = array();
$loadedExtensions = array_map('strtolower', get_loaded_extensions(false)); $loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -154,7 +154,6 @@ $name = "GD";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions); print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions); print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
@ -165,7 +164,6 @@ $name = "Curl";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions); print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions); print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
@ -178,7 +176,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions); print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions); print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
@ -191,7 +188,6 @@ $name = "xDebug";
print "<tr>"; print "<tr>";
print "<td>".$name."</td>"; print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions); print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions); print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
@ -221,7 +217,7 @@ foreach ($phparray as $key => $value)
print '<td>'.$keyparam.'</td>'; print '<td>'.$keyparam.'</td>';
$valtoshow = $keyvalue; $valtoshow = $keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80); if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80);
print '<td colspan="2">'; print '<td colspan="2" class="wordbreak">';
if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow))); if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
@ -232,7 +228,7 @@ foreach ($phparray as $key => $value)
else else
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$keyparam.'</td>'; print '<td class="wordbreak">'.$keyparam.'</td>';
$i = 0; $i = 0;
foreach ($keyvalue as $keyparam2 => $keyvalue2) foreach ($keyvalue as $keyparam2 => $keyvalue2)
{ {
@ -256,78 +252,6 @@ foreach ($phparray as $key => $value)
llxFooter(); llxFooter();
$db->close(); $db->close();
/**
* Return all list with all activated, but possible not loaded PHP extensions
*
* @return array
*/
function getActivatedExtensions()
{
$file = getConfigFilePath();
$handle = fopen(GetConfigFilePath(), "r");
$content = fread($handle, filesize($file));
fclose($handle);
$configLines = explode("\r", $content);
$extensions = array();
$lastLine = "";
foreach ($configLines as $line)
{
$line = trim($line);
// ignore comment lines
if (substr($line, 0, 1) === ";")
{
continue;
}
// extension
if (substr($line, 0, 9) === "extension" && substr($line, 0, 10) !== "extension_")
{
$value = trim(end(explode("=", $line)));
$extensions[] = $value === "gd2" ? "gd" : $value;
}
// zend_extension
if (substr($line, 0, 14) === "zend_extension")
{
$extensions[] = str_replace("[", "", str_replace("]", "", $lastLine));
}
$lastLine = $line;
}
return array_unique($extensions);
}
/**
* Return the path to the current used php config file
*
* @return string
*/
function getConfigFilePath()
{
$phparray = phpinfo_array();
foreach ($phparray as $value)
{
foreach ($value as $keyparam => $keyvalue)
{
if (strtolower($keyparam) !== "loaded configuration file")
{
continue;
}
return $keyvalue;
}
}
return "";
}
/** /**
* Return a table column with a indicator (okay or warning), based on the given name and list * Return a table column with a indicator (okay or warning), based on the given name and list
@ -400,7 +324,7 @@ function getTableColumnFunction(array $functions)
* Return a result column with a translated result text * Return a result column with a translated result text
* *
* @param string $name The name of the PHP extension * @param string $name The name of the PHP extension
* @param array $activated A list with all activated PHP extensions * @param array $activated A list with all activated PHP extensions. Deprecated.
* @param array $loaded A list with all loaded PHP extensions * @param array $loaded A list with all loaded PHP extensions
* @param array $functions A list with all PHP functions to check * @param array $functions A list with all PHP functions to check
* *

View File

@ -34,7 +34,7 @@ $action = GETPOST('action', 'alpha');
$what = GETPOST('what', 'alpha'); $what = GETPOST('what', 'alpha');
$export_type = GETPOST('export_type', 'alpha'); $export_type = GETPOST('export_type', 'alpha');
$file = trim(GETPOST('zipfilename_template', 'alpha')); $file = trim(GETPOST('zipfilename_template', 'alpha'));
$compression = GETPOST('compression'); $compression = GETPOST('compression', 'aZ09');
$file = dol_sanitizeFileName($file); $file = dol_sanitizeFileName($file);
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file); $file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -42,6 +43,8 @@ $action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'user'; $type = 'user';

View File

@ -157,7 +157,7 @@ print '</tr>';
// Description // Description
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td >'; print '<td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('description', $object->description, '', 200, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, ROWS_6, '90%'); $doleditor = new DolEditor('description', $object->description, '', 200, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, ROWS_6, '90%');
$doleditor->Create(); $doleditor->Create();
@ -166,7 +166,7 @@ print '</td></tr>';
// Color // Color
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Color").'</td>'; print '<td>'.$langs->trans("Color").'</td>';
print '<td >'; print '<td>';
print $formother->selectColor($object->color, 'color'); print $formother->selectColor($object->color, 'color');
print '</td></tr>'; print '</td></tr>';

View File

@ -445,8 +445,8 @@ if (empty($reshook) && $action == 'update')
$object->fetch_userassigned(); $object->fetch_userassigned();
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml"); $object->label = GETPOST("label", "alphanohtml");
@ -469,7 +469,6 @@ if (empty($reshook) && $action == 'update')
$object->note_private = trim(GETPOST("note", "none")); $object->note_private = trim(GETPOST("note", "none"));
$object->fk_element = GETPOST("fk_element", "int"); $object->fk_element = GETPOST("fk_element", "int");
$object->elementtype = GETPOST("elementtype", "alphanohtml"); $object->elementtype = GETPOST("elementtype", "alphanohtml");
if (!$datef && $percentage == 100) if (!$datef && $percentage == 100)
{ {
$error++; $donotclearsession = 1; $error++; $donotclearsession = 1;

View File

@ -983,7 +983,7 @@ class ActionComm extends CommonObject
// Clean parameters // Clean parameters
$this->label = trim($this->label); $this->label = trim($this->label);
$this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private)); $this->note_private = dol_htmlcleanlastbr(trim(!isset($this->note_private) ? $this->note : $this->note_private));
if (empty($this->percentage)) $this->percentage = 0; if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
if (empty($this->transparency)) $this->transparency = 0; if (empty($this->transparency)) $this->transparency = 0;

View File

@ -269,7 +269,10 @@ if ($object->id > 0)
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td>'; print $langs->trans('CustomerCode').'</td><td>';
print $object->code_client; print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; $tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
}
print '</td></tr>'; print '</td></tr>';
print '<tr>'; print '<tr>';

View File

@ -346,7 +346,7 @@ if (empty($reshook))
if (!empty($conf->global->MAILING_DELAY)) if (!empty($conf->global->MAILING_DELAY))
{ {
dol_syslog("Wait a delay of MAILING_DELAY=".$conf->global->MAILING_DELAY); dol_syslog("Wait a delay of MAILING_DELAY=".$conf->global->MAILING_DELAY);
sleep($conf->global->MAILING_DELAY); usleep((float) $conf->global->MAILING_DELAY * 1000000);
} }
//test if CHECK READ change statut prospect contact //test if CHECK READ change statut prospect contact

View File

@ -481,11 +481,27 @@ if ($object->fetch($id) >= 0)
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text"; $sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.fk_mailing=".$object->id; $sql .= " WHERE mc.fk_mailing=".$object->id;
if ($search_lastname) $sql .= natural_search("mc.lastname", $search_lastname); $asearchcriteriahasbeenset = 0;
if ($search_firstname) $sql .= natural_search("mc.firstname", $search_firstname); if ($search_lastname) {
if ($search_email) $sql .= natural_search("mc.email", $search_email); $sql .= natural_search("mc.lastname", $search_lastname);
if ($search_other) $sql .= natural_search("mc.other", $search_other); $asearchcriteriahasbeenset++;
if ($search_dest_status != '' && $search_dest_status >= -1) $sql .= " AND mc.statut=".$db->escape($search_dest_status)." "; }
if ($search_firstname) {
$sql .= natural_search("mc.firstname", $search_firstname);
$asearchcriteriahasbeenset++;
}
if ($search_email) {
$sql .= natural_search("mc.email", $search_email);
$asearchcriteriahasbeenset++;
}
if ($search_other) {
$sql .= natural_search("mc.other", $search_other);
$asearchcriteriahasbeenset++;
}
if ($search_dest_status != '' && $search_dest_status >= -1) {
$sql .= " AND mc.statut=".$db->escape($search_dest_status)." ";
$asearchcriteriahasbeenset++;
}
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
@ -499,6 +515,18 @@ if ($object->fetch($id) >= 0)
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
// Fix/update nbemail on emailing record if it differs (may happen if user edit lines from database directly)
if (empty($asearchcriteriahasbeenset)) {
if ($nbtotalofrecords != $object->email) {
dol_syslog("We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail");
//print "nbemail=".$object->nbemail." nbtotalofrecords=".$nbtotalofrecords;
$resultrefresh = $object->refreshNbOfTargets();
if ($resultrefresh < 0) {
dol_print_error($db, $object->error, $object->errors);
}
}
}
} }
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets //$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets

View File

@ -461,6 +461,8 @@ class Mailing extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->refreshNbOfTargets();
return 1; return 1;
} }
else else
@ -532,6 +534,38 @@ class Mailing extends CommonObject
return 0; return 0;
} }
/**
* Refresh denormalized value ->nbemail into emailing record
* Note: There is also the method update_nb into modules_mailings that is used for this.
*
* @return int <0 if KO, >0 if OK
*/
public function refreshNbOfTargets()
{
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " WHERE fk_mailing = ".$this->id;
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$nbforupdate = $obj->nb;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'mailing SET nbemail = '.((int) $nbforupdate);
$sql .= ' WHERE rowid = '.$this->id;
$resqlupdate = $this->db->query($sql);
if (! $resqlupdate) {
$this->error = $this->db->lasterror();
return -1;
}
}
} else {
$this->error = $this->db->lasterror();
return -1;
}
return 1;
}
/** /**
* Return a link to the object card (with optionally the picto) * Return a link to the object card (with optionally the picto)

View File

@ -602,6 +602,7 @@ class Propal extends CommonObject
// Clean vat code // Clean vat code
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\((.*)\)/', $txtva, $reg)) if (preg_match('/\((.*)\)/', $txtva, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];
@ -779,7 +780,9 @@ class Propal extends CommonObject
$qty = price2num($qty); $qty = price2num($qty);
$pu = price2num($pu); $pu = price2num($pu);
$pu_ht_devise = price2num($pu_ht_devise); $pu_ht_devise = price2num($pu_ht_devise);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
$pa_ht = price2num($pa_ht); $pa_ht = price2num($pa_ht);
@ -1344,7 +1347,6 @@ class Propal extends CommonObject
// Load source object // Load source object
$object->fetch($this->id); $object->fetch($this->id);
$object->fetch_lines();
$objsoc = new Societe($this->db); $objsoc = new Societe($this->db);
@ -1738,7 +1740,7 @@ class Propal extends CommonObject
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql .= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; $sql .= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
$sql .= ' d.fk_unit,'; $sql .= ' d.fk_unit,';
$sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_batch,'; $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch, p.barcode as product_barcode,';
$sql .= ' p.weight, p.weight_units, p.volume, p.volume_units,'; $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units,';
$sql .= ' d.date_start, d.date_end,'; $sql .= ' d.date_start, d.date_end,';
$sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; $sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
@ -1800,11 +1802,14 @@ class Propal extends CommonObject
$line->fk_product = $objp->fk_product; $line->fk_product = $objp->fk_product;
$line->ref = $objp->product_ref; // deprecated $line->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref;
$line->libelle = $objp->product_label; // deprecated $line->libelle = $objp->product_label; // deprecated
$line->product_ref = $objp->product_ref;
$line->product_label = $objp->product_label; $line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit $line->product_desc = $objp->product_desc; // Description produit
$line->product_tobatch = $objp->product_tobatch; $line->product_tobatch = $objp->product_tobatch;
$line->product_barcode = $objp->product_barcode;
$line->fk_product_type = $objp->fk_product_type; // deprecated $line->fk_product_type = $objp->fk_product_type; // deprecated
$line->fk_unit = $objp->fk_unit; $line->fk_unit = $objp->fk_unit;
$line->weight = $objp->weight; $line->weight = $objp->weight;
@ -3924,6 +3929,18 @@ class PropaleLigne extends CommonObjectLine
*/ */
public $product_desc; public $product_desc;
/**
* Product use lot
* @var string
*/
public $product_tobatch;
/**
* Product barcode
* @var string
*/
public $product_barcode;
public $localtax1_tx; // Local tax 1 public $localtax1_tx; // Local tax 1
public $localtax2_tx; // Local tax 2 public $localtax2_tx; // Local tax 2
public $localtax1_type; // Local tax 1 type public $localtax1_type; // Local tax 1 type

View File

@ -37,11 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer'; $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
if ($mode == 'customer' && !$user->rights->propale->lire) accessforbidden(); if ($mode == 'customer' && !$user->rights->propale->lire) accessforbidden();
if ($mode == 'supplier' && !$user->rights->supplier_proposal->lire) accessforbidden(); if ($mode == 'supplier' && !$user->rights->supplier_proposal->lire) accessforbidden();
$object_status = GETPOST('object_status'); $object_status = GETPOST('object_status', 'intcomma');
$typent_id = GETPOST('typent_id', 'int'); $typent_id = GETPOST('typent_id', 'int');
$categ_id = GETPOST('categ_id', 'categ_id'); $categ_id = GETPOST('categ_id', 'categ_id');
@ -55,7 +55,7 @@ if ($user->socid > 0)
} }
$nowyear = strftime("%Y", dol_now()); $nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
//$startyear=$year-2; //$startyear=$year-2;
$startyear = $year - 1; $startyear = $year - 1;
$endyear = $year; $endyear = $year;

View File

@ -460,26 +460,15 @@ if (empty($reshook))
if (!$error) if (!$error)
{ {
$object_id = $object->create($user); $object_id = $object->create($user);
// If some invoice's lines already known
$NBLINES = 8;
for ($i = 1; $i <= $NBLINES; $i++) {
if ($_POST['idprod'.$i]) {
$xid = 'idprod'.$i;
$xqty = 'qty'.$i;
$xremise = 'remise_percent'.$i;
$object->add_product($_POST[$xid], $_POST[$xqty], $_POST[$xremise]);
}
}
} }
} }
// Insert default contacts if defined // Insert default contacts if defined
if ($object_id > 0) if ($object_id > 0)
{ {
if (GETPOST('contactid')) if (GETPOST('contactid', 'int'))
{ {
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); $result = $object->add_contact(GETPOST('contactid', 'int'), 'CUSTOMER', 'external');
if ($result < 0) { if ($result < 0) {
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors'); setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
$error++; $error++;
@ -681,8 +670,8 @@ if (empty($reshook))
$tva_tx = ''; $tva_tx = '';
} }
$qty = GETPOST('qty'.$predef); $qty = price2num(GETPOST('qty'.$predef, 'alpha'));
$remise_percent = (GETPOST('remise_percent'.$predef) != '' ? GETPOST('remise_percent'.$predef) : 0); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -964,6 +953,7 @@ if (empty($reshook))
if ($result > 0) { if ($result > 0) {
$ret = $object->fetch($object->id); // Reload to get new records $ret = $object->fetch($object->id); // Reload to get new records
$object->fetch_thirdparty();
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language // Define output language
@ -1772,7 +1762,7 @@ if ($action == 'create' && $usercancreate)
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER)) { if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER) && !empty($soc->id)) {
// copy from thirdparty // copy from thirdparty
$tpExtrafields = new Extrafields($db); $tpExtrafields = new Extrafields($db);
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element);

View File

@ -2033,7 +2033,7 @@ class Commande extends CommonOrder
$sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
$sql .= ' l.fk_unit,'; $sql .= ' l.fk_unit,';
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,'; $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch, p.barcode as product_barcode,';
$sql .= ' p.weight, p.weight_units, p.volume, p.volume_units'; $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units';
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
@ -2091,11 +2091,14 @@ class Commande extends CommonOrder
$line->fk_parent_line = $objp->fk_parent_line; $line->fk_parent_line = $objp->fk_parent_line;
$line->ref = $objp->product_ref; $line->ref = $objp->product_ref;
$line->product_ref = $objp->product_ref;
$line->libelle = $objp->product_label; $line->libelle = $objp->product_label;
$line->product_ref = $objp->product_ref;
$line->product_label = $objp->product_label; $line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; $line->product_desc = $objp->product_desc;
$line->product_tobatch = $objp->product_tobatch; $line->product_tobatch = $objp->product_tobatch;
$line->product_barcode = $objp->product_barcode;
$line->fk_product_type = $objp->fk_product_type; // Produit ou service $line->fk_product_type = $objp->fk_product_type; // Produit ou service
$line->fk_unit = $objp->fk_unit; $line->fk_unit = $objp->fk_unit;
@ -3117,7 +3120,9 @@ class Commande extends CommonOrder
$pu = price2num($pu); $pu = price2num($pu);
$pa_ht = price2num($pa_ht); $pa_ht = price2num($pa_ht);
$pu_ht_devise = price2num($pu_ht_devise); $pu_ht_devise = price2num($pu_ht_devise);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
@ -3132,6 +3137,7 @@ class Commande extends CommonOrder
// Clean vat code // Clean vat code
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\((.*)\)/', $txtva, $reg)) if (preg_match('/\((.*)\)/', $txtva, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];

View File

@ -38,11 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer'; $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
if ($mode == 'customer' && !$user->rights->commande->lire) accessforbidden(); if ($mode == 'customer' && !$user->rights->commande->lire) accessforbidden();
if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) accessforbidden(); if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) accessforbidden();
$object_status = GETPOST('object_status'); $object_status = GETPOST('object_status', 'intcomma');
$typent_id = GETPOST('typent_id', 'int'); $typent_id = GETPOST('typent_id', 'int');
$categ_id = GETPOST('categ_id', 'categ_id'); $categ_id = GETPOST('categ_id', 'categ_id');
@ -308,11 +308,11 @@ if ($mode == 'customer')
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled") Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
); );
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4); print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4);
} }
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$formorder->selectSupplierOrderStatus((strstr($object_status, ',') ?-1 : $object_status), 0, 'object_status'); $formorder->selectSupplierOrderStatus((strstr($object_status, ',') ? -1 : $object_status), 0, 'object_status');
} }
print '</td></tr>'; print '</td></tr>';
// Year // Year

View File

@ -907,7 +907,7 @@ else
print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"]) ?GETPOST("account_min_allowed") : $object->min_allowed).'"></td></tr>'; print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"]) ?GETPOST("account_min_allowed") : $object->min_allowed).'"></td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>'; print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td ><input size="12" type="text" class="flat" name="account_min_desired" value="'.(isset($_POST["account_min_desired"]) ?GETPOST("account_min_desired") : $object->min_desired).'"></td></tr>'; print '<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(isset($_POST["account_min_desired"]) ?GETPOST("account_min_desired") : $object->min_desired).'"></td></tr>';
// Web // Web
print '<tr><td>'.$langs->trans("Web").'</td>'; print '<tr><td>'.$langs->trans("Web").'</td>';

View File

@ -135,7 +135,7 @@ if ($result)
} }
else else
{ {
print "<td >".$objp->label."</td>"; print "<td>".$objp->label."</td>";
print '<td class="center">'; print '<td class="center">';
print '<a class="editfielda reposition marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=edit">'.img_edit().'</a>'; print '<a class="editfielda reposition marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=edit">'.img_edit().'</a>';
print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=delete">'.img_delete().'</a>'; print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=delete">'.img_delete().'</a>';

View File

@ -137,7 +137,7 @@ class PaymentVarious extends CommonObject
$sql .= " datev='".$this->db->idate($this->datev)."',"; $sql .= " datev='".$this->db->idate($this->datev)."',";
$sql .= " sens=".(int) $this->sens.","; $sql .= " sens=".(int) $this->sens.",";
$sql .= " amount=".price2num($this->amount).","; $sql .= " amount=".price2num($this->amount).",";
$sql .= " fk_typepayment=".(int) $this->fk_typepayment.","; $sql .= " fk_typepayment=".(int) $this->type_payment.",";
$sql .= " num_payment='".$this->db->escape($this->num_payment)."',"; $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
$sql .= " label='".$this->db->escape($this->label)."',"; $sql .= " label='".$this->db->escape($this->label)."',";
$sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " note='".$this->db->escape($this->note)."',";

View File

@ -392,7 +392,7 @@ if ($action == 'create')
// Subledger account // Subledger account
if (!empty($conf->accounting->enabled)) if (!empty($conf->accounting->enabled))
{ {
print '<tr><td>'.$langs->trans("SubledgerAccount").'aaaa</td>'; print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td>'; print '<td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{ {

View File

@ -345,15 +345,6 @@ if (empty($reshook))
} }
} }
elseif ($action == 'set_thirdparty' && $usercancreate)
{
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', null, 'int', '', $user, 'BILL_MODIFY');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit();
}
elseif ($action == 'classin' && $usercancreate) elseif ($action == 'classin' && $usercancreate)
{ {
$object->fetch($id); $object->fetch($id);
@ -2543,7 +2534,7 @@ if (empty($reshook))
{ {
$object->fetch($id, '', '', '', true); $object->fetch($id, '', '', '', true);
if ($object->statut == Facture::STATUS_VALIDATED if (in_array($object->statut, array(Facture::STATUS_CLOSED, Facture::STATUS_VALIDATED))
&& $object->type == Facture::TYPE_SITUATION && $object->type == Facture::TYPE_SITUATION
&& $usercancreate && $usercancreate
&& !$objectidnext && !$objectidnext
@ -3572,7 +3563,7 @@ if ($action == 'create')
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE)) { if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE) && !empty($soc->id)) {
// copy from thirdparty // copy from thirdparty
$tpExtrafields = new Extrafields($db); $tpExtrafields = new Extrafields($db);
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element);
@ -3881,7 +3872,7 @@ elseif ($id > 0 || !empty($ref))
$label = $langs->trans("ConfirmOuting"); $label = $langs->trans("ConfirmOuting");
$formquestion = array(); $formquestion = array();
// remove situation from cycle // remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED if (in_array($object->statut, array(Facture::STATUS_CLOSED, Facture::STATUS_VALIDATED))
&& $usercancreate && $usercancreate
&& !$objectidnext && !$objectidnext
&& $object->is_last_in_cycle() && $object->is_last_in_cycle()
@ -4857,7 +4848,15 @@ elseif ($id > 0 || !empty($ref))
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
print '</td>'; print '</td>';
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>'; print '<td>';
$dateofpayment = $db->jdate($objp->dp);
$tmparray = dol_getdate($dateofpayment);
if ($tmparray['seconds'] == 0 && $tmparray['minutes'] == 0 && ($tmparray['hours'] == 0 || $tmparray['hours'] == 12)) { // We set hours to 0:00 or 12:00 because we don't know it
print dol_print_date($dateofpayment, 'day');
} else { // Hours was set to real date of payment (special case for POS for example)
print dol_print_date($dateofpayment, 'dayhour', 'tzuser');
}
print '</td>';
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label; $label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
print '<td>'.$label.' '.$objp->num_payment.'</td>'; print '<td>'.$label.' '.$objp->num_payment.'</td>';
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled))
@ -5396,7 +5395,7 @@ elseif ($id > 0 || !empty($ref))
} }
// Remove situation from cycle // Remove situation from cycle
if ($object->statut > Facture::STATUS_DRAFT if (in_array($object->statut, array(Facture::STATUS_CLOSED, Facture::STATUS_VALIDATED))
&& $object->type == Facture::TYPE_SITUATION && $object->type == Facture::TYPE_SITUATION
&& $usercancreate && $usercancreate
&& !$objectidnext && !$objectidnext

View File

@ -849,7 +849,9 @@ class FactureRec extends CommonInvoice
$qty = price2num($qty); $qty = price2num($qty);
$pu_ht = price2num($pu_ht); $pu_ht = price2num($pu_ht);
$pu_ttc = price2num($pu_ttc); $pu_ttc = price2num($pu_ttc);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
if (empty($txtva)) $txtva = 0; if (empty($txtva)) $txtva = 0;
@ -1031,7 +1033,9 @@ class FactureRec extends CommonInvoice
$pu_ht = price2num($pu_ht); $pu_ht = price2num($pu_ht);
$pu_ttc = price2num($pu_ttc); $pu_ttc = price2num($pu_ttc);
$pu_ht_devise = price2num($pu_ht_devise); $pu_ht_devise = price2num($pu_ht_devise);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
if (empty($txlocaltax1)) $txlocaltax1 = 0; if (empty($txlocaltax1)) $txlocaltax1 = 0;
@ -1059,6 +1063,7 @@ class FactureRec extends CommonInvoice
// Clean vat code // Clean vat code
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\((.*)\)/', $txtva, $reg)) if (preg_match('/\((.*)\)/', $txtva, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];

View File

@ -3311,7 +3311,9 @@ class Facture extends CommonInvoice
$pu = price2num($pu); $pu = price2num($pu);
$pu_ht_devise = price2num($pu_ht_devise); $pu_ht_devise = price2num($pu_ht_devise);
$pa_ht = price2num($pa_ht); $pa_ht = price2num($pa_ht);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
@ -3326,6 +3328,7 @@ class Facture extends CommonInvoice
// Clean vat code // Clean vat code
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\((.*)\)/', $txtva, $reg)) if (preg_match('/\((.*)\)/', $txtva, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];

View File

@ -44,7 +44,7 @@ $mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
if ($mode == 'customer' && !$user->rights->facture->lire) accessforbidden(); if ($mode == 'customer' && !$user->rights->facture->lire) accessforbidden();
if ($mode == 'supplier' && !$user->rights->fournisseur->facture->lire) accessforbidden(); if ($mode == 'supplier' && !$user->rights->fournisseur->facture->lire) accessforbidden();
$object_status = GETPOST('object_status'); $object_status = GETPOST('object_status', 'intcomma');
$typent_id = GETPOST('typent_id', 'int'); $typent_id = GETPOST('typent_id', 'int');
$categ_id = GETPOST('categ_id', 'categ_id'); $categ_id = GETPOST('categ_id', 'categ_id');
@ -59,7 +59,7 @@ if ($user->socid > 0)
} }
$nowyear = strftime("%Y", dol_now()); $nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
if(!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2; if(!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2;
else $startyear=$year-1; else $startyear=$year-1;
$endyear = $year; $endyear = $year;

View File

@ -1201,7 +1201,16 @@ class Paiement extends CommonObject
$result = ''; $result = '';
$label = '<u>'.$langs->trans("ShowPayment").'</u><br>'; $label = '<u>'.$langs->trans("ShowPayment").'</u><br>';
$label .= '<strong>'.$langs->trans("Ref").':</strong> '.$this->ref; $label .= '<strong>'.$langs->trans("Ref").':</strong> '.$this->ref;
if ($this->datepaye ? $this->datepaye : $this->date) $label .= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); $dateofpayment = ($this->datepaye ? $this->datepaye : $this->date);
if ($dateofpayment) {
$label .= '<br><strong>'.$langs->trans("Date").':</strong> ';
$tmparray = dol_getdate($dateofpayment);
if ($tmparray['seconds'] == 0 && $tmparray['minutes'] == 0 && ($tmparray['hours'] == 0 || $tmparray['hours'] == 12)) { // We set hours to 0:00 or 12:00 because we don't know it
$label .= dol_print_date($dateofpayment, 'day');
} else { // Hours was set to real date of payment (special case for POS for example)
$label .= dol_print_date($dateofpayment, 'dayhour', 'tzuser');
}
}
if ($mode == 'withlistofinvoices') if ($mode == 'withlistofinvoices')
{ {
$arraybill = $this->getBillsArray(); $arraybill = $this->getBillsArray();

View File

@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int');
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if ($value['active']) { if ($value['active']) {
$search_{$key} = GETPOST("search_".$key, 'alpha'); ${"search_".$key} = GETPOST("search_".$key, 'alpha');
} }
} }
} }
@ -259,7 +259,7 @@ if (empty($reshook))
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if ($value['active']) { if ($value['active']) {
$search_{$key} = ""; ${"search_".$key} = "";
} }
} }
} }
@ -363,8 +363,8 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se
if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax);
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if ($value['active'] && strlen($search_{$key})) { if ($value['active'] && strlen(${"search_".$key})) {
$sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.${"search_".$key}.'%\'';
} }
} }
} }
@ -674,7 +674,7 @@ if (!empty($conf->socialnetworks->enabled)) {
if (!empty($arrayfields['p.'.$key]['checked'])) if (!empty($arrayfields['p.'.$key]['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_'.$key.'" size="6" value="'.dol_escape_htmltag($search_{$key}).'">'; print '<input class="flat" type="text" name="search_'.$key.'" size="6" value="'.dol_escape_htmltag(${"search_".$key}).'">';
print '</td>'; print '</td>';
} }
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2020 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
@ -2110,7 +2110,7 @@ else
// Send // Send
if (empty($user->socid)) { if (empty($user->socid)) {
if ($object->statut == 1) { if ($object->statut == 1) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
} else } else
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';

View File

@ -1502,11 +1502,10 @@ class Contrat extends CommonObject
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
} }
$txtva = price2num($txtva); $txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
$remise_percent = price2num($remise_percent); $remise_percent = price2num($remise_percent);
$qty = price2num($qty); $qty = price2num($qty);
if (empty($qty)) $qty = 1; if (empty($qty)) $qty = 1;

View File

@ -89,6 +89,7 @@ class box_birthdays extends ModeleBoxes
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth"; $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql.= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY u.birth ASC"; $sql .= " ORDER BY u.birth ASC";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);

View File

@ -87,6 +87,11 @@ class box_produits extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire) if ($user->rights->produit->lire || $user->rights->service->lire)
{ {
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity"; $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql .= ", p.accountancy_code_sell";
$sql .= ", p.accountancy_code_sell_intra";
$sql .= ", p.accountancy_code_sell_export";
$sql .= ", p.accountancy_code_buy";
$sql .= ', p.barcode';
$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')'; $sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
if (empty($user->rights->produit->lire)) $sql .= ' AND p.fk_product_type != 0'; if (empty($user->rights->produit->lire)) $sql .= ' AND p.fk_product_type != 0';
@ -133,6 +138,13 @@ class box_produits extends ModeleBoxes
$productstatic->type = $objp->fk_product_type; $productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label; $productstatic->label = $objp->label;
$productstatic->entity = $objp->entity; $productstatic->entity = $objp->entity;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->barcode = $objp->barcode;
$productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
$productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',

View File

@ -96,7 +96,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")"; $sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT; $sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";

View File

@ -139,7 +139,7 @@ class box_task extends ModeleBoxes
$boxcontent .= '<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>'; $boxcontent .= '<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
} }
$this->info_box_contents[0][] = array( $this->info_box_contents[0][] = array(
'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"', 'tr' => 'class="nohover showiffilter'.$this->boxcode.' hideobject"',
'td' => 'class="nohover"', 'td' => 'class="nohover"',
'textnoformat' => $boxcontent, 'textnoformat' => $boxcontent,
); );

View File

@ -529,10 +529,13 @@ abstract class CommonDocGenerator
$resarray = array( $resarray = array(
'line_pos' => $linenumber, 'line_pos' => $linenumber,
'line_fulldesc'=>doc_getlinedesc($line, $outputlangs), 'line_fulldesc'=>doc_getlinedesc($line, $outputlangs),
'line_product_ref'=>$line->product_ref,
'line_product_ref_fourn'=>$line->ref_fourn, // for supplier doc lines 'line_product_ref'=>(empty($line->product_ref) ? '' : $line->product_ref),
'line_product_label'=>$line->product_label, 'line_product_ref_fourn'=>(empty($line->ref_fourn) ? '' : $line->ref_fourn), // for supplier doc lines
'line_product_type'=>$line->product_type, 'line_product_label'=>(empty($line->product_label) ? '' :$line->product_label),
'line_product_type'=>(empty($line->product_type) ? '' : $line->product_type),
'line_product_barcode'=>(empty($line->product_barcode) ? '' : $line->product_barcode),
'line_desc'=>$line->desc, 'line_desc'=>$line->desc,
'line_vatrate'=>vatrate($line->tva_tx, true, $line->info_bits), 'line_vatrate'=>vatrate($line->tva_tx, true, $line->info_bits),
'line_localtax1_rate'=>vatrate($line->localtax1_tx), 'line_localtax1_rate'=>vatrate($line->localtax1_tx),
@ -687,6 +690,12 @@ abstract class CommonDocGenerator
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
} }
// Add infor from $object->xxx where xxx has been loaded by fetch_origin() of shipment
if (!empty($object->commande) && is_object($object->commande)) {
$array_shipment['order_ref'] = $object->commande->ref;
$array_shipment['order_ref_customer'] = $object->commande->ref_customer;
}
return $array_shipment; return $array_shipment;
} }
@ -1344,7 +1353,7 @@ abstract class CommonDocGenerator
if ($itemsInRow > 0) { if ($itemsInRow > 0) {
// close table row and empty cols // close table row and empty cols
for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) { for ($i = $itemsInRow; $i <= $maxItemsInRow; $i++) {
$html .= "<td ></td><td></td>"; $html .= "<td></td><td></td>";
} }
$html .= "</tr>"; $html .= "</tr>";

View File

@ -71,6 +71,18 @@ abstract class CommonOrderLine extends CommonObjectLine
*/ */
public $product_desc; public $product_desc;
/**
* Product use lot
* @var string
*/
public $product_tobatch;
/**
* Product barcode
* @var string
*/
public $product_barcode;
/** /**
* Quantity * Quantity
* @var float * @var float

View File

@ -6191,12 +6191,6 @@ class Form
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if (!$forcecombo)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode);
}
// Construct $out and $outarray // Construct $out and $outarray
$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
@ -6247,6 +6241,12 @@ class Form
} }
$out .= '</select>'."\n"; $out .= '</select>'."\n";
if (!$forcecombo)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode);
}
} }
else else
{ {

View File

@ -62,7 +62,10 @@ class FormOrder extends Form
$options[$value] = $tmpsupplierorder->getLibStatut($short); $options[$value] = $tmpsupplierorder->getLibStatut($short);
} }
print Form::selectarray($hmlname, $options, $selected, 1); if (is_array($selected)) $selectedarray = $selected;
else $selectedarray = explode(',', $selected);
print Form::multiselectarray($hmlname, $options, $selectedarray, 0);
} }
/** /**

View File

@ -212,7 +212,7 @@ class Interfaces
if ($result < 0) if ($result < 0)
{ {
// Action KO // Action KO
//dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($objMod->errors), LOG_ERR); //dol_syslog("Error in trigger ".$action." - result = ".$result." - Nb of error strings returned = ".count($objMod->errors), LOG_ERR);
$nbtotal++; $nbtotal++;
$nbko++; $nbko++;
if (!empty($objMod->errors)) $this->errors = array_merge($this->errors, $objMod->errors); if (!empty($objMod->errors)) $this->errors = array_merge($this->errors, $objMod->errors);

View File

@ -89,7 +89,7 @@ abstract class DoliDB implements Database
*/ */
public function idate($param) public function idate($param)
{ {
// TODO GMT $param should be gmt, so we should add tzouptut to 'gmt' // TODO $param should be gmt, so we should add tzouptut to 'gmt' instead of default 'tzserver'
return dol_print_date($param, "%Y-%m-%d %H:%M:%S"); return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
} }
@ -285,7 +285,7 @@ abstract class DoliDB implements Database
*/ */
public function jdate($string, $gm = false) public function jdate($string, $gm = false)
{ {
// TODO GMT must set param gm to true by default // TODO $string should be converted into a GMT timestamp, so param gm should be set to true by default instead of false
if ($string == 0 || $string == "0000-00-00 00:00:00") return ''; if ($string == 0 || $string == "0000-00-00 00:00:00") return '';
$string = preg_replace('/([^0-9])/i', '', $string); $string = preg_replace('/([^0-9])/i', '', $string);
$tmp = $string.'000000'; $tmp = $string.'000000';

View File

@ -1380,10 +1380,15 @@ function complete_elementList_with_modules(&$elementList)
$dirmod[$i] = $dir; $dirmod[$i] = $dir;
//print "x".$modName." ".$orders[$i]."\n<br>"; //print "x".$modName." ".$orders[$i]."\n<br>";
if (!empty($objMod->module_parts['contactelement'])) if (!empty($objMod->module_parts['contactelement'])) {
{ if (is_array($objMod->module_parts['contactelement'])) {
foreach ($objMod->module_parts['contactelement'] as $elem => $title) {
$elementList[$elem] = $langs->trans($title);
}
} else {
$elementList[$objMod->name] = $langs->trans($objMod->name); $elementList[$objMod->name] = $langs->trans($objMod->name);
} }
}
$j++; $j++;
$i++; $i++;

View File

@ -866,8 +866,9 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
// List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file // 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 special chars for shells.
// Char '/' and '\' are file delimiters. // Char '/' and '\' are file delimiters.
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';'); // -- car can be used into filename to inject special paramaters like --use-compress-program to make command with file as parameter making remote execution of command
return dol_string_nospecial($unaccent ?dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';', '--');
return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
} }
/** /**
@ -4691,21 +4692,22 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
* Function to use on each input amount before any numeric test or database insert. A better name for this function * Function to use on each input amount before any numeric test or database insert. A better name for this function
* should be roundtext2num(). * should be roundtext2num().
* *
* @param float $amount Amount to convert/clean or round * @param string|float $amount Amount to convert/clean or round
* @param string $rounding ''=No rounding * @param string $rounding ''=No rounding
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK) * 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
* 'CR'=Currency rate * 'CR'=Currency rate
* Numeric = Nb of digits for rounding * Numeric = Nb of digits for rounding
* @param int $alreadysqlnb Put 1 if you know that content is already universal format number * @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
* Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator).
* @return string Amount with universal numeric format (Example: '99.99999'). * @return string Amount with universal numeric format (Example: '99.99999').
* If conversion fails, it return text unchanged if $rounding = '' or '0' if $rounding is defined. * If conversion fails, it return text unchanged if $rounding = '' or '0' if $rounding is defined.
* If amount is null or '', it returns '' if $rounding = '' or '0' if $rounding is defined.. * If amount is null or '', it returns '' if $rounding = '' or '0' if $rounding is defined..
* *
* @see price() Opposite function of price2num * @see price() Opposite function of price2num
*/ */
function price2num($amount, $rounding = '', $alreadysqlnb = 0) function price2num($amount, $rounding = '', $option = 0)
{ {
global $langs, $conf; global $langs, $conf;
@ -4720,12 +4722,19 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
//print "amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; //print "amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>";
// Convert value to universal number format (no thousand separator, '.' as decimal separator) // Convert value to universal number format (no thousand separator, '.' as decimal separator)
if ($alreadysqlnb != 1) // If not a PHP number or unknown, we change format if ($option != 1) { // If not a PHP number or unknown, we change or clean format
{
//print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>'; //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>';
if (!is_numeric($amount)) {
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount);
}
if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123
$amount = str_replace($thousand, '', $amount);
}
// Convert amount to format with dolibarr dec and thousand (this is because PHP convert a number // Convert amount to format with dolibarr dec and thousand (this is because PHP convert a number
// to format defined by LC_NUMERIC after a calculation and we want source format to be like defined by Dolibarr setup. // to format defined by LC_NUMERIC after a calculation and we want source format to be like defined by Dolibarr setup.
// So if number was already a good number, it is converted into local Dolibarr setup.
if (is_numeric($amount)) if (is_numeric($amount))
{ {
// We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10 // We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10
@ -4734,10 +4743,12 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
$nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0." $nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0."
$amount = number_format($amount, $nbofdec, $dec, $thousand); $amount = number_format($amount, $nbofdec, $dec, $thousand);
} }
//print "QQ".$amount.'<br>'; //print "QQ".$amount."<br>\n";
// Now make replace (the main goal of function) // Now make replace (the main goal of function)
if ($thousand != ',' && $thousand != '.') $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users if ($thousand != ',' && $thousand != '.') {
$amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
}
$amount = str_replace(' ', '', $amount); // To avoid spaces $amount = str_replace(' ', '', $amount); // To avoid spaces
$amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
$amount = str_replace($dec, '.', $amount); $amount = str_replace($dec, '.', $amount);
@ -4956,10 +4967,10 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = "", $thirdparty_sell
// By default, search value of local tax on line of common tax // By default, search value of local tax on line of common tax
$sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($thirdparty_seller->country_code)."'";
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql .= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority if ($vatratecode) $sql .= " AND t.code ='".$db->escape($vatratecode)."'"; // If we have the code, we use it in priority
else $sql .= " AND t.recuperableonly ='".$vatnpr."'"; else $sql .= " AND t.recuperableonly ='".$db->escape($vatnpr)."'";
dol_syslog("get_localtax", LOG_DEBUG); dol_syslog("get_localtax", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -5115,10 +5126,10 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
} }
$sql .= ", ".MAIN_DB_PREFIX."c_country as c"; $sql .= ", ".MAIN_DB_PREFIX."c_country as c";
if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ?? if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // local tax in spain use the buyer country ??
else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'";
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql .= " AND t.code = '".$vatratecode."'"; if ($vatratecode) $sql .= " AND t.code = '".$db->escape($vatratecode)."'";
} }
$resql = $db->query($sql); $resql = $db->query($sql);
@ -6615,6 +6626,7 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object
$substitfiles = dol_dir_list($dir, 'files', 0, 'functions_'); $substitfiles = dol_dir_list($dir, 'files', 0, 'functions_');
foreach ($substitfiles as $substitfile) foreach ($substitfiles as $substitfile)
{ {
$reg = array();
if (preg_match('/functions_(.*)\.lib\.php/i', $substitfile['name'], $reg)) if (preg_match('/functions_(.*)\.lib\.php/i', $substitfile['name'], $reg))
{ {
$module = $reg[1]; $module = $reg[1];
@ -6624,7 +6636,9 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object
require_once $dir.$substitfile['name']; require_once $dir.$substitfile['name'];
// Call the user's function, and only if it is defined // Call the user's function, and only if it is defined
$function_name = $module."_".$callfunc; $function_name = $module."_".$callfunc;
if (function_exists($function_name)) $function_name($substitutionarray, $outputlangs, $object, $parameters); if (function_exists($function_name)) {
$function_name($substitutionarray, $outputlangs, $object, $parameters);
}
} }
} }
} }

View File

@ -773,6 +773,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits'; if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter // Extract value for third party mask counter
$regClientRef = array();
if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef))
{ {
$maskrefclient = $regClientRef[1].$regClientRef[2]; $maskrefclient = $regClientRef[1].$regClientRef[2];
@ -806,6 +807,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
} }
// Extract value for user // Extract value for user
$regType = array();
if (preg_match('/\{(u+)\}/i', $mask, $regType)) if (preg_match('/\{(u+)\}/i', $mask, $regType))
{ {
$lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; $lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
@ -970,12 +972,10 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n"; //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
// Define $sqlstring // Define $sqlstring
if (function_exists('mb_strrpos')) if (function_exists('mb_strrpos')) {
{
$posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8'); $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
} }
else else {
{
$posnumstart = strrpos($maskwithnocode, $maskcounter); $posnumstart = strrpos($maskwithnocode, $maskcounter);
} // Pos of counter in final string (from 0 to ...) } // Pos of counter in final string (from 0 to ...)
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
@ -1218,6 +1218,7 @@ function check_value($mask, $value)
$hasglobalcounter = false; $hasglobalcounter = false;
// Extract value for mask counter, mask raz and mask offset // Extract value for mask counter, mask raz and mask offset
$reg = array();
if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg))
{ {
$masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : ''); $masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : '');
@ -1236,6 +1237,7 @@ function check_value($mask, $value)
if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter // Extract value for third party mask counter
$regClientRef = array();
if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef))
{ {
$maskrefclient = $regClientRef[1].$regClientRef[2]; $maskrefclient = $regClientRef[1].$regClientRef[2];
@ -1288,31 +1290,24 @@ function check_value($mask, $value)
// Define reg // Define reg
if ($maskraz > 1 && !preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; if ($maskraz > 1 && !preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask';
if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask'; if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask';
//print "x".$maskwithonlyymcode." ".$maskraz;
} }
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n"; //print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
// Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter) if (function_exists('mb_strrpos')) {
// $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
}
else {
$posnumstart = strrpos($maskwithnocode, $maskcounter);
} // Pos of counter in final string (from 0 to ...)
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
// Check we have a number in $value at position ($posnumstart+1).', '.dol_strlen($maskcounter)
// TODO
// Check length // Check length
$len = dol_strlen($maskwithnocode); $len = dol_strlen($maskwithnocode);
if (dol_strlen($value) != $len) $result = -1; if (dol_strlen($value) != $len) $result = -1;
// Define $maskLike
/* seems not used
$maskLike = dol_string_nospecial($mask);
$maskLike = str_replace("%","_",$maskLike);
// Replace protected special codes with matching number of _ as wild card caracter
$maskLike = str_replace(dol_string_nospecial('{yyyy}'),'____',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{yy}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
*/
dol_syslog("functions2::check_value result=".$result, LOG_DEBUG); dol_syslog("functions2::check_value result=".$result, LOG_DEBUG);
return $result; return $result;
} }

View File

@ -103,10 +103,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$seller = $mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc $seller = $mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc
//var_dump($seller->country_id);exit; //var_dump($seller->country_id);exit;
} }
if (empty($localtaxes_array) || !is_array($localtaxes_array)) if (empty($localtaxes_array) || !is_array($localtaxes_array)) {
{
dol_syslog("Price.lib::calcul_price_total Warning: function is called with parameter localtaxes_array that is missing", LOG_WARNING); dol_syslog("Price.lib::calcul_price_total Warning: function is called with parameter localtaxes_array that is missing", LOG_WARNING);
} }
if (!is_numeric($txtva)) {
dol_syslog("Price.lib::calcul_price_total Warning: function was called with a parameter vat rate that is not a real numeric value. There is surely a bug.", LOG_ERR);
} elseif ($txtva >= 1000) {
dol_syslog("Price.lib::calcul_price_total Warning: function was called with a bad value for vat rate (should be often < 100, always < 1000). There is surely a bug.", LOG_ERR);
}
// Too verbose. Enable for debug only // Too verbose. Enable for debug only
//dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress); //dol_syslog("Price.lib::calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate.' remise_percent_global='.$remise_percent_global.' price_base_type='.$ice_base_type.' type='.$type.' progress='.$progress);

View File

@ -2397,24 +2397,24 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
// this conf is actually hidden, by default we use 10% for "be carefull or warning" // this conf is actually hidden, by default we use 10% for "be carefull or warning"
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
$diffTitle = '<br/>'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : ''); $diffTitle = '<br>'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : '');
$diffTitle .= '<br/>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : ''); $diffTitle .= '<br>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : '');
//var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio)); //var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio));
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) { if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
$progressBarClass = 'progress-bar-danger'; $progressBarClass = 'progress-bar-danger';
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).' '.$langs->trans("point")); $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).'%</span>'; $diff = '<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'"><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).'%</span>';
} }
elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10% elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$progressBarClass = 'progress-bar-warning'; $progressBarClass = 'progress-bar-warning';
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).' '.$langs->trans("point")); $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).'%</span>'; $diff = '<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'"><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).'%</span>';
} }
else { else {
$progressBarClass = 'progress-bar-success'; $progressBarClass = 'progress-bar-success';
$title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).' '.$langs->trans("point")); $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).' '.$langs->trans("point"));
$diff = '<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).'%</span>'; $diff = '<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).'"><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).'%</span>';
} }
} }

View File

@ -1733,7 +1733,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1)
{ {
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode);
$newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&amp;leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode);
} }
elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only

View File

@ -1780,6 +1780,17 @@ class pdf_eratosthene extends ModelePDFCommandes
'border-left' => true, // add left line separator 'border-left' => true, // add left line separator
); );
// Adapt dynamically the width of subprice, if text is too long.
$tmpwidth = 0;
$nblines = count($object->lines);
for ($i = 0; $i < $nblines; $i++) {
$tmpwidth2 = dol_strlen(dol_string_nohtmltag(pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails)));
$tmpwidth = max($tmpwidth, $tmpwidth2);
}
if ($tmpwidth > 10) {
$this->cols['subprice']['width'] += (2 * ($tmpwidth - 10));
}
$rank = $rank + 10; $rank = $rank + 10;
$this->cols['qty'] = array( $this->cols['qty'] = array(
'rank' => $rank, 'rank' => $rank,

View File

@ -468,6 +468,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Replace tags of object + external modules // Replace tags of object + external modules
$tmparray = $this->get_substitutionarray_shipment($object, $outputlangs); $tmparray = $this->get_substitutionarray_shipment($object, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object); complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);

View File

@ -326,6 +326,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetAutoPageBreak(1, 0); $pdf->SetAutoPageBreak(1, 0);
$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
if($heightforinfotot > 220) $heightforinfotot = 220;
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
@ -467,6 +468,7 @@ class pdf_crabe extends ModelePDFFactures
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);

View File

@ -2307,6 +2307,17 @@ class pdf_sponge extends ModelePDFFactures
'border-left' => true, // add left line separator 'border-left' => true, // add left line separator
); );
// Adapt dynamically the width of subprice, if text is too long.
$tmpwidth = 0;
$nblines = count($object->lines);
for ($i = 0; $i < $nblines; $i++) {
$tmpwidth2 = dol_strlen(dol_string_nohtmltag(pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails)));
$tmpwidth = max($tmpwidth, $tmpwidth2);
}
if ($tmpwidth > 10) {
$this->cols['subprice']['width'] += (2 * ($tmpwidth - 10));
}
$rank = $rank + 10; $rank = $rank + 10;
$this->cols['qty'] = array( $this->cols['qty'] = array(
'rank' => $rank, 'rank' => $rank,

View File

@ -300,6 +300,7 @@ class modBom extends DolibarrModules
$this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) $this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'bom_bom as t'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'bom_bom as t';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bom_extrafields as extra on (t.rowid = extra.fk_object)';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid';
$this->export_sql_end[$r] .= ' WHERE 1 = 1'; $this->export_sql_end[$r] .= ' WHERE 1 = 1';
$this->export_sql_end[$r] .= ' AND t.entity IN ('.getEntity('bom').')'; $this->export_sql_end[$r] .= ' AND t.entity IN ('.getEntity('bom').')';

View File

@ -176,56 +176,20 @@ class modCategorie extends DolibarrModules
's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company', 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company',
's.fk_stcomm'=>'company' 's.fk_stcomm'=>'company'
); // We define here only fields that use another picto ); // We define here only fields that use another picto
$keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, ';
$this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object ';
$this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
$this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories $this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories
// Add extra fields
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj = $this->db->fetch_object($resql))
{
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
switch ($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'sellist':
$typeFilter = "List:".$obj->param;
break;
case 'select':
$typeFilter = "Select:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = 'company';
}
}
// End add axtra fields
$r++; $r++;
$this->export_code[$r] = 'category_'.$r; $this->export_code[$r] = 'category_'.$r;
$this->export_label[$r] = 'CatProdList'; $this->export_label[$r] = 'CatProdList';
@ -410,7 +374,7 @@ class modCategorie extends DolibarrModules
'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description", 'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description",
'ca.fk_parent' => 'Parent' 'ca.fk_parent' => 'Parent'
); );
$this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]'); $this->import_regex_array[$r] = array('ca.type'=>'^(0|1|2|3|4|5|6|7|8|9|10|11)$');
$this->import_convertvalue_array[$r] = array( $this->import_convertvalue_array[$r] = array(
'ca.fk_parent' => array( 'ca.fk_parent' => array(
'rule' => 'fetchidfromcodeandlabel', 'rule' => 'fetchidfromcodeandlabel',

View File

@ -194,7 +194,7 @@ class modProduct extends DolibarrModules
); );
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -216,7 +216,7 @@ class modProduct extends DolibarrModules
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
'p.datec'=>'Date', 'p.tms'=>'Date' 'p.datec'=>'Date', 'p.tms'=>'Date'
); );
if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
if (!empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric')); if (!empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text')); if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text'));
@ -559,6 +559,7 @@ class modProduct extends DolibarrModules
); );
//clauses copied from import_fields_array //clauses copied from import_fields_array
if (!empty($conf->stock->enabled)) $import_sample = array_merge($import_sample, array( if (!empty($conf->stock->enabled)) $import_sample = array_merge($import_sample, array(
'p.tobatch'=>"0 (don't use) / 1 (use batch/serial number)",
'p.seuil_stock_alerte' => '', 'p.seuil_stock_alerte' => '',
'p.pmp' => '0', 'p.pmp' => '0',
'p.desiredstock' => '' 'p.desiredstock' => ''

View File

@ -246,9 +246,9 @@ class modResource extends DolibarrModules
$this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
$this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')'; $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')';

View File

@ -478,7 +478,7 @@ class modSociete extends DolibarrModules
'classfile' => '/core/class/cstate.class.php', 'classfile' => '/core/class/cstate.class.php',
'class' => 'Cstate', 'class' => 'Cstate',
'method' => 'fetch', 'method' => 'fetch',
'dict' => 'DictionaryState' 'dict' => 'DictionaryStateCode'
), ),
's.fk_pays' => array( 's.fk_pays' => array(
'rule' => 'fetchidfromcodeid', 'rule' => 'fetchidfromcodeid',
@ -630,7 +630,7 @@ class modSociete extends DolibarrModules
'classfile' => '/core/class/cstate.class.php', 'classfile' => '/core/class/cstate.class.php',
'class' => 'Cstate', 'class' => 'Cstate',
'method' => 'fetch', 'method' => 'fetch',
'dict' => 'DictionaryState' 'dict' => 'DictionaryStateCode'
), ),
's.fk_pays' => array( 's.fk_pays' => array(
'rule' => 'fetchidfromcodeid', 'rule' => 'fetchidfromcodeid',

View File

@ -188,28 +188,31 @@ class modStock extends DolibarrModules
//-------- //--------
$r = 0; $r = 0;
// Export stock (without batch number)
$r++; $r++;
$this->export_code[$r] = $this->rights_class; $this->export_code[$r] = $this->rights_class;
$this->export_label[$r] = "WarehousesAndProducts"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r] = "Stocks"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r] = "warehouse";
$this->export_permission[$r] = array(array("stock", "lire")); $this->export_permission[$r] = array(array("stock", "lire"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town',
'e.zip'=>'Zip', 'e.town'=>'Town', 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note",
'p.note'=>"Note", 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", 'p.datec'=>'DateCreation', 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration",
'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice' 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice',
); );
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', 'p.rowid'=>"List:product:label::product", 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text',
'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.rowid'=>"List:product:label::product", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text",
'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", 'p.datec'=>'Date', 'p.tms'=>'Date', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric', 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree",
'p.datec'=>'Date', 'p.tms'=>'Date', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric',
'ps.reel'=>'Numeric' 'ps.reel'=>'Numeric'
); );
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
'e.rowid'=>'warehouse', 'e.ref'=>'warehouse', 'e.description'=>'warehouse', 'e.lieu'=>'warehouse', 'e.address'=>'warehouse', 'e.zip'=>'warehouse', 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product",
'e.town'=>'warehouse', 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product",
'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product', 'p.pmp'=>'product', 'p.cost_price'=>'product',
'p.datec'=>'product', 'p.tms'=>'product', 'p.pmp'=>'product', 'p.cost_price'=>'product', 'ps.reel'=>'stock' 'ps.reel'=>'stock'
); ); // We define here only fields that use another icon that the one defined into export_icon
$this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them. $this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them.
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
@ -220,73 +223,78 @@ class modStock extends DolibarrModules
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
$this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid'; $this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')';
// Export stock including batch number
if ($conf->productbatch->enabled) if ($conf->productbatch->enabled)
{ {
// Export of stock including lot number
$langs->load("productbatch"); $langs->load("productbatch");
// This request is same than previous but without field ps.stock (real stock in warehouse) and with link to subtable productbatch // This request is same than previous but without field ps.stock (real stock in warehouse) and with link to subtable productbatch
$r++; $r++;
$this->export_code[$r] = $this->rights_class.'_lot'; $this->export_code[$r] = $this->rights_class.'_lot';
$this->export_label[$r] = "WarehousesAndProductsBatchDetail"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r] = "StocksWithBatch"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r] = "warehouse";
$this->export_permission[$r] = array(array("stock", "lire")); $this->export_permission[$r] = array(array("stock", "lire"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town',
'e.zip'=>'Zip', 'e.town'=>'Town', 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note",
'p.note'=>"Note", 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", 'p.datec'=>'DateCreation', 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration",
'p.tms'=>'DateModification', 'pb.rowid'=>'Id', 'pb.batch'=>'Batch', 'pb.qty'=>'Qty', 'pl.eatby'=>'EatByDate', 'pl.sellby'=>'SellByDate' 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice',
'pb.rowid'=>'Id', 'pb.batch'=>'Batch', 'pb.qty'=>'Qty',
'pl.eatby'=>'EatByDate', 'pl.sellby'=>'SellByDate'
); );
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.description'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.description'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text',
'p.rowid'=>"List:product:label::product", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", 'p.rowid'=>"List:product:label::product", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text",
'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", 'p.datec'=>'Date', 'p.tms'=>'Date', 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree",
'pb.batch'=>'Text', 'pb.qty'=>'Numeric', 'pl.eatby'=>'Date', 'pl.sellby'=>'Date' 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice',
'pb.batch'=>'Text', 'pb.qty'=>'Numeric',
'pl.eatby'=>'Date', 'pl.sellby'=>'Date'
); );
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
'e.rowid'=>'warehouse', 'e.ref'=>'warehouse', 'e.description'=>'warehouse', 'e.lieu'=>'warehouse', 'e.address'=>'warehouse', 'e.zip'=>'warehouse', 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product",
'e.town'=>'warehouse', 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product",
'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product', 'p.pmp'=>'product', 'p.cost_price'=>'product',
'p.datec'=>'product', 'p.tms'=>'product', 'pb.rowid'=>'stockbatch', 'pb.batch'=>'stockbatch', 'pb.qty'=>'stockbatch', 'pl.eatby'=>'batch', 'pb.rowid'=>'batch', 'pb.batch'=>'batch', 'pb.qty'=>'batch',
'pl.sellby'=>'batch' 'pl.eatby'=>'batch', 'pl.sellby'=>'batch'
); ); // We define here only fields that use another icon that the one defined into export_icon
$this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r] = array('stockbatch'=>array('pb.rowid'), 'batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_dependencies_array[$r] = array('stockbatch'=>array('pb.rowid'), 'batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$keyforselect = 'product_lot'; $keyforelement = 'batch'; $keyforaliasextra = 'extra'; $keyforselect = 'product_lot'; $keyforelement = 'batch'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM ('.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'product_batch as pb)'; $this->export_sql_end[$r] = ' FROM ('.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'product_batch as pb)';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e';
$this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid AND ps.rowid = pb.fk_product_stock'; $this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid AND ps.rowid = pb.fk_product_stock';
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; }
}
// Export of stock movement // Export of stock movements
$r++; $r++;
$this->export_code[$r] = $this->rights_class.'_movement'; $this->export_code[$r] = $this->rights_class.'_movement';
$this->export_label[$r] = "StockMovements"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r] = "StockMovements"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r] = "movement";
$this->export_permission[$r] = array(array("stock", "lire")); $this->export_permission[$r] = array(array("stock", "lire"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'sm.rowid'=>'MovementId', 'sm.value'=>'Qty', 'sm.datem'=>'DateMovement', 'sm.label'=>'MovementLabel', 'sm.inventorycode'=>'InventoryCode',
'e.town'=>'Town', 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note", 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town',
'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", 'p.datec'=>'DateCreation', 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note",
'p.tms'=>'DateModification', 'sm.rowid'=>'MovementId', 'sm.value'=>'Qty', 'sm.datem'=>'DateMovement', 'sm.label'=>'MovementLabel', 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
'sm.inventorycode'=>'InventoryCode'
); );
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
'sm.rowid'=>'Numeric', 'sm.value'=>'Numeric', 'sm.datem'=>'Date', 'sm.batch'=>'Text', 'sm.label'=>'Text', 'sm.inventorycode'=>'Text',
'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.description'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.description'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text',
'p.rowid'=>"List:product:label::product", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", 'p.rowid'=>"List:product:label::product", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text",
'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", 'p.datec'=>'Date', 'p.tms'=>'Date', 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", 'p.datec'=>'Date', 'p.tms'=>'Date'
'sm.rowid'=>'Numeric', 'sm.value'=>'Numeric', 'sm.datem'=>'Date', 'sm.batch'=>'Text', 'sm.label'=>'Text', 'sm.inventorycode'=>'Text'
); );
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
'e.rowid'=>'warehouse', 'e.ref'=>'warehouse', 'e.description'=>'warehouse', 'e.lieu'=>'warehouse', 'e.address'=>'warehouse', 'e.zip'=>'warehouse', 'e.rowid'=>'warehouse', 'e.ref'=>'warehouse', 'e.description'=>'warehouse', 'e.lieu'=>'warehouse', 'e.address'=>'warehouse', 'e.zip'=>'warehouse', 'e.town'=>'warehouse',
'e.town'=>'warehouse', 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product",
'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product'
'p.tms'=>'product', 'sm.rowid'=>'movement', 'sm.value'=>'movement', 'sm.datem'=>'movement', 'sm.label'=>'movement', 'sm.inventorycode'=>'movement' ); // We define here only fields that use another icon that the one defined into export_icon
);
if ($conf->productbatch->enabled) if ($conf->productbatch->enabled)
{ {
$this->export_fields_array[$r]['sm.batch'] = 'Batch'; $this->export_fields_array[$r]['sm.batch'] = 'Batch';
@ -295,6 +303,7 @@ class modStock extends DolibarrModules
} }
$this->export_aggregate_array[$r] = array('sm.value'=>'SUM'); // TODO Not used yet $this->export_aggregate_array[$r] = array('sm.value'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r] = array('movement'=>array('sm.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_dependencies_array[$r] = array('movement'=>array('sm.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'stock_mouvement as sm, '.MAIN_DB_PREFIX.'entrepot as e'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'stock_mouvement as sm, '.MAIN_DB_PREFIX.'entrepot as e';
$this->export_sql_end[$r] .= ' WHERE p.rowid = sm.fk_product AND sm.fk_entrepot = e.rowid'; $this->export_sql_end[$r] .= ' WHERE p.rowid = sm.fk_product AND sm.fk_entrepot = e.rowid';
@ -309,34 +318,48 @@ class modStock extends DolibarrModules
$r++; $r++;
$this->import_code[$r] = $this->rights_class.'_'.$r; $this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "Warehouses"; // Translation key $this->import_label[$r] = "Warehouses"; // Translation key
$this->import_icon[$r] = $this->picto; $this->import_icon[$r] = "warehouse";
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('e'=>MAIN_DB_PREFIX.'entrepot'); $this->import_tables_array[$r] = array('e'=>MAIN_DB_PREFIX.'entrepot');
$this->import_tables_creator_array[$r] = array('e'=>'fk_user_author'); $this->import_tables_creator_array[$r] = array('e'=>'fk_user_author');
$this->import_fields_array[$r] = array('e.ref'=>"LocationSummary*", $this->import_fields_array[$r] = array('e.ref'=>"LocationSummary*",
'e.description'=>"DescWareHouse", 'e.lieu'=>"LieuWareHouse", 'e.description'=>"DescWareHouse",
'e.address'=>"Address", 'e.zip'=>'Zip', 'e.fk_pays'=>'CountryCode', 'e.lieu'=>"LieuWareHouse",
'e.address'=>"Address",
'e.zip'=>'Zip',
'e.fk_departement'=>'StateCode',
'e.fk_pays'=>'CountryCode',
'e.phone'=>'Phone',
'e.fax'=>'Fax',
'e.statut'=>'Status', 'e.statut'=>'Status',
'e.fk_parent'=>'ParentWarehouse' 'e.fk_parent'=>'ParentWarehouse'
); );
$this->import_convertvalue_array[$r] = array( $this->import_convertvalue_array[$r] = array(
'e.fk_departement'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/cstate.class.php', 'class'=>'Cstate', 'method'=>'fetch', 'dict'=>'DictionaryStateCode'),
'e.fk_pays'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'), 'e.fk_pays'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'),
'e.fk_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'ref') 'e.fk_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'ref')
); );
$this->import_regex_array[$r] = array('e.statut'=>'^[0|1]'); $this->import_regex_array[$r] = array('e.statut'=>'^[0|1]');
$this->import_examplevalues_array[$r] = array('e.ref'=>"ALM001", $this->import_examplevalues_array[$r] = array('e.ref'=>"ALM001",
'e.description'=>"Central Warehouse", 'e.lieu'=>"Central", 'e.description'=>"Central Warehouse",
'e.address'=>"Route 66", 'e.zip'=>'28080', 'e.fk_pays'=>'US', 'e.lieu'=>"Central",
'e.address'=>"Route 66",
'e.zip'=>'28080',
'e.fk_departement'=>'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"',
'e.fk_pays'=>'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"',
'e.phone'=>'(+33)(0)123456789',
'e.fax'=>'(+33)(0)123456790',
'e.statut'=>'1', 'e.statut'=>'1',
'e.fk_parent'=>'' 'e.fk_parent'=>'id or ref in this table'
); );
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
// Import stocks // Import stocks
$r++; $r++;
$this->import_code[$r] = $this->rights_class.'_'.$r; $this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "Stocks"; // Translation key $this->import_label[$r] = "Stocks"; // Translation key
$this->import_icon[$r] = $this->picto; $this->import_icon[$r] = "stock";
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = array('ps'=>MAIN_DB_PREFIX.'product_stock'); $this->import_tables_array[$r] = array('ps'=>MAIN_DB_PREFIX.'product_stock');
$this->import_fields_array[$r] = array('ps.fk_product'=>"Product*", 'ps.fk_entrepot'=>"Warehouse*", 'ps.reel'=>"Stock*"); $this->import_fields_array[$r] = array('ps.fk_product'=>"Product*", 'ps.fk_entrepot'=>"Warehouse*", 'ps.reel'=>"Stock*");
@ -346,7 +369,7 @@ class modStock extends DolibarrModules
'ps.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'ref') 'ps.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'ref')
); );
$this->import_examplevalues_array[$r] = array( $this->import_examplevalues_array[$r] = array(
'ps.fk_product'=>"PREF123456", 'ps.fk_entrepot'=>"ALM001", 'ps.reel'=>"10" 'ps.fk_product'=>"id or ref", 'ps.fk_entrepot'=>"id or ref", 'ps.reel'=>"10"
); );
$this->import_updatekeys_array[$r] = array('ps.fk_product'=>'Product', 'ps.fk_entrepot'=>"Warehouse"); $this->import_updatekeys_array[$r] = array('ps.fk_product'=>'Product', 'ps.fk_entrepot'=>"Warehouse");
$this->import_run_sql_after_array[$r] = array( // Because we may change data that are denormalized, we must update dernormalized data after. $this->import_run_sql_after_array[$r] = array( // Because we may change data that are denormalized, we must update dernormalized data after.

View File

@ -255,6 +255,8 @@ class modUser extends DolibarrModules
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
); );
$keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (empty($conf->adherent->enabled)) if (empty($conf->adherent->enabled))
{ {
unset($this->export_fields_array[$r]['u.fk_member']); unset($this->export_fields_array[$r]['u.fk_member']);
@ -262,6 +264,7 @@ class modUser extends DolibarrModules
} }
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')'; $this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
// Imports // Imports

View File

@ -1933,6 +1933,17 @@ class pdf_cyan extends ModelePDFPropales
'border-left' => true, // add left line separator 'border-left' => true, // add left line separator
); );
// Adapt dynamically the width of subprice, if text is too long.
$tmpwidth = 0;
$nblines = count($object->lines);
for ($i = 0; $i < $nblines; $i++) {
$tmpwidth2 = dol_strlen(dol_string_nohtmltag(pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails)));
$tmpwidth = max($tmpwidth, $tmpwidth2);
}
if ($tmpwidth > 10) {
$this->cols['subprice']['width'] += (2 * ($tmpwidth - 10));
}
$rank = $rank + 10; $rank = $rank + 10;
$this->cols['qty'] = array( $this->cols['qty'] = array(
'rank' => $rank, 'rank' => $rank,

View File

@ -267,7 +267,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* -2 ErrorCustomerCodeRequired * -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed * -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired * -4 ErrorPrefixRequired
* -5 Other (see this->error) * -5 NotConfigured - Setup empty so any value may be ok or not
* -6 Other (see this->error)
*/ */
public function verif($db, &$code, $soc, $type) public function verif($db, &$code, $soc, $type)
{ {
@ -297,12 +298,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$this->error = 'NotConfigured'; $this->error = 'NotConfigured';
return -5; return -5;
} }
$result = check_value($mask, $code); $result = check_value($mask, $code);
if (is_string($result)) if (is_string($result))
{ {
$this->error = $result; $this->error = $result;
return -5; return -6;
} }
} }

View File

@ -1052,7 +1052,10 @@ class Cronjob extends CommonObject
$object = new $this->objectname($this->db); $object = new $this->objectname($this->db);
if ($this->entity > 0) $object->entity = $this->entity; // We work on a dedicated entity if ($this->entity > 0) $object->entity = $this->entity; // We work on a dedicated entity
$params_arr = array();
if (!empty($this->params) || $this->params === '0'){
$params_arr = array_map('trim', explode(",", $this->params)); $params_arr = array_map('trim', explode(",", $this->params));
}
if (!is_array($params_arr)) if (!is_array($params_arr))
{ {

View File

@ -240,7 +240,7 @@ if (empty($reshook))
$stockLocation = "ent1".$i."_0"; $stockLocation = "ent1".$i."_0";
$qty = "qtyl".$i; $qty = "qtyl".$i;
if ($objectsrc->lines[$i]->product_tobatch) // If product need a batch number if (!empty($conf->productbatch->enabled) && $objectsrc->lines[$i]->product_tobatch) // If product need a batch number
{ {
if (GETPOSTISSET($batch)) if (GETPOSTISSET($batch))
{ {
@ -435,16 +435,11 @@ if (empty($reshook))
$result = $object->valid($user); $result = $object->valid($user);
if ($result < 0) if ($result < 0) {
{ setEventMessages($object->error, $object->errors, 'errors');
$langs->load("errors"); } else {
setEventMessages($langs->trans($object->error), $object->errors, 'errors');
}
else
{
// Define output language // Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
{
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
@ -1599,7 +1594,7 @@ if ($action == 'create')
$srcLine = new OrderLine($db); $srcLine = new OrderLine($db);
$srcLine->id = $line->id; $srcLine->id = $line->id;
$srcLine->fetch_optionals(); // fetch extrafields also available in orderline $srcLine->fetch_optionals(); // fetch extrafields also available in orderline
$line->array_options = array_merge($line->array_options, $srcLine->array_options); $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options);
print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1);
} }

View File

@ -954,29 +954,30 @@ class Expedition extends CommonObject
{ {
$fk_product = $orderline->fk_product; $fk_product = $orderline->fk_product;
if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) {
{
$langs->load("errors"); $langs->load("errors");
$this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); $this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
return -1; return -1;
} }
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) {
{
// Check must be done for stock of product into warehouse if $entrepot_id defined
$product = new Product($this->db); $product = new Product($this->db);
$result = $product->fetch($fk_product); $product->fetch($fk_product);
// Check must be done for stock of product into warehouse if $entrepot_id defined
if ($entrepot_id > 0) { if ($entrepot_id > 0) {
$product->load_stock('warehouseopen'); $product->load_stock('warehouseopen');
$product_stock = $product->stock_warehouse[$entrepot_id]->real; $product_stock = $product->stock_warehouse[$entrepot_id]->real;
} } else {
else
$product_stock = $product->stock_reel; $product_stock = $product->stock_reel;
}
$product_type = $product->type; $product_type = $product->type;
if ($product_type == 0 && $product_stock < $qty) if ($product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
{ $isavirtualproduct = ($product->hasFatherOrChild(1) > 0);
// The product is qualified for a check of quantity (must be enough in stock to be added into shipment).
if (!$isavirtualproduct || empty($conf->global->PRODUIT_SOUSPRODUITS) || ($isavirtualproduct && empty($conf->global->STOCK_EXCLUDE_VIRTUAL_PRODUCTS))) { // If STOCK_EXCLUDE_VIRTUAL_PRODUCTS is set, we do not manage stock for kits/virtual products.
if ($product_stock < $qty) {
$langs->load("errors"); $langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
$this->db->rollback(); $this->db->rollback();
@ -984,6 +985,8 @@ class Expedition extends CommonObject
} }
} }
} }
}
}
// If product need a batch number, we should not have called this function but addline_batch instead. // If product need a batch number, we should not have called this function but addline_batch instead.
if (!empty($conf->productbatch->enabled) && !empty($orderline->fk_product) && !empty($orderline->product_tobatch)) if (!empty($conf->productbatch->enabled) && !empty($orderline->fk_product) && !empty($orderline->product_tobatch))

View File

@ -1801,6 +1801,7 @@ class ExpenseReport extends CommonObject
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty); $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty);
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\s*\((.*)\)/', $vatrate, $reg)) if (preg_match('/\s*\((.*)\)/', $vatrate, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];
@ -2046,6 +2047,7 @@ class ExpenseReport extends CommonObject
// Clean vat code // Clean vat code
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\((.*)\)/', $vatrate, $reg)) if (preg_match('/\((.*)\)/', $vatrate, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];
@ -2060,10 +2062,6 @@ class ExpenseReport extends CommonObject
$tx_tva = $vatrate / 100; $tx_tva = $vatrate / 100;
$tx_tva = $tx_tva + 1; $tx_tva = $tx_tva + 1;
$total_ht = price2num($total_ttc / $tx_tva, 'MT');
$total_tva = price2num($total_ttc - $total_ht, 'MT');
// fin calculs
$this->line = new ExpenseReportLine($this->db); $this->line = new ExpenseReportLine($this->db);
$this->line->comments = $comments; $this->line->comments = $comments;

View File

@ -34,8 +34,8 @@ $langs->loadLangs(array('trips', 'companies'));
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer'; $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
$object_status = GETPOST('object_status'); $object_status = GETPOST('object_status', 'intcomma');
$userid = GETPOST('userid', 'int'); $userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0; $socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
@ -51,7 +51,7 @@ if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'expensereport', $id, ''); $result = restrictedArea($user, 'expensereport', $id, '');
$nowyear = strftime("%Y", dol_now()); $nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
//$startyear=$year-2; //$startyear=$year-2;
$startyear = $year - 1; $startyear = $year - 1;
$endyear = $year; $endyear = $year;
@ -231,7 +231,7 @@ print '</td></tr>';
// Status // Status
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">'; print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';
$liststatus = $tmpexpensereport->statuts; $liststatus = $tmpexpensereport->statuts;
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'int'), -4, 0, 0, '', 1); print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4, 0, 0, '', 1);
print '</td></tr>'; print '</td></tr>';
// Year // Year
print '<tr><td>'; print '<tr><td>';

View File

@ -102,6 +102,7 @@ class Export
// Search module files // Search module files
while (($file = readdir($handle)) !== false) while (($file = readdir($handle)) !== false)
{ {
$reg = array();
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg)) if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg))
{ {
$modulename = $reg[1]; $modulename = $reg[1];

View File

@ -39,6 +39,7 @@ $langs->loadlangs(array('admin', 'exports', 'other', 'users', 'companies', 'proj
//if (! $user->admin) //if (! $user->admin)
// accessforbidden(); // accessforbidden();
// Map icons, array duplicated in import.php, was not synchronized, TODO put it somewhere only once
$entitytoicon = array( $entitytoicon = array(
'invoice' => 'bill', 'invoice' => 'bill',
'invoice_line' => 'bill', 'invoice_line' => 'bill',
@ -54,13 +55,13 @@ $entitytoicon = array(
'payment' => 'payment', 'payment' => 'payment',
'tax' => 'generic', 'tax' => 'generic',
'tax_type' => 'generic', 'tax_type' => 'generic',
'stock' => 'generic',
'other' => 'generic', 'other' => 'generic',
'account' => 'account', 'account' => 'account',
'product' => 'product', 'product' => 'product',
'virtualproduct'=>'product', 'virtualproduct'=>'product',
'subproduct' => 'product', 'subproduct' => 'product',
'product_supplier_ref' => 'product', 'product_supplier_ref' => 'product',
'stock' => 'stock',
'warehouse' => 'stock', 'warehouse' => 'stock',
'batch' => 'stock', 'batch' => 'stock',
'stockbatch' => 'stock', 'stockbatch' => 'stock',
@ -78,7 +79,7 @@ $entitytoicon = array(
'bomline' => 'bom' 'bomline' => 'bom'
); );
// Translation code // Translation code, array duplicated in import.php, was not synchronized, TODO put it somewhere only once
$entitytolang = array( $entitytolang = array(
'user' => 'User', 'user' => 'User',
'company' => 'Company', 'company' => 'Company',
@ -459,15 +460,14 @@ if ($step == 1 || !$datatoexport)
$sortedarrayofmodules = dol_sort_array($objexport->array_export_module, 'module_position', 'asc', 0, 0, 1); $sortedarrayofmodules = dol_sort_array($objexport->array_export_module, 'module_position', 'asc', 0, 0, 1);
foreach ($sortedarrayofmodules as $key => $value) foreach ($sortedarrayofmodules as $key => $value)
{ {
//var_dump($objexport->array_import_code[$key]);
print '<tr class="oddeven"><td nospan="nospan">'; print '<tr class="oddeven"><td nospan="nospan">';
//print img_object($objexport->array_export_module[$key]->getName(),$export->array_export_module[$key]->picto).' ';
print $objexport->array_export_module[$key]->getName(); print $objexport->array_export_module[$key]->getName();
print '</td><td>'; print '</td><td>';
$icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[$key]); $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[$key]);
$label = $objexport->array_export_label[$key]; $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
//print $value.'-'.$icon.'-'.$label."<br>"; print img_object($objexport->array_export_module[$key]->getName(), $entityicon).' ';
print img_object($objexport->array_export_module[$key]->getName(), $icon).' '; print $objexport->array_export_label[$key];
print $label;
print '</td><td class="right">'; print '</td><td class="right">';
if ($objexport->array_export_perms[$key]) if ($objexport->array_export_perms[$key])
{ {
@ -522,11 +522,10 @@ if ($step == 2 && $datatoexport)
// Lot de donnees a exporter // Lot de donnees a exporter
print '<tr><td>'.$langs->trans("DatasetToExport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToExport").'</td>';
print '<td>'; print '<td>';
$icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]);
$label = $objexport->array_export_label[0]; $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
//print $value.'-'.$icon.'-'.$label."<br>"; print img_object($objexport->array_export_module[0]->getName(), $entityicon).' ';
print img_object($objexport->array_export_module[0]->getName(), $icon).' '; print $objexport->array_export_label[0];
print $label;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -728,11 +727,10 @@ if ($step == 3 && $datatoexport)
// Lot de donnees a exporter // Lot de donnees a exporter
print '<tr><td>'.$langs->trans("DatasetToExport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToExport").'</td>';
print '<td>'; print '<td>';
$icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]);
$label = $objexport->array_export_label[0]; $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
//print $value.'-'.$icon.'-'.$label."<br>"; print img_object($objexport->array_export_module[0]->getName(), $entityicon).' ';
print img_object($objexport->array_export_module[0]->getName(), $icon).' '; print $objexport->array_export_label[0];
print $label;
print '</td></tr>'; print '</td></tr>';
// Nbre champs exportes // Nbre champs exportes
@ -920,8 +918,9 @@ if ($step == 4 && $datatoexport)
// Lot de donnees a exporter // Lot de donnees a exporter
print '<tr><td>'.$langs->trans("DatasetToExport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToExport").'</td>';
print '<td>'; print '<td>';
$icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]);
print img_object($objexport->array_export_module[0]->getName(), $icon).' '; $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objexport->array_export_module[0]->getName(), $entityicon).' ';
print $objexport->array_export_label[0]; print $objexport->array_export_label[0];
print '</td></tr>'; print '</td></tr>';
@ -1190,8 +1189,9 @@ if ($step == 5 && $datatoexport)
// Dataset to export // Dataset to export
print '<tr><td>'.$langs->trans("DatasetToExport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToExport").'</td>';
print '<td>'; print '<td>';
$icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]);
print img_object($objexport->array_export_module[0]->getName(), $icon).' '; $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objexport->array_export_module[0]->getName(), $entityicon).' ';
print $objexport->array_export_label[0]; print $objexport->array_export_label[0];
print '</td></tr>'; print '</td></tr>';

View File

@ -473,7 +473,9 @@ class FichinterRec extends Fichinter
if (!$info_bits) $info_bits = 0; if (!$info_bits) $info_bits = 0;
$pu_ht = price2num($pu_ht); $pu_ht = price2num($pu_ht);
$pu_ttc = price2num($pu_ttc); $pu_ttc = price2num($pu_ttc);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
if ($price_base_type == 'HT') { if ($price_base_type == 'HT') {
$pu = $pu_ht; $pu = $pu_ht;
@ -481,7 +483,6 @@ class FichinterRec extends Fichinter
$pu = $pu_ttc; $pu = $pu_ttc;
} }
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker

View File

@ -42,12 +42,12 @@ if ($user->socid > 0)
} }
$nowyear = strftime("%Y", dol_now()); $nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
//$startyear=$year-2; //$startyear=$year-2;
$startyear = $year - 1; $startyear = $year - 1;
$endyear = $year; $endyear = $year;
$object_status = GETPOST('object_status'); $object_status = GETPOST('object_status', 'intcomma');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('interventions', 'companies', 'other', 'suppliers')); $langs->loadLangs(array('interventions', 'companies', 'other', 'suppliers'));

View File

@ -31,7 +31,7 @@
*/ */
if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('EURO')) define('EURO', chr(128)); if (!defined('EURO')) define('EURO', chr(128));

View File

@ -180,7 +180,10 @@ if ($object->id > 0)
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>'; print '<td class="titlefield">'.$langs->trans("SupplierCode").'</td><td>';
print $object->code_fournisseur; print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; $tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -1729,11 +1729,11 @@ class CommandeFournisseur extends CommonOrder
{ {
$coeff = intval($qty / $prod->packaging) + 1; $coeff = intval($qty / $prod->packaging) + 1;
$qty = $prod->packaging * $coeff; $qty = $prod->packaging * $coeff;
}
}
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
} }
} }
}
}
else else
{ {
$product_type = $type; $product_type = $type;
@ -1776,8 +1776,6 @@ class CommandeFournisseur extends CommonOrder
$localtax1_type = $localtaxes_type[0]; $localtax1_type = $localtaxes_type[0];
$localtax2_type = $localtaxes_type[2]; $localtax2_type = $localtaxes_type[2];
$subprice = price2num($pu, 'MU');
$rangmax = $this->line_max(); $rangmax = $this->line_max();
$rang = $rangmax + 1; $rang = $rangmax + 1;
@ -2635,7 +2633,9 @@ class CommandeFournisseur extends CommonOrder
if (!$qty) $qty = 1; if (!$qty) $qty = 1;
$pu = price2num($pu); $pu = price2num($pu);
$pu_ht_devise = price2num($pu_ht_devise); $pu_ht_devise = price2num($pu_ht_devise);
$txtva = price2num($txtva); if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
@ -2658,6 +2658,7 @@ class CommandeFournisseur extends CommonOrder
// Clean vat code // Clean vat code
$vat_src_code = ''; $vat_src_code = '';
$reg = array();
if (preg_match('/\((.*)\)/', $txtva, $reg)) if (preg_match('/\((.*)\)/', $txtva, $reg))
{ {
$vat_src_code = $reg[1]; $vat_src_code = $reg[1];
@ -2683,8 +2684,6 @@ class CommandeFournisseur extends CommonOrder
$localtax1_type = $localtaxes_type[0]; $localtax1_type = $localtaxes_type[0];
$localtax2_type = $localtaxes_type[2]; $localtax2_type = $localtaxes_type[2];
$subprice = price2num($pu_ht, 'MU');
//Fetch current line from the database and then clone the object and set it in $oldline property //Fetch current line from the database and then clone the object and set it in $oldline property
$this->line = new CommandeFournisseurLigne($this->db); $this->line = new CommandeFournisseurLigne($this->db);
$this->line->fetch($rowid); $this->line->fetch($rowid);
@ -2987,7 +2986,7 @@ class CommandeFournisseur extends CommonOrder
} }
$sql .= $clause." c.entity = ".$conf->entity; $sql .= $clause." c.entity = ".$conf->entity;
if ($mode === 'awaiting') { if ($mode === 'awaiting') {
$sql .= " AND c.fk_statut = ".self::STATUS_ORDERSENT; $sql .= " AND c.fk_statut IN (".self::STATUS_ORDERSENT.", ".self::STATUS_RECEIVED_PARTIALLY.")";
} }
else { else {
$sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")"; $sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")";
@ -3009,14 +3008,15 @@ class CommandeFournisseur extends CommonOrder
if ($mode === 'awaiting') { if ($mode === 'awaiting') {
$response->label = $langs->trans("SuppliersOrdersAwaitingReception"); $response->label = $langs->trans("SuppliersOrdersAwaitingReception");
$response->labelShort = $langs->trans("AwaitingReception"); $response->labelShort = $langs->trans("AwaitingReception");
$response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers'; $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3,4&mainmenu=commercial&leftmenu=orders_suppliers';
} }
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;
$commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$commandestatic->date_delivery = $this->db->jdate($obj->delivery_date);
$commandestatic->date_commande = $this->db->jdate($obj->date_commande); $commandestatic->date_commande = $this->db->jdate($obj->date_commande);
$commandestatic->statut = $obj->fk_statut; $commandestatic->statut = $obj->fk_statut;
@ -3177,7 +3177,7 @@ class CommandeFournisseur extends CommonOrder
$now = dol_now(); $now = dol_now();
$date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery;
return ($this->statut > 0 && $this->statut < 4) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay);
} }
/** /**

View File

@ -1679,11 +1679,11 @@ class FactureFournisseur extends CommonInvoice
$remise_percent = price2num($remise_percent); $remise_percent = price2num($remise_percent);
$qty = price2num($qty); $qty = price2num($qty);
$pu = price2num($pu); $pu = price2num($pu);
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if (!preg_match('/\((.*)\)/', $txtva)) { if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
} }
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($date_start && $date_end && $date_start > $date_end) { if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors"); $langs->load("errors");
@ -1939,8 +1939,6 @@ class FactureFournisseur extends CommonInvoice
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
$localtaxes_type = array($txlocaltax1, $txlocaltax2);
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker

View File

@ -274,7 +274,7 @@ class ProductFournisseur extends Product
$charges = price2num($charges, 'MU'); $charges = price2num($charges, 'MU');
$qty = price2num($qty, 'MS'); $qty = price2num($qty, 'MS');
$unitBuyPrice = price2num($buyprice / $qty, 'MU'); $unitBuyPrice = price2num($buyprice / $qty, 'MU');
$packaging = ($this->packaging < $qty) ? $qty : $this->packaging; $packaging = price2num((($this->packaging < $qty) ? $qty : $this->packaging), 'MS');
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();

View File

@ -92,7 +92,7 @@ class PaiementFourn extends Paiement
$error = 0; $error = 0;
$sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank, p.multicurrency_amount,'; $sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank, p.multicurrency_amount,';
$sql .= ' c.code as paiement_code, c.libelle as paiement_type,'; $sql .= ' c.code as payment_code, c.libelle as payment_type,';
$sql .= ' p.num_paiement as num_payment, p.note, b.fk_account'; $sql .= ' p.num_paiement as num_payment, p.note, b.fk_account';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
@ -121,6 +121,7 @@ class PaiementFourn extends Paiement
$this->datepaye = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp);
$this->num_paiement = $obj->num_payment; $this->num_paiement = $obj->num_payment;
$this->num_payment = $obj->num_payment; $this->num_payment = $obj->num_payment;
$this->numero = $obj->num_payment;
$this->bank_account = $obj->fk_account; $this->bank_account = $obj->fk_account;
$this->fk_account = $obj->fk_account; $this->fk_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank; $this->bank_line = $obj->fk_bank;
@ -129,8 +130,8 @@ class PaiementFourn extends Paiement
$this->multicurrency_amount = $obj->multicurrency_amount; $this->multicurrency_amount = $obj->multicurrency_amount;
$this->note = $obj->note; $this->note = $obj->note;
$this->note_private = $obj->note; $this->note_private = $obj->note;
$this->type_code = $obj->paiement_code; $this->type_code = $obj->payment_code;
$this->type_label = $obj->paiement_type; $this->type_label = $obj->payment_type;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$error = 1; $error = 1;

View File

@ -2065,9 +2065,9 @@ elseif (!empty($object->id))
if ($object->methode_commande_id > 0) if ($object->methode_commande_id > 0)
{ {
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>';
if ($object->date_commande) print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin) : '&nbsp;';
{ if ($object->hasDelay() && empty($object->date_livraison) && !empty($object->date_commande)) {
print dol_print_date($object->date_commande, "dayhour")."\n"; print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
} }
print "</td></tr>"; print "</td></tr>";

View File

@ -73,7 +73,6 @@ $search_user = GETPOST('search_user', 'int');
$search_request_author = GETPOST('search_request_author', 'alpha'); $search_request_author = GETPOST('search_request_author', 'alpha');
$search_ht = GETPOST('search_ht', 'alpha'); $search_ht = GETPOST('search_ht', 'alpha');
$search_ttc = GETPOST('search_ttc', 'alpha'); $search_ttc = GETPOST('search_ttc', 'alpha');
$search_status = (GETPOST('search_status', 'alpha') != '' ?GETPOST('search_status', 'alpha') : GETPOST('statut', 'alpha')); // alpha and not intbecause it can be '6,7'
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$search_sale = GETPOST('search_sale', 'int'); $search_sale = GETPOST('search_sale', 'int');
@ -91,8 +90,11 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_btn = GETPOST('button_search', 'alpha'); $search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha');
$status = GETPOST('statut', 'alpha'); if (is_array(GETPOST('search_status', 'intcomma'))) {
$search_status = GETPOST('search_status'); $search_status = join(',', GETPOST('search_status', 'intcomma'));
} else {
$search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma'));
}
// Security check // Security check
$orderid = GETPOST('orderid', 'int'); $orderid = GETPOST('orderid', 'int');
@ -127,7 +129,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'cf.ref'=>'Ref', 'cf.ref'=>'Ref',
'cf.ref_supplier'=>'RefSupplierOrder', 'cf.ref_supplier'=>'RefOrderSupplier',
'pd.description'=>'Description', 'pd.description'=>'Description',
's.nom'=>"ThirdParty", 's.nom'=>"ThirdParty",
'cf.note_public'=>'NotePublic', 'cf.note_public'=>'NotePublic',
@ -173,6 +175,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position');
$error = 0;
/* /*
@ -475,19 +478,22 @@ $formorder = new FormOrder($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$title = $langs->trans("SuppliersOrders"); $title = $langs->trans("ListOfSupplierOrders");
if ($socid > 0) if ($socid > 0)
{ {
$fourn = new Fournisseur($db); $fourn = new Fournisseur($db);
$fourn->fetch($socid); $fourn->fetch($socid);
$title .= ' - '.$fourn->name; $title .= ' - '.$fourn->name;
} }
if ($status)
/*if ($search_status)
{ {
if ($status == '1,2,3') $title .= ' - '.$langs->trans("StatusOrderToProcessShort"); if ($search_status == '1,2') $title .= ' - '.$langs->trans("SuppliersOrdersToProcess");
if ($status == '6,7') $title .= ' - '.$langs->trans("StatusOrderCanceled"); elseif ($search_status == '3,4') $title .= ' - '.$langs->trans("SuppliersOrdersAwaitingReception");
else $title .= ' - '.$commandestatic->LibStatut($status); elseif ($search_status == '1,2,3') $title .= ' - '.$langs->trans("StatusOrderToProcessShort");
} elseif ($search_status == '6,7') $title .= ' - '.$langs->trans("StatusOrderCanceled");
elseif (is_numeric($search_status) && $search_status >= 0) $title .= ' - '.$commandestatic->LibStatut($search_status);
}*/
if ($search_billed > 0) $title .= ' - '.$langs->trans("Billed"); if ($search_billed > 0) $title .= ' - '.$langs->trans("Billed");
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
@ -544,7 +550,7 @@ if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_prod
//Required triple check because statut=0 means draft filter //Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'intcomma') !== '') if (GETPOST('statut', 'intcomma') !== '')
$sql .= " AND cf.fk_statut IN (".$db->escape($db->escape(GETPOST('statut', 'intcomma'))).")"; $sql .= " AND cf.fk_statut IN (".$db->escape($db->escape(GETPOST('statut', 'intcomma'))).")";
if ($search_status != '' && $search_status >= 0) if ($search_status != '' && $search_status != '-1')
$sql .= " AND cf.fk_statut IN (".$db->escape($search_status).")"; $sql .= " AND cf.fk_statut IN (".$db->escape($search_status).")";
$sql .= dolSqlDateFilter("cf.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); $sql .= dolSqlDateFilter("cf.date_commande", $search_orderday, $search_ordermonth, $search_orderyear);
$sql .= dolSqlDateFilter("cf.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); $sql .= dolSqlDateFilter("cf.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear);
@ -591,17 +597,6 @@ $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfSupplierOrders').' - '.$soc->name;
}
else
{
$title = $langs->trans('ListOfSupplierOrders');
}
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
@ -640,7 +635,7 @@ if ($resql)
if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat); if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc); if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
if ($search_refsupp) $param .= "&search_refsupp=".urlencode($search_refsupp); if ($search_refsupp) $param .= "&search_refsupp=".urlencode($search_refsupp);
if ($search_status >= 0) $param .= "&search_status=".urlencode($search_status); if ($search_status != '' && $search_status != '-1') $param .= "&search_status=".urlencode($search_status);
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
if ($search_billed != '') $param .= "&search_billed=".urlencode($search_billed); if ($search_billed != '') $param .= "&search_billed=".urlencode($search_billed);
if ($show_files) $param .= '&show_files='.urlencode($show_files); if ($show_files) $param .= '&show_files='.urlencode($show_files);
@ -927,7 +922,7 @@ if ($resql)
if (!empty($arrayfields['cf.fk_statut']['checked'])) if (!empty($arrayfields['cf.fk_statut']['checked']))
{ {
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
$formorder->selectSupplierOrderStatus((strstr($search_status, ',') ?-1 : $search_status), 1, 'search_status'); $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status');
print '</td>'; print '</td>';
} }
// Status billed // Status billed
@ -1001,6 +996,7 @@ if ($resql)
$objectstatic->total_ht = $obj->total_ht; $objectstatic->total_ht = $obj->total_ht;
$objectstatic->total_tva = $obj->total_tva; $objectstatic->total_tva = $obj->total_tva;
$objectstatic->total_ttc = $obj->total_ttc; $objectstatic->total_ttc = $obj->total_ttc;
$objectstatic->date_commande = $db->jdate($obj->date_commande);
$objectstatic->date_delivery = $db->jdate($obj->date_delivery); $objectstatic->date_delivery = $db->jdate($obj->date_delivery);
$objectstatic->note_public = $obj->note_public; $objectstatic->note_public = $obj->note_public;
$objectstatic->note_private = $obj->note_private; $objectstatic->note_private = $obj->note_private;
@ -1110,8 +1106,10 @@ if ($resql)
if (!empty($arrayfields['cf.date_commande']['checked'])) if (!empty($arrayfields['cf.date_commande']['checked']))
{ {
print '<td class="center">'; print '<td class="center">';
if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day'); print dol_print_date($db->jdate($obj->date_commande), 'day');
else print ''; if ($objectstatic->hasDelay() && empty($objectstatic->date_delivery)) {
print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning");
}
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@ -274,10 +274,10 @@ if ($result > 0)
$i = 0; $i = 0;
$total = 0; $total = 0;
print '<b>'.$langs->trans("Invoices").'</b><br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>'; print '<td>'.$langs->trans('Invoice').'</td>';
print '<td>'.$langs->trans('RefSupplier').'</td>'; print '<td>'.$langs->trans('RefSupplier').'</td>';
print '<td>'.$langs->trans('Company').'</td>'; print '<td>'.$langs->trans('Company').'</td>';
print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>'; print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';

View File

@ -38,31 +38,93 @@ $langs->loadLangs(array('exports', 'compta', 'errors'));
// Security check // Security check
$result = restrictedArea($user, 'import'); $result = restrictedArea($user, 'import');
// Map icons, array duplicated in export.php, was not synchronized, TODO put it somewhere only once
$entitytoicon = array( $entitytoicon = array(
'invoice'=>'bill', 'invoice_line'=>'bill', 'invoice' => 'bill',
'order'=>'order', 'order_line'=>'order', 'invoice_line' => 'bill',
'intervention'=>'intervention', 'inter_line'=>'intervention', 'order' => 'order',
'member'=>'user', 'member_type'=>'group', 'subscription'=>'payment', 'order_line' => 'order',
'tax'=>'bill', 'tax_type'=>'generic', 'propal' => 'propal',
'account'=>'account', 'propal_line' => 'propal',
'payment'=>'payment', 'intervention' => 'intervention',
'product'=>'product', 'stock'=>'generic', 'warehouse'=>'stock', 'inter_line' => 'intervention',
'category'=>'generic', 'member' => 'user',
'other'=>'generic' 'member_type' => 'group',
'subscription' => 'payment',
'payment' => 'payment',
'tax' => 'bill',
'tax_type' => 'generic',
'other' => 'generic',
'account' => 'account',
'product' => 'product',
'virtualproduct'=>'product',
'subproduct' => 'product',
'product_supplier_ref' => 'product',
'stock' => 'stock',
'warehouse' => 'stock',
'batch' => 'stock',
'stockbatch' => 'stock',
'category' => 'category',
'shipment' => 'sending',
'shipment_line'=> 'sending',
'reception'=> 'sending',
'reception_line'=> 'sending',
'expensereport'=> 'trip',
'expensereport_line'=> 'trip',
'holiday' => 'holiday',
'contract_line' => 'contract',
'translation' => 'generic',
'bomm' => 'bom',
'bomline' => 'bom'
); );
$entitytolang = array( // Translation code
'user'=>'User', // Translation code, array duplicated in export.php, was not synchronized, TODO put it somewhere only once
'company'=>'Company', 'contact'=>'Contact', $entitytolang = array(
'invoice'=>'Bill', 'invoice_line'=>'InvoiceLine', 'user' => 'User',
'order'=>'Order', 'order_line'=>'OrderLine', 'company' => 'Company',
'intervention'=>'Intervention', 'inter_line'=>'InterLine', 'contact' => 'Contact',
'member'=>'Member', 'member_type'=>'MemberType', 'subscription'=>'Subscription', 'invoice' => 'Bill',
'tax'=>'SocialContribution', 'tax_type'=>'DictionarySocialContributions', 'invoice_line' => 'InvoiceLine',
'account'=>'BankTransactions', 'order' => 'Order',
'payment'=>'Payment', 'order_line' => 'OrderLine',
'product'=>'Product', 'stock'=>'Stock', 'warehouse'=>'Warehouse', 'propal' => 'Proposal',
'category'=>'Category', 'propal_line' => 'ProposalLine',
'other'=>'Other' 'intervention' => 'Intervention',
'inter_line' => 'InterLine',
'member' => 'Member',
'member_type' => 'MemberType',
'subscription' => 'Subscription',
'tax' => 'SocialContribution',
'tax_type' => 'DictionarySocialContributions',
'account' => 'BankTransactions',
'payment' => 'Payment',
'product' => 'Product',
'virtualproduct' => 'AssociatedProducts',
'subproduct' => 'SubProduct',
'product_supplier_ref' => 'SupplierPrices',
'service' => 'Service',
'stock' => 'Stock',
'movement' => 'StockMovement',
'batch' => 'Batch',
'stockbatch' => 'StockDetailPerBatch',
'warehouse' => 'Warehouse',
'category' => 'Category',
'other' => 'Other',
'trip' => 'TripsAndExpenses',
'shipment' => 'Shipments',
'shipment_line'=> 'ShipmentLine',
'project' => 'Projects',
'projecttask' => 'Tasks',
'task_time' => 'TaskTimeSpent',
'action' => 'Event',
'expensereport'=> 'ExpenseReport',
'expensereport_line'=> 'ExpenseReportLine',
'holiday' => 'TitreRequestCP',
'contract' => 'Contract',
'contract_line'=> 'ContractLine',
'translation' => 'Translation',
'bom' => 'BOM',
'bomline' => 'BOMLine'
); );
$datatoimport = GETPOST('datatoimport'); $datatoimport = GETPOST('datatoimport');
@ -365,7 +427,9 @@ if ($step == 1 || !$datatoimport)
if (in_array($objimport->array_import_code[$key], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService"); if (in_array($objimport->array_import_code[$key], array('produit_supplierprices', 'produit_multiprice', 'produit_languages'))) $titleofmodule = $langs->trans("ProductOrService");
print $titleofmodule; print $titleofmodule;
print '</td><td>'; print '</td><td>';
print img_object($objimport->array_import_module[$key]->getName(), $objimport->array_import_icon[$key]).' '; $entity = preg_replace('/:.*$/', '', $objimport->array_import_icon[$key]);
$entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objimport->array_import_module[$key]->getName(), $entityicon).' ';
print $objimport->array_import_label[$key]; print $objimport->array_import_label[$key];
print '</td><td style="text-align: right">'; print '</td><td style="text-align: right">';
if ($objimport->array_import_perms[$key]) if ($objimport->array_import_perms[$key])
@ -422,17 +486,17 @@ if ($step == 2 && $datatoimport)
// Lot de donnees a importer // Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>'; print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' '; $entity = preg_replace('/:.*$/', '', $objimport->array_import_icon[0]);
$entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objimport->array_import_module[0]->getName(), $entityicon).' ';
print $objimport->array_import_label[0]; print $objimport->array_import_label[0];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<form name="userfile" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" METHOD="POST">'; print '<form name="userfile" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" METHOD="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">'; print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
@ -512,17 +576,17 @@ if ($step == 3 && $datatoimport)
// Lot de donnees a importer // Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>'; print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' '; $entity = preg_replace('/:.*$/', '', $objimport->array_import_icon[0]);
$entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objimport->array_import_module[0]->getName(), $entityicon).' ';
print $objimport->array_import_label[0]; print $objimport->array_import_label[0];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', ''); print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', '');
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<table width="100%" class="border tableforfield">'; print '<table width="100%" class="border tableforfield">';
@ -797,14 +861,15 @@ if ($step == 4 && $datatoimport)
// Lot de donnees a importer // Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>'; print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' '; $entity = preg_replace('/:.*$/', '', $objimport->array_import_icon[0]);
$entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objimport->array_import_module[0]->getName(), $entityicon).' ';
print $objimport->array_import_label[0]; print $objimport->array_import_label[0];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', ''); print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', '');
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
@ -1273,14 +1338,15 @@ if ($step == 5 && $datatoimport)
// Lot de donnees a importer // Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>'; print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' '; $entity = preg_replace('/:.*$/', '', $objimport->array_import_icon[0]);
$entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objimport->array_import_module[0]->getName(), $entityicon).' ';
print $objimport->array_import_label[0]; print $objimport->array_import_label[0];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', ''); print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', '');
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
@ -1716,14 +1782,15 @@ if ($step == 6 && $datatoimport)
// Lot de donnees a importer // Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>'; print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>'; print '<td>';
print img_object($objimport->array_import_module[0]->getName(), $objimport->array_import_icon[0]).' '; $entity = preg_replace('/:.*$/', '', $objimport->array_import_icon[0]);
$entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity);
print img_object($objimport->array_import_module[0]->getName(), $entityicon).' ';
print $objimport->array_import_label[0]; print $objimport->array_import_label[0];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', ''); print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', '');
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';

View File

@ -121,7 +121,7 @@
-webkit-clip-path: inset(50%) !important; -webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important; clip-path: inset(50%) !important;
height: 1px !important; height: 1px !important;
margin: -1px !important; margin: -10000px !important;
overflow: hidden !important; overflow: hidden !important;
padding: 0 !important; padding: 0 !important;
position: absolute !important; position: absolute !important;

View File

@ -468,7 +468,7 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 413,'PCG99-BASE','INCOME', '754', '409', 'Ristournes perçues des coopératives (provenant des excédents)', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 413,'PCG99-BASE','INCOME', '754', '409', 'Ristournes perçues des coopératives (provenant des excédents)', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 414,'PCG99-BASE','INCOME', '755', '409', 'Quotes-parts de résultat sur opérations faites en commun', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 414,'PCG99-BASE','INCOME', '755', '409', 'Quotes-parts de résultat sur opérations faites en commun', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 415,'PCG99-BASE','INCOME', '758', '409', 'Produits divers de gestion courante', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 415,'PCG99-BASE','INCOME', '758', '409', 'Produits divers de gestion courante', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 416,'PCG99-BASE','INCOME', 'FIN', '76','1507', 'Produits financiers', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 416,'PCG99-BASE','INCOME', '76','1507', 'Produits financiers', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 417,'PCG99-BASE','INCOME', '761', '416', 'Produits de participations', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 417,'PCG99-BASE','INCOME', '761', '416', 'Produits de participations', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 418,'PCG99-BASE','INCOME', '762', '416', 'Produits des autres immobilisations financières', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 418,'PCG99-BASE','INCOME', '762', '416', 'Produits des autres immobilisations financières', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 419,'PCG99-BASE','INCOME', '763', '416', 'Revenus des autres créances', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 419,'PCG99-BASE','INCOME', '763', '416', 'Revenus des autres créances', 1);
@ -476,7 +476,7 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 421,'PCG99-BASE','INCOME', '765', '416', 'Escomptes obtenus', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 421,'PCG99-BASE','INCOME', '765', '416', 'Escomptes obtenus', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 422,'PCG99-BASE','INCOME', '766', '416', 'Gains de change', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 422,'PCG99-BASE','INCOME', '766', '416', 'Gains de change', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 423,'PCG99-BASE','INCOME', '767', '416', 'Produits nets sur cessions de valeurs mobilières de placement', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 423,'PCG99-BASE','INCOME', '767', '416', 'Produits nets sur cessions de valeurs mobilières de placement', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 424,'PCG99-BASE','INCOME', 'FIN', '768', '416', 'Autres produits financiers', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 424,'PCG99-BASE','INCOME', '768', '416', 'Autres produits financiers', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 425,'PCG99-BASE','INCOME', '77','1507', 'Produits exceptionnels', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 425,'PCG99-BASE','INCOME', '77','1507', 'Produits exceptionnels', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 426,'PCG99-BASE','INCOME', '771', '425', 'Produits exceptionnels sur opérations de gestion', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 426,'PCG99-BASE','INCOME', '771', '425', 'Produits exceptionnels sur opérations de gestion', 1);
INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 427,'PCG99-BASE','INCOME', '772', '425', '(Compte à la disposition des entités pour enregistrer, en cours d''exercice, les produits sur exercices antérieurs)', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 427,'PCG99-BASE','INCOME', '772', '425', '(Compte à la disposition des entités pour enregistrer, en cours d''exercice, les produits sur exercices antérieurs)', 1);

View File

@ -37,3 +37,9 @@ INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active)
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}', 0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (6,'KIALA','KIALA','Relais Kiala','http://www.kiala.fr/tnt/delivery/{TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','https://gls-group.eu/FR/fr/suivi-colis?match={TRACKID}', 0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (7,'GLS','GLS','General Logistics Systems','https://gls-group.eu/FR/fr/suivi-colis?match={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}', 0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (8,'CHRONO','Chronopost','Chronopost','http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (11,'TNT', 'TNT', NULL, 'https://www.tnt.com/express/fr_fr/site/outils-expedition/suivi.html?searchType=con&cons=={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (12,'DHL', 'DHL', NULL, 'https://www.dhl.com/fr-fr/home/tracking/tracking-global-forwarding.html?submit=1&tracking-id={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (13,'DPD', 'DPD', NULL, 'https://www.dpd.fr/trace/{TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (14,'MAINFREIGHT', 'Mainfreight', NULL, 'https://www.mainfreight.com/track?{TRACKID}', 0);

View File

@ -335,3 +335,20 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (72
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1);
ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0;
-- VMYSQL4.3 ALTER TABLE llx_mrp_mo MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_product (fk_product);
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL;
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (11,'TNT', 'TNT', NULL, 'https://www.tnt.com/express/fr_fr/site/outils-expedition/suivi.html?searchType=con&cons=={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (12,'DHL', 'DHL', NULL, 'https://www.dhl.com/fr-fr/home/tracking/tracking-global-forwarding.html?submit=1&tracking-id={TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (13,'DPD', 'DPD', NULL, 'https://www.dpd.fr/trace/{TRACKID}', 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (14,'MAINFREIGHT', 'Mainfreight', NULL, 'https://www.mainfreight.com/track?{TRACKID}', 0);

View File

@ -17,3 +17,6 @@
-- ============================================================================ -- ============================================================================
ALTER TABLE llx_commande_fournisseurdet ADD CONSTRAINT fk_commande_fournisseurdet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid); ALTER TABLE llx_commande_fournisseurdet ADD CONSTRAINT fk_commande_fournisseurdet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_product (fk_product);

View File

@ -231,7 +231,7 @@ if ($ok && GETPOST('standard', 'alpha'))
$listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product', $listofmodulesextra = array('societe'=>'societe', 'adherent'=>'adherent', 'product'=>'product',
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture', 'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', 'facture_fourn'=>'facture_fourn', 'supplier_proposal'=>'supplier_proposal', 'commande_fournisseur'=>'commande_fournisseur', 'facture_fourn'=>'facture_fourn',
'actioncomm'=>'actioncomm', 'actioncomm'=>'actioncomm', 'bom_bom'=>'bom_bom', 'mrp_mo'=>'mrp_mo',
'adherent_type'=>'adherent_type', 'user'=>'user', 'projet'=>'projet', 'projet_task'=>'projet_task'); 'adherent_type'=>'adherent_type', 'user'=>'user', 'projet'=>'projet', 'projet_task'=>'projet_task');
print '<tr><td colspan="2"><br>*** Check fields into extra table structure match table of definition. If not add column into table</td></tr>'; print '<tr><td colspan="2"><br>*** Check fields into extra table structure match table of definition. If not add column into table</td></tr>';
foreach ($listofmodulesextra as $tablename => $elementtype) foreach ($listofmodulesextra as $tablename => $elementtype)
@ -268,6 +268,7 @@ if ($ok && GETPOST('standard', 'alpha'))
$arrayoffieldsfound[$fieldname] = array('type'=>$fieldtype); $arrayoffieldsfound[$fieldname] = array('type'=>$fieldtype);
} }
// If it does not match, we create fields // If it does not match, we create fields
foreach ($arrayoffieldsdesc as $code => $label) foreach ($arrayoffieldsdesc as $code => $label)
{ {

View File

@ -99,8 +99,9 @@ CashDeskRefNumberingModules=Numbering module for POS sales
CashDeskGenericMaskCodes6 = <br><b>{TN}</b> tag is used to add the terminal number CashDeskGenericMaskCodes6 = <br><b>{TN}</b> tag is used to add the terminal number
TakeposGroupSameProduct=Group same products lines TakeposGroupSameProduct=Group same products lines
StartAParallelSale=Start a new parallel sale StartAParallelSale=Start a new parallel sale
ControlCashOpening=Control cash box at opening pos SaleStartedAt=Sale started at %s
CloseCashFence=Close cash fence ControlCashOpening=Control cash popup at opening POS
CloseCashFence=Close cash desk control
CashReport=Cash report CashReport=Cash report
MainPrinterToUse=Main printer to use MainPrinterToUse=Main printer to use
OrderPrinterToUse=Order printer to use OrderPrinterToUse=Order printer to use

View File

@ -133,3 +133,4 @@ KeysToUseForUpdates=Key (column) to use for <b>updating</b> existing data
NbInsert=Number of inserted lines: %s NbInsert=Number of inserted lines: %s
NbUpdate=Number of updated lines: %s NbUpdate=Number of updated lines: %s
MultipleRecordFoundWithTheseFilters=Multiple records have been found with these filters: %s MultipleRecordFoundWithTheseFilters=Multiple records have been found with these filters: %s
StocksWithBatch=Stocks and location (warehouse) of products with batch/serial number

View File

@ -133,3 +133,4 @@ KeysToUseForUpdates=Clé à utiliser pour mettre à jour les données
NbInsert=Nombre de lignes insérées: %s NbInsert=Nombre de lignes insérées: %s
NbUpdate=Nombre de lignes mises à jour: %s NbUpdate=Nombre de lignes mises à jour: %s
MultipleRecordFoundWithTheseFilters=Plusieurs enregistrements ont été trouvés avec ces filtres: %s MultipleRecordFoundWithTheseFilters=Plusieurs enregistrements ont été trouvés avec ces filtres: %s
StocksWithBatch=Stocks et emplacements (entrepôts) des produits avec numéros de lots/séries

View File

@ -1705,7 +1705,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
} }
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$text = '<span href="#" class="aversion"><span class="hideonsmartphone small">'.DOL_VERSION.'</span></span>'; $text = '<span class="aversion"><span class="hideonsmartphone small">'.DOL_VERSION.'</span></span>';
$toprightmenu .= @Form::textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2); $toprightmenu .= @Form::textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2);
} }

View File

@ -134,7 +134,7 @@ if (!$sortfield)
} }
// Products // Products
$TRes = $form->select_produits_list('', '', '', 20, 0, '', 1, 2, 1, 0, '', 1); $TRes = $form->select_produits_list('', '', '', '', 0, '', 1, 2, 1, 0, '', 1);
$TProducts = array(); $TProducts = array();
foreach ($TRes as $prod) { foreach ($TRes as $prod) {

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