Merge branch 'develop' of github.com:Dolibarr/dolibarr into dev_massaction_paid_custom_invoice

This commit is contained in:
Florian HENRY 2021-05-20 14:02:05 +02:00
commit 7a9102ac60
4 changed files with 46 additions and 23 deletions

View File

@ -85,8 +85,8 @@ $search_refcustomer = GETPOST('search_refcustomer', 'alpha');
$search_type = GETPOST('search_type', 'int'); $search_type = GETPOST('search_type', 'int');
$search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_project = GETPOST('search_project', 'alpha'); $search_project = GETPOST('search_project', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha'); $search_company = GETPOST('search_company', 'alpha');
$search_societe_alias = GETPOST('search_societe_alias', 'alpha'); $search_company_alias = GETPOST('search_company_alias', 'alpha');
$search_montant_ht = GETPOST('search_montant_ht', 'alpha'); $search_montant_ht = GETPOST('search_montant_ht', 'alpha');
$search_montant_vat = GETPOST('search_montant_vat', 'alpha'); $search_montant_vat = GETPOST('search_montant_vat', 'alpha');
$search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha'); $search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha');
@ -304,8 +304,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_type = ''; $search_type = '';
$search_project_ref = ''; $search_project_ref = '';
$search_project = ''; $search_project = '';
$search_societe = ''; $search_company = '';
$search_societe_alias = ''; $search_company_alias = '';
$search_montant_ht = ''; $search_montant_ht = '';
$search_montant_vat = ''; $search_montant_vat = '';
$search_montant_localtax1 = ''; $search_montant_localtax1 = '';
@ -543,7 +543,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo
if (!$sall) { if (!$sall) {
$sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed'; $sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
} }
if ($search_categ_cus) { if ($search_categ_cus && $search_categ_cus!=-1) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
@ -560,7 +560,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_cus)) { if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
@ -625,11 +625,11 @@ if ($search_project_ref) {
if ($search_project) { if ($search_project) {
$sql .= natural_search('p.title', $search_project); $sql .= natural_search('p.title', $search_project);
} }
if ($search_societe) { if ($search_company) {
$sql .= natural_search('s.nom', $search_societe); $sql .= natural_search('s.nom', $search_company);
} }
if ($search_societe_alias) { if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_societe_alias); $sql .= natural_search('s.name_alias', $search_company_alias);
} }
if ($search_town) { if ($search_town) {
$sql .= natural_search('s.town', $search_town); $sql .= natural_search('s.town', $search_town);
@ -771,7 +771,7 @@ if (!$sall) {
$sql .= ' country.code,'; $sql .= ' country.code,';
$sql .= " p.rowid, p.ref, p.title,"; $sql .= " p.rowid, p.ref, p.title,";
$sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender"; $sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender";
if ($search_categ_cus) { if ($search_categ_cus && $search_categ_cus!=-1) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
@ -833,8 +833,8 @@ if ($resql) {
if ($socid) { if ($socid) {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
if (empty($search_societe)) { if (empty($search_company)) {
$search_societe = $soc->name; $search_company = $soc->name;
} }
} }
@ -905,11 +905,11 @@ if ($resql) {
if ($search_type != '') { if ($search_type != '') {
$param .= '&search_type='.urlencode($search_type); $param .= '&search_type='.urlencode($search_type);
} }
if ($search_societe) { if ($search_company) {
$param .= '&search_societe='.urlencode($search_societe); $param .= '&search_societe='.urlencode($search_company);
} }
if ($search_societe_alias) { if ($search_company_alias) {
$param .= '&search_societe_alias='.urlencode($search_societe_alias); $param .= '&search_societe_alias='.urlencode($search_company_alias);
} }
if ($search_town) { if ($search_town) {
$param .= '&search_town='.urlencode($search_town); $param .= '&search_town='.urlencode($search_town);
@ -1212,11 +1212,11 @@ if ($resql) {
} }
// Thirdparty // Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) { if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_societe" value="'.$search_societe.'"></td>'; print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.$search_company.'"></td>';
} }
// Alias // Alias
if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_societe_alias" value="'.$search_societe_alias.'"></td>'; print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.$search_company_alias.'"></td>';
} }
// Town // Town
if (!empty($arrayfields['s.town']['checked'])) { if (!empty($arrayfields['s.town']['checked'])) {

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com> * Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr> * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
* Copyright (C) 2021 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
@ -612,6 +613,14 @@ if ($action == 'create') {
} }
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,"; $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,";
$sql .= "p.tosell, p.tobuy,";
$sql .= "p.accountancy_code_sell,";
$sql .= "p.accountancy_code_sell_intra,";
$sql .= "p.accountancy_code_sell_export,";
$sql .= "p.accountancy_code_buy,";
$sql .= "p.accountancy_code_buy_intra,";
$sql .= "p.accountancy_code_buy_export,";
$sql .= 'p.barcode,';
if ($separatedPMP) { if ($separatedPMP) {
$sql .= " pa.pmp as ppmp,"; $sql .= " pa.pmp as ppmp,";
} else { } else {
@ -683,6 +692,15 @@ if ($action == 'create') {
$productstatic->entity = $objp->entity; $productstatic->entity = $objp->entity;
$productstatic->status_batch = $objp->tobatch; $productstatic->status_batch = $objp->tobatch;
$productstatic->fk_unit = $objp->fk_unit; $productstatic->fk_unit = $objp->fk_unit;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->barcode = $objp->barcode;
$productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
$productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
print $productstatic->getNomUrl(1, 'stock', 16); print $productstatic->getNomUrl(1, 'stock', 16);
print '</td>'; print '</td>';
@ -768,6 +786,7 @@ if ($action == 'create') {
} }
print '<td class="liste_total">&nbsp;</td>'; print '<td class="liste_total">&nbsp;</td>';
print '<td class="liste_total">&nbsp;</td>'; print '<td class="liste_total">&nbsp;</td>';
print '<td class="liste_total">&nbsp;</td>';
print '</tr>'; print '</tr>';
} else { } else {
dol_print_error($db); dol_print_error($db);

View File

@ -962,6 +962,10 @@ class MouvementStock extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
$origin = new Reception($this->db); $origin = new Reception($this->db);
break; break;
case 'inventory':
require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
$origin = new Inventory($this->db);
break;
default: default:
if ($origintype) { if ($origintype) {

View File

@ -467,10 +467,10 @@ if ($search_sale && $search_sale != '-1') {
$sql .= ", sc.fk_soc, sc.fk_user"; $sql .= ", sc.fk_soc, sc.fk_user";
} }
// We'll need these fields in order to filter by categ // We'll need these fields in order to filter by categ
if ($search_categ_cus) { if ($search_categ_cus && $search_categ_cus!=-1) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
if ($search_categ_sup) { if ($search_categ_sup && $search_categ_sup!=-1) {
$sql .= ", cs.fk_categorie, cs.fk_soc"; $sql .= ", cs.fk_categorie, cs.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
@ -494,10 +494,10 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_ef
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
// We'll need this table joined to the select in order to filter by categ // We'll need this table joined to the select in order to filter by categ
if (!empty($search_categ_cus)) { if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
if (!empty($search_categ_sup)) { if (!empty($search_categ_sup) && $search_categ_sup!=-1) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
} }
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";