*
* 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');
}
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 566ae26f640..966ab630ade 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -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);
}
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index 1d81ae01230..d6a24b01ec6 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -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");
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 352c3150c52..6f8c3bc1920 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -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';
diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php
index 174adbdf725..2b265711fa1 100644
--- a/htdocs/holiday/admin/holiday.php
+++ b/htdocs/holiday/admin/holiday.php
@@ -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 = ''.$langs->trans('ErrorUpdateConfCP').'
';
} else {
$message = ''.$langs->trans('UpdateConfCPOK').'
';
@@ -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.= ''.$langs->trans('AddCPforUsers').'
';
}
@@ -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);
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index 1cf37e77d6f..f167422f503 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -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=''.$langs->trans('UpdateConfCPOK').'
';
@@ -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 = ''.$langs->trans('ErrorAddEventToUserCP').'
';
- } else {
+ }
+ else
+ {
$nb_holiday = $holiday->getCPforUser($userCP);
$add_holiday = $holiday->getValueEventCp($event);
$new_holiday = $nb_holiday + $add_holiday;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 98adfca23e0..12dbfee552d 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -959,6 +959,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print ' '."\n"; // Evite indexation par robots
print ' '."\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 ' '."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' '."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' '."\n";
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 308ca339303..934706a1c95 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -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;
diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php
index 501e0c60794..923b19e3daa 100644
--- a/htdocs/product/liste.php
+++ b/htdocs/product/liste.php
@@ -437,11 +437,15 @@ else
if (! empty($conf->service->enabled) && $type != 0)
{
print '';
- 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 ' ';
}
diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php
index cf4d996487b..5483c41e411 100644
--- a/htdocs/projet/tasks/index.php
+++ b/htdocs/projet/tasks/index.php
@@ -119,7 +119,7 @@ print '';
print ' ';
print "\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 '';
print '';
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index d6d5199b3c6..fd2c8a17252 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -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() 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; }
/* ============================================================================== */
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index b8414dd170e..342a7074ce9 100755
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$input='xxx ';
$after=dol_textishtml($input);
$this->assertTrue($after);
+ $input='abc ';
+ $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);