From 92b7914ef39a40d5dc9845ca4fd9694ab54f57e7 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 9 Jun 2017 11:09:06 +0200 Subject: [PATCH 01/24] Fix : button convert was still available even if deposit was already converted --- htdocs/compta/facture.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d7f6a5c7dfd..c19c521ca65 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3938,6 +3938,9 @@ else if ($id > 0 || ! empty($ref)) } } + $discount = new DiscountAbsolute($db); + $result = $discount->fetch(0, $object->id); + // Reopen a standard paid invoice if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) From 9341d5f448476a9a52d3b4cdf914706c882c8fcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Jun 2017 15:35:27 +0200 Subject: [PATCH 02/24] FIX Line of invoices not inserted when using POS module and VAT NPR. --- htdocs/cashdesk/affContenu.php | 6 +- htdocs/cashdesk/class/Facturation.class.php | 26 ++-- htdocs/cashdesk/facturation.php | 45 ++----- htdocs/cashdesk/facturation_verif.php | 115 +++++++++++------- htdocs/cashdesk/tpl/facturation1.tpl.php | 8 +- htdocs/cashdesk/validation_verif.php | 11 +- htdocs/compta/facture/class/facture.class.php | 11 +- htdocs/main.inc.php | 14 +-- 8 files changed, 125 insertions(+), 111 deletions(-) diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index 280f2b81908..bd778f3422e 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -34,8 +34,8 @@ if ( $_GET['id'] == 'NOUV' ) // Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ... if (isset($_SESSION['serObjFacturation'])) { - $obj_facturation = unserialize($_SESSION['serObjFacturation']); - unset($_SESSION['serObjFacturation']); + $obj_facturation = unserialize($_SESSION['serObjFacturation']); + unset($_SESSION['serObjFacturation']); } else { @@ -43,7 +43,7 @@ else $obj_facturation = new Facturation(); } - +// $obj_facturation contains data for all invoice total + selection of current product $obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart'] diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 240b32e34db..4b0ad0bf101 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -99,17 +99,25 @@ class Facturation $product = new Product($db); $product->fetch($this->id); - + $vatrowid = $this->tva(); - + $tmp = getTaxesFromId($vatrowid); - $vat_rate = $tmp['rate']; + $txtva = $tmp['rate'].(empty($tmp['code'])?'':' ('.$tmp['code'].')'); $vat_npr = $tmp['npr']; - + $localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1); - + + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } + // Define part of HT, VAT, TTC - $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); + $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); // Calcul du total ht sans remise $total_ht = $resultarray[0]; @@ -136,7 +144,7 @@ class Facturation $newcartarray[$i]['label']=$product->label; $newcartarray[$i]['price']=$product->price; $newcartarray[$i]['price_ttc']=$product->price_ttc; - + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { if (isset($product->multiprices[$societe->price_level])) @@ -148,7 +156,7 @@ class Facturation $newcartarray[$i]['fk_article']=$this->id; $newcartarray[$i]['qte']=$this->qte(); - $newcartarray[$i]['fk_tva']=$this->tva(); + $newcartarray[$i]['fk_tva']=$this->tva(); // Vat rowid $newcartarray[$i]['remise_percent']=$remise_percent; $newcartarray[$i]['remise']=price2num($montant_remise_ht); $newcartarray[$i]['total_ht']=price2num($total_ht,'MT'); @@ -220,7 +228,7 @@ class Facturation $this->prix_total_vat = $total_vat; $this->prix_total_localtax1 = $total_localtax1; $this->prix_total_localtax2 = $total_localtax2; - + $this->montant_tva = $total_ttc - $total_ht; //print $this->prix_total_ttc.'eeee'; exit; } diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index dd722805eb6..f4542ec91f8 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -35,7 +35,7 @@ $form=new Form($db); // Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled) -if ( GETPOST('filtre') ) { +if ( GETPOST('filtre','alpha') ) { // Avec filtre $ret=array(); $i=0; @@ -47,22 +47,23 @@ if ( GETPOST('filtre') ) { $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " AND p.tosell = 1"; if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0"; - $sql.= " AND (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'"; - if (! empty($conf->barcode->enabled)) { - - $filtre = GETPOST('filtre'); + $sql.= " AND ("; + $sql.= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'"; + if (! empty($conf->barcode->enabled)) + { + $filtre = GETPOST('filtre','alpha'); //If the barcode looks like an EAN13 format and the last digit is included in it, //then whe look for the 12-digit too //As the twelve-digit string will also hit the 13-digit code, we only look for this one if (strlen($filtre) == 13) { $crit_12digit = substr($filtre, 0, 12); - $sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%')"; + $sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'"; } else { - $sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%')"; + $sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%'"; } } - else $sql.= ")"; + $sql.= ")"; $sql.= " ORDER BY label"; dol_syslog("facturation.php", LOG_DEBUG); @@ -154,34 +155,6 @@ global $mysoc; $ret=array(); $i=0; -$sql = "SELECT t.rowid, t.taux"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t"; -$sql.= ", ".MAIN_DB_PREFIX."c_country as c"; -$sql.= " WHERE t.fk_pays = c.rowid"; -$sql.= " AND t.active = 1"; -$sql.= " AND c.code = '".$mysoc->country_code."'"; -//print $sql; - -$resql = $db->query($sql); -if ($resql) -{ - while ( $tab = $db->fetch_array($resql) ) - { - foreach ( $tab as $cle => $valeur ) - { - $ret[$i][$cle] = $valeur; - } - $i++; - } - $db->free($resql); -} -else -{ - dol_print_error($db); -} -$tab_tva = $ret; - - // Reinitialisation du mode de paiement, en cas de retour aux achats apres validation $obj_facturation->getSetPaymentMode('RESET'); $obj_facturation->montantEncaisse('RESET'); diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 95a129e88a5..ec21de2225d 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -32,12 +32,12 @@ $obj_facturation = unserialize($_SESSION['serObjFacturation']); unset ($_SESSION['serObjFacturation']); -switch ( $_GET['action'] ) +switch (GETPOST('action','alpha')) { default: if ( $_POST['hdnSource'] != 'NULL' ) { - $sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.recuperableonly"; + $sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly"; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot; @@ -54,7 +54,6 @@ switch ( $_GET['action'] ) } $result = $db->query($sql); - if ($result) { // ... et enregistrement dans l'objet @@ -67,62 +66,90 @@ switch ( $_GET['action'] ) $ret[$key] = $value; } // Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function - + $productid = $ret['rowid']; $product = new Product($db); $product->fetch($productid); + $prod = $product; $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; $societe = new Societe($db); $societe->fetch($thirdpartyid); - $tva_tx = get_default_tva($mysoc,$societe,$productid); - $tva_npr = get_default_npr($mysoc,$societe,$productid); + // Update if prices fields are defined + $tva_tx = get_default_tva($mysoc, $societe, $product->id); + $tva_npr = get_default_npr($mysoc, $societe, $product->id); if (empty($tva_tx)) $tva_npr=0; - dol_syslog('tva_tx='.$tva_tx.'-tva_npr='.$tva_npr); - + + $pu_ht = $prod->price; + $pu_ttc = $prod->price_ttc; + $price_min = $prod->price_min; + $price_base_type = $prod->price_base_type; + + // multiprix if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level)) { - if(isset($product->multiprices[$societe->price_level])) - { - $ret['price'] = $product->multiprices[$societe->price_level]; - $ret['price_ttc'] = $product->multiprices_ttc[$societe->price_level]; - // $product->multiprices_min[$societe->price_level]; - // $product->multiprices_min_ttc[$societe->price_level]; - // $product->multiprices_base_type[$societe->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level]; - if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } - } + $pu_ht = $prod->multiprices[$societe->price_level]; + $pu_ttc = $prod->multiprices_ttc[$societe->price_level]; + $price_min = $prod->multiprices_min[$societe->price_level]; + $price_base_type = $prod->multiprices_base_type[$societe->price_level]; + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility + { + if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level]; + if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level]; + } + } + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + { + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + + $prodcustprice = new Productcustomerprice($db); + + $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $societe->id); + + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result >= 0) + { + if (count($prodcustprice->lines) > 0) + { + $pu_ht = price($prodcustprice->lines [0]->price); + $pu_ttc = price($prodcustprice->lines [0]->price_ttc); + $price_base_type = $prodcustprice->lines [0]->price_base_type; + $tva_tx = $prodcustprice->lines [0]->tva_tx; + } + } + else + { + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); + } + } + + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + + // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? + if (! empty($price_ht)) { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + elseif ($tmpvat != $tmpprodvat) { + if ($price_base_type != 'HT') { + $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + } else { + $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } } - $ret['tva_tx'] = $tva_tx; - $ret['tva_npr'] = $tva_npr; - //var_dump('tva_tx='.$ret['tva_tx'].'-tva_npr='.$ret['tva_npr'].'-'.$conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL);exit; - $obj_facturation->id($ret['rowid']); $obj_facturation->ref($ret['ref']); $obj_facturation->stock($ret['reel']); $obj_facturation->prix($ret['price']); - - // Use $ret['tva_tx'] / ret['tva_npr'] to find vat id - $vatrowid = null; - $sqlfindvatid = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'c_tva'; - $sqlfindvatid.= ' WHERE taux = '.$ret['tva_tx'].' AND recuperableonly = '.(int) $ret['tva_npr']; - $sqlfindvatid.= ' AND fk_pays = '.$mysoc->country_id; - $resqlfindvatid=$db->query($sqlfindvatid); - if ($resqlfindvatid) - { - $obj = $db->fetch_object($resqlfindvatid); - if ($obj) $vatrowid = $obj->rowid; - } - else dol_print_error($db); - - dol_syslog("save vatrowid=".$vatrowid); - $obj_facturation->tva($vatrowid); // Save vat it for next use + + + $vatrate = $tva_tx; + $obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code) // Definition du filtre pour n'afficher que le produit concerne if ( $_POST['hdnSource'] == 'LISTE' ) @@ -168,11 +195,11 @@ switch ( $_GET['action'] ) { dol_syslog("facturation_verif save vat ".$_POST['selTva']); $obj_facturation->qte($_POST['txtQte']); - $obj_facturation->tva($_POST['selTva']); // Save VAT selected so we can use it for next product + $obj_facturation->tva($_POST['selTva']); // id of vat. Saved so we can use it for next product $obj_facturation->remisePercent($_POST['txtRemise']); $obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart'] // We update prixTotalTtc - + } $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 8f74cf98626..fce4df22c7a 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -125,12 +125,12 @@ $langs->load("cashdesk"); - tva(); // Try to get a previously entered VAT rowid. First time, this will return empty. + vatrate; // To get vat rate we just have selected + $buyer = new Societe($db); if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); - - echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):-1), $mysoc, $buyer, 0, 0, '', false, -1); + echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1); ?> diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index afe73820568..48d2d9bd0c7 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -165,6 +165,7 @@ switch ($action) $tmp = getTaxesFromId($tab_liste[$i]['fk_tva']); $vat_rate = $tmp['rate']; $vat_npr = $tmp['npr']; + $vat_src_code = $tmp['code']; $invoiceline=new FactureLigne($db); $invoiceline->fk_product=$tab_liste[$i]['fk_article']; @@ -173,15 +174,17 @@ switch ($action) $invoiceline->remise_percent=$tab_liste[$i]['remise_percent']; $invoiceline->price=$tab_liste[$i]['price']; $invoiceline->subprice=$tab_liste[$i]['price']; - + $invoiceline->tva_tx=empty($vat_rate)?0:$vat_rate; // works even if vat_rate is '' $invoiceline->info_bits=empty($vat_npr)?0:$vat_npr; - + $invoiceline->vat_src_code=$vat_src_code; + $invoiceline->total_ht=$tab_liste[$i]['total_ht']; $invoiceline->total_ttc=$tab_liste[$i]['total_ttc']; $invoiceline->total_tva=$tab_liste[$i]['total_vat']; $invoiceline->total_localtax1=$tab_liste[$i]['total_localtax1']; $invoiceline->total_localtax2=$tab_liste[$i]['total_localtax2']; + $invoice->lines[]=$invoiceline; } @@ -205,7 +208,7 @@ switch ($action) { $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease=0; // If a particular stock is defined, we disable choice - + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), 0); if ($warehouseidtodecrease > 0) @@ -245,7 +248,7 @@ switch ($action) { $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease=0; // If a particular stock is defined, we disable choice - + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), 0); if ($warehouseidtodecrease > 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5eeaa4a725e..6c73746d9af 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -519,9 +519,12 @@ class Facture extends CommonInvoice { $newinvoiceline=$this->lines[$i]; $newinvoiceline->fk_facture=$this->id; - $newinvoiceline->origin = $this->element; // TODO This seems not used. Here we but origin 'facture' but after - $newinvoiceline->origin_id = $this->lines[$i]->id; // we put an id of object ! - if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 + + // TODO This seems not used. Here we put origin 'facture' but after, we put an id of object ! + $newinvoiceline->origin = $this->element; + $newinvoiceline->origin_id = $this->lines[$i]->id; + + if ($result >= 0) { // Reset fk_parent_line for no child products and special product if (($newinvoiceline->product_type != 9 && empty($newinvoiceline->fk_parent_line)) || $newinvoiceline->product_type == 9) { @@ -558,7 +561,7 @@ class Facture extends CommonInvoice //if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object. if (! is_object($line)) $line = (object) $line; - if (($line->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 + if ($result >= 0) { // Reset fk_parent_line for no child products and special product if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9d97770e48a..82f008c2378 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -300,7 +300,7 @@ if (! defined('NOTOKENRENEWAL')) { // roulement des jetons car cree a chaque appel if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken']; - + // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] $token = dol_hash(uniqid(mt_rand(),TRUE)); // Generates a hash of a random number $_SESSION['newtoken'] = $token; @@ -586,7 +586,7 @@ if (! defined('NOLOGIN')) // We are already into an authenticated session $login=$_SESSION["dol_login"]; $entity=$_SESSION["dol_entity"]; - dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); + dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); $resultFetchUser=$user->fetch('',$login,'',1,($entity > 0 ? $entity : -1)); if ($resultFetchUser <= 0) @@ -1051,7 +1051,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs $ext='version='.urlencode(DOL_VERSION); if (GETPOST('version')) $ext='version='.GETPOST('version','int'); // usefull to force no cache on css/js if (GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) $ext='testmenuhider='.GETPOST('testmenuhider','int'); - + $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity; $themeparam.=($ext?'&'.$ext:''); if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; @@ -1060,7 +1060,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (GETPOST('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen','int'); } if (GETPOST('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); } if (GETPOST('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); } - + if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax) { print ''."\n"; @@ -1929,7 +1929,7 @@ if (! function_exists("llxFooter")) }); ' . "\n"; } - + // Wrapper to manage dropdown if ($conf->use_javascript_ajax) { @@ -1960,7 +1960,7 @@ if (! function_exists("llxFooter")) console.log("Link has class dropdowncloseonclick, so we close/hide the popup ul"); $(this).parent().parent().hide(); }); - + $(document).bind(\'click\', function (e) { var $clicked = $(e.target); if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide(); @@ -1968,7 +1968,7 @@ if (! function_exists("llxFooter")) }); '; } - + // A div for the address popup print "\n\n"; print ''."\n"; From 0d24df9ffcd0762bc732da77bd80badf81f8af80 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Sat, 10 Jun 2017 14:40:17 +0200 Subject: [PATCH 03/24] Fix 6939 new path for pictures is not used --- .../supplier_proposal/doc/pdf_aurore.modules.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 3b2812c7b90..c546aad91ad 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -167,9 +167,17 @@ class pdf_aurore extends ModelePDFSupplierProposal $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - $pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/"; - $dir = $conf->product->dir_output.'/'.$pdir; - + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + } + else + { + $pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $dir = $conf->product->dir_output.'/'.$pdir; + } + $realpath=''; foreach ($objphoto->liste_photos($dir,1) as $key => $obj) { From 946e72f269a3ec7aede35fedf42a0c38ecf713fd Mon Sep 17 00:00:00 2001 From: atm-ph Date: Sun, 11 Jun 2017 12:26:51 +0200 Subject: [PATCH 04/24] Fix 6982 missing parameter to get more informations about files --- htdocs/core/lib/files.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7d8f29f7681..a4680ca81e2 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1361,11 +1361,12 @@ function dol_uncompress($inputfile,$outputdir) * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @param int $nohook Disable all hooks + * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only * @return string Full path to most recent file */ -function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview\.png)$','^\.'),$nohook=false) +function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview\.png)$','^\.'),$nohook=false,$mode='') { - $tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,'',$nohook); + $tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,$mode,$nohook); return $tmparray[0]; } From 51579817517c8ef8159702f81cea9a6aa883bb9b Mon Sep 17 00:00:00 2001 From: atm-ph Date: Sun, 11 Jun 2017 12:59:54 +0200 Subject: [PATCH 05/24] Fix 6962 wrong permission check --- htdocs/expedition/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0077338aae5..a7f4043fcd1 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -73,7 +73,12 @@ $ref=GETPOST('ref','alpha'); // Security check $socid=''; if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user, $origin, $origin_id); + +if ($origin == 'expedition') $result=restrictedArea($user, $origin, $id); +else { + $result=restrictedArea($user, 'expedition'); + if (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden(); +} $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); From ca324346e41e4939d885fc9331611018d5453c5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Jun 2017 19:08:40 +0200 Subject: [PATCH 06/24] Update doc --- htdocs/install/mysql/migration/repair.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index c748f38acb3..991212c7d22 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -13,11 +13,12 @@ -- flush privileges; --- Requests to change character set and collation of a column +-- Requests to change character set and collation of a varchar column. +-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+) -- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; --- You can check with "show full columns from llx_accountingaccount"; +-- You can check with "show full columns from llx_accounting_account"; From 58c4144123d6b472fcebb01e79bc7f2bfd067abd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Jun 2017 19:27:07 +0200 Subject: [PATCH 07/24] Fix sort of dictionnary --- htdocs/admin/dict.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index f903ce3e8fc..c83a3aa39be 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -502,6 +502,14 @@ $tabfieldcheck[34] = array(); complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); +// Defaut sortorder +if (empty($sortfield)) +{ + $tmp1 = explode(',',$tabsqlsort[$id]); + $tmp2 = explode(' ',$tmp1[0]); + $sortfield=preg_replace('/^.*\./', '', $tmp2[0]); +} + // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") $elementList = array(); $sourceList=array(); @@ -944,7 +952,8 @@ if ($id) if (! preg_match('/ WHERE /',$sql)) $sql.= " WHERE 1 = 1"; if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id; - if ($search_code != '') $sql.= natural_search("code", $search_code); + if ($search_code != '' && $id != 9) $sql.= natural_search("code", $search_code); + if ($search_code != '' && $id == 9) $sql.= natural_search("code_iso", $search_code); if ($sortfield) { From b80ee49032ec1c4a097b37515c237ec977d2d838 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Jun 2017 19:27:21 +0200 Subject: [PATCH 08/24] Add missing currency for bengladesh --- htdocs/install/mysql/data/llx_c_currencies.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index 1c9d4b5f8a7..d9b1390bb32 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -41,6 +41,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BHD', NULL, 1, 'Bahrain'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BDT', '[2547]', 1, 'Bangladeshi Taka'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BZD', '[66,90,36]', 1, 'Belize Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar'); From 277dde5d618cae0d661ac69c51040224e36b3cda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Jun 2017 10:25:28 +0200 Subject: [PATCH 09/24] Fix dol_banner --- htdocs/cron/card.php | 85 ++++++++++---------- htdocs/cron/class/cronjob.class.php | 115 ++++++++++++++-------------- htdocs/cron/info.php | 11 +++ htdocs/langs/en_US/cron.lang | 4 +- 4 files changed, 110 insertions(+), 105 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index fc89f6eb3cf..a371069d7cf 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -109,9 +109,9 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex else { $now = dol_now(); // Date we start - + $result=$object->run_jobs($user->login); - + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -155,7 +155,7 @@ if ($action=='add') $object->unitfrequency=GETPOST('unitfrequency','int'); $object->frequency=GETPOST('nbfrequency','int'); $object->maxrun=GETPOST('maxrun','int'); - + // Add cron task $result = $object->create($user); @@ -191,7 +191,7 @@ if ($action=='update') $object->unitfrequency=GETPOST('unitfrequency','int'); $object->frequency=GETPOST('nbfrequency','int'); $object->maxrun=GETPOST('maxrun','int'); - + // Add cron task $result = $object->update($user); @@ -353,7 +353,7 @@ if (($action=="create") || ($action=="edit")) print ''; print $langs->trans('CronClassFile').""; - print "classesname."\" /> "; + print ' '; print ""; print ""; print $form->textwithpicto('',$langs->trans("CronClassFileHelp"),1,'help'); @@ -371,7 +371,7 @@ if (($action=="create") || ($action=="edit")) print ''; print $langs->trans('CronMethod').""; - print "methodename."\" /> "; + print ' '; print ""; print ""; print $form->textwithpicto('',$langs->trans("CronMethodHelp"),1,'help'); @@ -431,7 +431,7 @@ if (($action=="create") || ($action=="edit")) } $input .= ""; print $input; - + $input = " unitfrequency=="3600"){ $input .= ' checked />'; @@ -441,7 +441,7 @@ if (($action=="create") || ($action=="edit")) } $input .= ""; print $input; - + $input = " unitfrequency=="86400"){ $input .= ' checked />'; @@ -451,7 +451,7 @@ if (($action=="create") || ($action=="edit")) } $input .= ""; print $input; - + $input = " unitfrequency=="604800"){ $input .= ' checked />'; @@ -465,7 +465,7 @@ if (($action=="create") || ($action=="edit")) print ""; print ""; print "\n"; - + print ""; print $langs->trans('CronDtStart').""; if(!empty($object->datestart)) @@ -480,7 +480,7 @@ if (($action=="create") || ($action=="edit")) print ""; print ""; print "\n"; - + print ""; print $langs->trans('CronDtEnd').""; if(!empty($object->dateend)){ @@ -493,7 +493,7 @@ if (($action=="create") || ($action=="edit")) print ""; print ""; print "\n"; - + print ""; print $langs->trans('CronPriority').""; $priority=0; @@ -505,7 +505,7 @@ if (($action=="create") || ($action=="edit")) print ""; print ""; print "\n"; - + print ''; $maxrun=''; if (!empty($object->maxrun)) { @@ -517,7 +517,7 @@ if (($action=="create") || ($action=="edit")) print ""; print ""; print "\n"; - + print ''; print $langs->trans('CronDtNextLaunch'); print ' ('.$langs->trans('CronFrom').')'; @@ -529,14 +529,14 @@ if (($action=="create") || ($action=="edit")) else { $form->select_date(-1,'datenextrun',1,1,'',"cronform"); - } + } print ""; print ""; print ""; print ""; - + print ''; - + dol_fiche_end(); print '
'; @@ -554,24 +554,22 @@ else * view card */ $now = dol_now(); - + dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron'); $linkback = '' . $langs->trans("BackToList") . ''; - // TODO Use dol_banner - + $morehtmlref='
'; + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); + // box add_jobs_box print '
'; print '
'; print ''; print '"; - print "\n"; - - print '"; print ""; @@ -616,21 +614,16 @@ else print $langs->trans($object->note); print ""; - print '"; - print '
'; - print $langs->trans('CronId')."".$form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'id', '', '', 0); - print "
'; print $langs->trans('CronLabel')."".$langs->trans($object->label); print "
'; - print $langs->trans('Active').""; - print $object->getLibStatut(4); - print "
'; print '
'; - + print '
'; - + print '
'; print '
'; print ''; - + print '"; print ""; - + print '"; - + print ""; - + print ""; print ""; - + print ""; print ""; - + print ""; print ""; - + // Date next run (from) print '"; - + print '
'; print $langs->trans('CronEvery').""; @@ -639,33 +632,33 @@ else if($object->unitfrequency == "86400") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Days'); if($object->unitfrequency == "604800") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Weeks'); print "
'; print $langs->trans('CronDtStart').""; if(!empty($object->datestart)) {print dol_print_date($object->datestart,'dayhoursec');} print "
"; print $langs->trans('CronDtEnd').""; if(!empty($object->dateend)) {print dol_print_date($object->dateend,'dayhoursec');} print "
"; print $langs->trans('CronPriority')."".$object->priority; print "
"; print $langs->trans('CronMaxRun').""; print $object->maxrun>0?$object->maxrun:''; print "
"; print $langs->trans('CronNbRun')."".$object->nbrun; print "
'; print $langs->trans('CronDtNextLaunch'); @@ -673,18 +666,18 @@ else print ""; //print ''; if (! $object->status) print $langs->trans("Disabled"); - elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');} + elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');} else {print $langs->trans('CronNone');} //print ''; if ($object->maxnbrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("Finished")); if ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late")); print "
'; print '
'; - + print '
'; - + print '
'; print '
'; print ''; @@ -711,7 +704,7 @@ else print '
'; print '
'; - + dol_fiche_end(); @@ -733,7 +726,7 @@ else else { print ''.$langs->trans("CronExecute").''; } - + if (! $user->rights->cron->create) { print ''.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").''; } else { @@ -743,7 +736,7 @@ else print ''.$langs->trans("CronStatusInactiveBtn").''; } } - + if (! $user->rights->cron->delete) { print ''.$langs->trans("Delete").''; } else { diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 9d01ec888f0..f9b4ac67f03 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -30,36 +30,37 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class Cronjob extends CommonObject { - var $element='cronjob'; //!< Id that identify managed objects - var $table_element='cronjob'; //!< Name of table without prefix where object is stored + public $element='cronjob'; //!< Id that identify managed objects + public $table_element='cronjob'; //!< Name of table without prefix where object is stored + public $picto = 'cron'; - var $jobtype; - var $tms=''; - var $datec=''; - var $label; - var $command; - var $classesname; - var $objectname; - var $methodename; - var $params; - var $md5params; - var $module_name; - var $priority; - var $datelastrun=''; - var $datenextrun=''; - var $dateend=''; - var $datestart=''; - var $datelastresult=''; - var $lastresult; - var $lastoutput; - var $unitfrequency; - var $frequency; - var $status; - var $processing; - var $fk_user_author; - var $fk_user_mod; - var $nbrun; - var $libname; + public $jobtype; + public $tms=''; + public $datec=''; + public $label; + public $command; + public $classesname; + public $objectname; + public $methodename; + public $params; + public $md5params; + public $module_name; + public $priority; + public $datelastrun=''; + public $datenextrun=''; + public $dateend=''; + public $datestart=''; + public $datelastresult=''; + public $lastresult; + public $lastoutput; + public $unitfrequency; + public $frequency; + public $status; + public $processing; + public $fk_user_author; + public $fk_user_mod; + public $nbrun; + public $libname; /** @@ -1265,35 +1266,35 @@ class Cronjob extends CommonObject class Cronjobline { - var $id; - var $ref; + public $id; + public $ref; - var $tms=''; - var $datec=''; - var $label; - var $jobtype; - var $command; - var $classesname; - var $objectname; - var $methodename; - var $params; - var $md5params; - var $module_name; - var $priority; - var $datelastrun=''; - var $datenextrun=''; - var $dateend=''; - var $datestart=''; - var $lastresult=''; - var $lastoutput; - var $unitfrequency; - var $frequency; - var $status; - var $fk_user_author; - var $fk_user_mod; - var $note; - var $nbrun; - var $libname; + public $tms=''; + public $datec=''; + public $label; + public $jobtype; + public $command; + public $classesname; + public $objectname; + public $methodename; + public $params; + public $md5params; + public $module_name; + public $priority; + public $datelastrun=''; + public $datenextrun=''; + public $dateend=''; + public $datestart=''; + public $lastresult=''; + public $lastoutput; + public $unitfrequency; + public $frequency; + public $status; + public $fk_user_author; + public $fk_user_mod; + public $note; + public $nbrun; + public $libname; /** * Constructor diff --git a/htdocs/cron/info.php b/htdocs/cron/info.php index 18ab50adeaa..d3365abb90b 100644 --- a/htdocs/cron/info.php +++ b/htdocs/cron/info.php @@ -50,6 +50,17 @@ $head = cron_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron'); +$linkback = '' . $langs->trans("BackToList") . ''; + +$morehtmlref='
'; +$morehtmlref.='
'; + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); + +print '
'; + +print '
'; + print '
'; dol_print_object_info($object); print '
'; diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index a1d3c6a9986..8eb03114c64 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -57,9 +57,9 @@ CronStatusActiveBtn=Enable CronStatusInactiveBtn=Disable CronTaskInactive=This job is disabled CronId=Id -CronClassFile=Classes (filename.class.php) +CronClassFile=Filename with class CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module).
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for module is product -CronClassFileHelp=The file name to load.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is product.class.php +CronClassFileHelp=The relative path and file name to load (path is relative to web server root directory).
For exemple to call the fetch method of Dolibarr Product object htdocs/product/class/product.class.php, the value for class file name is product/class/product.class.php CronObjectHelp=The object name to load.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is Product CronMethodHelp=The object method to launch.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for method is fecth CronArgsHelp=The method arguments.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for paramters can be 0, ProductRef From 0312d2479d58124e4942ce1c29ce027b1904e5c0 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 12 Jun 2017 10:26:24 +0200 Subject: [PATCH 10/24] add block info popin, translation, hidden authority feature --- htdocs/blockedlog/admin/blockedlog.php | 28 ++++----- htdocs/blockedlog/admin/fingerprints.php | 61 +++++++++++++++++-- htdocs/blockedlog/ajax/block-info.php | 15 +++++ htdocs/blockedlog/class/authority.class.php | 2 +- .../install/mysql/migration/5.0.0-6.0.0.sql | 2 +- .../install/mysql/tables/llx_blockedlog.sql | 2 +- htdocs/langs/en_US/blockedlog.lang | 16 +++++ 7 files changed, 104 insertions(+), 22 deletions(-) create mode 100644 htdocs/blockedlog/ajax/block-info.php create mode 100644 htdocs/langs/en_US/blockedlog.lang diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 3c143b70b83..f77c6e9edd8 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -101,20 +101,20 @@ print $block_static->getSignature(); print ''; - -// Example with a yes / no select -$var=!$var; -print ''; -print ''.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).''; -print ''; -print '
'; -print ''; -print ''; -print ''; -print ''; -print '
'; -print ''; - +if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) { + // Example with a yes / no select + $var=!$var; + print ''; + print ''.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).''; + print ''; + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + print ''; +} print ''; diff --git a/htdocs/blockedlog/admin/fingerprints.php b/htdocs/blockedlog/admin/fingerprints.php index 29cd2a3f73b..95117bf2c28 100644 --- a/htdocs/blockedlog/admin/fingerprints.php +++ b/htdocs/blockedlog/admin/fingerprints.php @@ -74,7 +74,7 @@ print $langs->trans("FingerprintsDesc")."
\n"; print '
'; -echo ''; +echo ''; print ''; @@ -97,15 +97,16 @@ foreach($blocks as &$block) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; @@ -113,6 +114,54 @@ foreach($blocks as &$block) { print '
'.dol_print_date($block->tms,'dayhour').''.$block->ref_object.''.$langs->trans('log'.$block->action).''.$block->getObject().''.$block->getObject().''.img_info($langs->trans('ShowDetails')).''.price($block->amounts).''.$block->getUser().''.$block->signature.''; - print $block->checkSignature() ? img_picto('OkCheckPaymentValidity', 'on') : img_picto($langs->trans('KoCheckPaymentValidity'), 'off'); - print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') ); - + print $block->checkSignature() ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off'); + if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { + print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') ); + } print '
'; +?> + + +global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { + ?>