Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/facture/list.php htdocs/contact/document.php htdocs/product/list.php
This commit is contained in:
commit
af6b84ba3a
@ -681,6 +681,10 @@ if ($resql)
|
||||
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
||||
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
||||
);
|
||||
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
$listtype[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.
|
||||
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
|
||||
print '</td>';
|
||||
|
||||
@ -1133,5 +1133,31 @@ class Paiement extends CommonObject
|
||||
}*/
|
||||
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');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -504,3 +504,42 @@ function measuring_units_string($unit,$measuring_style='')
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
@ -725,12 +725,12 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $mysoc;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$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
|
||||
$widthrecbox=90;
|
||||
|
||||
@ -738,4 +738,30 @@ class PaiementFourn extends Paiement
|
||||
|
||||
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 ($_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);
|
||||
|
||||
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 ) {
|
||||
$objectsrc = new CommandeFournisseur($db);
|
||||
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];
|
||||
$oldvatrateclean = preg_replace('/\s*\(.*\)/', '', $oldvatrate); // Remove code into vatrate.
|
||||
}
|
||||
} else $oldvatrateclean=$oldvatrate;
|
||||
|
||||
// Clean vat code new
|
||||
$vat_src_code_new='';
|
||||
@ -81,7 +81,7 @@ if ($action == 'convert')
|
||||
{
|
||||
$vat_src_code_new = $reg[1];
|
||||
$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_id == $mysoc->country_id)
|
||||
|
||||
@ -754,12 +754,12 @@ class Product extends CommonObject
|
||||
if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$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);
|
||||
|
||||
@ -781,7 +781,7 @@ else
|
||||
}
|
||||
|
||||
// Better buy price
|
||||
if (! empty($arrayfields['p.minbuyprice']['checked']))
|
||||
if (! empty($arrayfields['p.minbuyprice']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($obj->tobuy && $obj->minsellprice != '')
|
||||
@ -794,7 +794,7 @@ else
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
|
||||
{
|
||||
$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");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user