Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-10-13 01:10:31 +02:00
commit eb0f898b01
34 changed files with 310 additions and 71 deletions

View File

@ -28,6 +28,84 @@ Following changes may create regressions for some external modules, but were nec
* All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead * All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead
***** ChangeLog for 16.0.1 compared to 16.0.0 *****
FIX: #16476 on massaction the pdf generation is not using the t…
FIX: #21416 Filter tag no-categorie in members
FIX: #21543
FIX: #21799 inactive companies shall not be selectable for new proposals, orders and invoices
FIX: #21859 Don't show html balise on list for private/public note
FIX: #22164
FIX: #22241
FIX: #22263 Accountancy - Account number expected in place of a rowid on parent account on export
FIX: #22264 Accountancy - Translation on chart of accounts export
FIX: #22265 Accountancy - Account number expected in place of a rowid on export
FIX: #22334
FIX: #22360
FIX: #22379 creating events on supplier order
FIX: #22382 Error on length of supplier reference
FIX: #22386 IBAN not mandatory for International Export Countries
FIX: #22440 Lang Key "UserAccountNotDefined" is missing
FIX: #22482
FIX: #22507
FIX: Accountancy - Some manuals operations are displayed in subledger
FIX: API reception return error 500
FIX: avoid override initial message ($this instead $object)
FIX: avoid some warnings (php8+)
FIX: Bad backtopage and CSRF on link for ticket message
FIX: bad closing select
FIX: broken feature, wrong fk_parent_line after cloning object
FIX: Column label
FIX: compatibility if javascript not actived
FIX: compatibility with Mysql <= 5.7
FIX: contact deletion: execute trigger before really deleting
FIX: CronJob sendBackup
FIX: CSRF + lost value of constant after use save button
FIX: CSS
FIX: data integrity for llx_delivery table
FIX: default value for partnership status
FIX: deletion of the MO_CHILD link
FIX: Dictionary - Display error on cache_vatrates
FIX: Dolibarr#16476 version 2a
FIX: Duplicate creation of invoice when closing shipment linked to order
FIX: Duplicate in list when filtering on categories
FIX: extrafields with value '0' was ''
FIX: filters lost when sorting on productMargin and customerMargins
FIX: fk_expedition in $line can be usefull for triggers
FIX: Import in upgrade when using a socialnetwork field.
FIX: input hidden with fk_product of line on mo production can be usefull
FIX: inventory code must be different at each transation
FIX: inventory total columns
FIX: Issue #16476 on massaction the pdf generation is not using the thirdparty language settings
FIX: Linked object agenda card
FIX: missing check if category module is enabled
FIX: missing check if incoice as a payment (wrong status)
FIX: missing class "societe" when create another object with workflow
FIX: missing error message if image size too large
FIX: Missing reposition
FIX: missing the management of a constant in the Ticket config
FIX: Missing token in different URLs links
FIX: @ must be allowed into dol_eval to allow rules including external module string 'abc@def'
FIX: - php V8 get number doc saphir
FIX: - php V8 propal index last draft
FIX: Preview button position on documents list (case when the file is too long)
FIX: Project - on global view, missing display of ref customer
FIX: Protection against bad value into accurancy setup
FIX: reading of trackid in emailcollector (when on recipient suffix)
FIX: recruitment linked files
FIX: Remove use of code we should not have
FIX: Restore the option MAIN_OPTIMIZEFORTEXTBROWSER
FIX: Rich text is not diplayed
FIX: same thing in deleteline
FIX: Supplier Reference is lost when page breaks
FIX: support of array parameters in "add to bookmark" feature.
FIX: Test that web dir is correct in install
FIX: the shipment PDF was using the full size logo instead of small
FIX: Token Error : delete stock transfer
FIX: ToOfferALinkForOnlinePayment not translated
FIX: tooltip of technical tables added of a module
FIX: wrong result check when update expensereport line
***** ChangeLog for 16.0.0 compared to 15.0.0 ***** ***** ChangeLog for 16.0.0 compared to 15.0.0 *****
@ -236,6 +314,7 @@ Following changes may create regressions for some external modules, but were nec
* Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions. * Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions.
* The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced. * The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced.
* The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier' * The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier'
* Because the module Resources highly linked to the Agenda module, the menu for Resources module has been moved into top menu Agenda.
***** ChangeLog for 15.0.3 compared to 15.0.2 ***** ***** ChangeLog for 15.0.3 compared to 15.0.2 *****

View File

@ -266,6 +266,9 @@ if (!$user->admin) {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>'; print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>'; print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
} }

View File

@ -133,7 +133,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " WHERE f.fk_statut > 0"; $sql .= " WHERE f.fk_statut > 0";
$sql .= " AND fd.fk_code_ventilation > 0"; $sql .= " AND fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
} else { } else {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
@ -764,7 +764,7 @@ if (empty($action) || $action == 'view') {
$exportlink = ''; $exportlink = '';
$builddate = dol_now(); $builddate = dol_now();
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");

View File

@ -202,6 +202,9 @@ if ($object->nature == 2 || $object->nature == 3) {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
} }
$listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger"));

View File

@ -342,7 +342,7 @@ if (strlen(trim($search_country))) {
if (strlen(trim($search_tvaintra))) { if (strlen(trim($search_tvaintra))) {
$sql .= natural_search("s.tva_intra", $search_tvaintra); $sql .= natural_search("s.tva_intra", $search_tvaintra);
} }
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
} else { } else {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";

View File

@ -410,7 +410,7 @@ if ($action == 'create') {
// Amount // Amount
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="amount" id="amount" class="minwidth100 maxwidth150onsmartphone" value="'.$amount.'">'; print '<input name="amount" id="amount" class="minwidth50 maxwidth100" value="'.$amount.'">';
print '</td></tr>'; print '</td></tr>';
// Bank // Bank

View File

@ -97,10 +97,19 @@ class FactureStats extends Stats
if ($this->userid > 0) { if ($this->userid > 0) {
$this->where .= ' AND f.fk_user_author = '.((int) $this->userid); $this->where .= ' AND f.fk_user_author = '.((int) $this->userid);
} }
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($mode == 'customer') {
$this->where .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
} else { $this->where .= " AND f.type IN (0,1,2,5)";
$this->where .= " AND f.type IN (0,1,2,3,5)"; } else {
$this->where .= " AND f.type IN (0,1,2,3,5)";
}
}
if ($mode == 'supplier') {
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$this->where .= " AND f.type IN (0,1,2,5)";
} else {
$this->where .= " AND f.type IN (0,1,2,3,5)";
}
} }
if ($typentid) { if ($typentid) {

View File

@ -260,7 +260,7 @@ if ($object->id > 0) {
$resteapayeraffiche = $resteapayer; $resteapayeraffiche = $resteapayer;
if ($type == 'bank-transfer') { if ($type == 'bank-transfer') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { // Not recommended
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { } else {
@ -273,7 +273,7 @@ if ($object->id > 0) {
$absolute_discount = price2num($absolute_discount, 'MT'); $absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT');
} else { } else {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Not recommended
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { } else {

View File

@ -95,7 +95,7 @@ $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = dol_now(); $builddate = dol_now();
$description = $langs->trans("DescPurchasesJournal").'<br>'; $description = $langs->trans("DescPurchasesJournal").'<br>';
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
@ -119,7 +119,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " WHERE f.fk_statut > 0 AND f.entity IN (".getEntity('invoice').")"; $sql .= " WHERE f.fk_statut > 0 AND f.entity IN (".getEntity('invoice').")";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2)"; $sql .= " AND f.type IN (0,1,2)";
} else { } else {
$sql .= " AND f.type IN (0,1,2,3)"; $sql .= " AND f.type IN (0,1,2,3)";

View File

@ -194,6 +194,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='<br>'.$lan
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description.='<br>'.$langs->trans("DepositsAreNotIncluded"); $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
} }
if (! empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description.='<br>'.$langs->trans("SupplierDepositsAreNotIncluded");
}
*/ */
if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) {
$description .= $langs->trans("ThisIsAnEstimatedValue"); $description .= $langs->trans("ThisIsAnEstimatedValue");

View File

@ -189,6 +189,9 @@ if ($modecompta == "CREANCES-DETTES") {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
$builddate = dol_now(); $builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
@ -637,7 +640,7 @@ if ($modecompta == 'BOOKKEEPING') {
$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.fk_statut IN (1,2)"; $sql .= " AND f.fk_statut IN (1,2)";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2)"; $sql .= " AND f.type IN (0,1,2)";
} else { } else {
$sql .= " AND f.type IN (0,1,2,3)"; $sql .= " AND f.type IN (0,1,2,3)";
@ -1341,7 +1344,7 @@ if ($modecompta == 'BOOKKEEPING') {
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount"; $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " WHERE f.fk_statut IN (1,2)"; $sql .= " WHERE f.fk_statut IN (1,2)";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2)"; $sql .= " AND f.type IN (0,1,2)";
} else { } else {
$sql .= " AND f.type IN (0,1,2,3)"; $sql .= " AND f.type IN (0,1,2,3)";

View File

@ -165,6 +165,9 @@ if ($modecompta == 'CREANCES-DETTES') {
} else { } else {
$description .= "<br>".$langs->trans("DepositsAreIncluded"); $description .= "<br>".$langs->trans("DepositsAreIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
$builddate = dol_now(); $builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
@ -330,7 +333,7 @@ if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " WHERE f.fk_statut IN (1,2)"; $sql .= " WHERE f.fk_statut IN (1,2)";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2)"; $sql .= " AND f.type IN (0,1,2)";
} else { } else {
$sql .= " AND f.type IN (0,1,2,3)"; $sql .= " AND f.type IN (0,1,2,3)";
@ -438,7 +441,7 @@ if (isModEnabled('tax') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "
$sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " WHERE f.fk_statut IN (1,2)"; $sql .= " WHERE f.fk_statut IN (1,2)";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2)"; $sql .= " AND f.type IN (0,1,2)";
} else { } else {
$sql .= " AND f.type IN (0,1,2,3)"; $sql .= " AND f.type IN (0,1,2,3)";

View File

@ -205,6 +205,9 @@ if ($modecompta == "CREANCES-DETTES") {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
$builddate = dol_now(); $builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
@ -231,8 +234,6 @@ if ($modecompta == "CREANCES-DETTES") {
$exportlink = ''; $exportlink = '';
$description = $langs->trans("RulesResultBookkeepingPersonalized"); $description = $langs->trans("RulesResultBookkeepingPersonalized");
$description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("AccountingCategory")).')'; $description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("AccountingCategory")).')';
//if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
//else $description.= $langs->trans("DepositsAreIncluded");
$builddate = dol_now(); $builddate = dol_now();
} }

View File

@ -225,7 +225,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= '<br>'.$langs->trans("DepositsAreNotIncluded"); $description .= '<br>'.$langs->trans("DepositsAreNotIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
// Customers invoices // Customers invoices
$elementcust = $langs->trans("CustomersInvoices"); $elementcust = $langs->trans("CustomersInvoices");
$productcust = $langs->trans("ProductOrService"); $productcust = $langs->trans("ProductOrService");
@ -256,6 +258,9 @@ if ($modecompta == "CREANCES-DETTES") {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
$builddate = dol_now(); $builddate = dol_now();
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
@ -406,7 +411,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql2 .= " WHERE ff.datef >= '".$db->idate($date_start)."'"; $sql2 .= " WHERE ff.datef >= '".$db->idate($date_start)."'";
$sql2 .= " AND ff.datef <= '".$db->idate($date_end)."'"; $sql2 .= " AND ff.datef <= '".$db->idate($date_end)."'";
$sql .= " AND ff.fk_statut in (1,2)"; $sql .= " AND ff.fk_statut in (1,2)";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND ff.type IN (0,1,2,5)"; $sql .= " AND ff.type IN (0,1,2,5)";
} else { } else {
$sql .= " AND ff.type IN (0,1,2,3,5)"; $sql .= " AND ff.type IN (0,1,2,3,5)";

View File

@ -247,7 +247,6 @@ if ($modecompta == "CREANCES-DETTES") {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
$builddate = dol_now(); $builddate = dol_now();
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices");

View File

@ -154,6 +154,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= '<br>'.$langs->trans("DepositsAreNotIncluded"); $description .= '<br>'.$langs->trans("DepositsAreNotIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) {
$description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue");
} }

View File

@ -211,6 +211,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= '<br>'.$langs->trans("DepositsAreNotIncluded"); $description .= '<br>'.$langs->trans("DepositsAreNotIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) {
$description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue");
} }

View File

@ -164,6 +164,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= '<br>'.$langs->trans("DepositsAreNotIncluded"); $description .= '<br>'.$langs->trans("DepositsAreNotIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) {
$description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue"); $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue");
} }

View File

@ -1707,8 +1707,8 @@ class Contrat extends CommonObject
$total_localtax1 = $tabprice[9]; $total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10]; $total_localtax2 = $tabprice[10];
$localtax1_type = $localtaxes_type[0]; $localtax1_type = (empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]);
$localtax2_type = $localtaxes_type[2]; $localtax2_type = (empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]);
// TODO A virer // TODO A virer
// Anciens indicateurs: $price, $remise (a ne plus utiliser) // Anciens indicateurs: $price, $remise (a ne plus utiliser)
@ -1741,8 +1741,8 @@ class Contrat extends CommonObject
$sql .= ",tva_tx = ".((float) price2num($tvatx)); $sql .= ",tva_tx = ".((float) price2num($tvatx));
$sql .= ",localtax1_tx = ".((float) price2num($localtax1tx)); $sql .= ",localtax1_tx = ".((float) price2num($localtax1tx));
$sql .= ",localtax2_tx = ".((float) price2num($localtax2tx)); $sql .= ",localtax2_tx = ".((float) price2num($localtax2tx));
$sql .= ",localtax1_type='".$this->db->escape($localtax1_type); $sql .= ",localtax1_type='".$this->db->escape($localtax1_type)."'";
$sql .= ",localtax2_type='".$this->db->escape($localtax2_type); $sql .= ",localtax2_type='".$this->db->escape($localtax2_type)."'";
$sql .= ", total_ht = ".((float) price2num($total_ht)); $sql .= ", total_ht = ".((float) price2num($total_ht));
$sql .= ", total_tva = ".((float) price2num($total_tva)); $sql .= ", total_tva = ".((float) price2num($total_tva));
$sql .= ", total_localtax1 = ".((float) price2num($total_localtax1)); $sql .= ", total_localtax1 = ".((float) price2num($total_localtax1));

View File

@ -175,7 +175,7 @@ abstract class CommonInvoice extends CommonObject
/** /**
* Return amount (with tax) of all deposits invoices used by invoice. * Return amount (with tax) of all deposits invoices used by invoice.
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on for sale invoices (not recommended), * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on for sale invoices (not recommended),
* of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended). * of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended).
* *
* @param int $multicurrency Return multicurrency_amount instead of amount * @param int $multicurrency Return multicurrency_amount instead of amount
* @return float <0 and set ->error if KO, Sum of deposits amount otherwise * @return float <0 and set ->error if KO, Sum of deposits amount otherwise
@ -183,7 +183,7 @@ abstract class CommonInvoice extends CommonObject
public function getSumDepositsUsed($multicurrency = 0) public function getSumDepositsUsed($multicurrency = 0)
{ {
/*if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { /*if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') {
// FACTURE_DEPOSITS_ARE_JUST_PAYMENTS was never supported for purchase invoice, so we can return 0 with no need of SQL for this case. // FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS was never supported for purchase invoice, so we can return 0 with no need of SQL for this case.
return 0.0; return 0.0;
}*/ }*/
@ -379,7 +379,7 @@ abstract class CommonInvoice extends CommonObject
$sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type"; $sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type";
$sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture_fourn as f'; $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture_fourn as f';
$sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $this->id); $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $this->id);
$sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set) $sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is set)
} }
if ($sql) { if ($sql) {

View File

@ -4410,7 +4410,7 @@ abstract class CommonObject
$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
if ($nb_rows_affected >= 0) { if ($nb_rows_affected > 0) {
if (empty($trigkey)) { if (empty($trigkey)) {
// Try to guess trigkey (for backward compatibility, now we should have trigkey defined into the call of setStatus) // Try to guess trigkey (for backward compatibility, now we should have trigkey defined into the call of setStatus)
if ($this->element == 'supplier_proposal' && $status == 2) { if ($this->element == 'supplier_proposal' && $status == 2) {

View File

@ -559,7 +559,7 @@ class DiscountAbsolute
/** /**
* Return amount (with tax) of all deposits invoices used by invoice as a payment. * Return amount (with tax) of all deposits invoices used by invoice as a payment.
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS or FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
* *
* @param CommonInvoice $invoice Object invoice (customer of supplier) * @param CommonInvoice $invoice Object invoice (customer of supplier)
* @param int $multicurrency 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount * @param int $multicurrency 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount

View File

@ -5759,7 +5759,7 @@ class Form
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="inline-block">'; print '<div class="inline-block">';
if (!empty($discount_type)) { if (!empty($discount_type)) {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") { if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") {
$translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { } else {

View File

@ -174,10 +174,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
$sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND f.rowid = d.".$fk_facture;
$sql .= " AND s.rowid = f.fk_soc"; $sql .= " AND s.rowid = f.fk_soc";
@ -222,10 +230,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
$sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND f.rowid = d.".$fk_facture;
$sql .= " AND s.rowid = f.fk_soc"; $sql .= " AND s.rowid = f.fk_soc";
@ -359,10 +375,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
$sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND f.rowid = d.".$fk_facture;
$sql .= " AND s.rowid = f.fk_soc"; $sql .= " AND s.rowid = f.fk_soc";
@ -407,10 +431,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
$sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND f.rowid = d.".$fk_facture;
$sql .= " AND s.rowid = f.fk_soc"; $sql .= " AND s.rowid = f.fk_soc";
@ -730,10 +762,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
if ($y && $m) { if ($y && $m) {
$sql .= " AND f.datef >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; $sql .= " AND f.datef >= '".$db->idate(dol_get_first_day($y, $m, false))."'";
@ -776,10 +816,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
if ($y && $m) { if ($y && $m) {
$sql .= " AND pa.datep >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; $sql .= " AND pa.datep >= '".$db->idate(dol_get_first_day($y, $m, false))."'";
@ -915,10 +963,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
if ($y && $m) { if ($y && $m) {
$sql .= " AND f.datef >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; $sql .= " AND f.datef >= '".$db->idate(dol_get_first_day($y, $m, false))."'";
@ -961,10 +1017,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
$sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")";
$sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely)
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($direction == 'buy') {
$sql .= " AND f.type IN (0,1,2,5)"; if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} else { } else {
$sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (0,1,2,5)";
} else {
$sql .= " AND f.type IN (0,1,2,3,5)";
}
} }
if ($y && $m) { if ($y && $m) {
$sql .= " AND pa.datep >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; $sql .= " AND pa.datep >= '".$db->idate(dol_get_first_day($y, $m, false))."'";

View File

@ -5,6 +5,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -238,7 +239,7 @@ class modFacture extends DolibarrModules
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'f.ref' => 'InvoiceRef*', 'f.ref' => 'InvoiceRef*',
'f.ref_ext' => 'ExternalRef', 'f.ref_ext' => 'ExternalRef',
'f.ref_client' => 'CutomerRef', 'f.ref_client' => 'CustomerRef',
'f.type' => 'Type*', 'f.type' => 'Type*',
'f.fk_soc' => 'Customer*', 'f.fk_soc' => 'Customer*',
'f.datec' => 'InvoiceDateCreation', 'f.datec' => 'InvoiceDateCreation',
@ -350,7 +351,7 @@ class modFacture extends DolibarrModules
) )
); );
//Import Supplier Invoice Lines // Import Invoice Lines
$r++; $r++;
$this->import_code[$r] = $this->rights_class.'_'.$r; $this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "InvoiceLine"; // Translation key $this->import_label[$r] = "InvoiceLine"; // Translation key

View File

@ -419,7 +419,11 @@ class ProductFournisseur extends Product
$productfournisseurprice->array_options[$key] = $value; $productfournisseurprice->array_options[$key] = $value;
} }
$res = $productfournisseurprice->update($user); $res = $productfournisseurprice->update($user);
if ($res < 0) $error++; if ($res < 0) {
$this->error = $productfournisseurprice->error;
$this->errors = $productfournisseurprice->errors;
$error++;
}
} }
} }
} }
@ -506,6 +510,7 @@ class ProductFournisseur extends Product
if ($resql) { if ($resql) {
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price");
} else { } else {
$this->error = $this->db->lasterror();
$error++; $error++;
} }
@ -518,7 +523,11 @@ class ProductFournisseur extends Product
$productfournisseurprice->array_options[$key] = $value; $productfournisseurprice->array_options[$key] = $value;
} }
$res = $productfournisseurprice->update($user); $res = $productfournisseurprice->update($user);
if ($res < 0) $error++; if ($res < 0) {
$this->error = $productfournisseurprice->error;
$this->errors = $productfournisseurprice->errors;
$error++;
}
} }
} }
} }

View File

@ -2121,7 +2121,7 @@ if ($action == 'create') {
print '</tr>'; print '</tr>';
// Relative and absolute discounts // Relative and absolute discounts
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { } else {

View File

@ -2641,7 +2641,7 @@ if ($action == 'create') {
} }
$resteapayeraffiche = $resteapayer; $resteapayeraffiche = $resteapayer;
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { } else {

View File

@ -365,7 +365,52 @@ ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER dom
-- Set default ticket type to OTHER if no default exists -- Set default ticket type to OTHER if no default exists
UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1);
-- Assets - New module -- Assets - New module
CREATE TABLE llx_asset(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
label varchar(255),
fk_asset_model integer,
reversal_amount_ht double(24,8),
acquisition_value_ht double(24,8) DEFAULT NULL,
recovered_vat double(24,8),
reversal_date date,
date_acquisition date NOT NULL,
date_start date NOT NULL,
qty real DEFAULT 1 NOT NULL,
acquisition_type smallint DEFAULT 0 NOT NULL,
asset_type smallint DEFAULT 0 NOT NULL,
not_depreciated integer DEFAULT 0,
disposal_date date,
disposal_amount_ht double(24,8),
fk_disposal_type integer,
disposal_depreciated integer DEFAULT 0,
disposal_subject_to_vat integer DEFAULT 0,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
last_main_doc varchar(255),
import_key varchar(14),
model_pdf varchar(255),
status integer NOT NULL
) ENGINE=innodb;
ALTER TABLE llx_asset DROP FOREIGN KEY fk_asset_asset_type; ALTER TABLE llx_asset DROP FOREIGN KEY fk_asset_asset_type;
ALTER TABLE llx_asset DROP INDEX idx_asset_fk_asset_type; ALTER TABLE llx_asset DROP INDEX idx_asset_fk_asset_type;

View File

@ -22,6 +22,7 @@
CREATE TABLE llx_establishment ( CREATE TABLE llx_establishment (
rowid integer NOT NULL auto_increment PRIMARY KEY, rowid integer NOT NULL auto_increment PRIMARY KEY,
entity integer NOT NULL DEFAULT 1, entity integer NOT NULL DEFAULT 1,
label varchar(255),
ref varchar(30), ref varchar(30),
label varchar(255) NOT NULL, label varchar(255) NOT NULL,
name varchar(128), name varchar(128),

View File

@ -14,6 +14,7 @@ ErrorLoginAlreadyExists=Login %s already exists.
ErrorGroupAlreadyExists=Group %s already exists. ErrorGroupAlreadyExists=Group %s already exists.
ErrorEmailAlreadyExists=Email %s already exists. ErrorEmailAlreadyExists=Email %s already exists.
ErrorRecordNotFound=Record not found. ErrorRecordNotFound=Record not found.
ErrorRecordNotFoundShort=Not found
ErrorFailToCopyFile=Failed to copy file '<b>%s</b>' into '<b>%s</b>'. ErrorFailToCopyFile=Failed to copy file '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToCopyDir=Failed to copy directory '<b>%s</b>' into '<b>%s</b>'. ErrorFailToCopyDir=Failed to copy directory '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToRenameFile=Failed to rename file '<b>%s</b>' into '<b>%s</b>'. ErrorFailToRenameFile=Failed to rename file '<b>%s</b>' into '<b>%s</b>'.

View File

@ -1613,7 +1613,7 @@ if ($action == 'create') {
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Relative and absolute discounts // Relative and absolute discounts
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { } else {

View File

@ -414,7 +414,7 @@ $htmltext .= '</i>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', ''); print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', '');
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans('Value').'</td>'; print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans('Value').'</td>';

View File

@ -587,7 +587,9 @@ function New() {
* return {void} * return {void}
*/ */
function Search2(keyCodeForEnter, moreorless) { function Search2(keyCodeForEnter, moreorless) {
console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); var eventKeyCode = window.event.keyCode;
console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode);
var search_term = $('#search').val(); var search_term = $('#search').val();
var search_start = 0; var search_start = 0;
@ -610,20 +612,19 @@ function Search2(keyCodeForEnter, moreorless) {
} }
var search = false; var search = false;
var eventKeyCode = window.event.keyCode; if (keyCodeForEnter != '' || eventKeyCode == keyCodeForEnter) {
if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) {
search = true; search = true;
} }
if (search === true) { if (search === true) {
// if a timer has been already started (search2_timer is a global js variable), we cancel it now
// temporization time to give time to type // we click onto another key, we will restart another timer just after
if (search2_timer) { if (search2_timer) {
clearTimeout(search2_timer); clearTimeout(search2_timer);
} }
// temporization time to give time to type
search2_timer = setTimeout(function(){ search2_timer = setTimeout(function(){
pageproducts = 0; pageproducts = 0;
jQuery(".wrapper2 .catwatermark").hide(); jQuery(".wrapper2 .catwatermark").hide();
var nbsearchresults = 0; var nbsearchresults = 0;
@ -695,8 +696,8 @@ function Search2(keyCodeForEnter, moreorless) {
if (data.length == 0) { if (data.length == 0) {
$('#search').val('<?php $('#search').val('<?php
$langs->load('errors'); $langs->load('errors');
echo dol_escape_js($langs->trans("ErrorRecordNotFound")); echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort"));
?>'); ?> ('+search_term+')');
$('#search').select(); $('#search').select();
} }
else ClearSearch(); else ClearSearch();