diff --git a/build/debian/README.howto b/build/debian/README.howto
index 705899d47c4..399c4f07a1f 100644
--- a/build/debian/README.howto
+++ b/build/debian/README.howto
@@ -385,13 +385,14 @@ http://packages.qa.debian.org
* Package will be into release when test will be moved as stable.
-##### Send an unblock request
+
+##### Send an unblock request to make a full update of a stable package
Use this to move from unstable to testing.
reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls
Choose package "release.debian.org"
-Then "unblock"
+Then usertag "unblock"
Then name of package "dolibarr"
Fill message, for example:
"Please unblock package dolibarr
@@ -400,12 +401,11 @@ Note that package 3.5.7 contains not only fixed for bugs reported to debian. It
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
After discussion with ..., it appears that security holes are enough to request this unblock request."
-
-Use this to request an update of a stable package
+Use this to request an full update of a stable package
reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls
Choose package "release.debian.org"
-Then "unblock"
+Then usertag "unblock"
Then name of package "dolibarr"
Fill message, for example:
"
@@ -417,11 +417,26 @@ Pro are:
- It fixes also stability bugs
- Patches were already tested because deployed and used by several thousands of users.
- It is easier for package maintener to include this official set of fixes than applying one patch after one patch for each debian report or backported each patch into a dedicated version.
-- Debian maintenance version matches with official project maintenance version (better when all fixes are not related to the way the software is packaged)
+- Debian maintenance version is inline with official project maintenance version (better when all fixes are not related to the way the software is packaged)
Cons are:
-- The patch include more than the only one security reported fxes
+- The patch include more than the only one security reported fixes
So I just need to know if it's ok to push such a version 3.5.7 (fixes for 3.5.* branch) instead of only one fix for only the few (the only) reported debian bugs,
since it provides more stability and is for me a more secured process.
"
+##### Send an request to ask a simple fix of a stable package
+
+Use this to ask to apply patches on a stable version.
+
+reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls
+Choose package "release.debian.org"
+Then usertag "jessie-pu"
+Then name of package "dolibarr"
+Fill message, for example:
+"Please unblock package dolibarr
+A security error CVE-2015-3935 was reported and is fixed into package 3.5.7.
+Note that package 3.5.7 contains not only fixed for bugs reported to debian. It includes other fixes, but they are all related to stability or security,
+so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
+After discussion with ..., it appears that security holes are enough to request this unblock request."
+
diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php
index 060c910753a..86b94d8ecf0 100644
--- a/htdocs/admin/clicktodial.php
+++ b/htdocs/admin/clicktodial.php
@@ -91,7 +91,8 @@ print '';
print '
';
print $langs->trans("DefaultLink").'
';
-print 'global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"> ';
+print 'global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"> ';
+print ajax_autoselect('CLICKTODIAL_URL');
print ' ';
print $langs->trans("ClickToDialUrlDesc").' ';
print $langs->trans("Example").': http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';
diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php
index 704ec1b6874..76a9befebc9 100644
--- a/htdocs/api/class/api_login.class.php
+++ b/htdocs/api/class/api_login.class.php
@@ -102,7 +102,7 @@ class Login
'success' => array(
'code' => 200,
'token' => $token,
- 'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call)')
+ 'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
)
);
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 70eea532a79..7e08bdc7fae 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -611,7 +611,9 @@ if (empty($reshook))
{
$db->begin();
- // Boucle sur chaque taux de tva
+ $amount_ht = $amount_tva = $amount_ttc = array();
+
+ // Loop on each vat rate
$i = 0;
foreach ($object->lines as $line)
{
@@ -630,20 +632,19 @@ if (empty($reshook))
$discount->description = '(CREDIT_NOTE)';
elseif ($object->type == Facture::TYPE_DEPOSIT)
$discount->description = '(DEPOSIT)';
- elseif ($object->type == Facture::TYPE_STANDARD)
+ elseif ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
$discount->description = '(EXCESS RECEIVED)';
else {
setEventMessages($langs->trans('CantConvertToReducAnInvoiceOfThisType'), null, 'errors');
}
- $discount->tva_tx = abs($object->total_ttc);
$discount->fk_soc = $object->socid;
$discount->fk_facture_source = $object->id;
$error = 0;
- if ($object->type == Facture::TYPE_STANDARD) {
-
- // If we're on a standard invoice, we have to get excess received to create it in TTC wuthout VAT
+ if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
+ {
+ // If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
$sql = 'SELECT SUM(pf.amount) as total_paiements
FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p
@@ -663,8 +664,9 @@ if (empty($reshook))
$error++;
}
- } else {
-
+ }
+ if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT)
+ {
foreach ($amount_ht as $tva_tx => $xxx)
{
$discount->amount_ht = abs($amount_ht[$tva_tx]);
@@ -871,19 +873,6 @@ if (empty($reshook))
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'),$remain_to_pay,1,0,0,0,0,0,'','','TTC');
}
}
-
- // Add predefined lines
- /*
- TODO delete
- for($i = 1; $i <= $NBLINES; $i ++) {
- if ($_POST['idprod' . $i]) {
- $product = new Product($db);
- $product->fetch($_POST['idprod' . $i]);
- $startday = dol_mktime(12, 0, 0, $_POST['date_start' . $i . 'month'], $_POST['date_start' . $i . 'day'], $_POST['date_start' . $i . 'year']);
- $endday = dol_mktime(12, 0, 0, $_POST['date_end' . $i . 'month'], $_POST['date_end' . $i . 'day'], $_POST['date_end' . $i . 'year']);
- $result = $object->addline($product->description, $product->price, $_POST['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod' . $i], $_POST['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
- }
- }*/
}
}
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 96f77e85758..8cd924a0df8 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2016 Laurent Destailleur
+ * Copyright (C) 2004-2017 Laurent Destailleur
* Copyright (C) 2005 Marc Barilley / Ocebo
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2007 Franky Van Liedekerke
@@ -221,7 +221,7 @@ if (empty($reshook))
$db->begin();
// Clean parameters amount if payment is for a credit note
- if (GETPOST('type') == 2)
+ if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE)
{
foreach ($amounts as $key => $value) // How payment is dispatch
{
@@ -249,7 +249,7 @@ if (empty($reshook))
// Creation of payment line
$paiement = new Paiement($db);
$paiement->datepaye = $datepaye;
- $paiement->amounts = $amounts; // Array with all payments dispatching
+ $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement');
$paiement->num_paiement = GETPOST('num_paiement');
@@ -257,7 +257,7 @@ if (empty($reshook))
if (! $error)
{
- $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0));
+ $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices
if ($paiement_id < 0)
{
setEventMessages($paiement->error, $paiement->errors, 'errors');
@@ -268,7 +268,7 @@ if (empty($reshook))
if (! $error)
{
$label='(CustomerInvoicePayment)';
- if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
+ if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) $label='(CustomerInvoicePaymentBack)'; // Refund of a credit note
$result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank'));
if ($result < 0)
{
@@ -281,7 +281,7 @@ if (empty($reshook))
{
$db->commit();
- // If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
+ // If payment dispatching on more than one invoice, we keep on summary page, otherwise jump on invoice card
$invoiceid=0;
foreach ($paiement->amounts as $key => $amount)
{
@@ -309,7 +309,7 @@ if (empty($reshook))
* View
*/
-llxHeader();
+llxHeader('', $langs->trans("Payment"));
$form=new Form($db);
@@ -324,8 +324,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$facture->fetch_thirdparty();
$title='';
- if ($facture->type != 2) $title.=$langs->trans("EnterPaymentReceivedFromCustomer");
- if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer");
+ if ($facture->type != Facture::TYPE_CREDIT_NOTE) $title.=$langs->trans("EnterPaymentReceivedFromCustomer");
+ if ($facture->type == Facture::TYPE_CREDIT_NOTE) $title.=$langs->trans("EnterPaymentDueToCustomer");
print load_fiche_titre($title);
// Initialize data for confirmation (this is used because data can be change during confirmation)
@@ -347,7 +347,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Add realtime total information
- if ($conf->use_javascript_ajax)
+ if (! empty($conf->use_javascript_ajax))
{
print "\n".''."\n";
}
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 53035dca96f..03a7759e52c 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -255,7 +255,7 @@ class Paiement extends CommonObject
{
if (! empty($conf->prelevement->enabled))
{
- // TODO Check if this payment has a withdraw request
+ // FIXME Check if this invoice has a withdraw request
// if not, $mustwait++; // This will disable automatic close on invoice to allow to process
}
}
@@ -275,11 +275,61 @@ class Paiement extends CommonObject
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
else
{
- $result=$invoice->set_paid($user,'','');
- if ($result<0)
+ // If invoice is a down payment, we also convert down payment to discount
+ if ($invoice->type == Facture::TYPE_DEPOSIT)
{
- $this->error=$invoice->error;
- $error++;
+ $amount_ht = $amount_tva = $amount_ttc = array();
+
+ // Loop on each vat rate
+ $i = 0;
+ foreach ($invoice->lines as $line)
+ {
+ if ($line->total_ht!=0)
+ { // no need to create discount if amount is null
+ $amount_ht[$line->tva_tx] += $line->total_ht;
+ $amount_tva[$line->tva_tx] += $line->total_tva;
+ $amount_ttc[$line->tva_tx] += $line->total_ttc;
+ $i ++;
+ }
+ }
+
+ // Insert one discount by VAT rate category
+ $discount = new DiscountAbsolute($this->db);
+ $discount->description = '(DEPOSIT)';
+ $discount->fk_soc = $invoice->socid;
+ $discount->fk_facture_source = $invoice->id;
+
+ foreach ($amount_ht as $tva_tx => $xxx)
+ {
+ $discount->amount_ht = abs($amount_ht[$tva_tx]);
+ $discount->amount_tva = abs($amount_tva[$tva_tx]);
+ $discount->amount_ttc = abs($amount_ttc[$tva_tx]);
+ $discount->tva_tx = abs($tva_tx);
+
+ $result = $discount->create($user);
+ if ($result < 0)
+ {
+ $error++;
+ break;
+ }
+ }
+
+ if ($error)
+ {
+ setEventMessages($discount->error, $discount->errors, 'errors');
+ $error++;
+ }
+ }
+
+ // Set invoice to paid
+ if (! $error)
+ {
+ $result=$invoice->set_paid($user,'','');
+ if ($result<0)
+ {
+ $this->error=$invoice->error;
+ $error++;
+ }
}
}
}
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 3e9d56f8f8c..4d9fa7a72af 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -51,7 +51,8 @@ abstract class CommonInvoice extends CommonObject
const TYPE_DEPOSIT = 3;
/**
- * Proforma invoice
+ * Proforma invoice.
+ * @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
*/
const TYPE_PROFORMA = 4;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 2526638cee5..5e5c13056e7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4674,7 +4674,26 @@ abstract class CommonObject
*/
public function createCommon(User $user, $notrigger = false)
{
+ foreach ($this->fields as $k => $v) {
+ $keys[] = $k;
+ $values[] = $this->quote($v);
+
+ }
+
+ $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$table.'
+ ( '.implode( ",", $keys ).' )
+ VALUES ( '.implode( ",", $values ).' ) ';
+
+ $res = $this->query($sql);
+ if($res===false) {
+
+ return false;
+ }
+
+ // TODO Add triggers
+
+ return true;
}
@@ -4690,7 +4709,6 @@ abstract class CommonObject
{
}
-
/**
* Update object into database
@@ -4702,10 +4720,36 @@ abstract class CommonObject
*/
public function updateCommon(User $user, $notrigger = false)
{
+ foreach ($this->fields as $k => $v) {
+ if (is_array($key)){
+ $i=array_search($k, $key);
+ if ( $i !== false) {
+ $where[] = $key[$i].'=' . $this->quote( $v ) ;
+ continue;
+ }
+ } else {
+ if ( $k == $key) {
+ $where[] = $k.'=' .$this->quote( $v ) ;
+ continue;
+ }
+ }
+
+ $tmp[] = $k.'='.$this->quote($v);
+ }
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET '.implode( ',', $tmp ).' WHERE ' . implode(' AND ',$where) ;
+ $res = $this->query( $sql );
+
+ if($res===false) {
+ //error
+ return false;
+ }
+
+ // TODO Add triggers
+
+ return true;
}
-
/**
* Delete object in database
*
@@ -4718,4 +4762,20 @@ abstract class CommonObject
{
}
+
+ /**
+ * Add quote to field value if necessary
+ *
+ * @param string|int $value value to protect
+ * @return string|int
+ */
+ function quote($value) {
+
+ if(is_null($value)) return 'NULL';
+ else if(is_numeric($value)) return $value;
+ else return "'".$this->escape( $value )."'";
+
+ }
+
}
+
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index fb398270fa6..9fc1739334c 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -295,122 +295,5 @@ abstract class DoliDB implements Database
{
return $this->lastqueryerror;
}
- /*
- * Add quote to field value if necessary
- *
- * @param string|int $value value to protect
- * @return string|int
- */
- function quote($value) {
-
- if(is_null($value)) return 'NULL';
- else if(is_numeric($value)) return $value;
- else return "'".$this->escape( $value )."'";
-
- }
-
- /**
- * Generate and execute Update SQL commande
- *
- * @param string $table table to update
- * @param array $values array of values to update
- * @param int|string|array $key key of value to select row to update
- * @return bool|result false or boolean
- */
- function update($table,$fields,$key){
-
- foreach ($fields as $k => $v) {
-
- if (is_array($key)){
- $i=array_search($k , $key );
- if ( $i !== false) {
- $where[] = $key[$i].'=' . $this->quote( $v ) ;
- continue;
- }
- } else {
- if ( $k == $key) {
- $where[] = $k.'=' .$this->quote( $v ) ;
- continue;
- }
- }
-
- $tmp[] = $k.'='.$this->quote($v);
- }
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET '.implode( ',', $tmp ).' WHERE ' . implode(' AND ',$where) ;
- $res = $this->query( $sql );
-
- if($res===false) {
- //error
- return false;
- }
-
- return true;
- }
-
- /**
- * Generate and execute Insert SQL commande
- *
- * @param string $table table to update
- * @param array $values array of values to update
- * @return bool|result false or boolean
- */
- function insert($table,$fields){
-
- foreach ($fields as $k => $v) {
-
- $keys[] = $k;
- $values[] = $this->quote($v);
-
- }
-
- $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$table.'
- ( '.implode( ",", $keys ).' )
- VALUES ( '.implode( ",", $values ).' ) ';
-
- $res = $this->query($sql);
- if($res===false) {
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Generate and execute Delete SQL commande
- *
- * @param string $table table for the delete
- * @param array $values array of values to delete
- * @param int|string|array $key key of value to select row to update
- * @return bool|result false or boolean
- */
- function delete($table,$fields,$key){
- foreach ($fields as $k => $v) {
- if (is_array($key)){
- $i=array_search($k , $key );
- if ( $i !== false) {
- $where[] = $key[$i].'=' . $this->quote( $v ) ;
- continue;
- }
- } else {
- if ( $k == $key) {
- $where[] = $k.'='.$this->quote( $v ) ;
- continue;
- }
- }
-
- }
-
- $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.implode(' AND ',$where);
-
- $res = $this->query( $sql );
- if($res===false) {
- return false;
- }
-
- return true;
-
- }
-
}
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index 942c17f5df9..49218ddf141 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -349,7 +349,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
/**
- * Make a input box content all selected
+ * Make content of an input box selected when we click into input field.
*
* @param string $htmlname Id of html object
* @param int $addlink Add a link to after
diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php
index c14927ec048..3242a388a3d 100644
--- a/htdocs/core/tpl/admin_extrafields_view.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2010-2017 Laurent Destailleur
* Copyright (C) 2012 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -49,23 +49,36 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '
';
+ print '';
}
print "";
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 02ff5740986..35037387c1f 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1501,7 +1501,7 @@ AGENDA_NOTIFICATION=Enable event notification on user browsers when event date i
AGENDA_NOTIFICATION_SOUND=Enable sound notification
##### Clicktodial #####
ClickToDialSetup=Click To Dial module setup
-ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags __PHONETO__ that will be replaced with the phone number of person to call __PHONEFROM__ that will be replaced with phone number of calling person (yours) __LOGIN__ that will be replaced with your clicktodial login (defined on your user card) __PASS__ that will be replaced with your clicktodial password (defined on your user card).
+ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags __PHONETO__ that will be replaced with the phone number of person to call __PHONEFROM__ that will be replaced with phone number of calling person (yours) __LOGIN__ that will be replaced with clicktodial login (defined on user card) __PASS__ that will be replaced with clicktodial password (defined on user card).
ClickToDialDesc=This module allows to make phone numbers clickable. A click on this icon will call make your phone to call the phone number. This can be used to call a call center system from Dolibarr that can call the phone number on a SIP system for example.
ClickToDialUseTelLink=Use just a link "tel:" on phone numbers
ClickToDialUseTelLinkDesc=Use this method if your users have a softphone or a software interface installed on same computer than the browser, and called when you click on a link in your browser that start with "tel:". If you need a full server solution (no need of local software installation), you must set this to "No" and fill next field.
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 7432f0e2412..189ef5c1fe2 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -447,7 +447,7 @@ CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least
ExpectedToPay=Expected payment
CantRemoveConciliatedPayment=Can't remove conciliated payment
PayedByThisPayment=Paid by this payment
-ClosePaidInvoicesAutomatically=Classify "Paid" all standard, situation or replacement invoices entirely paid.
+ClosePaidInvoicesAutomatically=Classify "Paid" all standard, down payment or replacement invoices entirely paid.
ClosePaidCreditNotesAutomatically=Classify "Paid" all credit notes entirely paid back.
ClosePaidContributionsAutomatically=Classify "Paid" all social or fiscal contributions entirely paid.
AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be automatically closed to status "Paid".
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 6a92e0f4eed..ab92df9ca12 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1271,9 +1271,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{
$enablebrowsernotif=false;
if (! empty($conf->agenda->enabled) && ! empty($conf->global->AGENDA_NOTIFICATION)) $enablebrowsernotif=true;
+ if ($conf->browser->layout == 'phone') $enablebrowsernotif=false;
if ($enablebrowsernotif)
{
- print ''."\n";
+ print ''."\n";
print ''."\n";
}
}
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index f7e4cbecb0a..dc279cc0929 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -23,7 +23,7 @@
require_once '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/listview.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/inventory/listview.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@@ -463,7 +463,8 @@ function card_line(&$inventory, &$lines, $mode)
if(!empty($TCacheEntrepot[$Inventorydet->fk_warehouse])) $e = $TCacheEntrepot[$Inventorydet->fk_warehouse];
elseif($e->fetch($Inventorydet->fk_warehouse) > 0) $TCacheEntrepot[$e->id] = $e;
- $qty = (float)GETPOST('qty_to_add')[$k];
+ $qtytoadd = GETPOST('qty_to_add', 'array');
+ $qty = (float) $qtytoadd[$k];
$lines[]=array(
'produit' => $product->getNomUrl(1).' - '.$product->label,
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 36a185d7fd1..57545b07948 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -23,7 +23,7 @@
require_once '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/listview.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/inventory/listview.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
diff --git a/htdocs/core/class/listview.class.php b/htdocs/product/inventory/listview.class.php
similarity index 93%
rename from htdocs/core/class/listview.class.php
rename to htdocs/product/inventory/listview.class.php
index 91dd182fc56..51855629686 100644
--- a/htdocs/core/class/listview.class.php
+++ b/htdocs/product/inventory/listview.class.php
@@ -103,7 +103,7 @@ class Listview
/**
* @param string $key field name
- * @param array $TParam array of configuration
+ * @param string $TParam array of configuration
* @return array
*/
private function getSearchKey($key, &$TParam)
@@ -149,7 +149,7 @@ class Listview
/**
- * @param array $TSQLMore contain some additional sql instructions
+ * @param string $TSQLMore contain some additional sql instructions
* @param string $value date with read format
* @param string $sKey field name
*/
@@ -181,9 +181,9 @@ class Listview
/**
- * @param array $TSQLMore contain some additional sql instructions
+ * @param string $TSQLMore contain some additional sql instructions
* @param string $value value to filter
- * @param array $TParam array of configuration
+ * @param string $TParam array of configuration
* @param string $sKey field name
* @param string $key reference of sKey to find value into TParam
* @return bool
@@ -222,7 +222,7 @@ class Listview
/**
* @param string $sql standard select sql
- * @param array $TParam array of configuration
+ * @param string $TParam array of configuration
* @return string
*/
private function search($sql, &$TParam)
@@ -289,7 +289,7 @@ class Listview
/**
* @param string $sql standard select sql
- * @param array $TParam array of configuration
+ * @param string $TParam array of configuration
* @return string
*/
public function render($sql, $TParam=array())
@@ -321,8 +321,8 @@ class Listview
}
/**
- * @param array $THeader the configuration of header
- * @param array $TParam array of configuration
+ * @param string $THeader the configuration of header
+ * @param string $TParam array of configuration
* @return array
*/
private function setSearch(&$THeader, &$TParam)
@@ -427,8 +427,8 @@ class Listview
/**
* Function to analyse and calculate the total from a column
*
- * @param $TField
- * @param $TParam
+ * @param string $TField TField
+ * @param string $TParam TParam
* @return array
*/
private function get_total(&$TField, &$TParam)
@@ -495,9 +495,9 @@ class Listview
*/
/**
- * @param $TParam
- * @param $TField
- * @param $THeader
+ * @param string $TParam TParam
+ * @param string $TField TField
+ * @param string $THeader THeader
* @return array
*/
private function setExport(&$TParam, $TField, $THeader)
@@ -535,8 +535,8 @@ class Listview
}
/**
- * @param $TField
- * @param $TTotalGroup
+ * @param string $TField TField
+ * @param string $TTotalGroup TTotalGroup
* @return array
*/
private function addTotalGroup($TField, $TTotalGroup)
@@ -594,11 +594,11 @@ class Listview
}
/**
- * @param $THeader
- * @param $TField
- * @param $TTotal
- * @param $TTotalGroup
- * @param $TParam
+ * @param string $THeader THeader
+ * @param string $TField TField
+ * @param string $TTotal TTotal
+ * @param string $TTotalGroup TTotalGroup
+ * @param string $TParam TParam
* @return string
*/
private function renderList(&$THeader, &$TField, &$TTotal, &$TTotalGroup, &$TParam)
@@ -723,9 +723,9 @@ class Listview
}
/**
- * @param $db
- * @param $TField
- * @param array $TParam
+ * @param string $db Db
+ * @param string $TField TField
+ * @param string $TParam TParam
*/
public function renderArray(&$db, $TField, $TParam=array())
{
@@ -744,9 +744,9 @@ class Listview
/**
- * @param $THeader
- * @param $TField
- * @param $TParam
+ * @param string $THeader THeader
+ * @param string $TField TField
+ * @param string $TParam TParam
* @return bool
*/
private function parse_array(&$THeader, &$TField, &$TParam)
@@ -853,8 +853,8 @@ class Listview
}
/**
- * @param $TParam
- * @param $line_number
+ * @param string $TParam TParam
+ * @param string $line_number aaa
* @return bool
*/
private function in_view(&$TParam, $line_number)
@@ -874,9 +874,9 @@ class Listview
}
/**
- * @param $TField
- * @param $TParam
- * @param $currentLine
+ * @param string $TField TField
+ * @param string $TParam TParam
+ * @param string $currentLine aaa
*/
private function set_line(&$TField, &$TParam, $currentLine)
{
@@ -910,7 +910,7 @@ class Listview
if(isset($TParam['eval'][$field]) && in_array($field,array_keys($row)))
{
- $strToEval = 'return '.strtr( $TParam['eval'][$field] , array_merge( $trans, array('@val@'=>$row[$field]) )).';';
+ $strToEval = 'return '.strtr( $TParam['eval'][$field], array_merge( $trans, array('@val@'=>$row[$field]) )).';';
$row[$field] = eval($strToEval);
}
@@ -932,7 +932,7 @@ class Listview
if($TParam['type'][$field]=='hour') { $row[$field] = date('H:i', strtotime($row[$field])); }
if($TParam['type'][$field]=='money') { $row[$field] = '