Merge branch '14.0' of https://github.com/Dolibarr/dolibarr into 14.0_FIX_productfournprice_saveextrafieldsvalues
This commit is contained in:
commit
a94e39f0f4
10
.travis.yml
10
.travis.yml
@ -50,7 +50,7 @@ jobs:
|
||||
env: DB=postgresql
|
||||
- stage: PHP 5.6-7.4
|
||||
if: type = pull_request OR type = push
|
||||
php: '7.4'
|
||||
php: '7.4.22'
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = develop
|
||||
@ -106,7 +106,7 @@ install:
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then
|
||||
composer -n require phpunit/phpunit ^7 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
@ -241,7 +241,7 @@ before_script:
|
||||
# enable php-fpm
|
||||
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- |
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
# Copy the included pool
|
||||
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
|
||||
fi
|
||||
@ -276,7 +276,7 @@ script:
|
||||
set -e
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
|
||||
if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then
|
||||
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
|
||||
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
|
||||
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
|
||||
@ -291,7 +291,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then
|
||||
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
|
||||
fi
|
||||
set +e
|
||||
|
||||
@ -260,7 +260,7 @@ if ($action == "confirm_update") {
|
||||
if ($mode != '_tmp') {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
}
|
||||
$action = 'update';
|
||||
$action = '';
|
||||
$id = $object->id;
|
||||
$piece_num = $object->piece_num;
|
||||
}
|
||||
@ -537,7 +537,7 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date document creation
|
||||
// Date document export
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("DateExport").'</td>';
|
||||
print '<td>';
|
||||
@ -545,7 +545,7 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date document creation
|
||||
// Date document validation
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>';
|
||||
print '<td>';
|
||||
@ -604,6 +604,7 @@ if ($action == 'create') {
|
||||
print '<br>';
|
||||
|
||||
$result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
@ -643,6 +644,15 @@ if ($action == 'create') {
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Add an empty line if there is not yet
|
||||
if (!empty($object->linesmvt[0])) {
|
||||
$tmpline = $object->linesmvt[0];
|
||||
if (!empty($tmpline->numero_compte)) {
|
||||
$line = new BookKeepingLine();
|
||||
$object->linesmvt[] = $line;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($object->linesmvt as $line) {
|
||||
print '<tr class="oddeven">';
|
||||
$total_debit += $line->debit;
|
||||
@ -673,7 +683,33 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="id" value="'.$line->id.'">'."\n";
|
||||
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">';
|
||||
print '</td>';
|
||||
} elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<!-- td columns in add mode -->';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
|
||||
// Also, it is not possible to use a value that is not in the list.
|
||||
// Also, the label is not automatically filled when a value is selected.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
|
||||
}
|
||||
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">';
|
||||
print '</td>';
|
||||
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
|
||||
print '</td>';
|
||||
}
|
||||
} else {
|
||||
print '<!-- td columns in display mode -->';
|
||||
$accountingaccount->fetch(null, $line->numero_compte, true);
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 0).'</td>';
|
||||
print '<td>'.length_accounta($line->subledger_account);
|
||||
@ -715,33 +751,8 @@ if ($action == 'create') {
|
||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings');
|
||||
}
|
||||
|
||||
if (empty($object->date_export) && empty($object->date_validation)) {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<!-- td columns in add mode -->';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
|
||||
// Also, it is not possible to use a value that is not in the list.
|
||||
// Also, the label is not automatically filled when a value is selected.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print $formaccounting->select_auxaccount('', 'subledger_account', 1);
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
|
||||
}
|
||||
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">';
|
||||
print '</td>';
|
||||
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
|
||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if ($mode == '_tmp' && $action == '') {
|
||||
print '<br>';
|
||||
|
||||
@ -597,9 +597,13 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->credit)) {
|
||||
$this->credit = 0;
|
||||
}
|
||||
if (empty($this->montant)) {
|
||||
$this->montant = 0;
|
||||
}
|
||||
|
||||
$this->debit = price2num($this->debit, 'MT');
|
||||
$this->credit = price2num($this->credit, 'MT');
|
||||
$this->montant = price2num($this->montant, 'MT');
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -1649,11 +1653,10 @@ class BookKeeping extends CommonObject
|
||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||
$this->doc_ref = $obj->doc_ref;
|
||||
$this->doc_type = $obj->doc_type;
|
||||
$this->date_creation = $obj->date_creation;
|
||||
$this->date_modification = $obj->date_modification;
|
||||
$this->date_export = $obj->date_export;
|
||||
$this->date_validation = $obj->date_validated;
|
||||
$this->date_validation = $obj->date_validation;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->date_export = $this->db->jdate($obj->date_export);
|
||||
$this->date_validation = $this->db->jdate($obj->date_validation);
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.$this->error, LOG_ERR);
|
||||
@ -1857,7 +1860,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -158,6 +158,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
|
||||
@ -137,9 +137,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
||||
@ -112,77 +112,78 @@ if ($conf->accounting->enabled) {
|
||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
print "<br>\n"; print "<br>\n";
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
print "<br>\n"; print "<br>\n";
|
||||
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
// STEPS
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
print "<br>\n";
|
||||
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
|
||||
$s = str_replace('{s}', $textlink, $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
if (!empty($conf->tax->enabled)) {
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
// STEPS
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
print "<br>\n";
|
||||
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
|
||||
$s = str_replace('{s}', $textlink, $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
if (!empty($conf->tax->enabled)) {
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
|
||||
$s = str_replace('{s}', $textlink, $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Step A - E
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
@ -288,8 +288,16 @@ if ($result) {
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
$is_sc = false;
|
||||
foreach ($links as $v) {
|
||||
if ($v['type'] == 'sc') {
|
||||
$is_sc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
||||
foreach ($links as $key => $val) {
|
||||
if ($links[$key]['type'] == 'user' && !$is_sc) continue;
|
||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) {
|
||||
// So we excluded 'company' and 'user' here. We want only payment lines
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -166,6 +166,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
|
||||
@ -140,9 +140,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
||||
@ -920,8 +920,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
$soc = new Societe($db);
|
||||
if (!empty($socid)) {
|
||||
$soc = new Societe($db);
|
||||
if ($socid > 0) {
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
@ -1061,12 +1061,12 @@ if ($rowid > 0) {
|
||||
// Bank account
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
|
||||
print img_picto('', 'bank_account');
|
||||
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
|
||||
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Payment mode
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Date of payment
|
||||
|
||||
@ -93,15 +93,17 @@ print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td
|
||||
print '<td class="right"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';
|
||||
print '<td colspan="2"><input type="text" class="flat" name="DEBUGBAR_LOGS_LINES_NUMBER" value="'.(empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER).'">'; // This slow seriously output
|
||||
print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput");
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium"> '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower").'</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_USE_LOG_FILE").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1);
|
||||
print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower");
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';
|
||||
print '<td><input type="text" class="flat" name="DEBUGBAR_LOGS_LINES_NUMBER" value="'.(empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER).'">'; // This slow seriously output
|
||||
print '</td><td>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("WarningValueHigherSlowsDramaticalyOutput").'</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -205,7 +205,7 @@ if (!empty($conf->expedition->enabled)) {
|
||||
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
||||
}
|
||||
if (!empty($conf->reception->enabled)) {
|
||||
$elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
||||
|
||||
@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') {
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$object->loadReminders();
|
||||
$object->loadReminders($remindertype, 0, false);
|
||||
if (!empty($object->reminders) && $object->datep > dol_now()) {
|
||||
foreach ($object->reminders as $reminder) {
|
||||
$reminder->delete($user);
|
||||
@ -1439,6 +1439,10 @@ if ($id > 0) {
|
||||
$("#fullday").change(function() {
|
||||
setdatefields();
|
||||
});
|
||||
$("#actioncode").change(function() {
|
||||
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||
else $("#dateend").removeClass("fieldrequired");
|
||||
});
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
@ -1483,7 +1487,12 @@ if ($id > 0) {
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
||||
|
||||
// Date start - end
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td><td td colspan="3">';
|
||||
//print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
|
||||
@ -979,8 +979,8 @@ if ($resql) {
|
||||
$event->type = 'holiday';
|
||||
$event->type_picto = 'holiday';
|
||||
|
||||
$event->datep = $db->jdate($obj->date_start);
|
||||
$event->datef = $db->jdate($obj->date_end);
|
||||
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
|
||||
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->
|
||||
$usercancreateorder = $user->rights->commande->creer;
|
||||
$usercancreateinvoice = $user->rights->facture->creer;
|
||||
$usercancreatecontract = $user->rights->contrat->creer;
|
||||
$usercancreateintervention = $user->rights->ficheinter->creer;
|
||||
$usercancreateintervention = empty($conf->ficheinter->enabled) ? 0 : $user->rights->ficheinter->creer;
|
||||
$usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer);
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
@ -231,8 +231,11 @@ if (empty($reshook)) {
|
||||
// Remove line
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result) {
|
||||
if ($result > 0) {
|
||||
$object->line_order(true);
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
|
||||
@ -980,6 +980,8 @@ class Propal extends CommonObject
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $line->error;
|
||||
$this->errors = $line->errors;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -4166,36 +4168,40 @@ class PropaleLigne extends CommonObjectLine
|
||||
$error = 0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid);
|
||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
// Remove extrafields
|
||||
if (!$error) {
|
||||
$this->id = $this->rowid;
|
||||
$result = $this->deleteExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid);
|
||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
// Remove extrafields
|
||||
if (!$error) {
|
||||
$this->id = $this->rowid;
|
||||
$result = $this->deleteExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->error() . " sql=" . $sql;
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -349,9 +349,9 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->statut == 0) {
|
||||
if ($tmpproposal->valid($user)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||
if ($tmpproposal->valid($user) > 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
|
||||
} else {
|
||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||
@ -362,7 +362,7 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -380,13 +380,13 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -394,7 +394,7 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -405,27 +405,28 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "nosign" && $permissiontoclose) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
$tmpproposal = new Propal($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) {
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user->rights->societe->creer) {
|
||||
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
|
||||
@ -153,7 +153,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user-
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setremise' && $user->rights->societe->creer) {
|
||||
if ($action == 'setremise' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
|
||||
@ -192,7 +192,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) {
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $user->rights->societe->creer) {
|
||||
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
|
||||
|
||||
@ -2525,7 +2525,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
|
||||
// Create intervention
|
||||
if ($conf->ficheinter->enabled) {
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$langs->load("interventions");
|
||||
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||
|
||||
@ -337,15 +337,15 @@ if ($action == 'shipped' && $permissiontoadd) {
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($objecttmp->fetch($checked)) {
|
||||
if ($objecttmp->statut == 1) {
|
||||
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
|
||||
if ($objecttmp->cloture($user)) {
|
||||
setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
|
||||
setEventMessage($objecttmp->ref." ".$langs->trans('PassedInShippedStatus'), 'mesgs');
|
||||
} else {
|
||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||
setEventMessage($langs->trans('YouCantShipThis'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors');
|
||||
setEventMessage($objecttmp->ref." ".$langs->trans('MustBeValidatedBefore'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -45,8 +45,14 @@ if ($mode == 'customer' && !$user->rights->commande->lire) {
|
||||
if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
$object_status = GETPOST('object_status', 'array:int');
|
||||
$object_status = implode(',', $object_status);
|
||||
} else {
|
||||
$object_status = GETPOST('object_status', 'intcomma');
|
||||
}
|
||||
|
||||
|
||||
$object_status = GETPOST('object_status', 'intcomma');
|
||||
$typent_id = GETPOST('typent_id', 'int');
|
||||
$categ_id = GETPOST('categ_id', 'categ_id');
|
||||
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/accounting-files.php
|
||||
* \ingroup compta
|
||||
* \brief Page to show portoflio and files of a thirdparty and download it
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/compta/accounting-files.php
|
||||
* \ingroup compta
|
||||
* \brief Page to show portoflio and files of a thirdparty and download it
|
||||
*/
|
||||
|
||||
if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) {
|
||||
$zip->addFromString('transactions.csv', $log);
|
||||
$zip->close();
|
||||
|
||||
///Then download the zipped file.
|
||||
// Then download the zipped file.
|
||||
header('Content-Type: application/zip');
|
||||
header('Content-disposition: attachment; filename='.basename($zipname));
|
||||
header('Content-Length: '.filesize($zipname));
|
||||
@ -578,7 +578,7 @@ print '<br>';
|
||||
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
if (empty($val['enabled'])) {
|
||||
continue; // list not qualified
|
||||
continue; // list not qualified
|
||||
}
|
||||
$disabled = '';
|
||||
if (empty($val['perms'])) {
|
||||
@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) {
|
||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
|
||||
}
|
||||
|
||||
print '<input class="button" type="submit" name="search" value="'.$langs->trans("Search").'">';
|
||||
print '<input type="submit" class="button small" name="search" value="'.$langs->trans("Search").'">';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
if (!empty($date_start) && !empty($date_stop)) {
|
||||
$param = 'action=searchfiles';
|
||||
$param .= '&date_startday='.GETPOST('date_startday', 'int');
|
||||
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
|
||||
$param .= '&date_startyear='.GETPOST('date_startyear', 'int');
|
||||
@ -603,25 +602,47 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
||||
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
||||
if (GETPOST($choice, 'int')) {
|
||||
$param .= '&'.$choice.'=1';
|
||||
}
|
||||
}
|
||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||
|
||||
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
||||
|
||||
|
||||
$filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
|
||||
|
||||
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||
|
||||
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
||||
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
||||
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopday" value="'.GETPOST('date_stopday', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopmonth" value="'.GETPOST('date_stopmonth', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopyear" value="'.GETPOST('date_stopyear', 'int').'" />';
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"';
|
||||
if (empty($TData)) {
|
||||
print " disabled";
|
||||
}
|
||||
print '>'."\n";
|
||||
print $langs->trans("Download");
|
||||
print '</a><br>';
|
||||
|
||||
print '<input class="butAction butDownload" type="submit" value="'.$langs->trans("Download").'" />';
|
||||
print '</form>'."\n";
|
||||
$param .= '&action=searchfiles';
|
||||
|
||||
/*
|
||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
||||
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
||||
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopday" value="'.GETPOST('date_stopday', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopmonth" value="'.GETPOST('date_stopmonth', 'int').'" />';
|
||||
print '<input type="hidden" name="date_stopyear" value="'.GETPOST('date_stopyear', 'int').'" />';
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
}
|
||||
|
||||
print '<input class="butAction butDownload small marginleftonly" type="submit" value="'.$langs->trans("Download").'"';
|
||||
if (empty($TData)) {
|
||||
print " disabled";
|
||||
}
|
||||
print '/>';
|
||||
print '</form>'."\n";
|
||||
*/
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -645,172 +666,181 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
if ($result) {
|
||||
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
||||
|
||||
if (empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
if (empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
} else {
|
||||
// Sort array by date ASC to calculate balance
|
||||
|
||||
$totalET_debit = 0;
|
||||
$totalIT_debit = 0;
|
||||
$totalVAT_debit = 0;
|
||||
$totalET_credit = 0;
|
||||
$totalIT_credit = 0;
|
||||
$totalVAT_credit = 0;
|
||||
|
||||
// Display array
|
||||
foreach ($TData as $data) {
|
||||
$html_class = '';
|
||||
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
||||
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
||||
print '<tr class="oddeven '.$html_class.'">';
|
||||
|
||||
// Type
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans($data['item'])).'">'.$langs->trans($data['item']).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Date due
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date_due'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Ref
|
||||
print '<td class="nowraponall tdoverflowmax150">';
|
||||
|
||||
if ($data['item'] == 'Invoice') {
|
||||
$invoice->id = $data['id'];
|
||||
$invoice->ref = $data['ref'];
|
||||
$invoice->total_ht = $data['amount_ht'];
|
||||
$invoice->total_ttc = $data['amount_ttc'];
|
||||
$invoice->total_tva = $data['amount_vat'];
|
||||
$invoice->multicurrency_code = $data['currency'];
|
||||
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'SupplierInvoice') {
|
||||
$supplier_invoice->id = $data['id'];
|
||||
$supplier_invoice->ref = $data['ref'];
|
||||
$supplier_invoice->total_ht = $data['amount_ht'];
|
||||
$supplier_invoice->total_ttc = $data['amount_ttc'];
|
||||
$supplier_invoice->total_tva = $data['amount_vat'];
|
||||
$supplier_invoice->multicurrency_code = $data['currency'];
|
||||
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'ExpenseReport') {
|
||||
$expensereport->id = $data['id'];
|
||||
$expensereport->ref = $data['ref'];
|
||||
print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
|
||||
} elseif ($data['item'] == 'SalaryPayment') {
|
||||
$salary_payment->id = $data['id'];
|
||||
$salary_payment->ref = $data['ref'];
|
||||
print $salary_payment->getNomUrl(1);
|
||||
} elseif ($data['item'] == 'Donation') {
|
||||
$don->id = $data['id'];
|
||||
$don->ref = $data['ref'];
|
||||
print $don->getNomUrl(1, 0, '', 0);
|
||||
} elseif ($data['item'] == 'SocialContributions') {
|
||||
$charge_sociales->id = $data['id'];
|
||||
$charge_sociales->ref = $data['ref'];
|
||||
print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
|
||||
} elseif ($data['item'] == 'VariousPayment') {
|
||||
$various_payment->id = $data['id'];
|
||||
$various_payment->ref = $data['ref'];
|
||||
print $various_payment->getNomUrl(1, '', 0, 0);
|
||||
} elseif ($data['item'] == 'LoanPayment') {
|
||||
$payment_loan->id = $data['id'];
|
||||
$payment_loan->ref = $data['ref'];
|
||||
print $payment_loan->getNomUrl(1, 0, 0, '', 0);
|
||||
} else {
|
||||
print $data['ref'];
|
||||
}
|
||||
print '</tr>';
|
||||
} else {
|
||||
// Sort array by date ASC to calculate balance
|
||||
print '</td>';
|
||||
|
||||
$totalET_debit = 0;
|
||||
$totalIT_debit = 0;
|
||||
$totalVAT_debit = 0;
|
||||
$totalET_credit = 0;
|
||||
$totalIT_credit = 0;
|
||||
$totalVAT_credit = 0;
|
||||
|
||||
// Display array
|
||||
foreach ($TData as $data) {
|
||||
$html_class = '';
|
||||
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
||||
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
||||
print '<tr class="oddeven '.$html_class.'">';
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans($data['item']).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Date due
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date_due'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Ref
|
||||
print '<td class="nowraponall">';
|
||||
|
||||
if ($data['item'] == 'Invoice') {
|
||||
$invoice->id = $data['id'];
|
||||
$invoice->ref = $data['ref'];
|
||||
$invoice->total_ht = $data['amount_ht'];
|
||||
$invoice->total_ttc = $data['amount_ttc'];
|
||||
$invoice->total_tva = $data['amount_vat'];
|
||||
$invoice->multicurrency_code = $data['currency'];
|
||||
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'SupplierInvoice') {
|
||||
$supplier_invoice->id = $data['id'];
|
||||
$supplier_invoice->ref = $data['ref'];
|
||||
$supplier_invoice->total_ht = $data['amount_ht'];
|
||||
$supplier_invoice->total_ttc = $data['amount_ttc'];
|
||||
$supplier_invoice->total_tva = $data['amount_vat'];
|
||||
$supplier_invoice->multicurrency_code = $data['currency'];
|
||||
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'ExpenseReport') {
|
||||
$expensereport->id = $data['id'];
|
||||
$expensereport->ref = $data['ref'];
|
||||
print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
|
||||
} elseif ($data['item'] == 'SalaryPayment') {
|
||||
$salary_payment->id = $data['id'];
|
||||
$salary_payment->ref = $data['ref'];
|
||||
print $salary_payment->getNomUrl(1);
|
||||
} elseif ($data['item'] == 'Donation') {
|
||||
$don->id = $data['id'];
|
||||
$don->ref = $data['ref'];
|
||||
print $don->getNomUrl(1, 0, '', 0);
|
||||
} elseif ($data['item'] == 'SocialContributions') {
|
||||
$charge_sociales->id = $data['id'];
|
||||
$charge_sociales->ref = $data['ref'];
|
||||
print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
|
||||
} elseif ($data['item'] == 'VariousPayment') {
|
||||
$various_payment->id = $data['id'];
|
||||
$various_payment->ref = $data['ref'];
|
||||
print $various_payment->getNomUrl(1, '', 0, 0);
|
||||
} elseif ($data['item'] == 'LoanPayment') {
|
||||
$payment_loan->id = $data['id'];
|
||||
$payment_loan->ref = $data['ref'];
|
||||
print $payment_loan->getNomUrl(1, 0, 0, '', 0);
|
||||
} else {
|
||||
print $data['ref'];
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// File link
|
||||
print '<td>';
|
||||
if (!empty($data['files'])) {
|
||||
foreach ($data['files'] as $id => $filecursor) {
|
||||
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a> '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>';
|
||||
// File link
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if (!empty($data['files'])) {
|
||||
foreach ($data['files'] as $id => $filecursor) {
|
||||
$tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0);
|
||||
if ($tmppreview) {
|
||||
print $tmppreview;
|
||||
}
|
||||
$filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']);
|
||||
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank" rel="noopener noreferrer" title="'.dol_escape_htmltag($filename).'">';
|
||||
if (empty($tmppreview)) {
|
||||
print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright');
|
||||
}
|
||||
print $filename;
|
||||
print '</a><br>';
|
||||
}
|
||||
print "</td>\n";
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Paid
|
||||
print '<td aling="left">'.$data['paid'].'</td>';
|
||||
// Paid
|
||||
print '<td class="center">'.($data['paid'] ? yn($data['paid']) : '').'</td>';
|
||||
|
||||
// Total ET
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
|
||||
// Total IT
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
|
||||
// Total VAT
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
|
||||
// Total ET
|
||||
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</span></td>\n";
|
||||
// Total IT
|
||||
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</span></td>\n";
|
||||
// Total VAT
|
||||
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</span></td>\n";
|
||||
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||
|
||||
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
||||
// VAT number
|
||||
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
||||
|
||||
if ($data['sens']) {
|
||||
$totalET_credit += $data['amount_ht'];
|
||||
$totalIT_credit += $data['amount_ttc'];
|
||||
$totalVAT_credit += $data['amount_vat'];
|
||||
} else {
|
||||
$totalET_debit -= $data['amount_ht'];
|
||||
$totalIT_debit -= $data['amount_ttc'];
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="center">'.$data['currency']."</td>\n";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
if ($data['sens']) {
|
||||
$totalET_credit += $data['amount_ht'];
|
||||
$totalIT_credit += $data['amount_ttc'];
|
||||
$totalVAT_credit += $data['amount_vat'];
|
||||
} else {
|
||||
$totalET_debit -= $data['amount_ht'];
|
||||
$totalIT_debit -= $data['amount_ttc'];
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
// Total credits
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Income').'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Total debits
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Outcome').'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Balance
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6" class="right">'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET_credit + $totalET_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
print '<td class="center">'.$data['currency']."</td>\n";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Total credits
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Income').'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Total debits
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Outcome').'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Balance
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6" class="right">'.$langs->trans('Total').'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET_credit + $totalET_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -759,6 +759,7 @@ if ($action == 'create') {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// TODO ICS is not used with bank transfer !
|
||||
if ($conf->paymentbybanktransfer->enabled) {
|
||||
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>';
|
||||
print '<td>'.$object->ics_transfer.'</td>';
|
||||
|
||||
@ -52,11 +52,12 @@ if (!empty($conf->salaries->enabled)) {
|
||||
|
||||
|
||||
$id = GETPOST('rowid', 'int');
|
||||
$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||
$rowid = GETPOST("rowid", 'int');
|
||||
$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id
|
||||
$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$rowid = GETPOST("rowid", 'int');
|
||||
$orig_account = GETPOST("orig_account");
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
@ -68,7 +69,7 @@ if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
|
||||
$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account');
|
||||
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -126,15 +127,19 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
$acline->fetch($rowid);
|
||||
|
||||
$acsource = new Account($db);
|
||||
$acsource->fetch($id);
|
||||
$acsource->fetch($accountoldid);
|
||||
|
||||
$actarget = new Account($db);
|
||||
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
|
||||
$actarget->fetch(GETPOST('accountid', 'int'));
|
||||
} else {
|
||||
$actarget->fetch($id);
|
||||
$actarget->fetch($accountoldid);
|
||||
}
|
||||
|
||||
if (!($actarget->id > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') {
|
||||
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
|
||||
$error++;
|
||||
@ -228,7 +233,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
$db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
||||
$sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
||||
if (empty($num_rel)) {
|
||||
$sql .= ", rappro = 0";
|
||||
} else {
|
||||
@ -302,7 +307,6 @@ if ($result) {
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
||||
|
||||
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($object->rappro == 0) {
|
||||
@ -548,6 +548,12 @@ if ($id) {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
|
||||
}
|
||||
|
||||
// Confirmation of the removal of the Various Payment
|
||||
if ($action == 'delete') {
|
||||
$text = $langs->trans('ConfirmDeleteVariousPayment');
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2);
|
||||
}
|
||||
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
|
||||
@ -589,40 +589,6 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Check parameters
|
||||
|
||||
// Check for mandatory fields in thirdparty (defined into setup)
|
||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
|
||||
foreach ($array_to_check as $key) {
|
||||
$keymin = strtolower($key);
|
||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
||||
$vallabel = $object->thirdparty->$keymin;
|
||||
|
||||
if ($i > 0) {
|
||||
if ($object->thirdparty->isACompany()) {
|
||||
// Check for mandatory prof id (but only if country is other than ours)
|
||||
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) {
|
||||
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
|
||||
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
|
||||
if ($key == 'EMAIL') {
|
||||
// Check for mandatory
|
||||
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for mandatory fields in invoice
|
||||
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
|
||||
foreach ($array_to_check as $key => $val) {
|
||||
@ -1030,7 +996,7 @@ if (empty($reshook)) {
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
||||
// We do not copy the private note
|
||||
$object->note_private = trim(GETPOST('note_private', 'restricthtml'));
|
||||
$object->ref_client = GETPOST('ref_client', 'alphanohtml');
|
||||
$object->model_pdf = GETPOST('model', 'alphanohtml');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
@ -1083,7 +1049,7 @@ if (empty($reshook)) {
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
||||
// We do not copy the private note
|
||||
$object->note_private = trim(GETPOST('note_private', 'restricthtml'));
|
||||
$object->ref_client = GETPOST('ref_client');
|
||||
$object->model_pdf = GETPOST('model');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
@ -2877,6 +2843,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
$currency_code = $conf->currency;
|
||||
$fk_account = 0;
|
||||
|
||||
// Load objectsrc
|
||||
$remise_absolue = 0;
|
||||
@ -3191,7 +3158,7 @@ if ($action == 'create') {
|
||||
|
||||
// Standard invoice
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type') == 0 ? ' checked' : '').'> ';
|
||||
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int') ? '' : ' checked').'> ';
|
||||
$tmp = $tmp.'<label for="radio_standard" >'.$langs->trans("InvoiceStandardAsk").'</label>';
|
||||
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3);
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
@ -3614,7 +3581,7 @@ if ($action == 'create') {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -4680,7 +4647,7 @@ if ($action == 'create') {
|
||||
}
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class=nowrap amountcard">'.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<td class="nowrap amountcard">'.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
|
||||
@ -800,6 +800,10 @@ class Facture extends CommonInvoice
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
// Complete vat rate with code
|
||||
$vatrate = $newinvoiceline->tva_tx;
|
||||
if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')';
|
||||
|
||||
$newinvoiceline->fk_parent_line = $fk_parent_line;
|
||||
|
||||
if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) {
|
||||
@ -810,7 +814,37 @@ class Facture extends CommonInvoice
|
||||
$newinvoiceline->fk_remise_except = $discountId;
|
||||
}
|
||||
|
||||
$result = $newinvoiceline->insert();
|
||||
$result = $this->addline(
|
||||
$newinvoiceline->desc,
|
||||
$newinvoiceline->subprice,
|
||||
$newinvoiceline->qty,
|
||||
$vatrate,
|
||||
$newinvoiceline->localtax1_tx,
|
||||
$newinvoiceline->localtax2_tx,
|
||||
$newinvoiceline->fk_product,
|
||||
$newinvoiceline->remise_percent,
|
||||
$newinvoiceline->date_start,
|
||||
$newinvoiceline->date_end,
|
||||
$newinvoiceline->fk_code_ventilation,
|
||||
$newinvoiceline->info_bits,
|
||||
$newinvoiceline->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$newinvoiceline->product_type,
|
||||
$newinvoiceline->rang,
|
||||
$newinvoiceline->special_code,
|
||||
$newinvoiceline->element,
|
||||
$newinvoiceline->id,
|
||||
$fk_parent_line,
|
||||
$newinvoiceline->fk_fournprice,
|
||||
$newinvoiceline->pa_ht,
|
||||
$newinvoiceline->label,
|
||||
$newinvoiceline->array_options,
|
||||
$newinvoiceline->situation_percent,
|
||||
$newinvoiceline->fk_prev_id,
|
||||
$newinvoiceline->fk_unit,
|
||||
$newinvoiceline->multicurrency_subprice
|
||||
);
|
||||
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $newinvoiceline->product_type == 9) {
|
||||
@ -2619,7 +2653,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $mysoc;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$productStatic = null;
|
||||
@ -2658,6 +2692,53 @@ class Facture extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check for mandatory fields in thirdparty (defined into setup)
|
||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
|
||||
foreach ($array_to_check as $key) {
|
||||
$keymin = strtolower($key);
|
||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
||||
if ($i == 1) {
|
||||
if (!is_object($this->thirdparty)) {
|
||||
$langs->load('errors');
|
||||
$this->error = $langs->trans('ErrorInvoiceLoadThirdParty', $this->ref);
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!property_exists($this->thirdparty, $keymin)) {
|
||||
$langs->load('errors');
|
||||
$this->error = $langs->trans('ErrorInvoiceLoadThirdPartyKey', $keymin, $this->ref);
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$vallabel = $this->thirdparty->$keymin;
|
||||
|
||||
if ($i > 0) {
|
||||
if ($this->thirdparty->isACompany()) {
|
||||
// Check for mandatory prof id (but only if country is other than ours)
|
||||
if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) {
|
||||
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
|
||||
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($key == 'EMAIL') {
|
||||
// Check for mandatory
|
||||
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Check parameters
|
||||
|
||||
@ -757,12 +757,28 @@ $sql .= ' f.rowid DESC ';
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount);
|
||||
}
|
||||
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
@ -52,7 +52,7 @@ $hookmanager->initHooks(array('paymentcard', 'globalcard'));
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
|
||||
$result = restrictedArea($user, $object->element, $object->id, 'paiement');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
|
||||
@ -41,12 +41,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
|
||||
$object = new RemiseCheque($db);
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
@ -63,11 +58,22 @@ if (empty($page) || $page == -1) {
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
$dir = $conf->bank->dir_output.'/checkdeposits/';
|
||||
$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits";
|
||||
|
||||
$filterdate = dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear'));
|
||||
$filteraccountid = GETPOST('accountid', 'int');
|
||||
|
||||
$object = new RemiseCheque($db);
|
||||
// Security check
|
||||
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname);
|
||||
|
||||
$usercanread = $user->rights->banque->cheque;
|
||||
$usercancreate = $user->rights->banque->cheque;
|
||||
$usercandelete = $user->rights->banque->cheque;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -242,7 +248,9 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) {
|
||||
|
||||
$langs->load("other");
|
||||
|
||||
$file = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'cheque').GETPOST('file');
|
||||
$filetodelete = GETPOST('file', 'alpha');
|
||||
$file = $upload_dir.'/'.$filetodelete;
|
||||
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret) {
|
||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
@ -633,6 +641,12 @@ if ($action == 'new') {
|
||||
$i = 1;
|
||||
if ($num > 0) {
|
||||
while ($objp = $db->fetch_object($resql)) {
|
||||
$paymentstatic->id = $objp->pid;
|
||||
$paymentstatic->ref = $objp->pref;
|
||||
|
||||
$accountlinestatic->id = $objp->rowid;
|
||||
$accountlinestatic->ref = $objp->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="center">'.$i.'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; // Operation date
|
||||
@ -642,8 +656,6 @@ if ($action == 'new') {
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
// Link to payment
|
||||
print '<td class="center">';
|
||||
$paymentstatic->id = $objp->pid;
|
||||
$paymentstatic->ref = $objp->pref;
|
||||
if ($paymentstatic->id) {
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
} else {
|
||||
@ -652,8 +664,6 @@ if ($action == 'new') {
|
||||
print '</td>';
|
||||
// Link to bank transaction
|
||||
print '<td class="center">';
|
||||
$accountlinestatic->id = $objp->rowid;
|
||||
$accountlinestatic->ref = $objp->ref;
|
||||
if ($accountlinestatic->id > 0) {
|
||||
print $accountlinestatic->getNomUrl(1);
|
||||
} else {
|
||||
@ -663,10 +673,10 @@ if ($action == 'new') {
|
||||
// Action button
|
||||
print '<td class="right">';
|
||||
if ($object->statut == 0) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&lineid='.$objp->rowid.'">'.img_delete().'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&token='.newToken().'&lineid='.$objp->rowid.'">'.img_delete().'</a>';
|
||||
}
|
||||
if ($object->statut == 1 && $objp->statut != 2) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reject_check&lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reject_check&token='.newToken().'&lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').'</a>';
|
||||
}
|
||||
if ($objp->statut == 2) {
|
||||
print ' '.img_picto($langs->trans('CheckRejected'), 'statut8').'</a>';
|
||||
@ -722,11 +732,13 @@ print '</div>';
|
||||
|
||||
if ($action != 'new') {
|
||||
if ($object->statut == 1) {
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits');
|
||||
// Documents
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $upload_dir.'/'.$objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
|
||||
print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1);
|
||||
$genallowed = $usercancreate;
|
||||
$delallowed = $usercandelete;
|
||||
print $formfile->showdocuments('remisecheque', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -615,6 +615,7 @@ class RemiseCheque extends CommonObject
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charseSupprimert_output = $outputlangs->charset_output;
|
||||
|
||||
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
|
||||
if ($result > 0) {
|
||||
//$outputlangs->charset_output=$sav_charset_output;
|
||||
|
||||
@ -517,8 +517,12 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Bank transaction
|
||||
if (!empty($arrayfields['transaction']['checked'])) {
|
||||
$bankline->fetch($objp->fk_bank);
|
||||
print '<td>'.$bankline->getNomUrl(1, 0).'</td>';
|
||||
print '<td>';
|
||||
if ($objp->fk_bank > 0) {
|
||||
$bankline->fetch($objp->fk_bank);
|
||||
print $bankline->getNomUrl(1, 0);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -39,12 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills'));
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
|
||||
// Get supervariables
|
||||
@ -54,6 +48,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
|
||||
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
|
||||
$format = GETPOST('format', 'aZ09');
|
||||
$id_bankaccount = GETPOST('id_bankaccount', 'int');
|
||||
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) {
|
||||
@ -63,6 +59,17 @@ $offset = $limit * $page;
|
||||
|
||||
$hookmanager->initHooks(array('directdebitcreatecard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -95,13 +102,15 @@ if (empty($reshook)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$bank = new Account($db);
|
||||
$bank->fetch($conf->global->{$default_account});
|
||||
if ((empty($bank->ics) && $type !== 'bank-transfer')
|
||||
// ICS is not mandatory with payment by bank transfer
|
||||
/*if ((empty($bank->ics) && $type !== 'bank-transfer')
|
||||
|| (empty($bank->ics_transfer) && $type === 'bank-transfer')
|
||||
) {
|
||||
) {*/
|
||||
if (empty($bank->ics) && $type !== 'bank-transfer') {
|
||||
$errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}'));
|
||||
setEventMessages($errormessage, null, 'errors');
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php');
|
||||
exit;
|
||||
$action = '';
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
@ -136,12 +145,16 @@ if (empty($reshook)) {
|
||||
setEventMessages($texttoshow, null);
|
||||
}
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode($bprev->id).'&type='.urlencode($type));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$objectclass = "BonPrelevement";
|
||||
$uploaddir = $conf->prelevement->dir_output;
|
||||
if ($type == 'bank-transfer') {
|
||||
$uploaddir = $conf->paymentbybanktransfer->dir_output;
|
||||
} else {
|
||||
$uploaddir = $conf->prelevement->dir_output;
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
@ -77,8 +77,8 @@ if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transf
|
||||
|
||||
llxHeader('', $langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id > 0 || $ref) {
|
||||
if ($object->fetch($prev_id, $ref) >= 0) {
|
||||
if ($id > 0 || $ref) {
|
||||
if ($object->fetch($id, $ref) >= 0) {
|
||||
$head = prelevement_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ if ($user->socid > 0) {
|
||||
}
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
@ -76,8 +76,8 @@ if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transf
|
||||
|
||||
llxHeader('', $langs->trans("WithdrawalsReceipts"));
|
||||
|
||||
if ($prev_id > 0 || $ref) {
|
||||
if ($object->fetch($prev_id, $ref) >= 0) {
|
||||
if ($id > 0 || $ref) {
|
||||
if ($object->fetch($id, $ref) >= 0) {
|
||||
$head = prelevement_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
|
||||
@ -42,13 +42,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'di
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -80,6 +73,17 @@ $company = new Societe($db);
|
||||
|
||||
$hookmanager->initHooks(array('withdrawalsreceiptslineslist'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -33,13 +33,6 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals'));
|
||||
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -72,6 +65,17 @@ if ($type == 'bank-transfer') {
|
||||
$usercancreate = $user->rights->paymentbybanktransfer->create;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -33,13 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
|
||||
// Get supervariables
|
||||
@ -54,6 +47,17 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -31,14 +31,18 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
|
||||
$type = GETPOST('type', 'aZ09');
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'prelevement', '', '', 'bons');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -57,6 +57,7 @@ $socid = GETPOST('socid', 'int');
|
||||
|
||||
// Category
|
||||
$selected_cat = (int) GETPOST('search_categ', 'int');
|
||||
if ($selected_cat == -1) $selected_cat = '';
|
||||
$subcat = false;
|
||||
if (GETPOST('subcat', 'alpha') === 'yes') {
|
||||
$subcat = true;
|
||||
|
||||
@ -125,6 +125,7 @@ class Tva extends CommonObject
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
|
||||
$sql .= "entity,";
|
||||
$sql .= "datec,";
|
||||
$sql .= "datep,";
|
||||
$sql .= "datev,";
|
||||
@ -136,6 +137,7 @@ class Tva extends CommonObject
|
||||
$sql .= "fk_user_creat,";
|
||||
$sql .= "fk_user_modif";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".((int) $conf->entity).", ";
|
||||
$sql .= " '".$this->db->idate($now)."',";
|
||||
$sql .= " '".$this->db->idate($this->datep)."',";
|
||||
$sql .= " '".$this->db->idate($this->datev)."',";
|
||||
@ -144,8 +146,8 @@ class Tva extends CommonObject
|
||||
$sql .= " '".$this->db->escape($this->note)."',";
|
||||
$sql .= " '".$this->db->escape($this->fk_account)."',";
|
||||
$sql .= " '".$this->db->escape($this->type_payment)."',";
|
||||
$sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',";
|
||||
$sql .= " '".$this->db->escape($this->fk_user_modif)."'";
|
||||
$sql .= " ".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id).",";
|
||||
$sql .= " ".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
|
||||
@ -503,6 +503,29 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Update extrafields
|
||||
if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) {
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->insertExtraFields('CONTACT_MODIFY');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'CONTACT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
|
||||
@ -236,10 +236,6 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($id > 0) {
|
||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
||||
|
||||
@ -351,6 +347,9 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($error) {
|
||||
$action = 'create';
|
||||
}
|
||||
} else {
|
||||
$result = $object->create($user);
|
||||
if ($result > 0) {
|
||||
|
||||
@ -1246,9 +1246,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) {
|
||||
$model = $objecttmp->model_pdf;
|
||||
$ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records
|
||||
// To be sure vars is defined
|
||||
$hidedetails = !empty($hidedetails) ? $hidedetails : 0;
|
||||
$hidedesc = !empty($hidedesc) ? $hidedesc : 0;
|
||||
$hideref = !empty($hideref) ? $hideref : 0;
|
||||
$hidedetails = !empty($hidedetails) ? $hidedetails : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
|
||||
$hidedesc = !empty($hidedesc) ? $hidedesc : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
|
||||
$hideref = !empty($hideref) ? $hideref : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
|
||||
$moreparams = !empty($moreparams) ? $moreparams : null;
|
||||
|
||||
$result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
@ -1378,13 +1378,13 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
|
||||
|
||||
// To be sure vars is defined
|
||||
if (empty($hidedetails)) {
|
||||
$hidedetails = 0;
|
||||
$hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
|
||||
}
|
||||
if (empty($hidedesc)) {
|
||||
$hidedesc = 0;
|
||||
$hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
|
||||
}
|
||||
if (empty($hideref)) {
|
||||
$hideref = 0;
|
||||
$hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
|
||||
}
|
||||
if (empty($moreparams)) {
|
||||
$moreparams = null;
|
||||
|
||||
@ -119,7 +119,7 @@ class box_birthdays extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center nowraponall"',
|
||||
'text' => dol_print_date($dateb, "day", 'gmt').' - '.$age.' '.$langs->trans('DurationYears')
|
||||
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
|
||||
);
|
||||
|
||||
/*$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -79,6 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
|
||||
$hookmanager = new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('index'));
|
||||
$object = new stdClass;
|
||||
$action = '';
|
||||
$hookmanager->executeHooks('addStatisticLine', array(), $object, $action);
|
||||
$boxstatItems = array();
|
||||
$boxstatFromHook = '';
|
||||
$boxstatFromHook = $hookmanager->resPrint;
|
||||
|
||||
@ -131,7 +131,7 @@ class box_graph_nb_tickets_type extends ModeleBoxes
|
||||
}
|
||||
foreach ($listofoppcode as $rowid => $code) {
|
||||
$dataseries[] = array(
|
||||
'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_category', 'code', 'label', $code),
|
||||
'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_type', 'code', 'label', $code),
|
||||
'data' => (empty($data[$code]) ? 0 : $data[$code])
|
||||
);
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ class box_graph_ticket_by_severity extends ModeleBoxes
|
||||
}
|
||||
foreach ($listofoppcode as $rowid => $code) {
|
||||
$dataseries[] = array(
|
||||
'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_category', 'code', 'label', $code),
|
||||
'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_severity', 'code', 'label', $code),
|
||||
'data' => (empty($data[$code]) ? 0 : $data[$code])
|
||||
);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-dolly" ></i> '.dol_print_date($delivery_date, 'day', 'tzuserrel').'</span>',
|
||||
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-flip-dolly" ></i> '.dol_print_date($delivery_date, 'day', 'tzuserrel').'</span>',
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ trait CommonIncoterm
|
||||
$this->fk_incoterms = $id_incoterm;
|
||||
$this->location_incoterms = $location;
|
||||
|
||||
$sql = 'SELECT libelle as label_incotermsFROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
|
||||
$sql = 'SELECT libelle as label_incoterms FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
|
||||
$res = $this->db->query($sql);
|
||||
if ($res) {
|
||||
$obj = $this->db->fetch_object($res);
|
||||
|
||||
@ -4805,18 +4805,18 @@ abstract class CommonObject
|
||||
global $langs, $hookmanager, $conf, $form;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('Description').'</td>';
|
||||
print '<td class="right">'.$langs->trans('VATRate').'</td>';
|
||||
print '<td class="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td class="linecolref">'.$langs->trans('Ref').'</td>';
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
print '<td class="linecolvat right">'.$langs->trans('VATRate').'</td>';
|
||||
print '<td class="linecoluht right">'.$langs->trans('PriceUHT').'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans('PriceUHTCurrency').'</td>';
|
||||
print '<td class="linecoluht_currency right">'.$langs->trans('PriceUHTCurrency').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">'.$langs->trans('Unit').'</td>';
|
||||
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td class="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
|
||||
print '</tr>';
|
||||
$i = 0;
|
||||
@ -5843,8 +5843,15 @@ abstract class CommonObject
|
||||
$attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey];
|
||||
$attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey];
|
||||
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
|
||||
$attributeUnique = $extrafields->attributes[$this->table_element]['unique'][$attributeKey];
|
||||
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
|
||||
|
||||
// If we clone, we have to clean unique extrafields to prevent duplicates.
|
||||
// This behaviour can be prevented by external code by changing $this->context['createfromclone'] value in createFrom hook
|
||||
if (! empty($this->context['createfromclone']) && $this->context['createfromclone'] == 'createfromclone' && ! empty($attributeUnique)) {
|
||||
$new_array_options[$key] = null;
|
||||
}
|
||||
|
||||
// Similar code than into insertExtraFields
|
||||
if ($attributeRequired) {
|
||||
$mandatorypb = false;
|
||||
@ -6753,7 +6760,7 @@ abstract class CommonObject
|
||||
$out .= '</select>';
|
||||
} elseif ($type == 'checkbox') {
|
||||
$value_arr = explode(',', $value);
|
||||
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
||||
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%');
|
||||
} elseif ($type == 'radio') {
|
||||
$out = '';
|
||||
foreach ($param['options'] as $keyopt => $val) {
|
||||
@ -7403,7 +7410,7 @@ abstract class CommonObject
|
||||
$langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
|
||||
}
|
||||
|
||||
$colspan = '';
|
||||
$colspan = 0;
|
||||
if (is_array($params) && count($params) > 0 && $display_type=='card') {
|
||||
if (array_key_exists('cols', $params)) {
|
||||
$colspan = $params['cols'];
|
||||
@ -7416,6 +7423,7 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$colspan = intval($colspan);
|
||||
|
||||
switch ($mode) {
|
||||
case "view":
|
||||
@ -7461,7 +7469,7 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$out .= $extrafields->showSeparator($key, $this, ($colspan + 1), $display_type);
|
||||
$out .= $extrafields->showSeparator($key, $this, ($colspan ? $colspan + 1 : 2), $display_type);
|
||||
} else {
|
||||
$class = (!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : '');
|
||||
$csstyle = '';
|
||||
@ -7482,7 +7490,7 @@ abstract class CommonObject
|
||||
$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
|
||||
if ($display_type=='card') {
|
||||
if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) {
|
||||
$colspan = '0';
|
||||
$colspan = 0;
|
||||
}
|
||||
|
||||
if ($action == 'selectlines') {
|
||||
@ -7496,14 +7504,16 @@ abstract class CommonObject
|
||||
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
|
||||
$datenotinstring = $this->db->jdate($datenotinstring);
|
||||
}
|
||||
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
|
||||
$datekey = $keyprefix.'options_'.$key.$keysuffix;
|
||||
$value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring;
|
||||
}
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) {
|
||||
$datenotinstring = $this->array_options['options_'.$key];
|
||||
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
|
||||
$datenotinstring = $this->db->jdate($datenotinstring);
|
||||
}
|
||||
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring;
|
||||
$timekey = $keyprefix.'options_'.$key.$keysuffix;
|
||||
$value = (GETPOSTISSET($timekey)) ? dol_mktime(GETPOST($timekey.'hour', 'int', 3), GETPOST($timekey.'min', 'int', 3), GETPOST($timekey.'sec', 'int', 3), GETPOST($timekey.'month', 'int', 3), GETPOST($timekey.'day', 'int', 3), GETPOST($timekey.'year', 'int', 3), 'tzuserrel') : $datenotinstring;
|
||||
}
|
||||
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double'))) {
|
||||
@ -7511,7 +7521,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// HTML, text, select, integer and varchar: take into account default value in database if in create mode
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int'))) {
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int', 'boolean'))) {
|
||||
if ($action == 'create') {
|
||||
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : $extrafields->attributes[$this->table_element]['default'][$key];
|
||||
}
|
||||
@ -7562,7 +7572,7 @@ abstract class CommonObject
|
||||
if ($display_type == 'card') {
|
||||
$out .= '<td '.($html_id ? 'id="'.$html_id.'" ' : '').' class="'.$this->element.'_extras_'.$key.'" '.($colspan ? ' colspan="'.$colspan.'"' : '').'>';
|
||||
} elseif ($display_type == 'line') {
|
||||
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').' style="display: inline-block" class="'.$this->element.'_extras_'.$key.'">';
|
||||
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').' style="display: inline-block" class="'.$this->element.'_extras_'.$key.' extra_inline_'.$extrafields->attributes[$this->table_element]['type'][$key].'">';
|
||||
}
|
||||
|
||||
switch ($mode) {
|
||||
|
||||
@ -54,12 +54,21 @@ class DiscountAbsolute
|
||||
public $fk_soc;
|
||||
|
||||
public $discount_type; // 0 => customer discount, 1 => supplier discount
|
||||
public $amount_ht; //
|
||||
public $amount_tva; //
|
||||
public $amount_ttc; //
|
||||
public $multicurrency_amount_ht;
|
||||
public $multicurrency_amount_tva;
|
||||
public $multicurrency_amount_ttc;
|
||||
|
||||
public $total_ht;
|
||||
public $total_tva;
|
||||
public $total_ttc;
|
||||
public $amount_ht; // deprecated
|
||||
public $amount_tva; // deprecated
|
||||
public $amount_ttc; // deprecated
|
||||
|
||||
public $multicurrency_total_ht;
|
||||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
public $multicurrency_amount_ht; // deprecated
|
||||
public $multicurrency_amount_tva; // deprecated
|
||||
public $multicurrency_amount_ttc; // deprecated
|
||||
|
||||
// Vat rate
|
||||
public $tva_tx;
|
||||
public $vat_src_code;
|
||||
@ -163,13 +172,21 @@ class DiscountAbsolute
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
$this->discount_type = $obj->discount_type;
|
||||
|
||||
$this->amount_ht = $obj->amount_ht;
|
||||
$this->amount_tva = $obj->amount_tva;
|
||||
$this->amount_ttc = $obj->amount_ttc;
|
||||
$this->total_ht = $obj->amount_ht;
|
||||
$this->total_tva = $obj->amount_tva;
|
||||
$this->total_ttc = $obj->amount_ttc;
|
||||
// For backward compatibility
|
||||
$this->amount_ht = $this->total_ht;
|
||||
$this->amount_tva = $this->total_tva;
|
||||
$this->amount_ttc = $this->total_ttc;
|
||||
|
||||
$this->multicurrency_amount_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht;
|
||||
$this->multicurrency_amount_tva = $obj->multicurrency_amount_tva;
|
||||
$this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc;
|
||||
$this->multicurrency_total_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht;
|
||||
$this->multicurrency_total_tva = $obj->multicurrency_amount_tva;
|
||||
$this->multicurrency_total_ttc = $obj->multicurrency_amount_ttc;
|
||||
// For backward compatibility
|
||||
$this->multicurrency_amount_ht = $this->multicurrency_total_ht;
|
||||
$this->multicurrency_amount_tva = $this->multicurrency_total_tva;
|
||||
$this->multicurrency_amount_ttc = $this->multicurrency_total_ttc;
|
||||
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->vat_src_code = $obj->vat_src_code;
|
||||
|
||||
@ -1766,15 +1766,18 @@ class ExtraFields
|
||||
}
|
||||
}
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
$toprint = array();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$c = new Categorie($this->db);
|
||||
$c->fetch($obj->rowid);
|
||||
$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
|
||||
foreach ($ways as $way) {
|
||||
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.img_object('', 'category').' '.$way.'</li>';
|
||||
if ($obj->rowid) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$c = new Categorie($this->db);
|
||||
$result = $c->fetch($obj->rowid);
|
||||
if ($result > 0) {
|
||||
$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
|
||||
foreach ($ways as $way) {
|
||||
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
||||
}
|
||||
|
||||
@ -3400,7 +3400,7 @@ class Form
|
||||
'value'=>$outref,
|
||||
'label'=>$outval,
|
||||
'qty'=>$outqty,
|
||||
'price_ht'=>price2num($objp->unitprice, 'MT'),
|
||||
'price_ht'=>price2num($objp->unitprice, 'MU'),
|
||||
'discount'=>$outdiscount,
|
||||
'type'=>$outtype,
|
||||
'duration_value'=>$outdurationvalue,
|
||||
|
||||
@ -359,9 +359,9 @@ class FormFile
|
||||
* Return a string to show the box with list of available documents for object.
|
||||
* This also set the property $this->numoffiles
|
||||
*
|
||||
* @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:myobject', 'mymodule_temp', ...)
|
||||
* @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
|
||||
* @param string $filedir Directory to scan
|
||||
* @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...)
|
||||
* @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module.
|
||||
* @param string $filedir Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234'
|
||||
* @param string $urlsource Url of origin page (for return)
|
||||
* @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates)
|
||||
* @param int $delallowed Remove is allowed (1/0)
|
||||
|
||||
@ -356,10 +356,19 @@ class Utils
|
||||
|
||||
dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_INFO);
|
||||
|
||||
|
||||
/* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */
|
||||
$MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_DUMP');
|
||||
if (!empty($MemoryLimit)) {
|
||||
@ini_set('memory_limit', $MemoryLimit);
|
||||
}
|
||||
|
||||
|
||||
// TODO Replace with executeCLI function
|
||||
if ($execmethod == 1) {
|
||||
$output_arr = array();
|
||||
$retval = null;
|
||||
|
||||
exec($fullcommandclear, $output_arr, $retval);
|
||||
|
||||
if ($retval != 0) {
|
||||
|
||||
@ -963,6 +963,7 @@ function document_preview(file, type, title)
|
||||
img.src = file;
|
||||
|
||||
}
|
||||
|
||||
function show_preview(mode) {
|
||||
/* console.log("mode="+mode+" file="+file+" type="+type+" width="+width+" height="+height); */
|
||||
var newElem = '<object name="objectpreview" data="'+file+'" type="'+type+'" width="'+object_width+'" height="'+object_height+'" param="noparam"></object>';
|
||||
@ -977,6 +978,7 @@ function document_preview(file, type, title)
|
||||
}
|
||||
|
||||
$("#dialogforpopup").html(newElem);
|
||||
|
||||
$("#dialogforpopup").dialog({
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
@ -1162,7 +1164,7 @@ $(document).ready(function() {
|
||||
|
||||
// Force to hide menus when page is inside an iFrame
|
||||
$(document).ready(function() {
|
||||
if (window.location !== window.parent.location ) {
|
||||
if (window.location && window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) {
|
||||
console.log("Page is detected to be into an iframe, we hide by CSS the menus");
|
||||
// The page is in an iframe
|
||||
jQuery(".side-nav-vert, .side-nav, .websitebar").hide();
|
||||
|
||||
@ -290,7 +290,7 @@ function dol_shutdown()
|
||||
$depth = $db->transaction_opened;
|
||||
$disconnectdone = $db->close();
|
||||
}
|
||||
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO));
|
||||
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2154,7 +2154,7 @@ function dol_bc($var, $moreclass = '')
|
||||
*/
|
||||
function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$ret = '';
|
||||
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
||||
@ -2220,6 +2220,14 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
$langs->load("dict");
|
||||
$ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
|
||||
}
|
||||
if ($hookmanager) {
|
||||
$parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs,'mode' => $mode, 'extralangcode' => $extralangcode);
|
||||
$reshook = $hookmanager->executeHooks('formatAddress', $parameters, $object);
|
||||
if ($reshook > 0) {
|
||||
$ret = '';
|
||||
}
|
||||
$ret .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
|
||||
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
|
||||
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
|
||||
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
|
||||
//print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
|
||||
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>";
|
||||
|
||||
$parentfortableentity = '';
|
||||
@ -494,8 +494,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
if (!$user->rights->fournisseur->facture->creer) {
|
||||
$deleteok = 0;
|
||||
}
|
||||
} elseif ($feature == 'payment') { // Permission to delete a payment of an invoice is permission to edit an invoice.
|
||||
if (!$user->rights->facture->creer) {
|
||||
} elseif ($feature == 'payment') {
|
||||
if (!$user->rights->facture->paiement) {
|
||||
$deleteok = 0;
|
||||
}
|
||||
} elseif ($feature == 'banque') {
|
||||
@ -616,7 +616,7 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta
|
||||
$feature = 'projet_task';
|
||||
}
|
||||
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company)
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company)
|
||||
$checksoc = array('societe'); // Test for societe object
|
||||
$checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet', 'project'); // Test for project object
|
||||
|
||||
@ -819,7 +819,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if module is core or external
|
||||
* Tells if module is core or external.
|
||||
* 'dolibarr' and 'dolibarr_deprecated' is core
|
||||
* 'experimental' and 'development' is core
|
||||
*
|
||||
* @return string 'core', 'external' or 'unknown'
|
||||
*/
|
||||
|
||||
@ -126,8 +126,7 @@ abstract class ModeleNumRefChequeReceipts
|
||||
}
|
||||
|
||||
/**
|
||||
* \class ModeleChequeReceipts
|
||||
* \brief Classe mere des modeles de
|
||||
* Class parent for templates of document generation
|
||||
*/
|
||||
abstract class ModeleChequeReceipts extends CommonDocGenerator
|
||||
{
|
||||
|
||||
@ -1504,7 +1504,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
|
||||
|
||||
@ -290,11 +290,11 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen) {
|
||||
$dir = $conf->facture->dir_output;
|
||||
$dir = empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$conf->entity];
|
||||
$file = $dir."/SPECIMEN.pdf";
|
||||
} else {
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->facture->dir_output."/".$objectref;
|
||||
$dir = (empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$conf->entity])."/".$objectref;
|
||||
$file = $dir."/".$objectref.".pdf";
|
||||
}
|
||||
if (!file_exists($dir)) {
|
||||
@ -837,7 +837,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$tab3_width = 80;
|
||||
$tab3_height = 4;
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$tab3_posx -= 20;
|
||||
$tab3_posx -= 15;
|
||||
}
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
@ -1211,7 +1211,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$col1x = 120;
|
||||
$col2x = 170;
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$col2x -= 20;
|
||||
$col1x -= 15;
|
||||
$col2x -= 10;
|
||||
}
|
||||
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
|
||||
|
||||
|
||||
@ -498,7 +498,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
// $this->_pagefoot($pdf,$object,$outputlangs,1);
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
@ -556,7 +556,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
$height_note = $posyafter - $tab_top_newpage;
|
||||
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
|
||||
@ -578,7 +578,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
|
||||
$posyafter = $tab_top_newpage;
|
||||
@ -873,7 +873,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
}
|
||||
|
||||
@ -891,7 +891,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
}
|
||||
$pagenb++;
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -977,7 +977,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$tab3_width = 80;
|
||||
$tab3_height = 4;
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$tab3_posx -= 20;
|
||||
$tab3_posx -= 15;
|
||||
}
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
@ -1292,7 +1292,8 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$col1x = 120;
|
||||
$col2x = 170;
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$col2x -= 20;
|
||||
$col1x -= 15;
|
||||
$col2x -= 10;
|
||||
}
|
||||
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
|
||||
|
||||
@ -1960,7 +1961,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
|
||||
|
||||
@ -51,7 +51,7 @@ class modCashDesk extends DolibarrModules
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
$this->description = "CashDesk module";
|
||||
|
||||
$this->version = 'deprecated';
|
||||
$this->version = 'dolibarr_deprecated';
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->picto = 'cash-register';
|
||||
|
||||
@ -855,7 +855,7 @@ class modProduct extends DolibarrModules
|
||||
}
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
|
||||
'sp.packagning'=>'1',
|
||||
'sp.packaging'=>'10',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ class modProjet extends DolibarrModules
|
||||
's.phone'=>'Text', 's.email'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref::project", 'p.ref'=>"Text", 'p.title'=>"Text",
|
||||
'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean',
|
||||
'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric',
|
||||
'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', 'p.budget_amount'=>'Numeric',
|
||||
'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text",
|
||||
'ptt.rowid'=>'Numeric', 'ptt.task_date'=>'Date', 'ptt.task_duration'=>"Duree", 'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)", 'ptt.note'=>"Text"
|
||||
);
|
||||
@ -235,7 +235,7 @@ class modProjet extends DolibarrModules
|
||||
's.phone'=>'Phone', 's.email'=>'Email', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||
'p.rowid'=>"ProjectId", 'p.ref'=>"RefProject", 'p.title'=>'ProjectLabel',
|
||||
'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime',
|
||||
'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.description'=>"Description"
|
||||
'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.budget_amount'=>'Budget', 'p.description'=>"Description"
|
||||
);
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
|
||||
@ -423,7 +423,7 @@ class modRecruitment extends DolibarrModules
|
||||
$sql = array();
|
||||
|
||||
// Document template
|
||||
$moduledir = 'mymodule';
|
||||
$moduledir = 'recruitment';
|
||||
$myTmpObjects = array();
|
||||
$myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1);
|
||||
|
||||
@ -431,10 +431,10 @@ class modRecruitment extends DolibarrModules
|
||||
if ($myTmpObjectKey == 'MyObject') {
|
||||
continue;
|
||||
}
|
||||
if ($myTmpObjectArray['includerefgeneration']) {
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
|
||||
$dest = $dirodt.'/template_myobjects.odt';
|
||||
if ($myTmpObjectArray['includedocgeneration']) {
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_recruitmentjobposition.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
|
||||
$dest = $dirodt.'/template_recruitmentjobposition.odt';
|
||||
|
||||
if (file_exists($src) && !file_exists($dest)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -450,8 +450,6 @@ class modRecruitment extends DolibarrModules
|
||||
$sql = array_merge($sql, array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ class modResource extends DolibarrModules
|
||||
$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.'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] .= ' WHERE r.entity IN ('.getEntity('resource').')';
|
||||
|
||||
|
||||
// Imports
|
||||
|
||||
@ -786,7 +786,7 @@ class modService extends DolibarrModules
|
||||
}
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
|
||||
'sp.packagning'=>'1',
|
||||
'sp.packagning'=>'10',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -1595,7 +1595,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
|
||||
|
||||
@ -523,9 +523,9 @@ class pdf_squille extends ModelePdfReception
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
$pagenb++;
|
||||
@ -534,9 +534,9 @@ class pdf_squille extends ModelePdfReception
|
||||
}
|
||||
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object);
|
||||
}
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
// New page
|
||||
@ -550,10 +550,10 @@ class pdf_squille extends ModelePdfReception
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object);
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object);
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
|
||||
@ -719,9 +719,10 @@ class pdf_squille extends ModelePdfReception
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @param int $hidetop Hide top bar of array
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @param Object|NULL $object Object reception to generate
|
||||
* @return void
|
||||
*/
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
|
||||
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $object = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -767,7 +768,18 @@ class pdf_squille extends ModelePdfReception
|
||||
$pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqtytoship, $tab_top + 1);
|
||||
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"), '', 'C');
|
||||
$statusreceived = Reception::STATUS_CLOSED;
|
||||
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
|
||||
$statusreceived = Reception::STATUS_VALIDATED;
|
||||
}
|
||||
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
|
||||
$statusreceived = Reception::STATUS_CLOSED;
|
||||
}
|
||||
if ($object && $object->statut < $statusreceived) {
|
||||
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyToReceive'), '', 'C');
|
||||
} else {
|
||||
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyReceived'), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -132,7 +133,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
$this->db = $db;
|
||||
$this->name = "standard";
|
||||
$this->description = $langs->trans('DocumentModelStandardPDF');
|
||||
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
$this->update_main_doc_field = 0; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
|
||||
// Page size for A4 format
|
||||
$this->type = 'pdf';
|
||||
|
||||
@ -1336,7 +1336,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
|
||||
}
|
||||
/* PHFAVRE
|
||||
$posy+=4;
|
||||
|
||||
@ -156,6 +156,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
|
||||
//var_dump($user->rights);
|
||||
$permok = false;
|
||||
$keyforperm = $object->element;
|
||||
|
||||
if ($object->element == 'fichinter') {
|
||||
$keyforperm = 'ficheinter';
|
||||
}
|
||||
|
||||
@ -26,21 +26,21 @@ if (empty($conf) || !is_object($conf)) {
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
|
||||
<?php
|
||||
print '<tr class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
|
||||
print '<td>'.$this->tpl['label'].'</td>';
|
||||
print '<td>'.$this->tpl['description'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['vat_rate'].'</td>';
|
||||
print '<td class="right">'.$this->tpl['price'].'</td>';
|
||||
print '<tr data-id="'.$this->tpl['id'].'" class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
|
||||
print '<td class="linecolref">'.$this->tpl['label'].'</td>';
|
||||
print '<td class="linecoldescription">'.$this->tpl['description'].'</td>';
|
||||
print '<td class="linecolvat right">'.$this->tpl['vat_rate'].'</td>';
|
||||
print '<td class="linecoluht right">'.$this->tpl['price'].'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$this->tpl['multicurrency_price'].'</td>';
|
||||
print '<td class="linecoluht_currency right">'.$this->tpl['multicurrency_price'].'</td>';
|
||||
}
|
||||
|
||||
print '<td class="right">'.$this->tpl['qty'].'</td>';
|
||||
print '<td class="linecolqty right">'.$this->tpl['qty'].'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">'.$langs->trans($this->tpl['unit']).'</td>';
|
||||
print '<td class="linecoluseunit left">'.$langs->trans($this->tpl['unit']).'</td>';
|
||||
}
|
||||
|
||||
print '<td class="right">'.$this->tpl['remise_percent'].'</td>';
|
||||
print '<td class="linecoldiscount right">'.$this->tpl['remise_percent'].'</td>';
|
||||
|
||||
$selected = 1;
|
||||
if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) {
|
||||
|
||||
@ -353,6 +353,10 @@ if ($action == 'execute') {
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1);
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
|
||||
@ -73,7 +73,7 @@ class DolLogsCollector extends MessagesCollector
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$uselogfile = $conf->global->DEBUGBAR_USE_LOGFILE;
|
||||
$uselogfile = $conf->global->DEBUGBAR_USE_LOG_FILE;
|
||||
|
||||
if ($uselogfile) {
|
||||
$this->getStorageLogs($this->path);
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -162,6 +163,11 @@ if (!empty($hashp)) {
|
||||
$modulepart = $moduleparttocheck;
|
||||
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
|
||||
}
|
||||
$entity = $ecmfile->entity;
|
||||
if ($entity != $conf->entity) {
|
||||
$conf->entity = $entity;
|
||||
$conf->setValues($db);
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1);
|
||||
|
||||
@ -327,7 +327,11 @@ class EcmFiles extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$this->errors[] = 'Error DB_ERROR_RECORD_ALREADY_EXISTS : '.$this->db->lasterror();
|
||||
} else {
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
}
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
|
||||
@ -1282,6 +1282,15 @@ if (empty($reshook)) {
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($qty);
|
||||
unset($value_unit_ht);
|
||||
unset($value_unit);
|
||||
unset($vatrate);
|
||||
unset($comments);
|
||||
unset($fk_c_type_fees);
|
||||
unset($fk_project);
|
||||
unset($date);
|
||||
}
|
||||
|
||||
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
@ -2059,7 +2068,8 @@ if ($action == 'create') {
|
||||
// IK
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||
print '<td class="fk_c_exp_tax_cat">';
|
||||
print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
|
||||
$exp_tax_cat_label = dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
|
||||
print $langs->trans($exp_tax_cat_label);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ if ($action == 'add') {
|
||||
|
||||
// on récupère les enregistrements
|
||||
$object->fetch($id);
|
||||
|
||||
$res = $object->fetch_lines();
|
||||
// on transfert les données de l'un vers l'autre
|
||||
if ($object->socid > 0) {
|
||||
$newinter->socid = $object->socid;
|
||||
@ -178,6 +178,7 @@ if ($action == 'add') {
|
||||
|
||||
$newinter->entity = $object->entity;
|
||||
$newinter->duree = $object->duree;
|
||||
$newinter->datei = $object->date;
|
||||
|
||||
$newinter->description = $object->description;
|
||||
$newinter->note_private = $object->note_private;
|
||||
@ -194,7 +195,7 @@ if ($action == 'add') {
|
||||
if ($newfichinterid > 0) {
|
||||
// Now we add line of details
|
||||
foreach ($object->lines as $line) {
|
||||
$newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, '');
|
||||
$newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree, '');
|
||||
}
|
||||
|
||||
// on update le nombre d'inter crée à partir du modèle
|
||||
@ -743,7 +744,7 @@ if ($action == 'create') {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel&token='.newToken().'';
|
||||
print '&socid='.$object->thirdparty->id.'&id='.$object->id.'">';
|
||||
print $langs->trans("CreateFichInter").'</a></div>';
|
||||
print $langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->ficheinter->supprimer) {
|
||||
|
||||
@ -375,11 +375,15 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$mesg = $srcobject->error;
|
||||
$langs->load("errors");
|
||||
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -403,12 +407,14 @@ if (empty($reshook)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"));
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
} elseif ($action == 'update' && $user->rights->ficheinter->creer) {
|
||||
$object->socid = $socid;
|
||||
|
||||
@ -426,7 +426,7 @@ class Fichinter extends CommonObject
|
||||
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
|
||||
$sql .= " f.date_valid as datev,";
|
||||
$sql .= " f.tms as datem,";
|
||||
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
|
||||
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
if ($ref) {
|
||||
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
@ -459,6 +459,7 @@ class Fichinter extends CommonObject
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
$this->fk_contrat = $obj->fk_contrat;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->user_creation = $obj->fk_user_author;
|
||||
|
||||
@ -1346,7 +1347,6 @@ class Fichinter extends CommonObject
|
||||
$line->fetch_optionals();
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -349,7 +349,7 @@ class FichinterRec extends Fichinter
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, ';
|
||||
$sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, ';
|
||||
$sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, l.date, ';
|
||||
$sql .= ' l.total_ht, l.total_tva, l.total_ttc,';
|
||||
$sql .= ' l.rang, l.special_code,';
|
||||
$sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,';
|
||||
@ -366,7 +366,6 @@ class FichinterRec extends Fichinter
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$line = new FichinterLigne($this->db);
|
||||
|
||||
$line->id = $objp->rowid;
|
||||
$line->label = $objp->custom_label; // Label line
|
||||
$line->desc = $objp->description; // Description line
|
||||
@ -386,8 +385,6 @@ class FichinterRec extends Fichinter
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
* \brief File of class to manage suppliers orders
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->productbatch->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
@ -431,6 +431,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
* Lines
|
||||
*/
|
||||
$result = $this->fetch_lines();
|
||||
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
} else {
|
||||
@ -453,7 +454,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
{
|
||||
global $conf;
|
||||
// phpcs:enable
|
||||
//$result=$this->fetch_lines();
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,";
|
||||
@ -464,22 +465,12 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql .= " l.fk_unit,";
|
||||
$sql .= " l.date_start, l.date_end,";
|
||||
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND l.qty >= pfp.quantity AND pfp.fk_soc = ".((int) $this->socid);
|
||||
}
|
||||
$sql .= " WHERE l.fk_commande = ".$this->id;
|
||||
$sql .= " WHERE l.fk_commande = ".((int) $this->id);
|
||||
if ($only_product) {
|
||||
$sql .= ' AND p.fk_product_type = 0';
|
||||
}
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql.= " GROUP BY l.rowid";
|
||||
$sql.= " HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)";
|
||||
}
|
||||
$sql .= " ORDER BY l.rang, l.rowid";
|
||||
//print $sql;
|
||||
|
||||
@ -527,11 +518,34 @@ class CommandeFournisseur extends CommonOrder
|
||||
$line->ref_supplier = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$line->fk_fournprice = $objp->fk_pfp;
|
||||
$line->packaging = $objp->packaging;
|
||||
// TODO We should not fetch this properties into the fetch_lines. This is NOT properties of a line.
|
||||
// Move this into another method and call it when required.
|
||||
|
||||
// Take better packaging for $objp->qty (first supplier ref quantity <= $objp->qty)
|
||||
$sqlsearchpackage = 'SELECT rowid, packaging FROM '.MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")";
|
||||
$sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product);
|
||||
$sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'";
|
||||
$sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified
|
||||
$sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified
|
||||
$sqlsearchpackage .= " AND fk_soc = ".((int) $this->socid);
|
||||
$sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first
|
||||
$sqlsearchpackage .= " LIMIT 1";
|
||||
|
||||
$resqlsearchpackage = $this->db->query($sqlsearchpackage);
|
||||
if ($resqlsearchpackage) {
|
||||
$objsearchpackage = $this->db->fetch_object($resqlsearchpackage);
|
||||
if ($objsearchpackage) {
|
||||
$line->fk_fournprice = $objsearchpackage->rowid;
|
||||
$line->packaging = $objsearchpackage->packaging;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
$line->date_end = $this->db->jdate($objp->date_end);
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
@ -1807,6 +1821,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$prod = new Product($this->db, $fk_product);
|
||||
$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid));
|
||||
|
||||
if ($qty < $prod->packaging) {
|
||||
$qty = $prod->packaging;
|
||||
} else {
|
||||
@ -3515,25 +3530,18 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
global $conf;
|
||||
|
||||
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx, cd.special_code,';
|
||||
$sql .= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref,';
|
||||
$sql .= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref as ref_supplier,';
|
||||
$sql .= ' cd.remise, cd.remise_percent, cd.subprice,';
|
||||
$sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,';
|
||||
$sql .= ' cd.total_localtax1, cd.total_localtax2,';
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,';
|
||||
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
||||
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
|
||||
}
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,';
|
||||
$sql .= ' c.fk_soc as socid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseur as c, '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn AND cd.qty >= pfp.quantity";
|
||||
}
|
||||
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= " GROUP BY cd.rowid HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)";
|
||||
}
|
||||
$sql .= ' WHERE cd.fk_commande = c.rowid AND cd.rowid = '.((int) $rowid);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
@ -3544,8 +3552,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$this->fk_commande = $objp->fk_commande;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->ref_fourn = $objp->ref;
|
||||
$this->ref_supplier = $objp->ref;
|
||||
$this->ref_fourn = $objp->ref_supplier;
|
||||
$this->ref_supplier = $objp->ref_supplier;
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->localtax1_tx = $objp->localtax1_tx;
|
||||
@ -3569,9 +3577,33 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->product_label = $objp->product_label;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$this->packaging = $objp->packaging;
|
||||
$this->fk_fournprice = $objp->fk_pfp;
|
||||
// TODO We should not fetch this properties into the fetch_lines. This is NOT properties of a line.
|
||||
// Move this into another method and call it when required.
|
||||
|
||||
// Take better packaging for $objp->qty (first supplier ref quantity <= $objp->qty)
|
||||
$sqlsearchpackage = 'SELECT rowid, packaging FROM '.MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")";
|
||||
$sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product);
|
||||
$sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'";
|
||||
$sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified
|
||||
$sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified
|
||||
$sqlsearchpackage .= " AND fk_soc = ".((int) $objp->socid);
|
||||
$sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first
|
||||
$sqlsearchpackage .= " LIMIT 1";
|
||||
|
||||
$resqlsearchpackage = $this->db->query($sqlsearchpackage);
|
||||
if ($resqlsearchpackage) {
|
||||
$objsearchpackage = $this->db->fetch_object($resqlsearchpackage);
|
||||
if ($objsearchpackage) {
|
||||
$this->fk_fournprice = $objsearchpackage->rowid;
|
||||
$this->packaging = $objsearchpackage->packaging;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
|
||||
@ -262,7 +262,6 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges = 0, $remise_percent = 0, $remise = 0, $newnpr = 0, $delivery_time_days = 0, $supplier_reputation = '', $localtaxes_array = array(), $newdefaultvatcode = '', $multicurrency_buyprice = 0, $multicurrency_price_base_type = 'HT', $multicurrency_tx = 1, $multicurrency_code = '', $desc_fourn = '', $barcode = '', $fk_barcode_type = '', $options = array())
|
||||
{
|
||||
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
//global $mysoc;
|
||||
@ -320,7 +319,9 @@ class ProductFournisseur extends Product
|
||||
$qty = price2num($qty, 'MS');
|
||||
$unitBuyPrice = price2num($buyprice / $qty, 'MU');
|
||||
|
||||
$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS');
|
||||
// We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50.
|
||||
//$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS');
|
||||
$packaging = price2num((empty($this->packaging) ? $qty : $this->packaging), 'MS');
|
||||
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
@ -625,13 +626,7 @@ class ProductFournisseur extends Product
|
||||
$this->supplier_barcode = $obj->barcode;
|
||||
$this->supplier_fk_barcode_type = $obj->fk_barcode_type;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$this->packaging = $obj->packaging;
|
||||
if ($this->packaging < $this->fourn_qty) {
|
||||
$this->packaging = $this->fourn_qty;
|
||||
}
|
||||
}
|
||||
$this->packaging = $obj->packaging;
|
||||
|
||||
if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression)) {
|
||||
$priceparser = new PriceParser($this->db);
|
||||
@ -679,10 +674,7 @@ class ProductFournisseur extends Product
|
||||
$sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
|
||||
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= ", pfp.packaging";
|
||||
}
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
||||
$sql .= " AND pfp.fk_soc = s.rowid AND pfp.fk_product = p.rowid";
|
||||
@ -736,12 +728,7 @@ class ProductFournisseur extends Product
|
||||
$prodfourn->fourn_multicurrency_id = $record["fk_multicurrency"];
|
||||
$prodfourn->fourn_multicurrency_code = $record["multicurrency_code"];
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$prodfourn->packaging = $record["packaging"];
|
||||
if ($prodfourn->packaging < $prodfourn->fourn_qty) {
|
||||
$prodfourn->packaging = $prodfourn->fourn_qty;
|
||||
}
|
||||
}
|
||||
$prodfourn->packaging = $record["packaging"];
|
||||
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
$prodfourn->supplier_barcode = $record["barcode"];
|
||||
|
||||
@ -274,6 +274,8 @@ if (empty($reshook)) {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$default_ref_supplier=dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
|
||||
foreach ($orders as $id_order) {
|
||||
$cmd = new CommandeFournisseur($db);
|
||||
if ($cmd->fetch($id_order) <= 0) {
|
||||
@ -290,9 +292,8 @@ if (empty($reshook)) {
|
||||
$objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
|
||||
$objecttmp->fk_project = $cmd->fk_project;
|
||||
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
|
||||
if (empty($createbills_onebythird)) {
|
||||
$objecttmp->ref_client = $cmd->ref_client;
|
||||
}
|
||||
$objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
|
||||
$default_ref_supplier+=1;
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
if (empty($datefacture)) {
|
||||
|
||||
@ -457,10 +457,9 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysToValidateBody")."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysToValidateBody")."</p>\n";
|
||||
|
||||
$delayForRequest = $object->getConfCP('delayForRequest');
|
||||
//$delayForRequest = $delayForRequest * (60*60*24);
|
||||
@ -470,8 +469,7 @@ if (empty($reshook)) {
|
||||
// option to warn the validator in case of too short delay
|
||||
if ($object->getConfCP('AlertValidatorDelay')) {
|
||||
if ($object->date_debut < $nextMonth) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,20 +477,21 @@ if (empty($reshook)) {
|
||||
if ($object->getConfCP('AlertValidatorSolde')) {
|
||||
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
|
||||
if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysToValidateAlertSolde")."</p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$message .= "\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id;
|
||||
|
||||
$message .= "<ul>";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>\n";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// Sending the email
|
||||
$result = $mail->sendfile();
|
||||
@ -601,19 +600,20 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."</p>\n";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$message .= "<ul>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>\n";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// Sending email
|
||||
$result = $mail->sendfile();
|
||||
@ -681,20 +681,21 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= GETPOST('detail_refuse', 'alpha')."\n\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."<p>\n";
|
||||
$message .= "<p>".GETPOST('detail_refuse', 'alpha')."</p>";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$message .= "<ul>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// sending email
|
||||
$result = $mail->sendfile();
|
||||
@ -820,18 +821,20 @@ if (empty($reshook)) {
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled");
|
||||
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message .= "<p>".$langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."</p>\n";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
|
||||
$message .= "\n";
|
||||
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
|
||||
|
||||
$message .= "<ul>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
|
||||
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
|
||||
$message .= "</ul>\n";
|
||||
|
||||
$trackid = 'leav'.$object->id;
|
||||
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
|
||||
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
|
||||
|
||||
// sending email
|
||||
$result = $mail->sendfile();
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("holiday"));
|
||||
$langs->loadLangs(array('holiday', 'hrm'));
|
||||
|
||||
// Security check
|
||||
$socid = 0;
|
||||
@ -112,7 +112,7 @@ if (empty($reshook)) {
|
||||
$arrayfields = array(
|
||||
'cp.ref'=>array('label'=>$langs->trans('Ref'), 'checked'=>1),
|
||||
'cp.fk_user'=>array('label'=>$langs->trans('Employee'), 'checked'=>1),
|
||||
'ct.label'=>array('label'=>$langs->trans('Type'), 'checked'=>1),
|
||||
'cp.fk_type'=>array('label'=>$langs->trans('Type'), 'checked'=>1),
|
||||
'cp.date_debut'=>array('label'=>$langs->trans('DateDebCP'), 'checked'=>1),
|
||||
'cp.date_fin'=>array('label'=>$langs->trans('DateFinCP'), 'checked'=>1),
|
||||
'used_days'=>array('label'=>$langs->trans('NbUseDaysCPShort'), 'checked'=>1),
|
||||
@ -141,10 +141,9 @@ $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m",
|
||||
$search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time());
|
||||
$year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month);
|
||||
|
||||
$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday";
|
||||
$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday cp";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid";
|
||||
$sql .= " WHERE cp.rowid > 0";
|
||||
$sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED;
|
||||
$sql .= " AND (";
|
||||
@ -244,7 +243,7 @@ if (!empty($arrayfields['cp.fk_user']['checked'])) {
|
||||
}
|
||||
|
||||
// Filter: Type
|
||||
if (!empty($arrayfields['ct.label']['checked'])) {
|
||||
if (!empty($arrayfields['cp.fk_type']['checked'])) {
|
||||
$typeleaves = $holidaystatic->getTypes(1, -1);
|
||||
$arraytypeleaves = array();
|
||||
foreach ($typeleaves as $key => $val) {
|
||||
@ -297,6 +296,9 @@ if (!empty($arrayfields['cp.ref']['checked'])) {
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['cp.fk_type']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['ct.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder);
|
||||
}
|
||||
@ -382,8 +384,8 @@ if ($num == 0) {
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) {
|
||||
print '<td>'.$user->getFullName($langs).'</td>';
|
||||
}
|
||||
if (!empty($arrayfields['ct.label']['checked'])) {
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
if (!empty($arrayfields['cp.fk_type']['checked'])) {
|
||||
print '<td>'.$arraytypeleaves[$obj->fk_type].'</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cp.date_debut']['checked'])) {
|
||||
@ -418,7 +420,7 @@ if ($num == 0) {
|
||||
print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cp.description']['checked'])) {
|
||||
print '<td class="maxwidth300 small">'.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).'</td>';
|
||||
print '<td class="maxwidth300 small">'.dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)).'</td>';
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
@ -84,8 +84,8 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'a
|
||||
UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo';
|
||||
DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo');
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
|
||||
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL;
|
||||
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
|
||||
|
||||
|
||||
-- For v14
|
||||
|
||||
@ -40,8 +40,8 @@ create table llx_product
|
||||
customcode varchar(32), -- Optionnal custom code
|
||||
fk_country integer DEFAULT NULL, -- Optionnal id of original country
|
||||
fk_state integer DEFAULT NULL, -- Optionnal id of original state/province
|
||||
price double(24,8) DEFAULT 0,
|
||||
price_ttc double(24,8) DEFAULT 0,
|
||||
price double(24,8) DEFAULT 0, -- price without tax
|
||||
price_ttc double(24,8) DEFAULT 0, -- price inc vat (but not localtax1 nor localtax2)
|
||||
price_min double(24,8) DEFAULT 0,
|
||||
price_min_ttc double(24,8) DEFAULT 0,
|
||||
price_base_type varchar(3) DEFAULT 'HT',
|
||||
|
||||
@ -50,7 +50,7 @@ create table llx_product_fournisseur_price
|
||||
import_key varchar(14), -- Import key
|
||||
delivery_time_days integer,
|
||||
supplier_reputation varchar(10),
|
||||
packaging varchar(64) DEFAULT NULL,
|
||||
packaging real DEFAULT NULL,
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
|
||||
@ -29,8 +29,8 @@ create table llx_product_price
|
||||
fk_product integer NOT NULL,
|
||||
date_price datetime NOT NULL,
|
||||
price_level smallint NULL DEFAULT 1,
|
||||
price double(24,8) DEFAULT NULL,
|
||||
price_ttc double(24,8) DEFAULT NULL,
|
||||
price double(24,8) DEFAULT NULL, -- price without tax
|
||||
price_ttc double(24,8) DEFAULT NULL, -- price inc vat (but not localtax1 nor localtax2)
|
||||
price_min double(24,8) default NULL,
|
||||
price_min_ttc double(24,8) default NULL,
|
||||
price_base_type varchar(3) DEFAULT 'HT',
|
||||
|
||||
@ -2158,3 +2158,5 @@ YouShouldSetThisToOff=You should set this to 0 or off
|
||||
InstallAndUpgradeLockedBy=Install and upgrades are locked by the file <b>%s</b>
|
||||
IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sales tax
|
||||
IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sales tax
|
||||
DEBUGBAR_USE_LOG_FILE=Use the <b>dolibarr.log</b> file to trap Logs
|
||||
UsingLogFileShowAllRecordOfSubrequestButIsSlower=Use the dolibarr.log file to trap Logs instead of live memory catching. It allows to catch all logs instead of only log of current process (so including the one of ajax subrequests pages) but will make your instance very very slow. Not recommended.
|
||||
|
||||
@ -146,9 +146,11 @@ ConfirmPaySalary=Are you sure you want to classify this salary card as paid?
|
||||
DeleteSocialContribution=Delete a social or fiscal tax payment
|
||||
DeleteVAT=Delete a VAT declaration
|
||||
DeleteSalary=Delete a salary card
|
||||
DeleteVariousPayment=Delete a various payment
|
||||
ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ?
|
||||
ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ?
|
||||
ConfirmDeleteSalary=Are you sure you want to delete this salary?
|
||||
ConfirmDeleteSalary=Are you sure you want to delete this salary ?
|
||||
ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ?
|
||||
ExportDataset_tax_1=Social and fiscal taxes and payments
|
||||
CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
|
||||
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
|
||||
|
||||
@ -272,6 +272,9 @@ ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it
|
||||
ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify.
|
||||
ErrorExecIdFailed=Can't execute command "id"
|
||||
ErrorBadCharIntoLoginName=Unauthorized character in the login name
|
||||
ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s"
|
||||
ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s"
|
||||
ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by actual object status
|
||||
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
|
||||
@ -102,6 +102,9 @@ ConfirmCancelOrder=Are you sure you want to cancel this order?
|
||||
ConfirmMakeOrder=Are you sure you want to confirm you made this order on <b>%s</b>?
|
||||
GenerateBill=Generate invoice
|
||||
ClassifyShipped=Classify delivered
|
||||
PassedInShippedStatus=classified delivered
|
||||
YouCantShipThis=I can't classify this. Please check user permissions
|
||||
MustBeValidatedBefore=must be Validated or In process in order to be classified as shipped
|
||||
DraftOrders=Draft orders
|
||||
DraftSuppliersOrders=Draft purchase orders
|
||||
OnProcessOrders=In process orders
|
||||
|
||||
@ -345,7 +345,7 @@ UseProductFournDesc=Add a feature to define the descriptions of products defined
|
||||
ProductSupplierDescription=Vendor description for the product
|
||||
UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents)
|
||||
PackagingForThisProduct=Packaging
|
||||
PackagingForThisProductDesc=On supplier order, you will automaticly order this quantity (or a multiple of this quantity). Cannot be less than minimum buying quantity
|
||||
PackagingForThisProductDesc=You will automaticaly purchase a multiple of this quantity.
|
||||
QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging
|
||||
|
||||
#Attributes
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user