diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index f5c824fce43..247268177b8 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -71,7 +71,7 @@ $eventstolog=array( array('id'=>'MEMBER_MODIFY', 'test'=>$conf->adherent->enabled), array('id'=>'MEMBER_RESILIATE', 'test'=>$conf->adherent->enabled), array('id'=>'MEMBER_DELETE', 'test'=>$conf->adherent->enabled), -*/ +*/ ); @@ -83,7 +83,7 @@ if ($action == "save") $i=0; $db->begin(); - + foreach ($eventstolog as $key => $arr) { $param='MAIN_LOGEVENTS_'.$arr['id']; @@ -91,18 +91,18 @@ if ($action == "save") if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0); else dolibarr_del_const($db,$param); } - + $db->commit(); $mesg = "".$langs->trans("SetupSaved").""; } -/** - * Affichage du formulaire de saisie +/* + * View */ -llxHeader(); +llxHeader('',$langs->trans("Audit")); //$linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 37728e7ad90..33190eeaa1f 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -48,8 +48,11 @@ if ($_GET["action"] == 'remove') } +/* + * View + */ -llxHeader(); +llxHeader('',$langs->trans("DefaultRights")); print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); @@ -126,7 +129,7 @@ if ($result) foreach($objMod->rights as $key => $val) { } - + // Break found, it's a new module to catch if ($old <> $obj->module) { diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 0577f287433..60eabffa57f 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -59,7 +59,7 @@ if ($_GET["action"] == 'setgeneraterule') if ($_GET["action"] == 'activate_encrypt') { $db->begin(); - + dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1"); $sql = "UPDATE ".MAIN_DB_PREFIX."user as u"; @@ -157,7 +157,7 @@ else if ($_GET["action"] == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') * Affichage onglet */ -llxHeader(); +llxHeader('',$langs->trans("Passwords")); if ($mesg) print "$mesg\n"; @@ -332,7 +332,7 @@ print ''; print '
| '.$langs->trans("Description").' | '; @@ -83,30 +90,51 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='') $var=!$var; $objp = $db->fetch_object($resql); print "|||||||
| ';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.dol_trunc($product->libelle,20);
- if ($objp->description) print ' '.dol_htmlentitiesbr(dol_trunc($objp->description,24)); + + // Show product and description + $product_static->type=$objp->fk_product_type; + $product_static->id=$objp->fk_product; + $product_static->ref=$objp->ref; + $product_static->libelle=$objp->product; + $text=$product_static->getNomUrl(1); + $text.= ' - '.$objp->product; + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); + print $html->textwithtooltip($text,$description,3,'','',$i); + + // Show range + print_date_range($objp->date_start,$objp->date_end); + + // Add description in form + if ($conf->global->PRODUIT_DESC_IN_FORM) + { + print ($objp->description && $objp->description!=$objp->product)?' '.dol_htmlentitiesbr($objp->description):''; + } + print ' | ';
}
else
{
- print "".dol_htmlentitiesbr(dol_trunc($objp->description,24))." | \n"; + print ""; + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + print $text.' '.nl2br($objp->description); + + // Show range + print_date_range($objp->date_start,$objp->date_end); + print " | \n"; } //print ''.$objp->qty_asked.' | '; - + // Sending id - print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.' | '; + print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.' | '; print ''.$objp->qty_shipped.' | '; - + print ''.dol_print_date($objp->date_expedition,'dayhour').' | '; if ($conf->livraison_bon->enabled) { diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 4ebe60bb87a..6900f6fc8bc 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -1826,22 +1826,22 @@ class Product extends CommonObject } /** - * \brief fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits - * \return void + * \brief fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits + * \remarks Define value of this->res + * \param multiply Because each sublevel must be multiplicated by parent nb + * \return void */ - function fetch_prod_arbo($prod,$compl_path="",$multiply="") + function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1) { global $langs; - $this->res; - $this->pere_encours; foreach($prod as $nom_pere => $desc_pere) { - // on est dans une sous-categorie - if(is_array($desc_pere)) + if (is_array($desc_pere)) // If this parent desc is an array, this is an array of childs { if($multiply) { + //print "XXX ".$desc_pere[1]." multiply=".$multiply; $img=""; $trueValue=$desc_pere[1]*$multiply; $product = new Product($this->db); @@ -1851,24 +1851,34 @@ class Product extends CommonObject { $img=img_warning($langs->trans("StockTooLow")); } - $this->res[]= array("
| + $this->res[]= array( + " | |||||||
| -> ".$compl_path.stripslashes($nom_pere)." - | ".$trueValue." |   |   | -".$this->stock_entrepot[1]." ".$img." | ".$trueValue." |   |   | +".$this->stock_entrepot[1]." ".$img." | ", + $desc_pere[0], + 'fullpath' => $compl_path.$nom_pere); } else { - $this->res[]= array($compl_path.$nom_pere." (".$desc_pere[1].")",$desc_pere[0]); + $this->res[]= array($compl_path.$nom_pere." (".$desc_pere[1].")", + $desc_pere[0], + 'fullpath' => $compl_path.$nom_pere); } } else if($nom_pere != "0" && $nom_pere != "1") - $this->res[]= array($compl_path.$nom_pere,$desc_pere); - if(sizeof($desc_pere) >1) { - $this ->fetch_prod_arbo($desc_pere,$nom_pere." -> "); + $this->res[]= array($compl_path.$nom_pere,$desc_pere); + } + + // Recursive call + if (is_array($desc_pere)) + { + $this ->fetch_prod_arbo($desc_pere, $nom_pere." -> ", $desc_pere[1]*$multiply, $level+1); } } + + //if ($level == 1) var_dump($this->res); } /** @@ -1891,20 +1901,19 @@ class Product extends CommonObject } /** - * \brief reconstruit l'arborescence des categorie sous la forme d'un tableau - * \return array $this->res + * \brief reconstruit l'arborescence des categorie sous la forme d'un tableau + * \return array $this->res */ - function get_arbo_each_prod($multiply="") + function get_arbo_each_prod($multiply=1) { $this->res = array(); - if(is_array($this -> sousprods)) + if (is_array($this -> sousprods)) { foreach($this -> sousprods as $nom_pere => $desc_pere) { - if(sizeof($desc_pere) >1) - $this ->fetch_prod_arbo($desc_pere,"",$multiply); + if (is_array($desc_pere)) $this->fetch_prod_arbo($desc_pere,"",$multiply); } - sort($this->res); +// dol_sort($this->res,); } return $this->res; } @@ -1930,8 +1939,8 @@ class Product extends CommonObject } /** - * \brief Retourne les cat�gories p�res - * \return array prod + * \brief Return all parent products + * \return array prod */ function get_pere() { @@ -1940,15 +1949,16 @@ class Product extends CommonObject $sql .= MAIN_DB_PREFIX."product_association as pa,"; $sql .= MAIN_DB_PREFIX."product as p"; $sql .= " where p.rowid=pa.fk_product_pere and p.rowid = '".$this->id."'"; + $res = $this->db->query ($sql); if ($res) { $prods = array (); while ($record = $this->db->fetch_array ($res)) - { - $prods[addslashes($record['label'])] = array(0=>$record['id']); - } - return $prods; + { + $prods[addslashes($record['label'])] = array(0=>$record['id']); + } + return $prods; } else { @@ -1958,26 +1968,26 @@ class Product extends CommonObject } /** - * \brief Retourne les fils de la cat�gorie structur�s pour l'arbo - * \return array prod + * \brief Return childs + * \return array prod */ function get_fils_arbo ($id_pere) { $sql = "SELECT p.rowid, p.label as label,pa.qty as qty,pa.fk_product_fils as id FROM "; $sql .= MAIN_DB_PREFIX."product as p,".MAIN_DB_PREFIX."product_association as pa"; $sql .= " WHERE p.rowid = pa.fk_product_fils and pa.fk_product_pere = '".$id_pere."'"; - $res = $this->db->query ($sql); + $res = $this->db->query ($sql); if ($res) { $prods = array(); while ($rec = $this->db->fetch_array ($res)) - { - $prods[addslashes($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); - foreach($this -> get_fils_arbo($rec['id']) as $kf=>$vf) - $prods[addslashes($rec['label'])][$kf] = $vf; - } - return $prods; + { + $prods[addslashes($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); + foreach($this -> get_fils_arbo($rec['id']) as $kf=>$vf) + $prods[addslashes($rec['label'])][$kf] = $vf; + } + return $prods; } else { @@ -1985,21 +1995,23 @@ class Product extends CommonObject return -1; } } + /** - * \brief compose l'arborescence des sousproduits, id, nom et quantit� sous la forme d'un tableau associatif - * \return void + * \brief Return tree of all subproducts for product. Tree contains id, name and quantity. + * \remarks Set this->sousprods + * \return void */ - function get_sousproduits_arbo () + function get_sousproduits_arbo() { $peres = $this -> get_pere(); foreach($peres as $k=>$v) { foreach($this -> get_fils_arbo($v[0]) as $kf=>$vf) { - $peres[$k][$kf] = $vf; + $peres[$k][$kf] = $vf; } } - // on concat�ne tout �a + // concatenation foreach($peres as $k=>$v) { $this -> sousprods[$k]=$v;