Merge branch '14.0' of github.com:Dolibarr/dolibarr into 14.0
This commit is contained in:
commit
e34c921f8b
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
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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'));
|
||||
|
||||
@ -126,8 +126,10 @@ $utils = new Utils($db);
|
||||
|
||||
if ($compression == 'zip') {
|
||||
$file .= '.zip';
|
||||
$excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
|
||||
|
||||
$excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i';
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, $excludefiles);
|
||||
|
||||
if ($ret < 0) {
|
||||
if ($ret == -2) {
|
||||
$langs->load("errors");
|
||||
|
||||
@ -348,6 +348,9 @@ class DolibarrApi
|
||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
||||
|
||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||
if ($operator == 'NOTLIKE') {
|
||||
$operator = 'NOT LIKE';
|
||||
}
|
||||
|
||||
$tmpescaped = trim($tmp[2]);
|
||||
$regbis = array();
|
||||
|
||||
@ -66,7 +66,7 @@ function printDropdownBookmarksList()
|
||||
|
||||
|
||||
// Url to list bookmark
|
||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('ListOfBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
$listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>';
|
||||
|
||||
// Url to go on create new bookmark page
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -765,8 +765,8 @@ if (empty($reshook)) {
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code = GETPOST('special_code', 'int');
|
||||
if (!GETPOST('qty', 'alpha')) {
|
||||
$special_code = 3;
|
||||
if ($special_code == 3) {
|
||||
$special_code = 0; // Options should not exists on invoices
|
||||
}
|
||||
|
||||
/*$line = new FactureLigne($db);
|
||||
|
||||
@ -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) {
|
||||
@ -2371,9 +2337,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code = GETPOST('special_code');
|
||||
if (!GETPOST('qty')) {
|
||||
$special_code = 3;
|
||||
$special_code = GETPOST('special_code', 'int');
|
||||
if ($special_code == 3) {
|
||||
$special_code = 0; // Options should not exists on invoices
|
||||
}
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
@ -2898,6 +2864,9 @@ if ($action == 'create') {
|
||||
if (empty($mode_reglement_id)) {
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
}
|
||||
if (empty($fk_account)) {
|
||||
$fk_account = $soc->fk_account;
|
||||
}
|
||||
if (!$remise_percent) {
|
||||
$remise_percent = $soc->remise_percent;
|
||||
}
|
||||
@ -3005,6 +2974,9 @@ if ($action == 'create') {
|
||||
$mode_reglement_id = GETPOST("mode_reglement_id", 'int');
|
||||
}
|
||||
|
||||
// when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
|
||||
$fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
|
||||
|
||||
if (!empty($soc->id)) {
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
}
|
||||
@ -3607,8 +3579,8 @@ if ($action == 'create') {
|
||||
// Bank Account
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
|
||||
$fk_account = GETPOST('fk_account', 'int');
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -2619,7 +2619,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 +2658,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
|
||||
|
||||
@ -83,7 +83,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
}
|
||||
}
|
||||
|
||||
if ($amounts[key($amounts)] <= 0) {
|
||||
if (empty($amounts[key($amounts)])) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'create';
|
||||
|
||||
@ -857,32 +857,29 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
$column = 's.dateep'; // We use the date of end of period of salary
|
||||
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, s.label as label, date_format($column,'%Y-%m') as dm, sum(s.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
|
||||
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, s.label, dm";
|
||||
} else {
|
||||
$column = 'p.datep';
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = p.fk_salary";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
||||
}
|
||||
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
||||
|
||||
// For backward compatibility with old module salary
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
|
||||
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'u.firstname, u.lastname';
|
||||
@ -896,7 +893,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= $db->order($newsortfield, $sortorder);
|
||||
}
|
||||
|
||||
dol_syslog("get payment salaries");
|
||||
dol_syslog("get salaries");
|
||||
$result = $db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
|
||||
@ -611,21 +611,31 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
|
||||
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
$column = 's.dateep'; // we use the date of end of period of salary
|
||||
|
||||
$sql = "SELECT s.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(s.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
|
||||
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY s.label, dm";
|
||||
}
|
||||
if ($modecompta == "RECETTES-DEPENSES") {
|
||||
$column = 'p.datep';
|
||||
|
||||
$sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON p.fk_salary = s.rowid";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY p.label, dm";
|
||||
}
|
||||
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
$sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY p.label, dm";
|
||||
|
||||
dol_syslog("get social salaries payments");
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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) {
|
||||
@ -376,9 +385,9 @@ class Utils
|
||||
continue;
|
||||
}
|
||||
fwrite($handle, $read.($execmethod == 2 ? '' : "\n"));
|
||||
if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) {
|
||||
if (preg_match('/'.preg_quote('-- Dump completed', '/').'/i', $read)) {
|
||||
$ok = 1;
|
||||
} elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) {
|
||||
} elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES', '/').'/i', $read)) {
|
||||
$ok = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1162,7 +1162,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();
|
||||
|
||||
@ -1355,7 +1355,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
|
||||
$note = $prodser->multilangs[$outputlangs->defaultlang]["other"];
|
||||
}
|
||||
}
|
||||
} elseif ($object->element == 'facture' || $object->element == 'facturefourn') {
|
||||
} elseif (($object->element == 'facture' || $object->element == 'facturefourn') && preg_match('/^\(DEPOSIT\).+/', $desc)) { // We must not replace '(DEPOSIT)' when it is alone, it will be translated and detailed later
|
||||
$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -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',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -18,15 +18,14 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
|
||||
if (empty($extrafieldsobjectprefix)) {
|
||||
$extrafieldsobjectprefix = 'ef.';
|
||||
}
|
||||
|
||||
foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['list'][$key])) {
|
||||
$arrayfields[$extrafieldsobjectprefix.$key] = array(
|
||||
'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
|
||||
'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key],
|
||||
'checked' => (($extrafields->attributes[$extrafieldsobjectkey]['list'][$key] < 0) ? 0 : 1),
|
||||
'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1) <= 0) ? 0 : 1),
|
||||
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
|
||||
'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]),
|
||||
'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1)),
|
||||
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
|
||||
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
|
||||
);
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -1194,6 +1194,7 @@ if ($action == 'create') {
|
||||
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" class="qtyl center" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
} else {
|
||||
if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">';
|
||||
}
|
||||
|
||||
|
||||
@ -370,13 +370,15 @@ class Expedition extends CommonObject
|
||||
// Insert of lines
|
||||
$num = count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
if (!isset($this->lines[$i]->detail_batch)) { // no batch management
|
||||
if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) {
|
||||
$error++;
|
||||
}
|
||||
} else { // with batch management
|
||||
if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) {
|
||||
$error++;
|
||||
if (empty($this->lines[$i]->product_type) || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
if (!isset($this->lines[$i]->detail_batch)) { // no batch management
|
||||
if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) {
|
||||
$error++;
|
||||
}
|
||||
} else { // with batch management
|
||||
if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -916,6 +918,7 @@ class Expedition extends CommonObject
|
||||
|
||||
// Copy the rang of the order line to the expedition line
|
||||
$line->rang = $orderline->rang;
|
||||
$line->product_type = $orderline->product_type;
|
||||
|
||||
if (!empty($conf->stock->enabled) && !empty($orderline->fk_product)) {
|
||||
$fk_product = $orderline->fk_product;
|
||||
@ -968,6 +971,8 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
$this->lines[$num] = $line;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -2602,6 +2607,12 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
*/
|
||||
public $product_desc;
|
||||
|
||||
/**
|
||||
* Type of the product. 0 for product, 1 for service
|
||||
* @var int
|
||||
*/
|
||||
public $product_type = 0;
|
||||
|
||||
/**
|
||||
* @var int rang of line
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 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.= " AND l.qty >= pfp.quantity ";
|
||||
$sql.= " GROUP BY l.rowid HAVING max_qty = MAX(pfp.quantity) ";
|
||||
}
|
||||
$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";
|
||||
}
|
||||
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= " AND cd.qty >= pfp.quantity GROUP BY cd.rowid HAVING max_qty = MAX(pfp.quantity)";
|
||||
}
|
||||
$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);
|
||||
|
||||
@ -317,7 +317,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();
|
||||
@ -405,6 +407,7 @@ class ProductFournisseur extends Product
|
||||
$sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging);
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $this->product_fourn_price_id);
|
||||
//print $sql;exit;
|
||||
// TODO Add price_base_type and price_ttc
|
||||
|
||||
dol_syslog(get_class($this).'::update_buyprice update knowing id of line = product_fourn_price_id = '.$this->product_fourn_price_id, LOG_DEBUG);
|
||||
@ -593,13 +596,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);
|
||||
@ -647,10 +644,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";
|
||||
@ -704,12 +698,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) {
|
||||
@ -291,7 +293,8 @@ if (empty($reshook)) {
|
||||
$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'));
|
||||
|
||||
@ -113,7 +113,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write &&
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||
$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut);
|
||||
|
||||
|
||||
/*
|
||||
@ -1400,7 +1400,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
||||
|
||||
// Confirmation messages
|
||||
if ($action == 'delete') {
|
||||
if ($user->rights->holiday->delete) {
|
||||
if ($candelete) {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -43,6 +43,8 @@ create table llx_commande_fournisseur_dispatch_extrafields
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object);
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1;
|
||||
|
||||
UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA';
|
||||
|
||||
create table llx_c_shipment_package_type
|
||||
|
||||
@ -566,7 +566,8 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
|
||||
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
|
||||
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1);
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
|
||||
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_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;
|
||||
|
||||
|
||||
@ -84,6 +84,9 @@ 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 real DEFAULT NULL;
|
||||
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
|
||||
|
||||
|
||||
-- For v14
|
||||
|
||||
|
||||
@ -50,8 +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),
|
||||
|
||||
packaging real DEFAULT NULL,
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
|
||||
@ -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,8 @@ 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"
|
||||
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
@ -305,5 +307,8 @@ WarningTheHiddenOptionIsOn=Warning, the hidden option <b>%s</b> is on.
|
||||
WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list
|
||||
WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection.
|
||||
WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here.
|
||||
<<<<<<< HEAD
|
||||
WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead.
|
||||
|
||||
=======
|
||||
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
|
||||
|
||||
@ -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
|
||||
|
||||
@ -274,4 +274,5 @@ AddPersonToTask=Add also to tasks
|
||||
UsageOrganizeEvent=Usage: Event Organization
|
||||
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
|
||||
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100 %% progress won't be affected: you will have to close them manually. This option only affects open projects.
|
||||
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
|
||||
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
|
||||
ErrorPROJECTLEADERRoleMissingRestoreIt=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types
|
||||
|
||||
@ -85,6 +85,22 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature
|
||||
ProposalsStatisticsSuppliers=Vendor proposals statistics
|
||||
CaseFollowedBy=Case followed by
|
||||
SignedOnly=Signed only
|
||||
NoSign=Set not signed
|
||||
NoSigned=set not signed
|
||||
CantBeNoSign=cannot be set not signed
|
||||
ConfirmMassNoSignature=Bulk Not signed confirmation
|
||||
ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ?
|
||||
IsNotADraft=is not a draft
|
||||
PassedInOpenStatus=has been validated
|
||||
CantBeSign=cannot be signed
|
||||
Sign=Sign
|
||||
Signed=signed
|
||||
CantBeSign=cannot be signed
|
||||
CantBeValidated=cannot be validated
|
||||
ConfirmMassValidation=Bulk Validate confirmation
|
||||
ConfirmMassSignature=Bulk Signature confirmation
|
||||
ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ?
|
||||
ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ?
|
||||
IdProposal=Proposal ID
|
||||
IdProduct=Product ID
|
||||
PrParentLine=Proposal Parent Line
|
||||
|
||||
@ -176,7 +176,7 @@ ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock cor
|
||||
ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated
|
||||
ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted
|
||||
AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock
|
||||
AddStockLocationLine=Decrease quantity then click to add another warehouse for this product
|
||||
AddStockLocationLine=Decrease quantity then click to split the line
|
||||
InventoryDate=Inventory date
|
||||
Inventories=Inventories
|
||||
NewInventory=New inventory
|
||||
|
||||
@ -146,9 +146,11 @@ ConfirmPaySalary=Voulez-vous vraiment classer ce salaire comme payé ?
|
||||
DeleteSocialContribution=Effacer une charge fiscale ou sociale
|
||||
DeleteVAT=Supprimer une déclaration de TVA
|
||||
DeleteSalary=Supprimer un salaire
|
||||
DeleteVariousPayment=Supprimer un paiement divers
|
||||
ConfirmDeleteSocialContribution=Voulez-vous vraiment supprimer ce paiement de taxe sociale / fiscale?
|
||||
ConfirmDeleteVAT=Voulez-vous vraiment supprimer cette déclaration de TVA ?
|
||||
ConfirmDeleteSalary=Êtes-vous sûr de vouloir supprimer ce salaire ?
|
||||
ConfirmDeleteVariousPayment=Voulez-vous vraiment supprimer ce paiement divers ?
|
||||
ExportDataset_tax_1=Taxes sociales et fiscales et paiements
|
||||
CalcModeVATDebt=Mode <b>%sTVA sur débit%s</b>.
|
||||
CalcModeVATEngagement=Mode <b>%sTVA sur encaissement%s</b>.
|
||||
|
||||
@ -102,6 +102,9 @@ ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ?
|
||||
ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du <b>%s</b> ?
|
||||
GenerateBill=Facturer
|
||||
ClassifyShipped=Classer livrée
|
||||
PassedInShippedStatus=classée livrée
|
||||
YouCantShipThis=Classement impossible : veuillez vérifier les droits utilisateur
|
||||
MustBeValidatedBefore=doit être Validée ou En cours de livraison pour pouvoir être classée livrée
|
||||
DraftOrders=Commandes brouillons
|
||||
DraftSuppliersOrders=Commandes fournisseurs brouillons
|
||||
OnProcessOrders=Commandes en cours de traitement
|
||||
|
||||
@ -346,7 +346,7 @@ UseProductFournDesc=Ajouter une fonctionnalité pour définir la description pro
|
||||
ProductSupplierDescription=Description du fournisseur du produit
|
||||
UseProductSupplierPackaging=Utiliser le conditionnement/emballage sur les prix fournisseur (recalculer les quantités en fonction de l'emballage défini sur le prix fournisseur lors de l'ajout / mise à jour de la ligne dans les documents fournisseurs)
|
||||
PackagingForThisProduct=Emballage
|
||||
PackagingForThisProductDesc=Sur une commande fournisseur, vous commanderez automatiquement cette quantité ou un multiple. Vous ne pourrez pas saisir un montant inférieur
|
||||
PackagingForThisProductDesc=Sur une commande fournisseur, vous commanderez automatiquement cette quantité ou un multiple.
|
||||
QtyRecalculatedWithPackaging=La quantité de la ligne a été recalculée en fonction de l'emballage du fournisseur
|
||||
|
||||
#Attributes
|
||||
|
||||
@ -112,8 +112,8 @@ class Mo extends CommonObject
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
|
||||
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
|
||||
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
|
||||
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
|
||||
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
|
||||
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
|
||||
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
|
||||
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
|
||||
@ -148,25 +148,8 @@ if ($action == 'other') {
|
||||
$value = GETPOST('activate_FillProductDescAuto', 'alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($value) {
|
||||
$sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
|
||||
$resql = $db->query($sql_test);
|
||||
if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
|
||||
$sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN desc_fourn text";
|
||||
$resql_new = $db->query($sql_new);
|
||||
}
|
||||
}
|
||||
|
||||
$value = GETPOST('activate_useProdSupplierPackaging', 'alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity);
|
||||
if ($value) {
|
||||
$sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
|
||||
$resql = $db->query($sql_test);
|
||||
if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
|
||||
$sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1";
|
||||
$resql_new = $db->query($sql_new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen') { // For products
|
||||
|
||||
@ -1947,7 +1947,10 @@ class Product extends CommonObject
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
||||
$sql .= " pfp.packaging";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= " WHERE pfp.fk_product = ".((int) $product_id);
|
||||
$sql .= " WHERE 1 = 1";
|
||||
if ($product_id > 0) {
|
||||
$sql .= " AND pfp.fk_product = ".((int) $product_id);
|
||||
}
|
||||
if ($fourn_ref != 'none') {
|
||||
$sql .= " AND pfp.ref_fourn = '".$this->db->escape($fourn_ref)."'";
|
||||
}
|
||||
@ -2189,7 +2192,8 @@ class Product extends CommonObject
|
||||
$this->db->commit();
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -320,9 +320,10 @@ if (empty($reshook)) {
|
||||
if (empty($packaging)) {
|
||||
$packaging = 1;
|
||||
}
|
||||
/* We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50.
|
||||
if ($packaging < $quantity) {
|
||||
$packaging = $quantity;
|
||||
}
|
||||
}*/
|
||||
$object->packaging = $packaging;
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
|
||||
@ -171,10 +171,15 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
if (!$error) {
|
||||
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
||||
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
|
||||
$object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
|
||||
$ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
|
||||
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -394,13 +399,21 @@ if (empty($reshook)) {
|
||||
if ($action == 'activate_price_by_qty') {
|
||||
// Activating product price by quantity add a new price line with price_by_qty set to 1
|
||||
$level = GETPOST('level', 'int');
|
||||
$object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
|
||||
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
|
||||
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
// Unset Price by quantity
|
||||
if ($action == 'disable_price_by_qty') {
|
||||
// Disabling product price by quantity add a new price line with price_by_qty set to 0
|
||||
$level = GETPOST('level', 'int');
|
||||
$object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
|
||||
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
|
||||
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité
|
||||
@ -1483,13 +1496,17 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
|
||||
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
|
||||
// We emulate the change of the price from interface with the same value than the one into table llx_product
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
$object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1);
|
||||
$ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1);
|
||||
} else {
|
||||
$object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min));
|
||||
$ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min));
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
} else {
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
}
|
||||
|
||||
if ($num > 0) {
|
||||
|
||||
@ -180,9 +180,14 @@ if (empty($reshook)) {
|
||||
$result = $object->create($user);
|
||||
if (!$error && $result > 0) {
|
||||
// Add myself as project leader
|
||||
$typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error.
|
||||
$typeofcontact = 'PROJECTLEADER';
|
||||
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
|
||||
if ($result < 0) {
|
||||
|
||||
// -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case
|
||||
if ($result == -3) {
|
||||
setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors');
|
||||
$error++;
|
||||
} elseif ($result < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
@ -615,11 +620,11 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
||||
}
|
||||
|
||||
if (count($array) > 0) {
|
||||
print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('public', $array, GETPOST('public'), 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
} else {
|
||||
print '<input type="hidden" name="public" id="public" value="'.(GETPOSTISSET('public') ? GETPOST('public') : $object->public).'">';
|
||||
print '<input type="hidden" name="public" id="public" value="'.GETPOST('public').'">';
|
||||
|
||||
if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) {
|
||||
if (GETPOST('public') == 0) {
|
||||
print $langs->trans("PrivateProject");
|
||||
} else {
|
||||
print $langs->trans("SharedProject");
|
||||
|
||||
@ -1604,23 +1604,23 @@ class Task extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
|
||||
$sql .= " WHERE rowid = ".$this->timespent_id;
|
||||
|
||||
dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
|
||||
$sql .= " WHERE rowid = ".$this->timespent_id;
|
||||
|
||||
dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -254,10 +254,10 @@ if (empty($reshook)) {
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $origin_id;
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
$object->weight = GETPOST('weight', 'int') == '' ? "NULL" : GETPOST('weight', 'int');
|
||||
$object->sizeH = GETPOST('sizeH', 'int') == '' ? "NULL" : GETPOST('sizeH', 'int');
|
||||
$object->sizeW = GETPOST('sizeW', 'int') == '' ? "NULL" : GETPOST('sizeW', 'int');
|
||||
$object->sizeS = GETPOST('sizeS', 'int') == '' ? "NULL" : GETPOST('sizeS', 'int');
|
||||
$object->weight = GETPOST('weight', 'int') == '' ? null : GETPOST('weight', 'int');
|
||||
$object->sizeH = GETPOST('sizeH', 'int') == '' ? null : GETPOST('sizeH', 'int');
|
||||
$object->sizeW = GETPOST('sizeW', 'int') == '' ? null : GETPOST('sizeW', 'int');
|
||||
$object->sizeS = GETPOST('sizeS', 'int') == '' ? null : GETPOST('sizeS', 'int');
|
||||
$object->size_units = GETPOST('size_units', 'int');
|
||||
$object->weight_units = GETPOST('weight_units', 'int');
|
||||
|
||||
@ -679,7 +679,7 @@ if (empty($reshook)) {
|
||||
$triggersendname = 'RECEPTION_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfromreception';
|
||||
$trackid = 'shi'.$object->id;
|
||||
$trackid = 'rec'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
@ -1921,15 +1921,16 @@ if ($action == 'create') {
|
||||
|
||||
// Warehouse source
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
print '<td class="left">';
|
||||
|
||||
if ($lines[$i]->fk_entrepot > 0) {
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($lines[$i]->fk_entrepot);
|
||||
print $entrepot->getNomUrl(1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '<td class="left tdoverflowmax150" title="'.dol_escape_htmltag($entrepot->label).'">';
|
||||
print $entrepot->getNomUrl(1);
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Batch number managment
|
||||
|
||||
@ -236,7 +236,6 @@ class Reception extends CommonObject
|
||||
|
||||
$this->user = $user;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."reception (";
|
||||
@ -273,12 +272,12 @@ class Reception extends CommonObject
|
||||
$sql .= ", ".$this->fk_project;
|
||||
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null");
|
||||
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
|
||||
$sql .= ", ".$this->weight;
|
||||
$sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
||||
$sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth
|
||||
$sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
||||
$sql .= ", ".$this->weight_units;
|
||||
$sql .= ", ".$this->size_units;
|
||||
$sql .= ", ".(is_null($this->weight) ? "NULL" : ((double) $this->weight));
|
||||
$sql .= ", ".(is_null($this->sizeS) ? "NULL" : ((double) $this->sizeS)); // TODO Should use this->trueDepth
|
||||
$sql .= ", ".(is_null($this->sizeW) ? "NULL" : ((double) $this->sizeW)); // TODO Should use this->trueWidth
|
||||
$sql .= ", ".(is_null($this->sizeH) ? "NULL" : ((double) $this->sizeH)); // TODO Should use this->trueHeight
|
||||
$sql .= ", ".(is_null($this->weight_units) ? "NULL" : ((double) $this->weight_units));
|
||||
$sql .= ", ".(is_null($this->size_units) ? "NULL" : ((double) $this->size_units));
|
||||
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
|
||||
@ -566,7 +565,7 @@ class Reception extends CommonObject
|
||||
|
||||
// Loop on each product line to add a stock movement
|
||||
// TODO in future, reception lines may not be linked to order line
|
||||
$sql = "SELECT cd.fk_product, cd.subprice,";
|
||||
$sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,";
|
||||
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
|
||||
$sql .= " ed.eatby, ed.sellby, ed.batch";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
|
||||
@ -592,12 +591,19 @@ class Reception extends CommonObject
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
$mouvS->origin = &$this;
|
||||
|
||||
// get unit price with discount
|
||||
$up_ht_disc = $obj->subprice;
|
||||
if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) {
|
||||
$up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU');
|
||||
}
|
||||
|
||||
if (empty($obj->batch)) {
|
||||
// line without batch detail
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
$inventorycode = '';
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors[] = $mouvS->error;
|
||||
@ -610,7 +616,8 @@ class Reception extends CommonObject
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
||||
$inventorycode = '';
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors[] = $mouvS->error;
|
||||
@ -727,8 +734,14 @@ class Reception extends CommonObject
|
||||
$line->qty = $qty;
|
||||
|
||||
$supplierorderline = new CommandeFournisseurLigne($this->db);
|
||||
$supplierorderline->fetch($id);
|
||||
$result = $supplierorderline->fetch($id);
|
||||
if ($result <= 0) {
|
||||
$this->error = $supplierorderline->error;
|
||||
$this->errors = $supplierorderline->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
$fk_product = 0;
|
||||
if (!empty($conf->stock->enabled) && !empty($supplierorderline->fk_product)) {
|
||||
$fk_product = $supplierorderline->fk_product;
|
||||
|
||||
|
||||
@ -491,6 +491,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
|
||||
if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " WHERE e.entity IN (".getEntity('reception').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all
|
||||
$sql .= " AND e.fk_soc = sc.fk_soc";
|
||||
@ -976,6 +979,9 @@ while ($i < min($num, $limit)) {
|
||||
{
|
||||
}*/
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
|
||||
@ -1071,6 +1077,13 @@ if ($num == 0) {
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011-2012 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
|
||||
@ -225,7 +225,7 @@ if ($action == "setaskforshippingmet") {
|
||||
}
|
||||
}
|
||||
|
||||
//Activate "Disable prospect/customer type"
|
||||
// Activate "Disable prospect/customer type"
|
||||
if ($action == "setdisableprospectcustomer") {
|
||||
$setdisableprospectcustomer = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -986,21 +986,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$modCodeFournisseur = new $module;
|
||||
|
||||
// Define if customer/prospect or supplier status is set or not
|
||||
if (GETPOST("type") != 'f') {
|
||||
if (GETPOST("type", 'aZ') != 'f') {
|
||||
$object->client = -1;
|
||||
if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) {
|
||||
$object->client = 3;
|
||||
}
|
||||
}
|
||||
// Prospect / Customer
|
||||
if (GETPOST("type") == 'c') {
|
||||
if (GETPOST("type", 'aZ') == 'c') {
|
||||
if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) {
|
||||
$object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT;
|
||||
} else {
|
||||
$object->client = 3;
|
||||
}
|
||||
}
|
||||
if (GETPOST("type") == 'p') {
|
||||
if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS) && $object->client == 3) {
|
||||
$object->client = 1;
|
||||
}
|
||||
if (GETPOST("type", 'aZ') == 'p') {
|
||||
$object->client = 2;
|
||||
}
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) {
|
||||
@ -1757,21 +1760,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if (GETPOSTISSET('name')) {
|
||||
// We overwrite with values if posted
|
||||
$object->name = GETPOST('name', 'alphanohtml');
|
||||
$object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
|
||||
$object->client = GETPOST('client', 'int');
|
||||
$object->code_client = GETPOST('customer_code', 'alpha');
|
||||
$object->fournisseur = GETPOST('fournisseur', 'int');
|
||||
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
|
||||
$object->address = GETPOST('address', 'alphanohtml');
|
||||
$object->zip = GETPOST('zipcode', 'alphanohtml');
|
||||
$object->town = GETPOST('town', 'alphanohtml');
|
||||
$object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id;
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
//$object->skype = GETPOST('skype', 'alpha');
|
||||
//$object->twitter = GETPOST('twitter', 'alpha');
|
||||
//$object->facebook = GETPOST('facebook', 'alpha');
|
||||
//$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
$object->name = GETPOST('name', 'alphanohtml');
|
||||
$object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml');
|
||||
$object->client = GETPOST('client', 'int');
|
||||
$object->code_client = GETPOST('customer_code', 'alpha');
|
||||
$object->fournisseur = GETPOST('fournisseur', 'int');
|
||||
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
|
||||
$object->address = GETPOST('address', 'alphanohtml');
|
||||
$object->zip = GETPOST('zipcode', 'alphanohtml');
|
||||
$object->town = GETPOST('town', 'alphanohtml');
|
||||
$object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id;
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
//$object->skype = GETPOST('skype', 'alpha');
|
||||
//$object->twitter = GETPOST('twitter', 'alpha');
|
||||
//$object->facebook = GETPOST('facebook', 'alpha');
|
||||
//$object->linkedin = GETPOST('linkedin', 'alpha');
|
||||
$object->socialnetworks = array();
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
|
||||
@ -48,7 +48,7 @@ if (!isset($action)) {
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$langs->loadLangs(array("main", "cashdesk", "companies"));
|
||||
$langs->loadLangs(array("main", "bills", "cashdesk", "companies"));
|
||||
|
||||
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
|
||||
|
||||
@ -68,7 +68,7 @@ if (empty($user->rights->takepos->run)) {
|
||||
top_httphead('text/html');
|
||||
|
||||
if ($place > 0) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
@ -79,6 +79,7 @@ $object = new Facture($db);
|
||||
$object->fetch($facid);
|
||||
|
||||
// Call to external receipt modules if exist
|
||||
$parameters = array();
|
||||
$hookmanager->initHooks(array('takeposfrontend'), $facid);
|
||||
$reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object);
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
|
||||
@ -536,7 +536,14 @@ class ProductCombination
|
||||
$new_price += $variation_price;
|
||||
}
|
||||
|
||||
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
|
||||
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
|
||||
|
||||
if ($ret < 0) {
|
||||
$this->db->rollback();
|
||||
$this->error = $child->error;
|
||||
$this->errors = $child->errors;
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -558,7 +565,14 @@ class ProductCombination
|
||||
$new_price += $this->variation_price;
|
||||
}
|
||||
|
||||
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
|
||||
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
|
||||
|
||||
if ($ret < 0) {
|
||||
$this->db->rollback();
|
||||
$this->error = $child->error;
|
||||
$this->errors = $child->errors;
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
@ -567,6 +581,8 @@ class ProductCombination
|
||||
}
|
||||
|
||||
$this->db->rollback();
|
||||
$this->error = $child->error;
|
||||
$this->errors = $child->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +234,14 @@ if (empty($modulepart)) {
|
||||
accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
|
||||
}
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
|
||||
// When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output
|
||||
// is not set on the requested entity, but they are public documents, so reset entity
|
||||
if ($modulepart === 'medias' && $entity != $conf->entity) {
|
||||
$conf->entity = $entity;
|
||||
$conf->setValues($db);
|
||||
}
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user