mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Set import_key in import when update record (#28644)
* fix can't delete pdf if ref is not encoded (#28630) * fix typo in ChangeLog (#28613) * fix typo in ChangeLog * Update ChangeLog * FIX: Count of virtual stock at Services and MoLine with disabled stock change (#28580) * fix the count of virtual stock * - fix "Found non sanitized string" ? --------- Co-authored-by: christian.humpel <christian.humpel@gmail.com> * Set import_key in import when update record * Set import_key in import when update record --------- Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com> Co-authored-by: Christian Humpel <78662388+Humml87@users.noreply.github.com> Co-authored-by: christian.humpel <christian.humpel@gmail.com> Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
13f3dcf39c
commit
cb77ff0a16
|
|
@ -4511,7 +4511,7 @@ if ($action == 'create') {
|
|||
$file = GETPOST('file', 'alpha');
|
||||
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"].'?facid='.$object->id.'&file='.$file,
|
||||
$_SERVER["PHP_SELF"].'?facid='.$object->id.'&file='.urlencode($file),
|
||||
$langs->trans('DeleteFileHeader'),
|
||||
$langs->trans('DeleteFileText')."<br><br>".$file,
|
||||
'remove_file',
|
||||
|
|
|
|||
|
|
@ -965,7 +965,7 @@ class ImportCsv extends ModeleImports
|
|||
foreach ($data as $key => $val) {
|
||||
$set[] = $key." = ".$val;
|
||||
}
|
||||
$sqlstart .= " SET ".implode(', ', $set);
|
||||
$sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'";
|
||||
|
||||
if (empty($keyfield)) {
|
||||
$keyfield = 'rowid';
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@ class ImportXlsx extends ModeleImports
|
|||
foreach ($data as $key => $val) {
|
||||
$set[] = $key." = ".$val;
|
||||
}
|
||||
$sqlstart .= " SET " . implode(', ', $set);
|
||||
$sqlstart .= " SET " . implode(', ', $set) . ", import_key = '" . $this->db->escape($importid) . "'";
|
||||
|
||||
if (empty($keyfield)) {
|
||||
$keyfield = 'rowid';
|
||||
|
|
|
|||
|
|
@ -3535,6 +3535,8 @@ class Product extends CommonObject
|
|||
// phpcs:enable
|
||||
global $conf, $user, $hookmanager, $action;
|
||||
|
||||
$serviceStockIsEnabled = isModEnabled("service") && getDolGlobalString('STOCK_SUPPORTS_SERVICES');
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT m.fk_soc) as nb_customers, COUNT(DISTINCT m.rowid) as nb,";
|
||||
$sql .= " COUNT(mp.rowid) as nb_rows, SUM(mp.qty) as qty, role";
|
||||
$sql .= " FROM ".$this->db->prefix()."mrp_production as mp";
|
||||
|
|
@ -3546,6 +3548,7 @@ class Product extends CommonObject
|
|||
$sql .= " WHERE m.rowid = mp.fk_mo";
|
||||
$sql .= " AND m.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'mrp').")";
|
||||
$sql .= " AND mp.fk_product = ".((int) $this->id);
|
||||
$sql .= " AND mp.disable_stock_change IN (0)";
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$forVirtualStock) {
|
||||
$sql .= " AND m.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
|
@ -3558,6 +3561,9 @@ class Product extends CommonObject
|
|||
if (!empty($dateofvirtualstock)) {
|
||||
$sql .= " AND m.date_valid <= '".$this->db->idate($dateofvirtualstock)."'"; // better date to code ? end of production ?
|
||||
}
|
||||
if (!$serviceStockIsEnabled) {
|
||||
$sql .= "AND EXISTS (SELECT p.rowid FROM ".$this->db->prefix()."product AS p WHERE p.rowid = ".((int) $this->id)." AND p.fk_product_type IN (0))";
|
||||
}
|
||||
if (!empty($warehouseid)) {
|
||||
$sql.= " AND m.fk_warehouse = ".((int) $warehouseid);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user