Merge branch '3.5' of git@github.com:Dolibarr/dolibarr.git into 3.5

This commit is contained in:
Laurent Destailleur 2014-05-26 17:28:00 +02:00
commit 7bd46d8aee
27 changed files with 167 additions and 118 deletions

View File

@ -30,7 +30,12 @@ Fix: [ bug #1393 ] PHP Warning when creating a supplier invoice.
Fix: [ bug #1399 ] [pgsql] Silent warning when setting a propal as "facturée" in propal.php
Fix: When number reach 9999 with default numbering module, next number
will be 10000 instead of 0000 and error.
Fix: element page on project give wrong href link
Fix: element page on project give wrong href link.
Fix: [ bug #1397 ] Filter by supplier orders with status Draft does not filter.
Fix: [ bug #1388 ] Wrong date when invoicing several orders.
Fix: [ bug #1411 ] Unable to set an expedition note if invoices module is not enabled.
Fix: [ bug #1407 ] Rouget pdf overlapped when using tracking number and public notes.
Fix: [ bug #1405 ] Rouget PDF expedition incorrect when two expeditions under the same commande
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
Fix: Can't add user for a task.
@ -118,7 +123,7 @@ Fix: [ bug #1306 ] Fatal error when adding an external calendar.
New: Added es_CL language
Fix: Margin tabs bad data show
Fix: [ bug #1318 ] Problem with enter key when adding an existing product to a customer invoice.
Fix: [ bug #1388 ] Wrong date when invoicing several orders
Fix: [ bug #1410 ] Add customer order line asks for required Unit Price but doesn't interrupt the creation of the line
***** ChangeLog for 3.5 compared to 3.4.* *****
For users:

View File

@ -85,18 +85,35 @@ print '</br>';
// OPCode cache
print '<br>';
print '<strong>'.$langs->trans("OPCodeCache").'</strong>: ';
$test1=function_exists('xcache_info');
if ($test1)
$foundcache=0;
$test=function_exists('xcache_info');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("XCacheInstalled");
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>';
}
else
$test=function_exists('eaccelerator_info');
if (! $foundcache && $test)
{
$test2=function_exists('eaccelerator_info');
if ($test2) print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
else print $langs->trans("NoOPCodeCacheFound");
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("EAcceleratorInstalled");
}
$test=function_exists('apc_cache_info');
if (! $foundcache && $test)
{
//var_dump(apc_cache_info());
if (ini_get('apc.enabled'))
{
$foundcache++;
print img_picto('','tick.png').' '.$langs->trans("APCInstalled");
}
else
{
print img_picto('','warning').' '.$langs->trans("APCCacheInstalledButDisabled");
}
}
if (! $foundcache) print $langs->trans("NoOPCodeCacheFound");
print '<br>';
// HTTPCacheStaticResources

View File

@ -1368,7 +1368,7 @@ if ($action == 'create')
// Date
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
$form->select_date('','','','','',"addprop");
$form->select_date('','','','','',"addprop",1,1);
print '</td></tr>';
// Validaty duration
@ -1407,8 +1407,7 @@ if ($action == 'create')
}
else
{
$datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$form->select_date($datepropal,'liv_','','','',"addprop");
$form->select_date(-1,'liv_','','','',"addprop",1,1);
}
print '</td></tr>';
@ -1462,7 +1461,7 @@ if ($action == 'create')
print '<input type="hidden" name="createmode" value="empty">';
}
print '<table>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '<table>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
{
// For backward compatibility
@ -1533,14 +1532,11 @@ if ($action == 'create')
print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_percent.'">%</td>';
print '</tr>';
}
print "</table>";
}
print '</td></tr>';
}
print '</table>';
print '<br>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '</table><br>';
$langs->load("bills");
print '<center>';

View File

@ -568,7 +568,7 @@ else if ($action == 'setnote_private' && $user->rights->commande->creer)
else if ($action == 'addline' && $user->rights->commande->creer)
{
$langs->load('errors');
$error = false;
$error = 0;
// Set if we used free entry or predefined product
if (GETPOST('addline_libre')
@ -1548,7 +1548,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:'');
@ -1567,7 +1567,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$demand_reason_id = $soc->demand_reason_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$projectid = 0;
}
$absolute_discount=$soc->getAvailableDiscounts();
@ -1643,7 +1643,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (empty($datedelivery))
{
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
}
$form->select_date($datedelivery,'liv_','','','',"crea_commande",1,1);
print "</td></tr>";

View File

@ -373,7 +373,7 @@ if ($action == 'create' && empty($mesgs))
$remise_percent = $soc->remise_percent;
}
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$absolute_discount=$soc->getAvailableDiscounts();
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -2082,7 +2082,7 @@ if ($action == 'create')
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
//Replicate extrafields
$objectsrc->fetch_optionals($originid);
@ -2095,7 +2095,7 @@ if ($action == 'create')
$mode_reglement_id = $soc->mode_reglement_id;
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
}
$absolute_discount=$soc->getAvailableDiscounts();

View File

@ -397,7 +397,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date payment
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
$datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment);
$form->select_date($datepayment,'','','',0,"add_paiement",1,1);
print '</td>';
print '<td>'.$langs->trans('Comments').'</td></tr>';

View File

@ -3673,6 +3673,7 @@ function dol_textishtml($msg,$option=0)
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
return false;
@ -4532,4 +4533,4 @@ function natural_search($fields, $value)
return " AND " . ($end > 1? '(' : '') . $res;
}
?>
?>

View File

@ -128,7 +128,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
// Protection and encryption of pdf
if (empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->PDF_SECURITY_ENCRYPTION))
{
{
/* Permission supported by TCPDF
- print : Print the document;
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
@ -957,7 +957,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang))
{
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"];
//Manage HTML entities description test
//Cause $prodser->description is store with htmlentities but $desc no
$needdesctranslation=false;
@ -1032,10 +1032,10 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if (empty($hideref))
{
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
if ($issupplierline) $ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
else $ref_prodserv = $prodser->ref; // Show local ref only
$ref_prodserv .= " - ";
if (! empty($libelleproduitservice)) $ref_prodserv .= " - ";
}
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;

View File

@ -286,7 +286,8 @@ function dol_loginfunction($langs,$conf,$mysoc)
// Set jquery theme
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
$favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico';
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
$jquerytheme = 'smoothness';
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;

View File

@ -758,16 +758,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Suppliers
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
{
if (! empty($conf->facture->enabled))
{
$langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
$langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer);
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
}
$newmenu->add("/compta/facture/stats/index.php?leftmenu=suppliers_bills&mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
}
// Orders

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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
@ -179,9 +180,10 @@ class pdf_rouget extends ModelePdfExpedition
$tab_height = 130;
$tab_height_newpage = 150;
if (! empty($object->note_public) || ! empty($object->tracking_number))
if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id)))
{
$tab_top = 88;
$tab_top_alt = $tab_top;
// Tracking number
if (! empty($object->tracking_number))
@ -196,7 +198,9 @@ class pdf_rouget extends ModelePdfExpedition
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
$pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
$tab_top_alt += 7;
}
}
}
@ -205,7 +209,7 @@ class pdf_rouget extends ModelePdfExpedition
if (! empty($object->note_public))
{
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
}
$nexY = $pdf->GetY();

View File

@ -77,14 +77,14 @@ if ($id > 0 || ! empty($ref))
/* Actions */
/******************************************************************************/
if ($action == 'setnote_public' && $user->rights->facture->creer)
if ($action == 'setnote_public')
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setnote_private' && $user->rights->facture->creer)
else if ($action == 'setnote_private')
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');

View File

@ -420,7 +420,7 @@ class FactureFournisseur extends CommonInvoice
*/
function fetch_lines()
{
$sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
@ -428,7 +428,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
$sql.= ' WHERE fk_facture_fourn='.$this->id;
dol_syslog("FactureFournisseur::fetch_lines sql=".$sql, LOG_DEBUG);
dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG);
$resql_rows = $this->db->query($sql);
if ($resql_rows)
{
@ -443,11 +443,11 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i] = new stdClass();
$this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description;
$this->lines[$i]->ref = $obj->product_ref; // TODO deprecated
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
//$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit
$this->lines[$i]->libelle = $obj->label; // Label du produit
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
$this->lines[$i]->ref = $obj->product_ref; // deprecated.
$this->lines[$i]->ref_supplier = $obj->ref_supplier; // Reference product supplier TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline
$this->lines[$i]->libelle = $obj->label; // This field may contains label of product (when invoice create from order)
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
$this->lines[$i]->pu_ht = $obj->pu_ht;
$this->lines[$i]->pu_ttc = $obj->pu_ttc;
$this->lines[$i]->tva_tx = $obj->tva_tx;
@ -474,7 +474,7 @@ class FactureFournisseur extends CommonInvoice
else
{
$this->error=$this->db->error();
dol_syslog('FactureFournisseur::fetch_lines: Error '.$this->error,LOG_ERR);
dol_syslog(get_class($this).'::fetch_lines: Error '.$this->error,LOG_ERR);
return -3;
}
}
@ -1034,6 +1034,8 @@ class FactureFournisseur extends CommonInvoice
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue).
*
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
*
* @param string $desc Description de la ligne
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
* @param double $txtva Taux de tva force, sinon -1
@ -1127,7 +1129,7 @@ class FactureFournisseur extends CommonInvoice
* Update a line detail into database
*
* @param int $id Id of line invoice
* @param string $label Description of line
* @param string $desc Description of line
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
* @param double $vatrate VAT Rate
* @param double $txlocaltax1 LocalTax1 Rate
@ -1141,9 +1143,9 @@ class FactureFournisseur extends CommonInvoice
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function updateline($id, $label, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
{
dol_syslog(get_class($this)."::updateline $id,$label,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$pu = price2num($pu);
@ -1169,7 +1171,7 @@ class FactureFournisseur extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -1192,7 +1194,7 @@ class FactureFournisseur extends CommonInvoice
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
$sql.= " description ='".$this->db->escape($label)."'";
$sql.= " description ='".$this->db->escape($desc)."'";
$sql.= ", pu_ht = ".price2num($pu_ht);
$sql.= ", pu_ttc = ".price2num($pu_ttc);
$sql.= ", qty = ".price2num($qty);

View File

@ -40,8 +40,13 @@ class ProductFournisseur extends Product
var $product_fourn_price_id; // id of ligne product-supplier
var $id; // product id
var $fourn_ref; // ref supplier
var $fourn_qty; // quantity for price
var $fourn_ref; // deprecated
var $ref_supplier; // ref supplier (can be set by get_buyprice)
var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
var $fourn_qty; // quantity for price (can be set by get_buyprice)
var $fourn_pu; // unit price for quantity (can be set by get_buyprice)
var $fourn_price; // price for quantity
var $fourn_remise_percent; // discount for quantity (percent)
var $fourn_remise; // discount for quantity (amount)

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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
@ -113,7 +114,8 @@ if ($sall)
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (GETPOST('statut'))
//Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'int') !== '')
{
$sql .= " AND fk_statut =".GETPOST('statut','int');
}

View File

@ -373,6 +373,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
$result = $object->addline(
$desc,
$lines[$i]->subprice,
@ -542,7 +543,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
}
if (GETPOST('addline_predefined')
|| (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0) // we push enter onto qty field
)
)
{
$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
$idprod=GETPOST('idprod', 'int');
@ -593,6 +594,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
$type = $productsupplier->type;
// TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
$result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
}
if ($idprod == 0)
@ -631,19 +633,17 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
{
$ht = price2num($_POST['amount']);
$price_base_type = 'HT';
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
$result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
}
else
{
{
$ttc = price2num($_POST['amountttc']);
$ht = $ttc / (1 + ($tauxtva / 100));
$price_base_type = 'HT';
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
$result=$object->addline($product_desc, $ht, $tauxtva,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
}
}
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
// FIXME Must add $productsupplier->ref_supplier and $productsupplier->label if there were loaded by get_buyprice previously.
$result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
}
}
//print "xx".$tva_tx; exit;
@ -1122,10 +1122,10 @@ if ($action == 'create')
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
@ -1135,7 +1135,7 @@ if ($action == 'create')
$cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id;
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
if (! $user->rights->facture->lire) accessforbidden();
if (! $user->rights->fournisseur->facture->lire) accessforbidden();
$langs->load("companies");
$langs->load("bills");

View File

@ -191,7 +191,7 @@ if ($action == 'create' || $action == 'add_paiement')
$object->fetch($facid);
$datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture);
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datefacture);
$sql = 'SELECT s.nom, s.rowid as socid,';
$sql.= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total';

View File

@ -60,18 +60,18 @@ $cp = new Holiday($db);
if ($action == "add")
{
$message = '';
$error = false;
$error = 0;
// Option du groupe de validation
/*if (!$cp->updateConfCP('userGroup',$_POST['userGroup']))
{
$error = true;
$error++;
}*/
// Option du délai pour faire une demande de congés payés
if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest']))
{
$error = true;
$error++;
}
// Option du nombre de jours à ajouter chaque mois
@ -79,67 +79,69 @@ if ($action == "add")
if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth))
{
$error = true;
$error++;
}
// Option du nombre de jours pour un mariage
$OptMariageCP = price2num($_POST['OptMariage'],5);
if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) {
$error = true;
$error++;
}
// Option du nombre de jours pour un décés d'un proche
$OptDecesProcheCP = price2num($_POST['OptDecesProche'],5);
if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) {
$error = true;
$error++;
}
// Option du nombre de jours pour un mariage d'un enfant
$OptMariageProcheCP = price2num($_POST['OptMariageProche'],5);
if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) {
$error = true;
$error++;
}
// Option du nombre de jours pour un décés d'un parent
$OptDecesParentsCP = price2num($_POST['OptDecesParents'],5);
if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) {
$error = true;
$error++;
}
// Option pour avertir le valideur si délai de demande incorrect
if(isset($_POST['AlertValidatorDelay'])) {
if(!$cp->updateConfCP('AlertValidatorDelay','1')) {
$error = true;
$error++;
}
} else {
if(!$cp->updateConfCP('AlertValidatorDelay','0')) {
$error = true;
$error++;
}
}
// Option pour avertir le valideur si solde des congés de l'utilisateur inccorect
if(isset($_POST['AlertValidatorSolde'])) {
if(!$cp->updateConfCP('AlertValidatorSolde','1')) {
$error = true;
$error++;
}
} else {
if(!$cp->updateConfCP('AlertValidatorSolde','0')) {
$error = true;
$error++;
}
}
// Option du nombre de jours à déduire pour 1 jour de congés
$nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],2);
if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) {
$error = true;
if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted))
{
$error++;
}
if ($error) {
if ($error)
{
$message = '<div class="error">'.$langs->trans('ErrorUpdateConfCP').'</div>';
} else {
$message = '<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>';
@ -151,8 +153,8 @@ if ($action == "add")
$result = $db->query($sql);
$num = $db->num_rows($sql);
if($num < 1) {
if($num < 1)
{
$cp->createCPusers();
$message.= '<br /><div class="warning">'.$langs->trans('AddCPforUsers').'</div>';
}
@ -202,7 +204,7 @@ elseif ($action == 'create_event')
}
elseif($action == 'event' && isset($_POST['update_event']))
{
$error = false;
$error = 0;
$eventId = array_keys($_POST['update_event']);
$eventId = $eventId[0];
@ -213,19 +215,21 @@ elseif($action == 'event' && isset($_POST['update_event']))
$eventValue = $optValue;
$eventValue = $eventValue[$eventId];
if(!empty($eventName)) {
if (!empty($eventName))
{
$eventName = trim($eventName);
} else {
$error = true;
$error++;
}
if(!empty($eventValue)) {
if (!empty($eventValue))
{
$eventValue = price2num($eventValue,2);
} else {
$error = true;
$error++;
}
if(!$error)
if (!$error)
{
// Mise à jour des congés de l'utilisateur
$update = $cp->updateEventCP($eventId,$eventName,$eventValue);

View File

@ -82,7 +82,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
$sql.= " WHERE name = 'lastUpdate' and value IS NULL"; // Add value IS NULL to be sure to update only at init.
dol_syslog('define_holiday update lastUpdate entry sql='.$sql);
$result = $db->query($sql);
$result = $db->query($sql);
$mesg='<div class="ok">'.$langs->trans('UpdateConfCPOK').'</div>';
@ -91,21 +91,24 @@ if ($action == 'update' && isset($_POST['update_cp']))
}
elseif($action == 'add_event')
{
$error = false;
$error = 0;
if(!empty($_POST['list_event']) && $_POST['list_event'] > 0) {
$event = $_POST['list_event'];
} else { $error = true;
} else { $error++;
}
if(!empty($_POST['userCP']) && $_POST['userCP'] > 0) {
$userCP = $_POST['userCP'];
} else { $error = true;
} else { $erro++;
}
if($error) {
if ($error)
{
$message = '<div class="error">'.$langs->trans('ErrorAddEventToUserCP').'</div>';
} else {
}
else
{
$nb_holiday = $holiday->getCPforUser($userCP);
$add_holiday = $holiday->getValueEventCp($event);
$new_holiday = $nb_holiday + $add_holiday;

View File

@ -959,6 +959,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
print '<meta name="author" content="Dolibarr Development Team">'."\n";
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";

View File

@ -902,14 +902,14 @@ class Product extends CommonObject
/**
* Lit le prix pratique par un fournisseur
* On renseigne le couple prodfournprice/qty ou le triplet qty/product_id/fourn_ref
* Read price used by a provider
* We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref
*
* @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price
* @param double $qty Quantity asked
* @param int $product_id Filter on a particular product id
* @param string $fourn_ref Filter on a supplier ref
* @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve
* @return int <-1 if KO, -1 if qty not enough, 0 si ok mais rien trouve, id_product si ok et trouve. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
*/
function get_buyprice($prodfournprice,$qty,$product_id=0,$fourn_ref=0)
{
@ -940,7 +940,7 @@ class Product extends CommonObject
{
// We do same select again but searching with qty, ref and id product
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
$sql.= " pfp.fk_product, pfp.ref_fourn, pfp.tva_tx";
$sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'";
$sql.= " AND pfp.fk_product = ".$product_id;
@ -955,9 +955,11 @@ class Product extends CommonObject
$obj = $this->db->fetch_object($resql);
if ($obj && $obj->quantity > 0) // If found
{
$this->buyprice = $obj->price; // \deprecated
$this->buyprice = $obj->price; // deprecated
$this->fourn_qty = $obj->quantity; // min quantity for price
$this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id
$this->ref_fourn = $obj->ref_fourn; // Ref supplier
$this->ref_fourn = $obj->ref_supplier; // deprecated
$this->ref_supplier = $obj->ref_supplier; // Ref supplier
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$result=$obj->fk_product;
return $result;

View File

@ -437,11 +437,15 @@ else
if (! empty($conf->service->enabled) && $type != 0)
{
print '<td align="center">';
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
else print $objp->duration;
if (preg_match('/([0-9]+)[a-z]/i',$objp->duration))
{
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
//elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
else print $objp->duration;
}
print '</td>';
}

View File

@ -119,7 +119,7 @@ print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print "</tr>\n";
if (count($tasksarray) > 1000)
if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
{
print '<tr '.$bc[0].'>';
print '<td colspan="9">';

View File

@ -2269,6 +2269,8 @@ li.cal_event { border: none; list-style-type: none; }
/* Ajax - Liste deroulante de l'autocompletion */
/* ============================================================================== */
.ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff; }
.ui-autocomplete-loading { background: white url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/working.gif',1) ?>) right center no-repeat; }
.ui-autocomplete {
position:absolute;
@ -2482,7 +2484,7 @@ A.none, A.none:active, A.none:visited, A.none:hover {
{
line-height: 1em !important;
}
.ui-autocomplete-input { margin: 0; padding: 1px; }
.ui-autocomplete-input { margin: 0; padding: 2px; }
/* ============================================================================== */

View File

@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$input='xxx<br style="eee" >';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='<h2>abc</h2>';
$after=dol_textishtml($input);
$this->assertTrue($after);
// False
$input='xxx < br>';
@ -528,16 +531,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
public function testVerifCond()
{
$verifcond=verifCond('1==1');
$this->assertTrue($verifcond);
$this->assertTrue($verifcond,'Test a true comparison');
$verifcond=verifCond('1==2');
$this->assertFalse($verifcond);
$this->assertFalse($verifcond,'Test a false comparison');
$verifcond=verifCond('$conf->facture->enabled');
$this->assertTrue($verifcond);
$this->assertTrue($verifcond,'Test that conf property of a module report true when enabled');
$verifcond=verifCond('$conf->moduledummy->enabled');
$this->assertFalse($verifcond);
$this->assertFalse($verifcond,'Test that conf property of a module report false when disabled');
$verifcond=verifCond('');
$this->assertTrue($verifcond);