Merge branch 'develop' into productinstock

This commit is contained in:
Laurent Destailleur 2022-04-29 18:52:46 +02:00 committed by GitHub
commit 498c6a4804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 969 additions and 678 deletions

View File

@ -34,7 +34,7 @@ Following changes may create regressions for some external modules, but were nec
* The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
* All triggers with a name XXX_UPDATE have been rename with name XXX_MODIFY for code consistency purpose.
* Rename build_path_from_id_categ() into buildPathFromId() and set method to private
* Move massaction 'confirm_createbills' from actions_massactions.inc.php to commande/list.php
***** ChangeLog for 15.0.1 compared to 15.0.0 *****
FIX: #19777 #20281

View File

@ -8,12 +8,13 @@ This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog.
To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- Update version/info in ChangeLog, for this you can:
To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- To know number of lines changes: git diff --shortstat A B
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
Recopy the content of the output file into the file ChangeLog.
- Note: To know number of lines changes: git diff --shortstat A B
- Update version number with x.y.z-w in file htdocs/filefunc.inc.php
- Commit all changes.
- Run makepack-dolibarr.pl to generate all packages.
@ -24,7 +25,6 @@ To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dol
(/home/dolibarr/wwwroot/files/lastbuild).
- Post a news on dolibarr.org/dolibarr.fr + social networks
- Send mail on mailings-list
***** Actions to do a RELEASE *****
@ -32,12 +32,13 @@ This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog.
To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- Update version/info in ChangeLog, for this you can:
To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from a repo pn branch x.y), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- To know number of lines changes: git diff --shortstat A B
- Update version number with x.y.z in htdocs/filefunc.inc.php
Recopy the content of the output file into the file ChangeLog.
- Note: To know the number of lines changes: git diff --shortstat A B
- Update version number with x.y.z in file htdocs/filefunc.inc.php
- Commit all changes.
- Run makepack-dolibarr.pl to generate all packages.
@ -52,4 +53,3 @@ To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dol
on server to point to new files (used by some web sites).
- Post a news on dolibarr.org/dolibarr.fr + social networks
- Send mail on mailings-list

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,6 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->categorie->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array("companies", "compta", "accountancy", "products"));
@ -59,6 +62,8 @@ $account_number_sell = GETPOST('account_number_sell');
$changeaccount = GETPOST('changeaccount', 'array');
$changeaccount_buy = GETPOST('changeaccount_buy', 'array');
$changeaccount_sell = GETPOST('changeaccount_sell', 'array');
$searchCategoryProductOperator = (GETPOST('search_category_product_operator', 'int') ? GETPOST('search_category_product_operator', 'int') : 0);
$searchCategoryProductList = GETPOST('search_category_product_list', 'array');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
@ -144,6 +149,8 @@ if ($reshook < 0) {
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$searchCategoryProductOperator = 0;
$searchCategoryProductList = array();
$search_ref = '';
$search_label = '';
$search_desc = '';
@ -283,7 +290,16 @@ $aacompta_prodsell = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUN
$aacompta_prodsell_intra = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodsell_export = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
llxHeader('', $langs->trans("ProductsBinding"));
$title = $langs->trans("ProductsBinding");
$helpurl = '';
$paramsCat = '';
foreach ($searchCategoryProductList as $searchCategoryProduct) {
$paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct);
}
llxHeader('', $title, $helpurl, '', 0, 0, array(), array(), $paramsCat, '');
$pcgverid = getDolGlobalString('CHARTOFACCOUNTS');
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
@ -308,6 +324,9 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
} else {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
}
if (!empty($searchCategoryProductList)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if (strlen(trim($search_current_account))) {
$sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, $search_current_account);
@ -318,6 +337,30 @@ if ($search_current_account_valid == 'withoutvalidaccount') {
if ($search_current_account_valid == 'withvalidaccount') {
$sql .= " AND aa.account_number IS NOT NULL";
}
$searchCategoryProductSqlList = array();
if ($searchCategoryProductOperator == 1) {
foreach ($searchCategoryProductList as $searchCategoryProduct) {
if (intval($searchCategoryProduct) == -2) {
$searchCategoryProductSqlList[] = "cp.fk_categorie IS NULL";
} elseif (intval($searchCategoryProduct) > 0) {
$searchCategoryProductSqlList[] = "cp.fk_categorie = ".$db->escape($searchCategoryProduct);
}
}
if (!empty($searchCategoryProductSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
}
} else {
foreach ($searchCategoryProductList as $searchCategoryProduct) {
if (intval($searchCategoryProduct) == -2) {
$searchCategoryProductSqlList[] = "cp.fk_categorie IS NULL";
} elseif (intval($searchCategoryProduct) > 0) {
$searchCategoryProductSqlList[] = "p.rowid IN (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_categorie = ".((int) $searchCategoryProduct).")";
}
}
if (!empty($searchCategoryProductSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
}
}
// Add search filter like
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
@ -338,6 +381,15 @@ if ($search_onpurchase != '' && $search_onpurchase != '-1') {
$sql .= natural_search('p.tobuy', $search_onpurchase, 1);
}
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,";
$sql .= " p.fk_product_type,";
$sql .= ' p.tms,';
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export";
} else {
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export";
}
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
@ -365,11 +417,17 @@ if ($result) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($searchCategoryProductOperator == 1) {
$param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator);
}
foreach ($searchCategoryProductList as $searchCategoryProduct) {
$param .= "&search_category_product_list[]=".urlencode($searchCategoryProduct);
}
if ($search_ref > 0) {
$param .= "&search_desc=".urlencode($search_ref);
$param .= "&search_ref=".urlencode($search_ref);
}
if ($search_label > 0) {
$param .= "&search_desc=".urlencode($search_label);
$param .= "&search_label=".urlencode($search_label);
}
if ($search_desc > 0) {
$param .= "&search_desc=".urlencode($search_desc);
@ -461,6 +519,40 @@ if ($result) {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($chk_prod)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
}
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);
$categoriesProductArr[-2] = '- '.$langs->trans('NotCategorized').' -';
$moreforfilter .= Form::multiselectarray('search_category_product_list', $categoriesProductArr, $searchCategoryProductList, 0, 0, 'minwidth300');
$moreforfilter .= ' <input type="checkbox" class="valignmiddle" name="search_category_product_operator" value="1"'.($searchCategoryProductOperator == 1 ? ' checked="checked"' : '').'/> <span class="none">'.$langs->trans('UseOrOperatorForCategories').'</span>';
$moreforfilter .= '</div>';
}
//Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
if ($moreforfilter) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';

View File

@ -267,7 +267,7 @@ if ($action == "confirm_update") {
if ($mode != '_tmp') {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
$action = 'update';
$action = '';
$id = $object->id;
$piece_num = $object->piece_num;
}
@ -647,6 +647,12 @@ if ($action == 'create') {
print "</tr>\n";
// Empty line is the first line of $object->linesmvt
// So we must get the first line (the empty one) and put it at the end of the array
// in order to display it correctly to the user
$empty_line = array_shift($object->linesmvt);
$object->linesmvt[]= $empty_line;
foreach ($object->linesmvt as $line) {
print '<tr class="oddeven">';
$total_debit += $line->debit;
@ -677,7 +683,33 @@ if ($action == 'create') {
print '<input type="hidden" name="id" value="'.$line->id.'">'."\n";
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">';
print '</td>';
} elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
if ($action == "" || $action == 'add') {
print '<!-- td columns in add mode -->';
print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
// Also, it is not possible to use a value that is not in the list.
// Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
}
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">';
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td>';
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
print '</td>';
}
} else {
print '<!-- td columns in display mode -->';
$resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true);
print '<td>';
if ($resultfetch > 0) {
@ -733,35 +765,6 @@ if ($action == 'create') {
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings');
}
if (empty($object->date_export) && empty($object->date_validation)) {
if ($action == "" || $action == 'add') {
print '<tr class="oddeven">';
print '<!-- td columns in add mode -->';
print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
// Also, it is not possible to use a value that is not in the list.
// Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
}
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">';
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td>';
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
print '</td>';
print '</tr>';
}
}
print '</table>';
print '</div>';

View File

@ -980,6 +980,8 @@ class AccountancyExport
print dol_string_unaccent($date_creation) . $separator;
// FEC:EcritureLib
// Clean label operation to prevent problem on export with tab separator & other character
$line->label_operation = str_replace(array("\t", "\n", "\r"), " ", $line->label_operation);
print dol_string_unaccent($line->label_operation) . $separator;
// FEC:Debit
@ -1007,6 +1009,8 @@ class AccountancyExport
print $date_limit_payment . $separator;
// FEC_suppl:NumFacture
// Clean ref invoice to prevent problem on export with tab separator & other character
$refInvoice = str_replace(array("\t", "\n", "\r"), " ", $refInvoice);
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1);
print $end_line;
@ -1107,6 +1111,8 @@ class AccountancyExport
print $date_document . $separator;
// FEC:EcritureLib
// Clean label operation to prevent problem on export with tab separator & other character
$line->label_operation = str_replace(array("\t", "\n", "\r"), " ", $line->label_operation);
print dol_string_unaccent($line->label_operation) . $separator;
// FEC:Debit
@ -1134,6 +1140,8 @@ class AccountancyExport
print $date_limit_payment . $separator;
// FEC_suppl:NumFacture
// Clean ref invoice to prevent problem on export with tab separator & other character
$refInvoice = str_replace(array("\t", "\n", "\r"), " ", $refInvoice);
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1);
@ -1712,6 +1720,8 @@ class AccountancyExport
print self::trunc($line->label_compte, 60).$separator; //Account label
print self::trunc($line->doc_ref, 20).$separator; //Piece
// Clean label operation to prevent problem on export with tab separator & other character
$line->label_operation = str_replace(array("\t", "\n", "\r"), " ", $line->label_operation);
print self::trunc($line->label_operation, 60).$separator; //Operation label
print price(abs($line->debit - $line->credit)).$separator; //Amount
print $line->sens.$separator; //Direction

View File

@ -172,7 +172,7 @@ $result = restrictedArea($user, 'adherent');
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
@ -587,7 +587,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').'&ensp;'.$langs->trans("SendByMail"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
if ($user->rights->adherent->creer) {

View File

@ -111,7 +111,7 @@ $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}

View File

@ -485,18 +485,17 @@ if ($mode == 'other') {
print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
print $langs->trans("Miscelaneous");
print '</td><td class="titlefieldmiddle">';
print '</td></tr>';
print $langs->trans("Miscellaneous");
print '</td>';
print '<td class="titlefieldmiddle"></td>';
print '</tr>';
// Max size of lists
print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Max size of short lists on customer card
print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// show input border
@ -504,7 +503,6 @@ if ($mode == 'other') {
print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
*/
@ -512,21 +510,18 @@ if ($mode == 'other') {
print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// DefaultWorkingDays
print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5') . '">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// DefaultWorkingHours
print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18') . '">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Firstname/Name
@ -534,7 +529,6 @@ if ($mode == 'other') {
$array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Hide unauthorized menus
@ -542,7 +536,6 @@ if ($mode == 'other') {
//print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Hide unauthorized button
@ -550,7 +543,6 @@ if ($mode == 'other') {
//print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Hide version link
@ -559,7 +551,6 @@ if ($mode == 'other') {
print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
*/
@ -569,7 +560,6 @@ if ($mode == 'other') {
print '</td><td>';
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Hide wiki link on login page
@ -578,7 +568,6 @@ if ($mode == 'other') {
print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Disable javascript and ajax
@ -586,8 +575,6 @@ if ($mode == 'other') {
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print ' <span class="opacitymedium paddingleft marginleft">' . $langs->trans("DisableJavascriptNote") . '</span>';
print '</td>';
print '<td>';
print '</td>';
print '</tr>';
print '</table>' . "\n";

View File

@ -435,7 +435,8 @@ foreach ($configfileparameters as $key => $value) {
if (empty($valuetoshow)) {
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
}
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("HashForPing").'='.md5('dolibarr'.$valuetoshow).')</span>';
print '</td></tr>';
print '<tr class="oddeven"><td></td><td>&nbsp; => '.$langs->trans("HashForPing").'</td><td>'.md5('dolibarr'.$valuetoshow).'</td></tr>'."\n";
} elseif ($newkey == 'dolibarr_main_prod') {
print ${$newkey};

View File

@ -611,6 +611,16 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$object = new FactureFournisseur($this->db);
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
$modulepart = 'commande';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$object = new Commande($this->db);
} elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') {
$modulepart = 'supplier_order';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$object = new CommandeFournisseur($this->db);
} elseif ($modulepart == 'project') {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object = new Project($this->db);
@ -669,7 +679,7 @@ class Documents extends DolibarrApi
}
// Special cases that need to use get_exdir to get real dir of object
// If future, all object should use this to define path of documents.
// In future, all object should use this to define path of documents.
if ($modulepart == 'supplier_invoice') {
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
}

View File

@ -1646,17 +1646,17 @@ if ($action == 'create') {
print '</td></tr>';
// Validaty duration
print '<tr><td class="fieldrequired">'.$langs->trans("ValidityDuration").'</td><td>'.img_picto('', 'clock').'&ensp;<input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("ValidityDuration").'</td><td>'.img_picto('', 'clock', 'class="paddingright"').'<input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
// Terms of payment
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'paiment');
print img_picto('', 'payment', 'class="pictofixedwidth"');
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
print '</td></tr>';
// Mode of payment
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print img_picto('', 'bank').'&ensp;';
print img_picto('', 'bank', 'class="pictofixedwidth"');
$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
@ -1679,7 +1679,7 @@ if ($action == 'create') {
print ' ('.$langs->trans('AfterOrder').')';
}
print '</td><td>';
print img_picto('', 'clock').'&ensp;';
print img_picto('', 'clock', 'class="pictofixedwidth"');
$form->selectAvailabilityDelay('', 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
@ -1741,7 +1741,7 @@ if ($action == 'create') {
print '<tr>';
print '<td>'.$langs->trans("DefaultModel").'</td>';
print '<td>';
print img_picto('', 'pdf').'&ensp;';
print img_picto('', 'pdf', 'class="pictofixedwidth"');
$liste = ModelePDFPropales::liste_modeles($db);
$preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF"));
print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
@ -1752,7 +1752,7 @@ if ($action == 'create') {
print '<tr>';
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
print '</td></tr>';
}

View File

@ -1670,7 +1670,7 @@ if ($action == 'create' && $usercancreate) {
// Terms of the settlement
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'paiment');
print img_picto('', 'payment', 'class="pictofixedwidth"');
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1);
print '</td></tr>';
@ -1759,10 +1759,10 @@ if ($action == 'create' && $usercancreate) {
// Template to use by default
print '<tr><td>'.$langs->trans('DefaultModel').'</td>';
print '<td>';
print img_picto('', 'pdf', 'class="pictofixedwidth"');
include_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
$liste = ModelePDFCommandes::liste_modeles($db);
$preselected = $conf->global->COMMANDE_ADDON_PDF;
print img_picto('', 'pdf', 'class="pictofixedwidth"');
print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
print "</td></tr>";
@ -1771,7 +1771,7 @@ if ($action == 'create' && $usercancreate) {
print '<tr>';
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>';
}

View File

@ -302,6 +302,352 @@ if (empty($reshook)) {
$uploaddir = $conf->commande->multidir_output[$conf->entity];
$triggersendname = 'ORDER_SENTBYMAIL';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction == 'confirm_createbills') { // Create bills from orders.
$orders = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('validate_invoices', 'int');
$errors = array();
$TFact = array();
$TFactThird = array();
$TFactThirdNbLines = array();
$nb_bills_created = 0;
$lastid= 0;
$lastref = '';
$db->begin();
foreach ($orders as $id_order) {
$cmd = new Commande($db);
if ($cmd->fetch($id_order) <= 0) {
continue;
}
$cmd->fetch_thirdparty();
$objecttmp = new Facture($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
// If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it.
$objecttmp = $TFactThird[$cmd->socid];
} else {
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
$objecttmp->socid = $cmd->socid;
$objecttmp->thirdparty = $cmd->thirdparty;
$objecttmp->type = $objecttmp::TYPE_STANDARD;
$objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
$objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
if (empty($createbills_onebythird)) {
$objecttmp->ref_client = $cmd->ref_client;
}
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture)) {
$datefacture = dol_now();
}
$objecttmp->date = $datefacture;
$objecttmp->origin = 'commande';
$objecttmp->origin_id = $id_order;
$objecttmp->array_options = $cmd->array_options; // Copy extrafields
$res = $objecttmp->create($user);
if ($res > 0) {
$nb_bills_created++;
$lastref = $objecttmp->ref;
$lastid = $objecttmp->id;
$TFactThird[$cmd->socid] = $objecttmp;
$TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang
} else {
$langs->load("errors");
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]);
$error++;
}
}
if ($objecttmp->id > 0) {
$res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
if ($res == 0) {
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]);
$error++;
}
if (!$error) {
$lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines')) {
$cmd->fetch_lines();
$lines = $cmd->lines;
}
$fk_parent_line = 0;
$num = count($lines);
for ($i = 0; $i < $num; $i++) {
$desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
// If we build one invoice for several orders, we must put the ref of order on the invoice line
if (!empty($createbills_onebythird)) {
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day'));
}
if ($lines[$i]->subprice < 0) {
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc = $objecttmp->socid;
$discount->amount_ht = abs($lines[$i]->total_ht);
$discount->amount_tva = abs($lines[$i]->total_tva);
$discount->amount_ttc = abs($lines[$i]->total_ttc);
$discount->tva_tx = $lines[$i]->tva_tx;
$discount->fk_user = $user->id;
$discount->description = $desc;
$discountid = $discount->create($user);
if ($discountid > 0) {
$result = $objecttmp->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
} else {
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
} else {
// Positive line
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Date start
$date_start = false;
if ($lines[$i]->date_debut_prevue) {
$date_start = $lines[$i]->date_debut_prevue;
}
if ($lines[$i]->date_debut_reel) {
$date_start = $lines[$i]->date_debut_reel;
}
if ($lines[$i]->date_start) {
$date_start = $lines[$i]->date_start;
}
//Date end
$date_end = false;
if ($lines[$i]->date_fin_prevue) {
$date_end = $lines[$i]->date_fin_prevue;
}
if ($lines[$i]->date_fin_reel) {
$date_end = $lines[$i]->date_fin_reel;
}
if ($lines[$i]->date_end) {
$date_end = $lines[$i]->date_end;
}
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// Extrafields
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
$objecttmp->context['createfromclone'];
$rang = $lines[$i]->rang;
//there may already be rows from previous orders
if (!empty($createbills_onebythird))
$rang = $TFactThirdNbLines[$cmd->socid];
$result = $objecttmp->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$rang,
$lines[$i]->special_code,
$objecttmp->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label,
$array_options,
100,
0,
$lines[$i]->fk_unit
);
if ($result > 0) {
$lineid = $result;
if (!empty($createbills_onebythird)) //increment rang to keep order
$TFactThirdNbLines[$rcp->socid]++;
} else {
$lineid = 0;
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
}
}
}
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
$TFactThird[$cmd->socid] = $objecttmp;
} else {
$TFact[$objecttmp->id] = $objecttmp;
}
}
// Build doc with all invoices
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array();
if (!$error && $validate_invoices) {
$massaction = $action = 'builddoc';
foreach ($TAllFact as &$objecttmp) {
$result = $objecttmp->validate($user);
if ($result <= 0) {
$error++;
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
break;
}
$id = $objecttmp->id; // For builddoc action
// Builddoc
$donotredirect = 1;
$upload_dir = $conf->facture->dir_output;
$permissiontoadd = $user->rights->facture->creer;
// Call action to build doc
$savobject = $object;
$object = $objecttmp;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
$object = $savobject;
}
$massaction = $action = 'confirm_createbills';
}
if (!$error) {
$db->commit();
if ($nb_bills_created == 1) {
$texttoshow = $langs->trans('BillXCreated', '{s1}');
$texttoshow = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?id='.urlencode($lastid).'">'.$lastref.'</a>', $texttoshow);
setEventMessages($texttoshow, null, 'mesgs');
} else {
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
}
// Make a redirect to avoid to bill twice if we make a refresh or back
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);
}
if ($socid > 0) {
$param .= '&socid='.urlencode($socid);
}
if ($search_status != '') {
$param .= '&search_status='.urlencode($search_status);
}
if ($search_orderday) {
$param .= '&search_orderday='.urlencode($search_orderday);
}
if ($search_ordermonth) {
$param .= '&search_ordermonth='.urlencode($search_ordermonth);
}
if ($search_orderyear) {
$param .= '&search_orderyear='.urlencode($search_orderyear);
}
if ($search_deliveryday) {
$param .= '&search_deliveryday='.urlencode($search_deliveryday);
}
if ($search_deliverymonth) {
$param .= '&search_deliverymonth='.urlencode($search_deliverymonth);
}
if ($search_deliveryyear) {
$param .= '&search_deliveryyear='.urlencode($search_deliveryyear);
}
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
if ($search_company) {
$param .= '&search_company='.urlencode($search_company);
}
if ($search_ref_customer) {
$param .= '&search_ref_customer='.urlencode($search_ref_customer);
}
if ($search_user > 0) {
$param .= '&search_user='.urlencode($search_user);
}
if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
if ($search_total_ht != '') {
$param .= '&search_total_ht='.urlencode($search_total_ht);
}
if ($search_total_vat != '') {
$param .= '&search_total_vat='.urlencode($search_total_vat);
}
if ($search_total_ttc != '') {
$param .= '&search_total_ttc='.urlencode($search_total_ttc);
}
if ($search_project_ref >= 0) {
$param .= "&search_project_ref=".urlencode($search_project_ref);
}
if ($show_files) {
$param .= '&show_files='.urlencode($show_files);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($billed != '') {
$param .= '&billed='.urlencode($billed);
}
header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
exit;
} else {
$db->rollback();
$action = 'create';
$_GET["origin"] = $_POST["origin"];
$_GET["originid"] = $_POST["originid"];
if (!empty($errors)) {
setEventMessages(null, $errors, 'errors');
} else {
setEventMessages("Error", null, 'errors');
}
$error++;
}
}
}
if ($action == 'validate' && $permissiontoadd) {
if (GETPOST('confirm') == 'yes') {

View File

@ -778,13 +778,13 @@ if ($action == 'create') {
print '</td></tr>';
if ($conf->prelevement->enabled) {
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("StandingOrder").')</td>';
print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
print '<td>'.$object->ics.'</td>';
print '</tr>';
}
if ($conf->paymentbybanktransfer->enabled) {
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>';
print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
print '<td>'.$object->ics_transfer.'</td>';
print '</tr>';
@ -1082,12 +1082,12 @@ if ($action == 'create') {
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET('bic') ? GETPOST('bic', 'alphanohtml') : $object->bic).'"></td></tr>';
if ($conf->prelevement->enabled) {
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("StandingOrder").')</td>';
print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET('ics') ? GETPOST('ics', 'alphanohtml') : $object->ics).'"></td></tr>';
}
if ($conf->paymentbybanktransfer->enabled) {
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>';
print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET('ics_transfer') ? GETPOST('ics_transfer', 'alphanohtml') : $object->ics_transfer).'"></td></tr>';
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';

View File

@ -587,10 +587,14 @@ foreach ($accounts as $key => $type) {
// Accountancy journal
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
print '<td>';
if (!empty($conf->accounting->enabled) && !empty($objecttmp->fk_accountancy_journal)) {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
if (!empty($conf->accounting->enabled)) {
if (empty($objecttmp->fk_accountancy_journal)) {
print img_warning($langs->trans("Mandatory"));
} else {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
} else {
print '';
}

View File

@ -1724,8 +1724,8 @@ class Invoices extends DolibarrApi
*
* Return an array with invoice informations
*
* @param int $id ID of template invoice
* @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, 1: Return array contains just id, -1: Do not return contacts/adddesses
* @param int $id ID of template invoice
* @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses
* @return array|mixed data without useless information
*
* @url GET templates/{id}

View File

@ -2724,7 +2724,7 @@ class Facture extends CommonInvoice
// Check for mandatory fields in thirdparty (defined into setup)
if (!empty($this->thirdparty) && is_object($this->thirdparty)) {
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'ACCOUNTANCY_CODE_CUSTOMER');
foreach ($array_to_check as $key) {
$keymin = strtolower($key);
if (!property_exists($this->thirdparty, $keymin)) {
@ -2756,6 +2756,15 @@ class Facture extends CommonInvoice
return -1;
}
}
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
// Check for mandatory
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY) && empty($this->thirdparty->code_compta)) {
$langs->load("errors");
$this->error = $langs->trans("ErrorAccountancyCodeCustomerIsMandatory", $this->thirdparty->name).' ('.$langs->trans("ForbiddenBySetupRules").')';
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
return -1;
}
}
}
}
}

View File

@ -32,8 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
$langs->loadLangs(array('compta', 'banks', 'bills'));
$id = GETPOST("id", 'int');
$action = GETPOST("action", "alpha");
$cancel = GETPOST('cancel');
$action = GETPOST("action", "aZ09");
$cancel = GETPOST('cancel', 'aZ09');
$refund = GETPOST("refund", "int");
if (empty($refund)) {
@ -143,7 +143,7 @@ $form = new Form($db);
$title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card");
$help_url = '';
llxHeader("", $title, $helpurl);
llxHeader('', $title, $helpurl);
if ($action == 'create') {
print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));
@ -157,11 +157,13 @@ if ($action == 'create') {
print '<table class="border centpercent">';
// Date of payment
print "<tr>";
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->selectDate($datep, "datep", '', '', '', 'add', 1, 1);
print '</td></tr>';
// End date of period
print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).'</td><td>';
print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1);
print '</td></tr>';
@ -173,20 +175,24 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
if (!empty($conf->banque->enabled)) {
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
$form->select_comptes(GETPOST("accountid", "int"), "accountid", 0, "courant=1", 2); // Affiche liste des comptes courant
print '</td></tr>';
// Type payment
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("paiementtype"), "paiementtype");
$form->select_types_paiements(GETPOST("paiementtype"), "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx');
print "</td>\n";
print "</tr>";
// Bank account
print '<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans("Account").'</td><td>';
print img_picto('', 'bank_account', 'pictofixedwidth');
$form->select_comptes(GETPOST("accountid", "int"), "accountid", 0, "courant=1", 2, '', 0, 'maxwidth500 widthcentpercentminusx'); // Affiche liste des comptes courant
print '</td></tr>';
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
}
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -63,6 +63,7 @@ if ($result) {
$i = 0;
$total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
@ -85,7 +86,7 @@ if ($result) {
print '<td class="left">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
$total = $total + $obj->amount;
print "<td align=\"right\">".price($obj->amount)."</td>";
print '<td class="right nowraponall"><span class="amount">'.price($obj->amount).'</span></td>';
print "</tr>\n";
$i++;
@ -94,6 +95,8 @@ if ($result) {
print '<td class="right"><span class="amount">'.price($total).'</span></td></tr>';
print "</table>";
print '</div>';
$db->free($result);
} else {
dol_print_error($db);

View File

@ -419,7 +419,8 @@ class Paiement extends CommonObject
}
if ($error) {
setEventMessages($discount->error, $discount->errors, 'errors');
$this->error = $discount->error;
$this->errors = $discount->errors;
$error++;
}
}
@ -460,7 +461,8 @@ class Paiement extends CommonObject
$result = $invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$this->error = $invoice->error;
$this->errors = $invoice->errors;
$error++;
}
}

View File

@ -207,14 +207,15 @@ if ($action == 'create') {
print '</tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype", "int") : $tva->paiementtype, "paiementtype");
$form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype", "int") : $tva->paiementtype, "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx');
print "</td>\n";
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$form->select_comptes(GETPOST("accountid") ? GETPOST("accountid", "int") : $tva->accountid, "accountid", 0, '', 1); // Show opend bank account list
print img_picto('', 'bank_account', 'pictofixedwidth');
$form->select_comptes(GETPOST("accountid", "int") ? GETPOST("accountid", "int") : $tva->accountid, "accountid", 0, '', 1, '', 0, 'maxwidth500 widthcentpercentminusx'); // Show opend bank account list
print '</td></tr>';
// Number
@ -225,7 +226,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '<td class="tdtop"><textarea name="note" class="quatrevingtpercent" wrap="soft" rows="'.ROWS_3.'"></textarea></td>';
print '</tr>';
print '</table>';
@ -238,6 +239,7 @@ if ($action == 'create') {
$num = 1;
$i = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
//print '<td>'.$langs->trans("SocialContribution").'</td>';
@ -259,14 +261,14 @@ if ($action == 'create') {
if ($objp->datev > 0) {
print '<td class="left">'.dol_print_date($objp->datev, 'day').'</td>'."\n";
} else {
print "<td align=\"center\"><b>!!!</b></td>\n";
print '<td class="center"><b>!!!</b></td>'."\n";
}
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>";
print '<td class="right nowraponall"><span class="amount">'.price($objp->amount)."</span></td>";
print '<td class="right"><span class="amount">'.price($sumpaid)."</span></td>";
print '<td class="right nowraponall"><span class="amount">'.price($sumpaid)."</span></td>";
print '<td class="right"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
print '<td class="right nowraponall"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
print '<td class="center">';
@ -279,7 +281,7 @@ if ($action == 'create') {
} */
$remaintopay = $objp->amount - $sumpaid;
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
print '<input type="text" class="right width100" name="'.$namef.'" id="'.$namef.'" value="'.$remaintopay.'">';
print '<input type="text" class="right width75" name="'.$namef.'" id="'.$namef.'" value="'.$remaintopay.'">';
} else {
print '-';
}
@ -303,6 +305,7 @@ if ($action == 'create') {
}
print "</table>";
print '</div>';
// Bouton Save payment
print '<br><div class="center"><input type="checkbox" checked name="closepaidvat"> '.$langs->trans("ClosePaidVATAutomatically");

View File

@ -922,7 +922,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql .= " WHERE ref LIKE '%".$this->db->escape($ref)."%'";
$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
$sql .= " AND entity = ".((int) $conf->entity);
$sql .= " ORDER BY ref DESC LIMIT 1";
@ -933,7 +933,7 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql);
// Build the new ref
$ref = "T".$ref.str_pad(dol_substr("00".(intval($row[0]) + 1), 0, 2), 2, "0", STR_PAD_LEFT);
$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
// $conf->abc->dir_output may be:
// /home/ldestailleur/git/dolibarr_15.0/documents/abc/

View File

@ -1042,7 +1042,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
}
$case = strftime("%Y-%m", dol_mktime(12, 0, 0, $mois_modulo, 1, $annee_decalage));
print '<td class="right">&nbsp;';
print '<td class="right">';
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
if (isset($decaiss[$case]) && $decaiss[$case] != 0) {
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price(price2num($decaiss[$case], 'MT')).'</a>';
@ -1062,7 +1062,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
}
print "</td>";
print '<td class="borderrightlight nowrap right">&nbsp;';
print '<td class="borderrightlight nowrap right">';
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
if (isset($encaiss[$case])) {
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price(price2num($encaiss[$case], 'MT')).'</a>';

View File

@ -460,7 +460,7 @@ if ($action == 'create') {
print '</div>';
print '</td>';
//print "<br>\n";
print "</tr>\n";
// Label
if ($refund == 1) {
@ -490,14 +490,15 @@ if ($action == 'create') {
// Type payment
print '<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
$form->select_types_paiements(GETPOST("type_payment", 'int'), "type_payment", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx');
print "</td>\n";
print "</tr>";
if (!empty($conf->banque->enabled)) {
// Bank account
print '<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans("BankAccount").'</td><td>';
print img_picto('', 'bank_account', 'pictofixedwidth');
$form->select_comptes(GETPOST("accountid", 'int'), "accountid", 0, "courant=1", 1); // List of bank account available
$form->select_comptes(GETPOST("accountid", 'int'), "accountid", 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusx'); // List of bank account available
print '</td></tr>';
}
@ -509,7 +510,7 @@ if ($action == 'create') {
// Comments
print '<tr class="hide_if_no_auto_create_payment">';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'">'.GETPOST('note', 'restricthtml').'</textarea></td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" rows="'.ROWS_3.'" class="quatrevingtpercent">'.GETPOST('note', 'restricthtml').'</textarea></td>';
print '</tr>';
// Other attributes

View File

@ -163,7 +163,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}

View File

@ -128,6 +128,14 @@ if (!$error && $massaction == 'confirm_presend') {
$listofobjectcontacts[$toselectid][$data_email['id']] = $data_email['email'];
}
}
} elseif ($objectclass == 'CommandeFournisseur') {
$tmparraycontact = array();
$tmparraycontact = $objecttmp->liste_contact(-1, 'external', 0, 'CUSTOMER');
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
foreach ($tmparraycontact as $data_email) {
$listofobjectcontacts[$toselectid][$data_email['id']] = $data_email['email'];
}
}
}
$listofobjectthirdparties[$thirdpartyid] = $thirdpartyid;
@ -277,6 +285,19 @@ if (!$error && $massaction == 'confirm_presend') {
if (count($emails_to_sends) > 0) {
$sendto = implode(',', $emails_to_sends);
}
} elseif ($objectobj->element == 'order_supplier' && !empty($listofobjectcontacts[$objectid])) {
$emails_to_sends = array();
$objectobj->fetch_thirdparty();
$contactidtosend = array();
foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) {
$emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid, 'email');
if (!in_array($contactemailid, $contactidtosend)) {
$contactidtosend[] = $contactemailid;
}
}
if (count($emails_to_sends) > 0) {
$sendto = implode(',', $emails_to_sends);
}
} else {
$objectobj->fetch_thirdparty();
$sendto = $objectobj->thirdparty->email;
@ -625,349 +646,6 @@ if (!$error && $massaction == 'confirm_presend') {
}
}
// TODO Move this action into commande/list.php if called only by this page.
if ($massaction == 'confirm_createbills') { // Create bills from orders.
$orders = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('validate_invoices', 'int');
$errors = array();
$TFact = array();
$TFactThird = array();
$TFactThirdNbLines = array();
$nb_bills_created = 0;
$lastid= 0;
$lastref = '';
$db->begin();
foreach ($orders as $id_order) {
$cmd = new Commande($db);
if ($cmd->fetch($id_order) <= 0) {
continue;
}
$cmd->fetch_thirdparty();
$objecttmp = new Facture($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
// If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it.
$objecttmp = $TFactThird[$cmd->socid];
} else {
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
$objecttmp->socid = $cmd->socid;
$objecttmp->thirdparty = $cmd->thirdparty;
$objecttmp->type = $objecttmp::TYPE_STANDARD;
$objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
$objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
if (empty($createbills_onebythird)) {
$objecttmp->ref_client = $cmd->ref_client;
}
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture)) {
$datefacture = dol_now();
}
$objecttmp->date = $datefacture;
$objecttmp->origin = 'commande';
$objecttmp->origin_id = $id_order;
$objecttmp->array_options = $cmd->array_options; // Copy extrafields
$res = $objecttmp->create($user);
if ($res > 0) {
$nb_bills_created++;
$lastref = $objecttmp->ref;
$lastid = $objecttmp->id;
$TFactThird[$cmd->socid] = $objecttmp;
$TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang
} else {
$langs->load("errors");
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->error);
$error++;
}
}
if ($objecttmp->id > 0) {
$res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
if ($res == 0) {
$errors[] = $objecttmp->error;
$error++;
}
if (!$error) {
$lines = $cmd->lines;
if (empty($lines) && method_exists($cmd, 'fetch_lines')) {
$cmd->fetch_lines();
$lines = $cmd->lines;
}
$fk_parent_line = 0;
$num = count($lines);
for ($i = 0; $i < $num; $i++) {
$desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
// If we build one invoice for several orders, we must put the ref of order on the invoice line
if (!empty($createbills_onebythird)) {
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day'));
}
if ($lines[$i]->subprice < 0) {
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc = $objecttmp->socid;
$discount->amount_ht = abs($lines[$i]->total_ht);
$discount->amount_tva = abs($lines[$i]->total_tva);
$discount->amount_ttc = abs($lines[$i]->total_ttc);
$discount->tva_tx = $lines[$i]->tva_tx;
$discount->fk_user = $user->id;
$discount->description = $desc;
$discountid = $discount->create($user);
if ($discountid > 0) {
$result = $objecttmp->insert_discount($discountid);
//$result=$discount->link_to_invoice($lineid,$id);
} else {
setEventMessages($discount->error, $discount->errors, 'errors');
$error++;
break;
}
} else {
// Positive line
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Date start
$date_start = false;
if ($lines[$i]->date_debut_prevue) {
$date_start = $lines[$i]->date_debut_prevue;
}
if ($lines[$i]->date_debut_reel) {
$date_start = $lines[$i]->date_debut_reel;
}
if ($lines[$i]->date_start) {
$date_start = $lines[$i]->date_start;
}
//Date end
$date_end = false;
if ($lines[$i]->date_fin_prevue) {
$date_end = $lines[$i]->date_fin_prevue;
}
if ($lines[$i]->date_fin_reel) {
$date_end = $lines[$i]->date_fin_reel;
}
if ($lines[$i]->date_end) {
$date_end = $lines[$i]->date_end;
}
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// Extrafields
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
$objecttmp->context['createfromclone'];
$rang = $lines[$i]->rang;
//there may already be rows from previous orders
if (!empty($createbills_onebythird))
$rang = $TFactThirdNbLines[$cmd->socid];
$result = $objecttmp->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$lines[$i]->fk_remise_except,
'HT',
0,
$product_type,
$rang,
$lines[$i]->special_code,
$objecttmp->origin,
$lines[$i]->rowid,
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label,
$array_options,
100,
0,
$lines[$i]->fk_unit
);
if ($result > 0) {
$lineid = $result;
if (!empty($createbills_onebythird)) //increment rang to keep order
$TFactThirdNbLines[$rcp->socid]++;
} else {
$lineid = 0;
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
}
}
}
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
$TFactThird[$cmd->socid] = $objecttmp;
} else {
$TFact[$objecttmp->id] = $objecttmp;
}
}
// Build doc with all invoices
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array();
if (!$error && $validate_invoices) {
$massaction = $action = 'builddoc';
foreach ($TAllFact as &$objecttmp) {
$result = $objecttmp->validate($user);
if ($result <= 0) {
$error++;
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
break;
}
$id = $objecttmp->id; // For builddoc action
// Builddoc
$donotredirect = 1;
$upload_dir = $conf->facture->dir_output;
$permissiontoadd = $user->rights->facture->creer;
// Call action to build doc
$savobject = $object;
$object = $objecttmp;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
$object = $savobject;
}
$massaction = $action = 'confirm_createbills';
}
if (!$error) {
$db->commit();
if ($nb_bills_created == 1) {
$texttoshow = $langs->trans('BillXCreated', '{s1}');
$texttoshow = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?id='.urlencode($lastid).'">'.$lastref.'</a>', $texttoshow);
setEventMessages($texttoshow, null, 'mesgs');
} else {
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
}
// Make a redirect to avoid to bill twice if we make a refresh or back
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($sall) {
$param .= '&sall='.urlencode($sall);
}
if ($socid > 0) {
$param .= '&socid='.urlencode($socid);
}
if ($search_status != '') {
$param .= '&search_status='.urlencode($search_status);
}
if ($search_orderday) {
$param .= '&search_orderday='.urlencode($search_orderday);
}
if ($search_ordermonth) {
$param .= '&search_ordermonth='.urlencode($search_ordermonth);
}
if ($search_orderyear) {
$param .= '&search_orderyear='.urlencode($search_orderyear);
}
if ($search_deliveryday) {
$param .= '&search_deliveryday='.urlencode($search_deliveryday);
}
if ($search_deliverymonth) {
$param .= '&search_deliverymonth='.urlencode($search_deliverymonth);
}
if ($search_deliveryyear) {
$param .= '&search_deliveryyear='.urlencode($search_deliveryyear);
}
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
if ($search_company) {
$param .= '&search_company='.urlencode($search_company);
}
if ($search_ref_customer) {
$param .= '&search_ref_customer='.urlencode($search_ref_customer);
}
if ($search_user > 0) {
$param .= '&search_user='.urlencode($search_user);
}
if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
if ($search_total_ht != '') {
$param .= '&search_total_ht='.urlencode($search_total_ht);
}
if ($search_total_vat != '') {
$param .= '&search_total_vat='.urlencode($search_total_vat);
}
if ($search_total_ttc != '') {
$param .= '&search_total_ttc='.urlencode($search_total_ttc);
}
if ($search_project_ref >= 0) {
$param .= "&search_project_ref=".urlencode($search_project_ref);
}
if ($show_files) {
$param .= '&show_files='.urlencode($show_files);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($billed != '') {
$param .= '&billed='.urlencode($billed);
}
header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
exit;
} else {
$db->rollback();
$action = 'create';
$_GET["origin"] = $_POST["origin"];
$_GET["originid"] = $_POST["originid"];
setEventMessages("Error", null, 'errors');
$error++;
}
}
if (!$error && $massaction == 'cancelorders') {
$db->begin();

View File

@ -6078,7 +6078,7 @@ abstract class CommonObject
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
} elseif ($value == '') {
$new_array_options[$key] = null;
$value = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$new_array_options[$key] = $value;
@ -6444,7 +6444,7 @@ abstract class CommonObject
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
} elseif ($value === '') {
$this->array_options["options_".$key] = null;
$value = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$this->array_options["options_".$key] = $value;

View File

@ -5872,6 +5872,7 @@ class Form
}
$out .= '</select>';
// Make select dynamic
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
@ -7753,13 +7754,6 @@ class Form
}
}
// Add code for jquery to use multiselect
if ($addjscombo && $jsbeautify) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', $show_empty < 0 ? (string) $show_empty : '-1');
}
$out .= '<select id="'.preg_replace('/^\./', '', $htmlname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').'"';
$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
$out .= '>';
@ -7859,6 +7853,14 @@ class Form
}
$out .= "</select>";
// Add code for jquery to use multiselect
if ($addjscombo && $jsbeautify) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', $show_empty < 0 ? (string) $show_empty : '-1');
}
return $out;
}
@ -9228,12 +9230,12 @@ class Form
if (!empty($conf->gravatar->enabled) && $email && empty($noexternsourceoverwrite)) {
// see https://gravatar.com/site/implement/images/php/
$ret .= '<!-- Put link to gravatar -->';
$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
} else {
if ($nophoto == 'company') {
$ret .= '<div class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'">'.img_picto('', 'company').'</div>';
$ret .= '<div class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'">'.img_picto('', 'company').'</div>';
} else {
$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
}
}
}

View File

@ -246,10 +246,10 @@ class FormFile
$out .= '<td>'.$options.'</td>';
}
$out .= '<td valign="middle" class="nowrap">';
$out .= '<input type="checkbox" '.$rename.' class="savingdocmask" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> ';
$out .= '<span class="opacitymedium">';
$out .= '<input type="checkbox" '.$rename.' class="savingdocmask" name="savingdocmask" id="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> ';
$out .= '<label class="opacitymedium small" for="savingdocmask">';
$out .= $langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
$out .= '</span>';
$out .= '</label>';
$out .= '</td>';
$out .= '</tr>';
}

View File

@ -1202,6 +1202,9 @@ class FormMail extends Form
if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') {
$defaultvaluefordeliveryreceipt = 1;
}
if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') {
$defaultvaluefordeliveryreceipt = 1;
}
$out .= $form->selectyesno('deliveryreceipt', (GETPOSTISSET("deliveryreceipt") ? GETPOST("deliveryreceipt") : $defaultvaluefordeliveryreceipt), 1);
}
$out .= "</td></tr>\n";

View File

@ -56,28 +56,34 @@ class FormProjets
/**
* Output a combo list with projects qualified for a third party / user
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param string $selected Id project preselected ('' or id of project)
* @param string $htmlname Name of HTML field
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable). Use a negative value to not show the "discarded" tooltip.
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
* @param int $nooutput No print output. Return it only.
* @param int $forceaddid Force to add project id in list, event if not qualified
* @param string $morecss More css
* @param int $htmlid Html id to use instead of htmlname
* @return string Return html content
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param string|Project $selected Id of preselected project or Project (or ''). Note: If you know the ref, you can also provide it into $selected_input_value to save one request in some cases.
* @param string $htmlname Name of HTML field
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable). Use a negative value to not show the "discarded" tooltip.
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
* @param int $nooutput No print output. Return it only.
* @param int $forceaddid Force to add project id in list, event if not qualified
* @param string $morecss More css
* @param int $htmlid Html id to use instead of htmlname
* @return string Return html content
*/
public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
{
// phpcs:enable
global $langs, $conf, $form;
$selected_input_value = '';
if (is_object($selected)) {
$selected_input_value = $selected->ref;
$selected = $selected->id;
}
$out = '';
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
@ -89,22 +95,20 @@ class FormProjets
$project->fetch($selected);
$selected_input_value = $project->ref;
}
$urloption = 'socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed;
$urloption = 'socid='.((int) $socid).'&htmlname='.urlencode($htmlname).'&discardclosed='.((int) $discard_closed);
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
// 'update' => array(
// 'projectid' => 'id'
// )
));
$out .= '<input type="text" class="minwidth200'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
} else {
$out .= $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss);
}
if ($discard_closed > 0) {
if (class_exists('Form')) {
if (!is_object($form)) {
$form = new Form($this->db);
}
if (!empty($form)) {
$out .= $form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
}
}

View File

@ -227,11 +227,16 @@ class RssParser
} else {
try {
$result = getURLContent($this->_urlRSS, 'GET', '', 1, array(), array('http', 'https'), 0);
if (!empty($result['content'])) {
$str = $result['content'];
} elseif (!empty($result['curl_error_msg'])) {
$this->error = 'Error retrieving URL '.$this->_urlRSS.' - '.$result['curl_error_msg'];
return -1;
}
} catch (Exception $e) {
print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage();
$this->error = 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage();
return -2;
}
}
@ -248,7 +253,8 @@ class RssParser
}
$xmlparser = xml_parser_create('');
if (!is_resource($xmlparser)) {
if (!is_resource($xmlparser) && !is_object($xmlparser)) {
$this->error = "ErrorFailedToCreateParser";
return -1;
}
@ -256,10 +262,11 @@ class RssParser
xml_set_object($xmlparser, $this);
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
xml_set_character_data_handler($xmlparser, 'feed_cdata');
$status = xml_parse($xmlparser, $str);
xml_parser_free($xmlparser);
$rss = $this;
//var_dump($rss->_format);exit;
//var_dump($status.' '.$rss->_format);exit;
}
}

View File

@ -11,7 +11,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
}
// Add extra fields
$sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields";
$sql = "SELECT name, label, type, param, fieldcomputed, fielddefault, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields";
$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).') ORDER BY pos ASC';
//print $sql;
$resql = $this->db->query($sql);

View File

@ -3730,7 +3730,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building',
'card', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
'multicurrency',
'currency', 'multicurrency',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
'edit', 'ellipsis-h', 'email', 'entity', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
@ -3789,7 +3789,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'currency'=>'dollar-sign', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature',
@ -3866,7 +3866,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'ecm'=>'infobox-action', 'eventorganization'=>'infobox-project',
'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat',
'incoterm'=>'infobox-supplier_proposal',
'multicurrency'=>'infobox-bank_account',
'currency'=>'infobox-bank_account', 'multicurrency'=>'infobox-bank_account',
'members'=>'infobox-adherent', 'member'=>'infobox-adherent', 'money-bill-alt'=>'infobox-bank_account',
'order'=>'infobox-commande',
'user'=>'infobox-adherent', 'users'=>'infobox-adherent',

View File

@ -367,6 +367,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
$url = 'https://www.dolistore.com/9-skins';
print '<a href="'.$url.'" target="_blank" rel="noopener noreferrer external">';
print $langs->trans('DownloadMoreSkins');
print img_picto('', 'globe', 'class="paddingleft"');
print '</a>';
print '</th></tr>';
}
@ -435,7 +436,9 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
$colorbacktitle1 = '';
$colortexttitle = '';
$colorbacklineimpair1 = '';
$colorbacklineimpair2 = '';
$colorbacklinepair1 = '';
$colorbacklinepair2 = '';
$colortextlink = '';
$colorbacklinepairhover = '';
$colorbacklinepairhover = '';
@ -746,7 +749,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
if ($color) {
@ -770,7 +773,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
if ($color) {

View File

@ -1528,7 +1528,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
}
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {

View File

@ -212,7 +212,7 @@ class pdf_rouget extends ModelePdfExpedition
}
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "other"));
$nblines = count($object->lines);

View File

@ -2050,7 +2050,7 @@ class pdf_sponge extends ModelePDFFactures
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
}
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {

View File

@ -302,7 +302,15 @@ class mailing_contacts1 extends MailingTargets
dol_print_error($this->db);
}
$s .= '</select>';
$s .= ajax_combobox("filter_category_supplier_contact");
// Choose language
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
$s .= $langs->trans("DefaultLang").': ';
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1);
return $s;
}
@ -336,6 +344,7 @@ class mailing_contacts1 extends MailingTargets
$filter_category = GETPOST('filter_category', 'alpha');
$filter_category_customer = GETPOST('filter_category_customer', 'alpha');
$filter_category_supplier = GETPOST('filter_category_supplier', 'alpha');
$filter_lang = GETPOST('filter_lang', 'alpha');
$cibles = array();
@ -381,6 +390,7 @@ class mailing_contacts1 extends MailingTargets
// Exclude unsubscribed email adresses
$sql .= " AND sp.statut = 1";
$sql .= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
// Filter on category
if ($filter_category != 'all' && $filter_category != '-1') {
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_socpeople = sp.rowid";
@ -394,6 +404,12 @@ class mailing_contacts1 extends MailingTargets
$sql .= " AND c3s.fk_categorie = c3.rowid AND c3s.fk_soc = sp.fk_soc";
$sql .= " AND c3.label = '".$this->db->escape($filter_category_supplier)."'";
}
// Filter on language
if ($filter_lang != '') {
$sql .= " AND sp.default_lang = '".$this->db->escape($filter_lang)."'";
}
// Filter on nature
$key = $filter;
@ -420,7 +436,7 @@ class mailing_contacts1 extends MailingTargets
}
$sql .= " ORDER BY sp.email";
//print "wwwwwwx".$sql;
// print "wwwwwwx".$sql;
// Stocke destinataires dans cibles
$result = $this->db->query($sql);

View File

@ -78,6 +78,10 @@ class mailing_thirdparties extends MailingTargets
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
if (GETPOST('default_lang', 'alpha')) {
$sql .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
}
} else {
$addFilter = "";
if (GETPOSTISSET("filter_client") && GETPOST("filter_client") <> '-1') {
@ -108,6 +112,11 @@ class mailing_thirdparties extends MailingTargets
$addDescription .= $langs->trans("Disabled");
}
}
if (GETPOST('default_lang', 'alpha')) {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
$sql .= " WHERE s.email <> ''";
@ -302,6 +311,13 @@ class mailing_thirdparties extends MailingTargets
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
$s .= '</select>';
$s .= ajax_combobox("filter_status_thirdparties");
// Choose language
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($this->db);
$s .= $langs->trans("DefaultLang").': ';
$s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1);
return $s;
}

View File

@ -219,19 +219,21 @@ class modPartnership extends DolibarrModules
// Label of tables
'tablib'=>array("PartnershipType"),
// Request to select fields
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'c_partnership_type as f WHERE f.entity = '.$conf->entity),
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.keyword, f.active FROM '.MAIN_DB_PREFIX.'c_partnership_type as f WHERE f.entity = '.((int) $conf->entity)),
// Sort order
'tabsqlsort'=>array("label ASC"),
// List of fields (result of select to show dictionary)
'tabfield'=>array("code,label"),
'tabfield'=>array("code,label,keyword"),
// List of fields (list of fields to edit a record)
'tabfieldvalue'=>array("code,label"),
'tabfieldvalue'=>array("code,label,keyword"),
// List of fields (list of fields for insert)
'tabfieldinsert'=>array("code,label"),
'tabfieldinsert'=>array("code,label,keyword"),
// Name of columns with primary key (try to always name it 'rowid')
'tabrowid'=>array("rowid"),
// Condition to show each dictionary
'tabcond'=>array($conf->partnership->enabled)
'tabcond'=>array($conf->partnership->enabled),
// Help tooltip for each fields of the dictionary
'tabhelp'=>array(array('keyword'=>$langs->trans('KeywordToCheckInWebsite')))
);
// Boxes/Widgets
@ -428,7 +430,7 @@ class modPartnership extends DolibarrModules
$sql = array();
// Document templates
$moduledir = 'partnership';
$moduledir = dol_sanitizeFileName('partnership');
$myTmpObjects = array();
$myTmpObjects['Partnership'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
@ -437,8 +439,8 @@ class modPartnership extends DolibarrModules
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/partnership/template_partnerships.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/partnership';
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_partnerships.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
$dest = $dirodt.'/template_partnerships.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@ -1618,7 +1618,7 @@ class pdf_cyan extends ModelePDFPropales
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
}
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {

View File

@ -1344,7 +1344,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
}
/* PHFAVRE
$posy+=4;

View File

@ -186,6 +186,14 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
$object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
$object->sendtoid = 0;
} elseif ($action == 'PROPAL_MODIFY') {
// Load translation files required by the page
$langs->loadLangs(array("agenda", "other", "propal"));
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref));
$object->actionmsg = $langs->transnoentities("PropalBackToDraftInDolibarr", ($object->newref ? $object->newref : $object->ref));
$object->sendtoid = 0;
} elseif ($action == 'PROPAL_SENTBYMAIL') {
// Load translation files required by the page

View File

@ -2135,7 +2135,8 @@ if ($action == 'create') {
// IK
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
print '<td class="fk_c_exp_tax_cat linecoltaxcat">';
print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
$exp_tax_cat_label = dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
print $langs->trans($exp_tax_cat_label);
print '</td>';
}

View File

@ -149,7 +149,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}

View File

@ -1904,7 +1904,7 @@ if ($action == 'create') {
$currency_code = $conf->currency;
$societe = '';
if (GETPOST('socid') > 0) {
if (GETPOST('socid', 'int') > 0) {
$societe = new Societe($db);
$societe->fetch(GETPOST('socid', 'int'));
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) {
@ -3466,10 +3466,9 @@ if ($action == 'create') {
// Remainder to pay
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche >= 0) {
print $langs->trans('RemainderToPay');
} else {
print $langs->trans('ExcessPaid');
print $langs->trans('RemainderToPay');
if ($resteapayeraffiche < 0) {
print ' ('.$langs->trans('NegativeIfExcessPaid').')';
}
print '</span>';
print '</td>';
@ -3479,10 +3478,9 @@ if ($action == 'create') {
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche <= 0) {
print $langs->trans('RemainderToPayBackMulticurrency');
} else {
print $langs->trans('ExcessPaidMulticurrency');
print $langs->trans('RemainderToPayMulticurrency');
if ($resteapayeraffiche < 0) {
print ' ('.$langs->trans('NegativeIfExcessPaid').')';
}
print '</span>';
print '</td>';
@ -3503,10 +3501,9 @@ if ($action == 'create') {
// Remainder to pay back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche <= 0) {
print $langs->trans('RemainderToPayBack');
} else {
print $langs->trans('ExcessPaid');
print $langs->trans('RemainderToPayBack');
if ($resteapayeraffiche > 0) {
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
}
print '</td>';
print '</span>';
@ -3516,10 +3513,9 @@ if ($action == 'create') {
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
if ($resteapayeraffiche <= 0) {
print $langs->trans('RemainderToPayBackMulticurrency');
} else {
print $langs->trans('ExcessPaidMulticurrency');
print $langs->trans('RemainderToPayBackMulticurrency');
if ($resteapayeraffiche> 0) {
print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
}
print '</span>';
print '</td>';

View File

@ -228,7 +228,7 @@ if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MA
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
@ -829,7 +829,7 @@ if ($resql) {
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if (!empty($conf->paymentbybanktransfer->enabled) && !empty($user->rights->paymentbybanktransfer->create)) {
$langs->load('withdrawals');
$arrayofmassactions['banktransfertrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeBankTransferOrder");
@ -837,7 +837,7 @@ if ($resql) {
if ($user->rights->fournisseur->facture->supprimer) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (in_array($massaction, array('presend', 'predelete', 'createbills'))) {
if (in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@ -868,45 +868,6 @@ if ($resql) {
$trackid = 'sinv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction == 'createbills') {
//var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">';
print '<table class="border" width="100%" >';
print '<tr>';
print '<td class="titlefieldmiddle">';
print $langs->trans('DateInvoice');
print '</td>';
print '<td>';
print $form->selectDate('', '', '', '', '', '', 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('CreateOneBillByThird');
print '</td>';
print '<td>';
print $form->selectyesno('createbills_onebythird', '', 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('ValidateInvoices');
print '</td>';
print '<td>';
print $form->selectyesno('validate_invoices', 1, 1);
print '</td>';
print '</tr>';
print '</table>';
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> ';
print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '<br>';
}
if ($search_all) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);

View File

@ -615,12 +615,13 @@ jQuery(document).ready(function() {
function init_needroot()
{
console.log("init_needroot force_install_noedit=<?php echo $force_install_noedit?>");
/*alert(jQuery("#db_create_database").prop("checked")); */
if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
{
jQuery(".hideroot").show();
<?php
if ($force_install_noedit == 0) { ?>
if (empty($force_install_noedit)) { ?>
jQuery(".needroot").removeAttr('disabled');
<?php } ?>
}

View File

@ -36,7 +36,8 @@
-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
-- VMYSQL4.3 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL USING packaging::real;
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL;
@ -119,8 +120,8 @@ ALTER TABLE llx_product ADD COLUMN mandatory_period tinyint NULL DEFAULT 0;
ALTER TABLE llx_holiday ADD COLUMN date_approve DATETIME DEFAULT NULL;
ALTER TABLE llx_holiday ADD COLUMN fk_user_approve integer DEFAULT NULL;
ALTER TABLE llx_ticket MODIFY COLUMN progress integer;
-- VMYSQL4.3 ALTER TABLE llx_ticket MODIFY COLUMN progress integer;
-- VPGSQL8.2 ALTER TABLE llx_ticket MODIFY COLUMN progress integer USING progress::integer;
ALTER TABLE llx_emailcollector_emailcollectoraction MODIFY COLUMN actionparam TEXT;

View File

@ -334,4 +334,8 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext;
DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php'));
DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php');
ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255);
ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128);

View File

@ -559,6 +559,13 @@ DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee';
-- Sequence to fix the content of llx_bank.amount_main_currency
-- Note: amount is amount in currency of bank account
-- Note: pamount is always amount into the main currency
-- Note: pmulticurrencyamount is in currency of invoice
-- Note: amount_main_currency must be amount in main currency
-- DROP TABLE tmp_bank;
-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;
-- DROP TABLE tmp_bank2;
-- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;

View File

@ -31,6 +31,7 @@ create table llx_c_partnership_type
entity integer DEFAULT 1 NOT NULL,
code varchar(32) NOT NULL,
label varchar(128) NOT NULL,
keyword varchar(128), -- a keyword to check into url of partner website or a dedicated url defined into partneship record
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;

View File

@ -34,8 +34,9 @@ CREATE TABLE llx_partnership(
note_private text,
note_public text,
last_main_doc varchar(255),
count_last_url_check_error integer DEFAULT '0',
last_check_backlink datetime NULL,
url_to_check varchar(255), -- url to check to find a specific keyword (defined into llx_c_partnership) to keep status of partnership valid
count_last_url_check_error integer DEFAULT '0', -- last result of check of keyword into url
last_check_backlink datetime NULL, -- date of last check of keyword into url
import_key varchar(14),
model_pdf varchar(255)
) ENGINE=innodb;

View File

@ -302,6 +302,7 @@ NotYetAccounted=Not yet transferred to accounting
ShowTutorial=Show Tutorial
NotReconciled=Not reconciled
WarningRecordWithoutSubledgerAreExcluded=Warning, all lines without subledger account defined are filtered and excluded from this view
AccountRemovedFromCurrentChartOfAccount=Accounting account that does not exist in the current chart of accounts
## Admin
BindingOptions=Binding options

View File

@ -1925,7 +1925,7 @@ ConfFileMustContainCustom=Installing or building an external module from applica
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
HighlightLinesColor=Highlight color of the line when the mouse passes over (use 'ffffff' for no highlight)
HighlightLinesChecked=Highlight color of the line when it is checked (use 'ffffff' for no highlight)
UseBorderOnTable=Active border on tables
UseBorderOnTable=Show left-right borders on tables
BtnActionColor=Color of the action button
TextBtnActionColor=Text color of the action button
TextTitleColor=Text color of Page title
@ -2143,7 +2143,7 @@ DeleteEmailCollector=Delete email collector
ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector?
RecipientEmailsWillBeReplacedWithThisValue=Recipient emails will be always replaced with this value
AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be defined
RESTRICT_ON_IP=Allow access to some host IP only (wildcard not allowed, use space between values). Empty means every hosts can access.
RESTRICT_ON_IP=Allow API access to only certain client IPs (wildcard not allowed, use space between values). Empty means every clients can access.
IPListExample=127.0.0.1 192.168.0.2 [::1]
BaseOnSabeDavVersion=Based on the library SabreDAV version
NotAPublicIp=Not a public IP
@ -2234,3 +2234,4 @@ TemplateforBusinessCards=Template for a business card in different size
InventorySetup= Inventory Setup
ExportUseLowMemoryMode=Use a low memory mode
ExportUseLowMemoryModeHelp=Use the low memory mode to execute the exec of the dump (compression is done through a pipe instead of into the PHP memory). This method does not allow to check that file is completed and error message can't be reported if it fails.
HashForPing=Hash used for ping

View File

@ -45,6 +45,7 @@ CONTRACT_DELETEInDolibarr=Contract %s deleted
PropalClosedSignedInDolibarr=Proposal %s signed
PropalClosedRefusedInDolibarr=Proposal %s refused
PropalValidatedInDolibarr=Proposal %s validated
PropalBackToDraftInDolibarr=Proposal %s go back to draft status
PropalClassifiedBilledInDolibarr=Proposal %s classified billed
InvoiceValidatedInDolibarr=Invoice %s validated
InvoiceValidatedInDolibarrFromPos=Invoice %s validated from POS

View File

@ -15,7 +15,7 @@ ErrorMemberIsAlreadyLinkedToThisThirdParty=Another member (name: <b>%s</b>, logi
ErrorUserPermissionAllowsToLinksToItselfOnly=For security reasons, you must be granted permissions to edit all users to be able to link a member to a user that is not yours.
SetLinkToUser=Link to a Dolibarr user
SetLinkToThirdParty=Link to a Dolibarr third party
MembersCards=Business cards for members
MembersCards=Generation of cards for members
MembersList=List of members
MembersListToValid=List of draft members (to be validated)
MembersListValid=List of valid members
@ -163,7 +163,7 @@ MoreActionsOnSubscription=Complementary action suggested by default when recordi
MoreActionBankDirect=Create a direct entry on bank account
MoreActionBankViaInvoice=Create an invoice, and a payment on bank account
MoreActionInvoiceOnly=Create an invoice with no payment
LinkToGeneratedPages=Generate visit cards
LinkToGeneratedPages=Generation of business cards or address sheets
LinkToGeneratedPagesDesc=This screen allows you to generate PDF files with business cards for all your members or a particular member.
DocForAllMembersCards=Generate business cards for all members
DocForOneMemberCards=Generate business cards for a particular member

View File

@ -59,6 +59,7 @@ BacklinkNotFoundOnPartnerWebsite=Backlink not found on partner website
ConfirmClosePartnershipAsk=Are you sure you want to cancel this partnership?
PartnershipType=Partnership type
PartnershipRefApproved=Partnership %s approved
KeywordToCheckInWebsite=If you want to check that a given keyword is present into the website of each partner, define this keyword here
#
# Template Mail
@ -89,4 +90,5 @@ PartnershipDraft=Draft
PartnershipAccepted=Accepted
PartnershipRefused=Refused
PartnershipCanceled=Canceled
PartnershipManagedFor=Partners are
PartnershipManagedFor=Partners are

View File

@ -123,4 +123,8 @@ ForceUserHolidayValidator=Force leave request validator
ValidatorIsSupervisorByDefault=By default, the validator is the supervisor of the user. Keep empty to keep this behaviour.
UserPersonalEmail=Personal email
UserPersonalMobile=Personal mobile phone
WarningNotLangOfInterface=Warning, this is the main language the user speak, not the language of the interface he choosed to see. To change the interface language visible by this user, go on tab %s
WarningNotLangOfInterface=Warning, this is the main language the user speak, not the language of the interface he choosed to see. To change the interface language visible by this user, go on tab %s
DateLastLogin=Date last login
DatePreviousLogin=Date previous login
IPLastLogin=IP last login
IPPreviousLogin=IP previous login

View File

@ -137,6 +137,7 @@ SEPAFRST=SEPA FRST
ExecutionDate=Execution date
CreateForSepa=Create direct debit file
ICS=Creditor Identifier - ICS
IDS=Debitor Identifier
END_TO_END="EndToEndId" SEPA XML tag - Unique id assigned per transaction
USTRD="Unstructured" SEPA XML tag
ADDDAYS=Add days to Execution Date
@ -154,4 +155,5 @@ ErrorCompanyHasDuplicateDefaultBAN=Company with id %s has more than one default
ErrorICSmissing=Missing ICS in Bank account %s
TotalAmountOfdirectDebitOrderDiffersFromSumOfLines=Total amount of direct debit order differs from sum of lines
WarningSomeDirectDebitOrdersAlreadyExists=Warning: There is already some pending Direct Debit orders (%s) requested for an amount of %s
WarningSomeCreditTransferAlreadyExists=Warning: There is already some pending Credit Transfer (%s) requested for an amount of %s
WarningSomeCreditTransferAlreadyExists=Warning: There is already some pending Credit Transfer (%s) requested for an amount of %s
UsedFor=Used for %s

View File

@ -109,10 +109,11 @@ function testSqlAndScriptInject($val, $type)
// We check string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char)
// We should use dol_string_nounprintableascii but function is not yet loaded/available
// Example of valid UTF8 chars:
// utf8=utf8mb3: '\x0A', '\x0D', '\x7E'
// utf8=utf8mb3: '\x09', '\x0A', '\x0D', '\x7E'
// utf8=utf8mb3: '\xE0\xA0\x80'
// utf8mb4: '\xF0\x9D\x84\x9E' (but this may be refused by the database insert if pagecode is utf8=utf8mb3)
$newval = preg_replace('/[\x00-\x09\x0B-\x0C\x0E-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace
$newval = preg_replace('/[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace
// Note that $newval may also be completely empty '' when non valid UTF8 are found.
if ($newval != $val) {
// If $val has changed after removing non valid UTF8 chars, it means we have an evil string.

View File

@ -261,7 +261,7 @@ if ($dirins && $action == 'initmodule' && $modulename) {
dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php');
dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php');
dol_delete_file($destdir.'/test/phpunit/'.$modulename.'FunctionnalTest.php');
// Delete some files related to Object (because the previous dolCopyDir has copied everything)
dol_delete_file($destdir.'/myobject_card.php');

View File

@ -222,6 +222,8 @@ class modMyModule extends DolibarrModules
'tabrowid'=>array("rowid", "rowid", "rowid"),
// Condition to show each dictionary
'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled)
// Help tooltip for each fields of the dictionary
'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp')))
);
*/

View File

@ -119,9 +119,10 @@ class Partnership extends CommonObject
'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,),
'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),),
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,),
'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,),
'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1),
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,),
'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>73, 'notnull'=>0, 'visible'=>-2,),
// fk_member and fk_soc are added into constructor
);

View File

@ -173,7 +173,7 @@ if ($object->id > 0) {
restrictedArea($user, 'service', $object->id, 'product&product', '', '');
}
} else {
restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
restrictedArea($user, 'produit|service', 0, 'product&product', '', '', $fieldtype);
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -1564,8 +1564,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Quality control
if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) {
print '<tr><td>'.$langs->trans("LifeTime").'</td><td><input name="lifetime" class="maxwidth100onsmartphone" value="'.GETPOST('lifetime').'"></td></tr>';
print '<tr><td>'.$langs->trans("QCFrequency").'</td><td><input name="qc_frequency" class="maxwidth100onsmartphone" value="'.GETPOST('qc_frequency').'"></td></tr>';
print '<tr><td>'.$langs->trans("LifeTime").'</td><td><input name="lifetime" class="maxwidth50" value="'.GETPOST('lifetime').'"></td></tr>';
print '<tr><td>'.$langs->trans("QCFrequency").'</td><td><input name="qc_frequency" class="maxwidth50" value="'.GETPOST('qc_frequency').'"></td></tr>';
}
// Other attributes
@ -2611,19 +2611,19 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Custom code
if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) {
print '<tr><td>'.$langs->trans("CustomCode").'</td><td>'.$object->customcode.'</td>';
print '<tr><td>'.$langs->trans("CustomCode").'</td><td>'.$object->customcode.'</td></tr>';
// Origin country code
print '<tr><td>'.$langs->trans("Origin").'</td><td>'.getCountry($object->country_id, 0, $db);
if (!empty($object->state_id)) {
print ' - '.getState($object->state_id, 0, $db);
}
print '</td>';
print '</td></tr>';
}
// Quality Control
if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) {
print '<tr><td>'.$langs->trans("LifeTime").'</td><td">'.$object->lifetime.'</td></tr>';
print '<tr><td>'.$langs->trans("LifeTime").'</td><td>'.$object->lifetime.'</td></tr>';
print '<tr><td>'.$langs->trans("QCFrequency").'</td><td>'.$object->qc_frequency.'</td></tr>';
}

View File

@ -1802,7 +1802,17 @@ class Product extends CommonObject
*/
public function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0)
{
global $conf, $db;
global $conf, $db, $hookmanager, $action;
// Call hook if any
if (is_object($hookmanager)) {
$parameters = array('thirdparty_seller'=>$thirdparty_seller, 'thirdparty_buyer' => $thirdparty_buyer, 'pqp' => $pqp);
// Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('getSellPrice', $parameters, $this, $action);
if ($reshook > 0) {
return $hookmanager->resArray;
}
}
// Update if prices fields are defined
$tva_tx = get_default_tva($thirdparty_seller, $thirdparty_buyer, $this->id);

View File

@ -1115,11 +1115,12 @@ if ($object->id > 0) {
print '<td class="right">';
print price($pmp_valuation_real);
print '</td>';
print '<td class="nowraponall right">';
$totalExpectedValuation += $pmp_valuation;
$totalRealValuation += $pmp_valuation_real;
}
print '<td class="nowraponall right">';
if ($obj->fk_movement > 0) {
$stockmovment = new MouvementStock($db);
$stockmovment->fetch($obj->fk_movement);

View File

@ -766,6 +766,7 @@ $form = new Form($db);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateoptions">';
print '<input type="hidden" name="page_y" value="">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
@ -788,7 +789,7 @@ if (!$conf->use_javascript_ajax) {
);
print $form->selectarray("activate_PROJECT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
print '</td><td class="right">';
print '<input type="submit" class="button" name="PROJECT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button small reposition" name="PROJECT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print "</td>";
}
print '</tr>';
@ -799,7 +800,7 @@ print '<td>'.$langs->trans("AllowToSelectProjectFromOtherCompany").'</td>';
print '<td class="right" width="60" colspan="2">';
print '<input type="text" id="projectToSelect" name="projectToSelect" value="'.$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.'"/>&nbsp;';
print $form->textwithpicto('', $langs->trans('AllowToLinkFromOtherCompany'));
print '<input type="submit" class="button" name="PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button small reposition" name="PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY" value="'.$langs->trans("Modify").'">';
print '</td>';
print '</tr>';
@ -818,7 +819,7 @@ print '<td>'.$langs->trans("TimesheetPreventAfterFollowingMonths").'</td>';
print '<td class="right" width="60" colspan="2">';
print '<input type="number" id="timesheetFreezeDuration" name="timesheetFreezeDuration" min="0" step="1" value="'.$conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS.'"/>&nbsp;';
print '<input type="submit" class="button" name="PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button small reposition" name="PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS" value="'.$langs->trans("Modify").'">';
print '</td>';
print '</tr>';
print '</table>';

View File

@ -226,7 +226,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}

View File

@ -185,7 +185,7 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}

View File

@ -1149,8 +1149,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Form to convert time spent into invoice
if ($massaction == 'generateinvoice') {
print '<input type="hidden" name="massaction" value="confirm_createbills">';
if ($projectstatic->thirdparty->id > 0) {
print '<table class="noborder centerpercent">';
print '<tr>';

View File

@ -166,6 +166,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
if (empty($reshook)) {
// Mass actions
$objectclass = 'Reception';
$objectlabel = 'Receptions';
$permissiontoread = $user->rights->reception->lire;
$permissiontoadd = $user->rights->reception->creer;
$permissiontodelete = $user->rights->reception->supprimer;
$uploaddir = $conf->reception->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction == 'confirm_createbills') {
$receptions = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');

View File

@ -919,7 +919,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
}
if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {

View File

@ -573,10 +573,10 @@ if ($resql) {
$arrayofmassactions = array(
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email',, 'class="pictofixedwidth"').'&ensp;'.$langs->trans("SendByMail"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($user->rights->supplier_proposal->supprimer) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').'&ensp;'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();

View File

@ -392,7 +392,7 @@ if (!empty($conf->barcode->enabled)) {
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("TakeposBarcodeRuleToInsertProduct"), $langs->trans("TakeposBarcodeRuleToInsertProductDesc"));
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT" value="' . (!empty($conf->global->TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT) ? $conf->global->TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT : '') . '">';
print '<input type="text" name="TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT" value="' . (getDolGlobalString('TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT')) . '">';
print "</td></tr>\n";
}

View File

@ -48,6 +48,8 @@ $category = GETPOST('category', 'alphanohtml'); // Can be id of category or 'sup
$action = GETPOST('action', 'aZ09');
$term = GETPOST('term', 'alpha');
$id = GETPOST('id', 'int');
$search_start = GETPOST('search_start', 'int');
$search_limit = GETPOST('search_limit', 'int');
if (empty($user->rights->takepos->run)) {
accessforbidden();
@ -217,13 +219,14 @@ if ($action == 'getProducts') {
}
}
$sql = 'SELECT rowid, ref, label, tosell, tobuy, barcode, price' ;
$sql = 'SELECT p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price' ;
if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) {
$sql .= ', ps.reel';
}
// Add fields from hooks
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters);
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
@ -235,7 +238,7 @@ if ($action == 'getProducts') {
// Add tables from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTables', $parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListTables', $parameters);
$sql .= $hookmanager->resPrint;
$sql .= ' WHERE entity IN ('.getEntity('product').')';
@ -249,9 +252,12 @@ if ($action == 'getProducts') {
$sql .= natural_search(array('ref', 'label', 'barcode'), $term);
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters);
$sql .= $hookmanager->resPrint;
// load only one page of products
$sql.= $db->plimit($search_limit, $search_start);
$resql = $db->query($sql);
if ($resql) {
$rows = array();
@ -274,7 +280,7 @@ if ($action == 'getProducts') {
}
}
$rows[] = array(
$row = array(
'rowid' => $obj->rowid,
'ref' => $obj->ref,
'label' => $obj->label,
@ -287,6 +293,20 @@ if ($action == 'getProducts') {
'qty' => 1,
//'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency)
);
// Add entries to row from hooks
$parameters=array();
$parameters['row'] = $row;
$parameters['obj'] = $obj;
$reshook = $hookmanager->executeHooks('completeAjaxReturnArray', $parameters);
if ($reshook > 0) {
// replace
$row = $hookmanager->resArray;
} else {
// add
$rows[] = $hookmanager->resArray;
}
$rows[] = $row;
}
echo json_encode($rows);
} else {

View File

@ -311,7 +311,7 @@ table.postablelines tr td {
.posinvoiceline td {
height: 40px !important;
background-color: var(--colorbacklineimpair1);
background-color: var(--colorbacklineimpair2);
}
.postablelines td.linecolht {

View File

@ -232,7 +232,7 @@ function PrintCategories(first) {
continue;
}
$("#catdivdesc"+i).show();
$("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']);
$("#catdesc"+i).html(categories[parseInt(i)+parseInt(first)]['label']);
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']);
$("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
$("#catdiv"+i).attr('class', 'wrapper');
@ -266,7 +266,7 @@ function MoreCategories(moreorless) {
continue;
}
$("#catdivdesc"+i).show();
$("#catdesc"+i).text(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label']);
$("#catdesc"+i).html(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label']);
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
$("#catdiv"+i).data("rowid",categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
$("#catwatermark"+i).show();
@ -295,8 +295,8 @@ function LoadProducts(position, issubcat) {
jQuery.each(subcategories, function(i, val) {
if (currentcat==val.fk_parent) {
$("#prodivdesc"+ishow).show();
$("#prodesc"+ishow).text(val.label);
$("#probutton"+ishow).text(val.label);
$("#prodesc"+ishow).html(val.label);
$("#probutton"+ishow).html(val.label);
$("#probutton"+ishow).show();
$("#proprice"+ishow).attr("class", "hidden");
$("#proprice"+ishow).html("");
@ -343,13 +343,13 @@ function LoadProducts(position, issubcat) {
if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) {
echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
} else {
echo '$("#prodesc"+ishow).text(data[parseInt(idata)][\'label\']);';
echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
}
echo '$("#proimg"+ishow).attr("title", titlestring);';
echo '$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
} else {
echo '$("#probutton"+ishow).show();';
echo '$("#probutton"+ishow).text(data[parseInt(idata)][\'label\']);';
echo '$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
}
?>
if (data[parseInt(idata)]['price_formated']) {
@ -372,6 +372,9 @@ function LoadProducts(position, issubcat) {
function MoreProducts(moreorless) {
console.log("MoreProducts");
if ($('#search_pagination').val() != '') return Search2('<?php echo $keyCodeForEnter; ?>', moreorless);
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
if (moreorless=="more"){
@ -414,9 +417,9 @@ function MoreProducts(moreorless) {
if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
$("#prodesc"+ishow).html(data[parseInt(idata)]['ref'].bold() + ' - ' + data[parseInt(idata)]['label']);
<?php } else { ?>
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
$("#prodesc"+ishow).html(data[parseInt(idata)]['label']);
<?php } ?>
$("#probutton"+ishow).text(data[parseInt(idata)]['label']);
$("#probutton"+ishow).html(data[parseInt(idata)]['label']);
$("#probutton"+ishow).show();
if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice");
@ -556,12 +559,20 @@ function New() {
* @param {int} keyCodeForEnter Key code for "enter"
* return {void}
*/
function Search2(keyCodeForEnter) {
function Search2(keyCodeForEnter, moreorless) {
console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter);
var search_term = $('#search').val();
var search_start = 0;
var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
if (moreorless != null) {
search_term = $('#search_pagination').val();
search_start = $('#search_start_'+moreorless).val();
}
var search = false;
var eventKeyCode = window.event.keyCode;
if (typeof keyCodeForEnter === 'undefined' || eventKeyCode == keyCodeForEnter) {
if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) {
search = true;
}
@ -576,7 +587,8 @@ function Search2(keyCodeForEnter) {
pageproducts = 0;
jQuery(".wrapper2 .catwatermark").hide();
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term=' + $('#search').val(), function (data) {
var nbsearchresults = 0;
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term=' + search_term + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
if (typeof (data[i]) == "undefined") {
$("#prodesc" + i).text("");
@ -597,10 +609,10 @@ function Search2(keyCodeForEnter) {
if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
$("#prodesc" + i).html(data[i]['ref'].bold() + ' - ' + data[i]['label']);
<?php } else { ?>
$("#prodesc" + i).text(data[i]['label']);
$("#prodesc" + i).html(data[i]['label']);
<?php } ?>
$("#prodivdesc" + i).show();
$("#probutton" + i).text(data[i]['label']);
$("#probutton" + i).html(data[i]['label']);
$("#probutton" + i).show();
if (data[i]['price_formated']) {
$("#proprice" + i).attr("class", "productprice");
@ -615,6 +627,7 @@ function Search2(keyCodeForEnter) {
}
$("#prodiv" + i).data("rowid", data[i]['rowid']);
$("#prodiv" + i).data("iscat", 0);
nbsearchresults++;
}
}).always(function (data) {
// If there is only 1 answer
@ -639,6 +652,24 @@ function Search2(keyCodeForEnter) {
}
else ClearSearch();
}
// memorize search_term and start for pagination
$("#search_pagination").val($("#search").val());
if (search_start == 0) {
$("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
}
else {
$("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
$("#search_start_less").val(search_start_less);
}
if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
$("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
}
else {
$("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
$("#search_start_more").val(search_start_more);
}
});
}, 500); // 500ms delay
}
@ -915,7 +946,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
</div>
<div class="topnav-right">
<div class="login_block_other">
<input type="text" id="search" name="search" class="input-search-takepos" onkeyup="Search2(<?php echo $keyCodeForEnter; ?>);" placeholder="<?php echo dol_escape_htmltag($langs->trans("Search")); ?>" autofocus>
<input type="text" id="search" name="search" class="input-search-takepos" onkeyup="Search2('<?php echo dol_escape_js($keyCodeForEnter); ?>', null);" placeholder="<?php echo dol_escape_htmltag($langs->trans("Search")); ?>" autofocus>
<a onclick="ClearSearch();"><span class="fa fa-backspace"></span></a>
<a href="<?php echo DOL_URL_ROOT.'/'; ?>" target="backoffice" rel="opener"><!-- we need rel="opener" here, we are on same domain and we need to be able to reuse this tab several times -->
<span class="fas fa-home"></span></a>
@ -1210,7 +1241,7 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
print '<!-- Show the search input text -->'."\n";
print '<div class="margintoponly">';
print '<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2('.$keyCodeForEnter.');" style="width: 80%; width:calc(100% - 51px); font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans("Search")).'" autofocus> ';
print '<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2(\''.dol_escape_js($keyCodeForEnter).'\', null);" style="width: 80%; width:calc(100% - 51px); font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans("Search")).'" autofocus> ';
print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch();">'.img_picto('', 'searchclear').'</a>';
print '</div>';
}
@ -1243,10 +1274,10 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
<?php
if ($count == ($MAXCATEG - 2)) {
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
} elseif ($count == ($MAXCATEG - 1)) {
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
} else {
if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORY_IMAGES')) {
echo '<img class="imgwrapper" height="100%" id="catimg'.$count.'" />';
@ -1285,10 +1316,10 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
<?php
if ($count == ($MAXPRODUCT - 2)) {
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
} elseif ($count == ($MAXPRODUCT - 1)) {
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
} else {
if (getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
echo '<button type="button" id="probutton'.$count.'" class="productbutton" style="display: none;"></button>';
@ -1309,6 +1340,9 @@ if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
$count++;
}
?>
<input type="hidden" id="search_start_less" value="0">
<input type="hidden" id="search_start_more" value="0">
<input type="hidden" id="search_pagination" value="">
</div>
</div>
</div>

View File

@ -13,7 +13,7 @@
--colorbacktitle1: rgb(<?php print $colorbacktitle1; ?>);
--colorbacktabcard1: rgb(<?php print $colorbacktabcard1; ?>);
--colorbacktabactive: rgb(<?php print $colorbacktabactive; ?>);
--colorbacklinepair1: rgb(<?php print $colorbacklineimpair1; ?>);
--colorbacklineimpair1: rgb(<?php print $colorbacklineimpair1; ?>);
--colorbacklineimpair2: rgb(<?php print $colorbacklineimpair2; ?>);
--colorbacklinepair1: rgb(<?php print $colorbacklinepair1; ?>);
--colorbacklinepair2: rgb(<?php print $colorbacklinepair2; ?>);

View File

@ -21,7 +21,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
display: block;
position: relative;
min-height: 90px;
/* background: #fff; */
background: var(--colorbacklineimpair2);
width: 100%;
box-shadow: 1px 1px 15px rgba(192, 192, 192, 0.2);
border-radius: 2px;
@ -88,7 +88,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
text-align: center;
font-size: 2.8em;
line-height: 90px;
background: rgba(0, 0, 0, 0.08) !important;
background: var(--colorbacktitle1) !important;
}
.info-box-module .info-box-icon {

View File

@ -133,7 +133,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
display: block;
position: relative;
min-height: 90px;
background: #fff;
background: var(--colorbacklineimpair2);
width: 100%;
/* box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); */
border-radius: 2px;

View File

@ -359,7 +359,7 @@ body {
<?php } ?>
color: rgb(<?php echo $colortext; ?>);
font-size: <?php print is_numeric($fontsize) ? $fontsize.'px' : $fontsize; ?>;
line-height: 1.3;
line-height: 1.4;
font-family: <?php print $fontlist ?>;
margin-top: 0;
margin-bottom: 0;
@ -3968,10 +3968,10 @@ table.hidepaginationnext .paginationnext {
/* Prepare to remove class pair - impair
.noborder > tbody > tr:nth-child(even) td {
background: linear-gradient(to bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 85%, var(--colorbacklineimpair2) 100%);
background: linear-gradient(to bottom, var(--colorbacklineimpai2) 85%, var(--colorbacklineimpair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklineimpair2) 85%, var(--colorbacklineimpair2) 100%);
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair2) 85%, var(--colorbacklineimpair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair2) 85%, var(--colorbacklineimpair2) 100%);
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
@ -3980,10 +3980,10 @@ table.hidepaginationnext .paginationnext {
}
.noborder > tbody > tr:nth-child(odd) td {
background: linear-gradient(to bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
background: -moz-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklinepair1) 85%, var(--colorbacklinepair2) 100%);
background: linear-gradient(to bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%);
background: -moz-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%);
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
@ -4038,10 +4038,10 @@ ul.noborder li:nth-child(odd):not(.liste_titre) {
}
.impair, .nohover .impair:hover, tr.impair td.nohover
{
background: var(--colorbacklineimpair1);
background: var(--colorbacklineimpair2);
}
#GanttChartDIV {
background-color: var(--colorbacklineimpair1);
background-color: var(--colorbacklineimpair2);
}
.oddeven, .evenodd, .pair, .nohover .pair:hover, tr.pair td.nohover, .tagtr.oddeven {
@ -4059,12 +4059,12 @@ table.dataTable tr.oddeven {
/* For no hover style */
td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover {
background-color: var(--colorbacklineimpair1) !important;
background: var(--colorbacklineimpair1) !important;
background-color: var(--colorbacklineimpair2) !important;
background: var(--colorbacklineimpair2) !important;
}
td.evenodd, tr.nohoverpair td, #trlinefordates td {
background-color: var(--colorbacklinepair1) !important;
background: var(--colorbacklinepair1) !important;
background-color: var(--colorbacklinepair2) !important;
background: var(--colorbacklinepair2) !important;
}
.trforbreak td {
font-weight: bold;
@ -4277,10 +4277,10 @@ div .tdtop {
div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre),
div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright) .oddeven.tagtr:nth-of-type(even):not(.liste_titre)
{
background: linear-gradient(to bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%);
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%);
background: linear-gradient(to bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%);
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%);
}
.noborder > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre),
.noborder .tagtr:nth-child(even):not(:last-of-type) .oddeven.tagtd:not(.liste_titre)

View File

@ -275,6 +275,8 @@ class User extends CommonObject
public $datelastlogin;
public $datepreviouslogin;
public $iplastlogin;
public $ippreviouslogin;
public $datestartvalidity;
public $dateendvalidity;
@ -435,6 +437,8 @@ class User extends CommonObject
$sql .= " u.tms as datem,";
$sql .= " u.datelastlogin as datel,";
$sql .= " u.datepreviouslogin as datep,";
$sql .= " u.iplastlogin,";
$sql .= " u.ippreviouslogin,";
$sql .= " u.datelastpassvalidation,";
$sql .= " u.datestartvalidity,";
$sql .= " u.dateendvalidity,";
@ -562,6 +566,8 @@ class User extends CommonObject
$this->datem = $this->db->jdate($obj->datem);
$this->datelastlogin = $this->db->jdate($obj->datel);
$this->datepreviouslogin = $this->db->jdate($obj->datep);
$this->iplastlogin = $obj->iplastlogin;
$this->ippreviouslogin = $obj->ippreviouslogin;
$this->datestartvalidity = $this->db->jdate($obj->datestartvalidity);
$this->dateendvalidity = $this->db->jdate($obj->dateendvalidity);
@ -2111,9 +2117,13 @@ class User extends CommonObject
// phpcs:enable
$now = dol_now();
$userremoteip = getUserRemoteIP();
$sql = "UPDATE ".$this->db->prefix()."user SET";
$sql .= " datepreviouslogin = datelastlogin,";
$sql .= " ippreviouslogin = iplastlogin,";
$sql .= " datelastlogin = '".$this->db->idate($now)."',";
$sql .= " iplastlogin = '".$this->db->escape($userremoteip)."',";
$sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion
$sql .= " WHERE rowid = ".((int) $this->id);
@ -2122,6 +2132,8 @@ class User extends CommonObject
if ($resql) {
$this->datepreviouslogin = $this->datelastlogin;
$this->datelastlogin = $now;
$this->ippreviouslogin = $this->iplastlogin;
$this->iplastlogin = $userremoteip;
return 1;
} else {
$this->error = $this->db->lasterror().' sql='.$sql;
@ -3116,7 +3128,9 @@ class User extends CommonObject
$this->datem = $now;
$this->datelastlogin = $now;
$this->iplastlogin = '127.0.0.1';
$this->datepreviouslogin = $now;
$this->ippreviouslogin = '127.0.0.1';
$this->statut = 1;
$this->entity = 1;

View File

@ -92,7 +92,7 @@ if (!$user->rights->user->user->lire && !$user->admin) {
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}

View File

@ -203,7 +203,7 @@ $childids = $user->getAllChildIds(1);
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
@ -551,7 +551,7 @@ if ($permissiontoadd) {
if ($permissiontoadd) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
//if ($permissiontodelete) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').'&ensp;'.$langs->trans("Delete");
//if ($permissiontodelete) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
$arrayofmassactions = array();

View File

@ -204,7 +204,7 @@ class UserTest extends PHPUnit\Framework\TestCase
$newlocalobject=new User($this->savdb);
$newlocalobject->initAsSpecimen();
$this->changeProperties($newlocalobject);
$this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','specimen','note','ref','pass','pass_indatabase','pass_indatabase_crypted','pass_temp','datec','datem','datelastlogin','datepreviouslogin','trackid')), array()); // Actual, Expected
$this->assertEquals($this->objCompare($localobject, $newlocalobject, true, array('id','socid','societe_id','specimen','note','ref','pass','pass_indatabase','pass_indatabase_crypted','pass_temp','datec','datem','datelastlogin','datepreviouslogin','iplastlogin','ippreviouslogin','trackid')), array()); // Actual, Expected
return $localobject;
}