Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
5e6ca6e61c
@ -561,7 +561,7 @@ class BOM extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -63,12 +64,67 @@ class Proposals extends DolibarrApi
|
|||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function get($id, $contact_list = 1)
|
public function get($id, $contact_list = 1)
|
||||||
|
{
|
||||||
|
return $this->_fetch($id, '', '', '', $contact_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of an proposal object by ref
|
||||||
|
*
|
||||||
|
* Return an array with proposal informations
|
||||||
|
*
|
||||||
|
* @param string $ref Ref of object
|
||||||
|
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||||
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @url GET ref/{ref}
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
public function getByRef($ref, $contact_list = 1)
|
||||||
|
{
|
||||||
|
return $this->_fetch('', $ref, '', '', $contact_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of an proposal object by ref_ext
|
||||||
|
*
|
||||||
|
* Return an array with proposal informations
|
||||||
|
*
|
||||||
|
* @param string $ref_ext External reference of object
|
||||||
|
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||||
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @url GET ref_ext/{ref_ext}
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||||
|
{
|
||||||
|
return $this->_fetch('', '', $ref_ext, '', $contact_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of an proposal object
|
||||||
|
*
|
||||||
|
* Return an array with proposal informations
|
||||||
|
*
|
||||||
|
* @param int $id ID of order
|
||||||
|
* @param string $ref Ref of object
|
||||||
|
* @param string $ref_ext External reference of object
|
||||||
|
* @param string $ref_int Internal reference of other objec
|
||||||
|
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||||
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->propal->fetch($id);
|
$result = $this->propal->fetch($id, $ref, $ref_ext, $ref_int);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commercial Proposal not found');
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1803,7 +1803,7 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||||
|
|||||||
@ -384,7 +384,7 @@ class Commande extends CommonOrder
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||||
|
|||||||
@ -104,9 +104,9 @@ class Invoices extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get properties of an order object
|
* Get properties of an invoice object
|
||||||
*
|
*
|
||||||
* Return an array with order informations
|
* Return an array with invoice informations
|
||||||
*
|
*
|
||||||
* @param int $id ID of order
|
* @param int $id ID of order
|
||||||
* @param string $ref Ref of object
|
* @param string $ref Ref of object
|
||||||
|
|||||||
@ -2530,7 +2530,7 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -536,21 +536,21 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
if (!empty($arrayfields['f.total']['checked']))
|
if (!empty($arrayfields['f.total']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($objp->total).'</td>'."\n";
|
print '<td class="nowrap right">'.price($objp->total).'</td>'."\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total';
|
||||||
$totalarray['val']['f.total'] += $objp->total;
|
$totalarray['val']['f.total'] += $objp->total;
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['f.tva']['checked']))
|
if (!empty($arrayfields['f.tva']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($objp->total_vat).'</td>'."\n";
|
print '<td class="nowrap right">'.price($objp->total_vat).'</td>'."\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.tva';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.tva';
|
||||||
$totalarray['val']['f.tva'] += $objp->total_vat;
|
$totalarray['val']['f.tva'] += $objp->total_vat;
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['f.total_ttc']['checked']))
|
if (!empty($arrayfields['f.total_ttc']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($objp->total_ttc).'</td>'."\n";
|
print '<td class="nowrap right">'.price($objp->total_ttc).'</td>'."\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
|
||||||
$totalarray['val']['f.total_ttc'] += $objp->total_ttc;
|
$totalarray['val']['f.total_ttc'] += $objp->total_ttc;
|
||||||
|
|||||||
@ -517,7 +517,7 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -697,7 +697,7 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
$numref = "EXP".$this->id;
|
$numref = "EXP".$this->id;
|
||||||
}
|
}
|
||||||
$this->newref = $numref;
|
$this->newref = dol_sanitizeFileName($numref);
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
|||||||
@ -1163,7 +1163,7 @@ class ExpenseReport extends CommonObject
|
|||||||
}
|
}
|
||||||
if (empty($num) || $num < 0) return -1;
|
if (empty($num) || $num < 0) return -1;
|
||||||
|
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -544,7 +544,7 @@ class Fichinter extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
||||||
$sql .= " SET fk_statut = 1";
|
$sql .= " SET fk_statut = 1";
|
||||||
|
|||||||
@ -587,7 +587,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur";
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur";
|
||||||
$sql .= " SET ref='".$this->db->escape($num)."',";
|
$sql .= " SET ref='".$this->db->escape($num)."',";
|
||||||
@ -971,7 +971,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
// Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated)
|
// Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated)
|
||||||
$movetoapprovestatus = true;
|
$movetoapprovestatus = true;
|
||||||
|
|||||||
@ -1413,7 +1413,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
||||||
$sql .= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
|
$sql .= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
|
||||||
|
|||||||
@ -716,7 +716,7 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
// Update status
|
// Update status
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET";
|
||||||
|
|||||||
@ -404,7 +404,7 @@ class Livraison extends CommonObject
|
|||||||
{
|
{
|
||||||
$numref = $this->ref;
|
$numref = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $numref;
|
$this->newref = dol_sanitizeFileName($numref);
|
||||||
|
|
||||||
// Test if is not already in valid status. If so, we stop to avoid decrementing the stock twice.
|
// Test if is not already in valid status. If so, we stop to avoid decrementing the stock twice.
|
||||||
$sql = "SELECT ref";
|
$sql = "SELECT ref";
|
||||||
|
|||||||
@ -546,7 +546,7 @@ class Reception extends CommonObject
|
|||||||
$numref = $this->ref;
|
$numref = $this->ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->newref = $numref;
|
$this->newref = dol_sanitizeFileName($numref);
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
|||||||
@ -1462,7 +1462,7 @@ class SupplierProposal extends CommonObject
|
|||||||
{
|
{
|
||||||
$num = $this->ref;
|
$num = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
$this->newref = dol_sanitizeFileName($num);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal";
|
||||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user