Merge remote-tracking branch 'uptream/6.0' into 6.0-d1

This commit is contained in:
Alexandre SPANGARO 2017-07-28 06:40:47 +02:00
commit 95672e3bf0
21 changed files with 124 additions and 113 deletions

View File

@ -1260,7 +1260,7 @@ class BookKeeping extends CommonObject
global $user; global $user;
$error = 0; $error = 0;
$object = new Accountingbookkeeping($this->db); $object = new BookKeeping($this->db);
$this->db->begin(); $this->db->begin();

View File

@ -401,7 +401,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_operation = $val["label"]; $bookkeeping->label_operation = $val["label"];
$bookkeeping->label_compte = $langs->trans("Bank"); $bookkeeping->label_compte = $langs->trans("Bank");
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->credit = ($mt < 0 ? - $mt : 0);
@ -462,7 +462,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_operation = $tabcompany[$key]['name']; $bookkeeping->label_operation = $tabcompany[$key]['name'];
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;

View File

@ -203,7 +203,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;

View File

@ -1750,6 +1750,7 @@ if ($action == 'create')
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -1924,6 +1924,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -236,7 +236,7 @@ class BankAccounts extends DolibarrApi
function _validate($data) function _validate($data)
{ {
$account = array(); $account = array();
foreach (Accounts::$FIELDS as $field) { foreach (BankAccounts::$FIELDS as $field) {
if (! isset($data[$field])) if (! isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$account[$field] = $data[$field]; $account[$field] = $data[$field];

View File

@ -3075,6 +3075,7 @@ else if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -1311,7 +1311,7 @@ else
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('RIB'); print $langs->trans('RIB');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';

View File

@ -332,7 +332,7 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
@ -523,7 +523,6 @@ while ($i < min($num,$limit))
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref

View File

@ -334,23 +334,23 @@ abstract class CommonObject
// No constructor as it is an abstract class // No constructor as it is an abstract class
/** /**
* Check an object id/ref exists * Check an object id/ref exists
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch * If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
* *
* @param string $element String of element ('product', 'facture', ...) * @param string $element String of element ('product', 'facture', ...)
* @param int $id Id of object * @param int $id Id of object
* @param string $ref Ref of object to check * @param string $ref Ref of object to check
* @param string $ref_ext Ref ext of object to check * @param string $ref_ext Ref ext of object to check
* @return int <0 if KO, 0 if OK but not found, >0 if OK and exists * @return int <0 if KO, 0 if OK but not found, >0 if OK and exists
*/ */
static function isExistingObject($element, $id, $ref='', $ref_ext='') static function isExistingObject($element, $id, $ref='', $ref_ext='')
{ {
global $db,$conf; global $db,$conf;
$sql = "SELECT rowid, ref, ref_ext"; $sql = "SELECT rowid, ref, ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX.$element; $sql.= " FROM ".MAIN_DB_PREFIX.$element;
$sql.= " WHERE entity IN (".getEntity($element, true).")" ; $sql.= " WHERE entity IN (".getEntity($element).")" ;
if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
@ -371,17 +371,17 @@ abstract class CommonObject
else return 0; else return 0;
} }
return -1; return -1;
} }
/** /**
* Method to output saved errors * Method to output saved errors
* *
* @return string String with errors * @return string String with errors
*/ */
function errorsToString() function errorsToString()
{ {
return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):''); return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):'');
} }
/** /**
* Return full name (civility+' '+name+' '+lastname) * Return full name (civility+' '+name+' '+lastname)
@ -3947,7 +3947,7 @@ abstract class CommonObject
// Now we add first model found in directories scanned // Now we add first model found in directories scanned
$listofdir=explode(',',$dirtoscan); $listofdir=explode(',',$dirtoscan);
foreach($listofdir as $key=>$tmpdir) foreach($listofdir as $key => $tmpdir)
{ {
$tmpdir=trim($tmpdir); $tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);

View File

@ -1447,55 +1447,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
* *
* @return int Error count (0 if ok) * @return int Error count (0 if ok)
*/ */
function insert_tabs() function insert_tabs()
{ {
global $conf; global $conf;
$err=0; $err=0;
if (! empty($this->tabs)) if (! empty($this->tabs))
{ {
$i=0; $i=0;
foreach ($this->tabs as $key => $value) foreach ($this->tabs as $key => $value)
{ {
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
$entity=$conf->entity; $entity=$conf->entity;
$newvalue = $value; $newvalue = $value;
if (is_array($value)) if (is_array($value))
{ {
$newvalue = $value['data']; $newvalue = $value['data'];
if (isset($value['entity'])) $entity = $value['entity']; if (isset($value['entity'])) $entity = $value['entity'];
} }
if ($newvalue) if ($newvalue)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
$sql.= "name"; $sql.= "name";
$sql.= ", type"; $sql.= ", type";
$sql.= ", value"; $sql.= ", value";
$sql.= ", note"; $sql.= ", note";
$sql.= ", visible"; $sql.= ", visible";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ")"; $sql.= ")";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1); $sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
$sql.= ", 'chaine'"; $sql.= ", 'chaine'";
$sql.= ", ".$this->db->encrypt($value,1); $sql.= ", ".$this->db->encrypt($newvalue,1);
$sql.= ", null"; $sql.= ", null";
$sql.= ", '0'"; $sql.= ", '0'";
$sql.= ", ".$conf->entity; $sql.= ", ".$entity;
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG); dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
$this->db->query($sql); $this->db->query($sql);
} }
$i++; $i++;
} }
} }
return $err; return $err;
} }
/** /**
* Adds constants * Adds constants

View File

@ -211,7 +211,7 @@ class doc_generic_contract_odt extends ModelePDFContract
if (! is_object($object)) if (! is_object($object))
{ {
$id = $object; $id = $object;
$object = new Contract($this->db); $object = new Contrat($this->db);
$result=$object->fetch($id); $result=$object->fetch($id);
if ($result < 0) if ($result < 0)
{ {

View File

@ -1,13 +1,13 @@
<?php <?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -1576,7 +1576,7 @@ class pdf_crabe extends ModelePDFFactures
if ($object->statut == Facture::STATUS_DRAFT) if ($object->statut == Facture::STATUS_DRAFT)
{ {
$pdf->SetTextColor(128,0,0); $pdf->SetTextColor(128,0,0);
$textref.=' - '.$outputlangs->trans("NotValidated"); $textref.=' - '.$outputlangs->transnoentities("NotValidated");
} }
$pdf->MultiCell($w, 4, $textref, '', 'R'); $pdf->MultiCell($w, 4, $textref, '', 'R');
@ -1663,7 +1663,7 @@ class pdf_crabe extends ModelePDFFactures
$posy+=4; $posy+=4;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); $pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
} }
} }

View File

@ -252,7 +252,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
if (! is_object($object)) if (! is_object($object))
{ {
$id = $object; $id = $object;
$object = new Propale($this->db); $object = new Propal($this->db);
$result=$object->fetch($id); $result=$object->fetch($id);
if ($result < 0) if ($result < 0)
{ {

View File

@ -492,7 +492,7 @@ if ($resql)
if (! GETPOST('cancel')) if (! GETPOST('cancel'))
{ {
$objecttmp=new FactureFourn($db); $objecttmp=new FactureFournisseur($db);
$listofselectedid=array(); $listofselectedid=array();
$listofselectedthirdparties=array(); $listofselectedthirdparties=array();
$listofselectedref=array(); $listofselectedref=array();

View File

@ -448,7 +448,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
} }
// Number of supplier invoices (has paid) // Number of supplier invoices (has paid)
if (! empty($conf->supplier_invoice->enabled) && ! empty($conf->facture->enabled) && $user->rights->facture->lire) if (! empty($conf->supplier_invoice->enabled) && ! empty($user->rights->fournisseur->facture->lire))
{ {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$board=new FactureFournisseur($db); $board=new FactureFournisseur($db);

View File

@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT; -- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50); ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
-- Negative buying prices
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)

View File

@ -117,6 +117,7 @@ SecondApprovalAlreadyDone=Second approval already done
SupplierOrderReceivedInDolibarr=Supplier order %s received %s SupplierOrderReceivedInDolibarr=Supplier order %s received %s
SupplierOrderSubmitedInDolibarr=Supplier order %s submited SupplierOrderSubmitedInDolibarr=Supplier order %s submited
SupplierOrderClassifiedBilled=Supplier order %s set billed SupplierOrderClassifiedBilled=Supplier order %s set billed
OtherOrders=Other orders
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_commande_internal_SALESREPFOLL=Representative following-up customer order TypeContact_commande_internal_SALESREPFOLL=Representative following-up customer order
TypeContact_commande_internal_SHIPPING=Representative following-up shipping TypeContact_commande_internal_SHIPPING=Representative following-up shipping

View File

@ -63,6 +63,7 @@ ProposalLine=Proposal line
AvailabilityPeriod=Availability delay AvailabilityPeriod=Availability delay
SetAvailability=Set availability delay SetAvailability=Set availability delay
AfterOrder=after order AfterOrder=after order
OtherProposals=Other proposals
##### Availability ##### ##### Availability #####
AvailabilityTypeAV_NOW=Immediate AvailabilityTypeAV_NOW=Immediate
AvailabilityTypeAV_1W=1 week AvailabilityTypeAV_1W=1 week

View File

@ -69,6 +69,7 @@ NoPredefinedProductToDispatch=No predefined products for this object. So no disp
DispatchVerb=Dispatch DispatchVerb=Dispatch
StockLimitShort=Limit for alert StockLimitShort=Limit for alert
StockLimit=Stock limit for alert StockLimit=Stock limit for alert
StockLimitDesc="" (empty) default value means no alert. <br>"0" can be used with 'Stock can be negative' configuration.
PhysicalStock=Physical stock PhysicalStock=Physical stock
RealStock=Real Stock RealStock=Real Stock
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements. RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements.

View File

@ -129,6 +129,8 @@ class modMyModule extends DolibarrModules
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
// 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
// Can also be: $this->tabs = array('data'=>'...', 'entity'=>0);
//
// where objecttype can be // where objecttype can be
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
// 'contact' to add a tab in contact view // 'contact' to add a tab in contact view