Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 6.0
This commit is contained in:
commit
e9bf6ed4ce
@ -785,7 +785,8 @@ if ($resql)
|
|||||||
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
|
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
|
||||||
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
|
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
|
||||||
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
||||||
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
||||||
|
Facture::TYPE_SITUATION=>$langs->trans("InvoiceSituation"),
|
||||||
);
|
);
|
||||||
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
|
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
|
||||||
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
|
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
|
||||||
|
|||||||
@ -1115,4 +1115,30 @@ class Paiement extends CommonObject
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the third party of object, from id into this->thirdparty
|
||||||
|
*
|
||||||
|
* @param int $force_thirdparty_id Force thirdparty id
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch_thirdparty($force_thirdparty_id=0)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
|
if (empty($force_thirdparty_id))
|
||||||
|
{
|
||||||
|
$billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first invoice to get him
|
||||||
|
if (!empty($billsarray))
|
||||||
|
{
|
||||||
|
$supplier_invoice = new FactureFournisseur($this->db);
|
||||||
|
if ($supplier_invoice->fetch($billsarray[0]) > 0)
|
||||||
|
{
|
||||||
|
$force_thirdparty_id = $supplier_invoice->fk_soc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::fetch_thirdparty($force_thirdparty_id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,9 +58,7 @@ $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'ro
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) {
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -477,3 +477,42 @@ function measuring_units_string($unit,$measuring_style='')
|
|||||||
|
|
||||||
return $measuring_units[$unit];
|
return $measuring_units[$unit];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform a given unit into the square of that unit, if known
|
||||||
|
*
|
||||||
|
* @param int $unit Unit key (-3,-2,-1,0,98,99...)
|
||||||
|
* @return int Squared unit key (-6,-4,-2,0,98,99...)
|
||||||
|
* @see formproduct->load_measuring_units
|
||||||
|
*/
|
||||||
|
function measuring_units_squared($unit)
|
||||||
|
{
|
||||||
|
$measuring_units=array();
|
||||||
|
$measuring_units[0] = 0; // m -> m3
|
||||||
|
$measuring_units[-1] = -2; // dm-> dm2
|
||||||
|
$measuring_units[-2] = -4; // cm -> cm2
|
||||||
|
$measuring_units[-3] = -6; // mm -> mm2
|
||||||
|
$measuring_units[98] = 98; // foot -> foot2
|
||||||
|
$measuring_units[99] = 99; // inch -> inch2
|
||||||
|
return $measuring_units[$unit];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform a given unit into the cube of that unit, if known
|
||||||
|
*
|
||||||
|
* @param int $unit Unit key (-3,-2,-1,0,98,99...)
|
||||||
|
* @return int Cubed unit key (-9,-6,-3,0,88,89...)
|
||||||
|
* @see formproduct->load_measuring_units
|
||||||
|
*/
|
||||||
|
function measuring_units_cubed($unit)
|
||||||
|
{
|
||||||
|
$measuring_units=array();
|
||||||
|
$measuring_units[0] = 0; // m -> m2
|
||||||
|
$measuring_units[-1] = -3; // dm-> dm3
|
||||||
|
$measuring_units[-2] = -6; // cm -> cm3
|
||||||
|
$measuring_units[-3] = -9; // mm -> mm3
|
||||||
|
$measuring_units[98] = 88; // foot -> foot3
|
||||||
|
$measuring_units[99] = 89; // inch -> inch3
|
||||||
|
return $measuring_units[$unit];
|
||||||
|
}
|
||||||
|
|||||||
@ -723,12 +723,12 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||||
$thirdparty = $object->contact;
|
$thirdparty = $object->contact;
|
||||||
} else {
|
} else {
|
||||||
$thirdparty = $mysoc;
|
$thirdparty = $object->thirdparty;
|
||||||
}
|
}
|
||||||
|
|
||||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||||
|
|
||||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object);
|
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$thirdparty,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object);
|
||||||
|
|
||||||
// Show recipient
|
// Show recipient
|
||||||
$widthrecbox=90;
|
$widthrecbox=90;
|
||||||
|
|||||||
@ -734,4 +734,30 @@ class PaiementFourn extends Paiement
|
|||||||
|
|
||||||
return $way;
|
return $way;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the third party of object, from id into this->thirdparty
|
||||||
|
*
|
||||||
|
* @param int $force_thirdparty_id Force thirdparty id
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch_thirdparty($force_thirdparty_id=0)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
|
if (empty($force_thirdparty_id))
|
||||||
|
{
|
||||||
|
$billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first supplier invoice to get him
|
||||||
|
if (!empty($billsarray))
|
||||||
|
{
|
||||||
|
$supplier_invoice = new FactureFournisseur($this->db);
|
||||||
|
if ($supplier_invoice->fetch($billsarray[0]) > 0)
|
||||||
|
{
|
||||||
|
$force_thirdparty_id = $supplier_invoice->fk_soc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::fetch_thirdparty($force_thirdparty_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,16 +171,15 @@ if (($action == 'create' || $action == 'add') && ! $error) {
|
|||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if ($_POST['origin'] && $_POST['originid']) {
|
if ($_POST['origin'] && $_POST['originid']) {
|
||||||
$object->linked_objects = $orders_id;
|
$linked_orders_ids=array();
|
||||||
|
foreach ( $orders_id as $origin => $origin_id ) {
|
||||||
|
$origin_id = (! empty($origin_id) ? $origin_id : $orders_id[$ii]);
|
||||||
|
$linked_orders_ids[]=$origin_id;
|
||||||
|
}
|
||||||
|
$object->linked_objects = array(GETPOST('origin')=>$linked_orders_ids);
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
foreach ( $orders_id as $origin => $origin_id ) {
|
|
||||||
$origin_id = (! empty($origin_id) ? $origin_id : $orders_id[$ii]);
|
|
||||||
|
|
||||||
$object->add_object_linked(GETPOST('origin'), $origin_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( $ii < $nn ) {
|
while ( $ii < $nn ) {
|
||||||
$objectsrc = new CommandeFournisseur($db);
|
$objectsrc = new CommandeFournisseur($db);
|
||||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
||||||
|
|||||||
@ -73,7 +73,7 @@ if ($action == 'convert')
|
|||||||
{
|
{
|
||||||
$vat_src_code_old = $reg[1];
|
$vat_src_code_old = $reg[1];
|
||||||
$oldvatrateclean = preg_replace('/\s*\(.*\)/', '', $oldvatrate); // Remove code into vatrate.
|
$oldvatrateclean = preg_replace('/\s*\(.*\)/', '', $oldvatrate); // Remove code into vatrate.
|
||||||
}
|
} else $oldvatrateclean=$oldvatrate;
|
||||||
|
|
||||||
// Clean vat code new
|
// Clean vat code new
|
||||||
$vat_src_code_new='';
|
$vat_src_code_new='';
|
||||||
@ -81,7 +81,7 @@ if ($action == 'convert')
|
|||||||
{
|
{
|
||||||
$vat_src_code_new = $reg[1];
|
$vat_src_code_new = $reg[1];
|
||||||
$newvatrateclean = preg_replace('/\s*\(.*\)/', '', $newvatrate); // Remove code into vatrate.
|
$newvatrateclean = preg_replace('/\s*\(.*\)/', '', $newvatrate); // Remove code into vatrate.
|
||||||
}
|
} else $newvatrateclean=$newvatrate;
|
||||||
|
|
||||||
// If country to edit is my country, so we change customer prices
|
// If country to edit is my country, so we change customer prices
|
||||||
if ($country_id == $mysoc->country_id)
|
if ($country_id == $mysoc->country_id)
|
||||||
|
|||||||
@ -745,12 +745,12 @@ class Product extends CommonObject
|
|||||||
if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units)
|
if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units)
|
||||||
{
|
{
|
||||||
$this->surface = $this->length * $this->width;
|
$this->surface = $this->length * $this->width;
|
||||||
$this->surface_units = $this->length_units + $this->width_units;
|
$this->surface_units = measuring_units_squared($this->length_units);
|
||||||
}
|
}
|
||||||
if (empty($this->volume) && !empty($this->surface_units) && !empty($this->height) && $this->length_units == $this->height_units)
|
if (empty($this->volume) && !empty($this->surface_units) && !empty($this->height) && $this->length_units == $this->height_units)
|
||||||
{
|
{
|
||||||
$this->volume = $this->surface * $this->height;
|
$this->volume = $this->surface * $this->height;
|
||||||
$this->volume_units = $this->surface_units + $this->height_units;
|
$this->volume_units = measuring_units_cubed($this->height_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->surface = price2num($this->surface);
|
$this->surface = price2num($this->surface);
|
||||||
|
|||||||
@ -821,7 +821,7 @@ else
|
|||||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
|
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
|
||||||
{
|
{
|
||||||
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
|
$htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
|
||||||
print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext);
|
print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext);
|
||||||
}
|
}
|
||||||
else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
|
else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user