Merge branch '6.0' of https://github.com/Dolibarr/dolibarr into 6.0
This commit is contained in:
commit
bcbbcc1c66
@ -367,6 +367,14 @@ if ($mode == 'searchkey')
|
||||
foreach($filearray as $file)
|
||||
{
|
||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||
//Detect if trans coming from extranl module
|
||||
foreach ($conf->file->dol_document_root as $keyconf=>$dirconfalt) {
|
||||
if (($keyconf!='main') && (preg_match('$'.preg_quote($dirconfalt).'$i', $file['fullname']))) {
|
||||
//In this case load modulename@nmodulename
|
||||
$tmpfile=$tmpfile.'@'.$tmpfile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
|
||||
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
|
||||
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||
|
||||
@ -1114,5 +1114,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;
|
||||
@ -108,7 +106,7 @@ if ($object->id)
|
||||
}
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
@ -120,11 +118,11 @@ if ($object->id)
|
||||
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
@ -147,7 +145,7 @@ if ($object->id)
|
||||
print '</td></tr>';
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// Civility
|
||||
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $object->getCivilityLabel();
|
||||
@ -160,7 +158,7 @@ if ($object->id)
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
$modulepart = 'contact';
|
||||
$permission = $user->rights->societe->contact->creer;
|
||||
$permtoedit = $user->rights->societe->contact->creer;
|
||||
|
||||
@ -477,3 +477,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];
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -280,14 +281,14 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
|
||||
@ -307,14 +307,14 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
|
||||
@ -723,12 +723,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;
|
||||
|
||||
@ -304,14 +304,14 @@ class doc_generic_user_odt extends ModelePDFUser
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Open and load template
|
||||
|
||||
@ -306,14 +306,14 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2015 Charlie Benke <charlies@patas-monkey.com>
|
||||
* Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com>
|
||||
*
|
||||
@ -297,7 +297,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang)) $newlang=$srcobject->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$srcobject->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
@ -878,7 +878,7 @@ if ($action == 'create')
|
||||
|
||||
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
$soc = $objectsrc->thirdparty;
|
||||
|
||||
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private')));
|
||||
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public'));
|
||||
|
||||
@ -734,4 +734,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,12 +745,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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user