diff --git a/build/debian/README.howto b/build/debian/README.howto index 705899d47c4898f5138b842cb2255d60936c258f..399c4f07a1f1a8c4c230181a45397c8b5457cde9 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 060c910753ab4f5752451d73ca7d5438557bc954..86b94d8ecf01b0a131a80f61b9072bfd9befee95 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -91,7 +91,8 @@ print '</td></tr>'; print '<tr class="oddeven"><td>'; print $langs->trans("DefaultLink").'</td><td>'; -print '<input style="width: 90%" type="text" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>'; +print '<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>'; +print ajax_autoselect('CLICKTODIAL_URL'); print '<br>'; print $langs->trans("ClickToDialUrlDesc").'<br>'; print $langs->trans("Example").':<br>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 704ec1b68746c1a34bdfc22f1940d12cdab6fad4..76a9befebc997a9e00003f1dc56db824e479638b 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 70eea532a790b6c66f664cf0036493d40614675c..7e08bdc7faee07adc60156b0f7a507c81ef6007e 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 96f77e857581cc8d0e0065de82dd7c26af6abf95..8cd924a0df82cc644db7d37942b02c4536beae70 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> @@ -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".'<script type="text/javascript" language="javascript">'; print '$(document).ready(function () { @@ -369,7 +369,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } if ($(\'#fieldchqemetteur\').val() == \'\') { - var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_js(dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM)).'\' : jQuery(\'#thirdpartylabel\').val(); + var emetteur = ('.$facture->type.' == '.Facture::TYPE_CREDIT_NOTE.') ? \''.dol_escape_js(dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM)).'\' : jQuery(\'#thirdpartylabel\').val(); $(\'#fieldchqemetteur\').val(emetteur); } } @@ -437,14 +437,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie '; print ' });'."\n"; - if (!empty($conf->use_javascript_ajax)){ - //Add js for AutoFill - print ' $(document).ready(function () {'; - print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ - $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change"); - });'; - print ' });'."\n"; - } + + //Add js for AutoFill + print ' $(document).ready(function () {'; + print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ + $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change"); + });'; + print ' });'."\n"; + print ' </script>'."\n"; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 53035dca96f669061fcb578067d786319508c740..03a7759e52c7ad402af13f42c937268134dd610f 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 3e9d56f8f8cce35a30a6f7df8520c324b81ebbef..4d9fa7a72af78ce83fc9c16714aa81467f02634a 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 2526638cee592c259d4028df048321e9a7c0ff2a..5e5c13056e7a98269384ee221db3164a247a3990 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 fb398270fa6b7fcc29f2bbcf1bd30e43244f8f7c..9fc1739334cbca48ef6c666168af434ba18a21a0 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 942c17f5df9938e1c91978f3a55040f064155de8..49218ddf14190d7e772145ebc25f9ed3c0c1560c 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 c14927ec0483fdf4a5725c5dd5518269a79a0653..3242a388a3d8fa3e5f13f12181603b93b676b60e 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2010-2016 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * * 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 '<td align="center" print '<td width="80"> </td>'; print "</tr>\n"; -$var=True; -foreach($extrafields->attribute_type as $key => $value) +if (count($extrafields->attribute_type)) { + foreach($extrafields->attribute_type as $key => $value) + { + + print '<tr class="oddeven">'; + print "<td>".$extrafields->attribute_pos[$key]."</td>\n"; + print "<td>".$extrafields->attribute_label[$key]."</td>\n"; + print "<td>".$key."</td>\n"; + print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n"; + print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n"; + print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n"; + print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n"; + print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n"; + if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it. + print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>'; + print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n"; + print "</tr>"; + } +} +else +{ + $colspan=9; + if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) $colspan++; print '<tr class="oddeven">'; - print "<td>".$extrafields->attribute_pos[$key]."</td>\n"; - print "<td>".$extrafields->attribute_label[$key]."</td>\n"; - print "<td>".$key."</td>\n"; - print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n"; - print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n"; - print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n"; - print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n"; - print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n"; - if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it. - print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>'; - print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n"; - print "</tr>"; + print '<td class="opacitymedium" colspan="'.$colspan.'">'; + print $langs->trans("None"); + print '</td>'; + print '</tr>'; } print "</table>"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 02ff5740986c33f9984a28fe91ba776805dbfc0a..35037387c1fc00c2169327faf25ad5e29dc9dc85 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<br><b>__PHONETO__</b> that will be replaced with the phone number of person to call<br><b>__PHONEFROM__</b> that will be replaced with phone number of calling person (yours)<br><b>__LOGIN__</b> that will be replaced with your clicktodial login (defined on your user card)<br><b>__PASS__</b> 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<br><b>__PHONETO__</b> that will be replaced with the phone number of person to call<br><b>__PHONEFROM__</b> that will be replaced with phone number of calling person (yours)<br><b>__LOGIN__</b> that will be replaced with clicktodial login (defined on user card)<br><b>__PASS__</b> 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 7432f0e2412302030d8c6da3c720562b4f370941..189ef5c1fe2ae2f07152683500cbb323049561f6 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 6a92e0f4eede68a9a807003eb2483dcc48421320..ab92df9ca12a671b85e03ed209b34ca2f15ceaef 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 '<!-- Includes JS of Dolibarr -->'."\n"; + print '<!-- Includes JS of Dolibarr (brwoser layout = '.$conf->browser->layout.')-->'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_notification.js.php?version='.urlencode(DOL_VERSION).($ext?'&'.$ext:'').'"></script>'."\n"; } } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index f7e4cbecb0a154ba73e9653e31c7beda7800b603..dc279cc09293041a2f52dd98fc1b1e344ed29489 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 36a185d7fd1df5424200c9edc2409115ab76040f..57545b07948c458e6d4a3c71d36c59b1e871dff1 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 91dd182fc56d44c773d962d70d2ebc6ca76a8956..51855629686adca82d295d7bb4743663c206913c 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] = '<div align="right">'.price($row[$field],0,'',1,-1,2).'</div>'; } if($TParam['type'][$field]=='number') { $row[$field] = '<div align="right">'.price($row[$field]).'</div>'; } - if($TParam['type'][$field]=='integer') { $row[$field] = '<div align="right">'.(int)$row[$field].'</div>'; } + if($TParam['type'][$field]=='integer') { $row[$field] = '<div align="right">'.((int) $row[$field]).'</div>'; } } if(isset($TParam['link'][$field])) @@ -945,7 +945,7 @@ class Listview { if(isset($TParam['translate'][$field][''])) unset($TParam['translate'][$field]['']); - $row[$field] = strtr( $row[$field] , $TParam['translate'][$field]); + $row[$field] = strtr( $row[$field], $TParam['translate'][$field]); } } } @@ -986,8 +986,8 @@ class Listview } /** - * @param $sql - * @param $TParam + * @param string $sql sql + * @param string $TParam TParam * @return string */ private function limitSQL($sql, &$TParam) @@ -1001,10 +1001,10 @@ class Listview } /** - * @param $THeader - * @param $TField - * @param $TParam - * @param $sql + * @param string $THeader THeader + * @param string $TField TField + * @param string $TParam TParam + * @param string $sql sql */ private function parse_sql(&$THeader, &$TField, &$TParam, $sql) {