From 424124434547f7346a82e262cc4930b817fdc600 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Apr 2015 17:35:07 +0200 Subject: [PATCH] Fix: class not defined --- htdocs/core/modules/modFournisseur.class.php | 15 +++-- htdocs/langs/en_US/main.lang | 4 ++ htdocs/langs/en_US/trips.lang | 1 - htdocs/product/stats/commande.php | 24 +++---- htdocs/product/stats/commande_fournisseur.php | 62 +++++++++---------- htdocs/theme/eldy/style.css.php | 2 +- 6 files changed, 59 insertions(+), 49 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 6bc4cc70e77..2e42c1f8b66 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -406,15 +406,20 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; - + // Order $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='Commandes fournisseurs et lignes de commandes'; $this->export_icon[$r]='order'; $this->export_permission[$r]=array(array("fournisseur","commande","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); - $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note_public'=>"order",'f.note_private'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) + { + unset($this->export_fields_array['f.date_approve2']); + unset($this->export_fields_array['ua2.login']); + } + $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'"; @@ -494,6 +499,8 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua1 ON ua1.rowid = f.fk_user_approve'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua2 ON ua2.rowid = f.fk_user_approve2'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseurdet as fd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields as extraline ON fd.rowid = extraline.fk_object'; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 671f1363498..bd2112cf871 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -242,6 +242,8 @@ DatePlanShort=Date planed DateRealShort=Date real. DateBuild=Report build date DatePayment=Date of payment +DateApprove=Approving date +DateApprove2=Approving date (second approval) DurationYear=year DurationMonth=month DurationWeek=week @@ -408,6 +410,8 @@ OtherInformations=Other informations Quantity=Quantity Qty=Qty ChangedBy=Changed by +ApprovedBy=Approved by +ApprovedBy2=Approved by (second approval) ReCalculate=Recalculate ResultOk=Success ResultKo=Failure diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index c84b8905562..b7d661478f6 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -69,7 +69,6 @@ MOTIF_CANCEL=Reason DATE_REFUS=Deny date DATE_SAVE=Validation date DATE_VALIDE=Validation date -DateApprove=Approving date DATE_CANCEL=Cancelation date DATE_PAIEMENT=Payment date diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index a1e538f4559..81b251d795b 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($user->rights->commande->lire) + if ($user->rights->commande->lire) { $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.ref_client,"; @@ -147,7 +147,7 @@ if ($id > 0 || ! empty($ref)) if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND c.fk_soc = ".$socid; $sql.= " ORDER BY $sortfield $sortorder "; - + //Calcul total qty and amount for global if full scan list $total_ht=0; $total_qty=0; @@ -162,21 +162,21 @@ if ($id > 0 || ! empty($ref)) } } } - + $sql.= $db->plimit($conf->liste_limit +1, $offset); - + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + if (! empty($id)) $option .= '&id='.$product->id; if (! empty($search_month)) $option .= '&search_month='.$search_month; if (! empty($search_year)) $option .= '&search_year='.$search_year; - + print '
' . "\n"; if (! empty($sortfield)) print ''; @@ -186,7 +186,7 @@ if ($id > 0 || ! empty($ref)) print ''; $option .= '&page=' . $page; } - + print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,''); print '
'; print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - '; @@ -197,7 +197,7 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'; print ''; - + $i = 0; print ''; print ''; @@ -209,7 +209,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","",$option,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","",$option,'align="right"',$sortfield,$sortorder); print "\n"; - + if ($num > 0) { $var=True; @@ -217,7 +217,7 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($result); $var=!$var; - + print ''; print '"; print '\n"; print '\n"; - print ''; + print ''; print "\n"; $i++; - + if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $total_ht+=$objp->total_ht; $total_qty+=$objp->qty; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 1b324d99bbf..f0444356bcc 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -46,7 +46,7 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array ( - 'productstatssupplyorder' + 'productstatssupplyorder' )); $mesg = ''; @@ -76,7 +76,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { * View */ -$commandefournstatic = new CommandeFournisseur($db); +$supplierorderstatic = new CommandeFournisseur($db); $societestatic = new Societe($db); $form = new Form($db); @@ -85,55 +85,55 @@ $formother = new FormOther($db); if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters = array ( - 'id' => $id + 'id' => $id ); $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + llxHeader("", "", $langs->trans("CardProduct" . $product->type)); - + if ($result > 0) { $head = product_prepare_head($product, $user); $titre = $langs->trans("CardProduct" . $product->type); $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print '
'; $orderstatic->id=$objp->commandeid; @@ -232,10 +232,10 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($db->jdate($objp->date_commande))."'.$objp->qty."'.price($objp->total_ht)."'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).''.$orderstatic->LibStatut($objp->statut,$objp->facture,5).'
'; - + // Reference print ''; print ''; print ''; - + // Libelle print ''; print ''; - + // Status (to sell) print ''; - + // Status (to buy) print ''; - + show_stats_for_company($product, $socid); - + print "
' . $langs->trans("Ref") . ''; print $form->showrefnav($product, 'ref', '', 1, 'ref'); print '
' . $langs->trans("Label") . '' . $product->libelle . '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; print $product->getLibStatut(2, 0); print '
' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')'; print $product->getLibStatut(2, 1); print '
"; - + print ''; - + if ($user->rights->fournisseur->commande->lire) { $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; $sql .= " c.rowid, d.total_ht as total_ht, c.ref,"; @@ -158,7 +158,7 @@ if ($id > 0 || ! empty($ref)) { if ($socid) $sql .= " AND c.fk_soc = " . $socid; $sql .= " ORDER BY $sortfield $sortorder "; - + // Calcul total qty and amount for global if full scan list $total_ht = 0; $total_qty = 0; @@ -173,20 +173,20 @@ if ($id > 0 || ! empty($ref)) { } } } - + $sql .= $db->plimit($conf->liste_limit + 1, $offset); - + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + if (! empty($id)) $option .= '&id=' . $product->id; if (! empty($search_month)) $option .= '&search_month=' . $search_month; if (! empty($search_year)) $option .= '&search_year=' . $search_year; - + print '' . "\n"; if (! empty($sortfield)) print ''; @@ -196,7 +196,7 @@ if ($id > 0 || ! empty($ref)) { print ''; $option .= '&page=' . $page; } - + print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); print '
'; print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - '; @@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print '
'; print ''; - + $i = 0; print ''; print ''; @@ -219,19 +219,19 @@ if ($id > 0 || ! empty($ref)) { print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "c.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; - + if ($num > 0) { $var = True; while ( $i < $num && $i < $conf->liste_limit ) { $objp = $db->fetch_object($result); $var = ! $var; - + print ''; print '\n"; $societestatic->fetch($objp->socid); print ''; @@ -240,10 +240,10 @@ if ($id > 0 || ! empty($ref)) { print dol_print_date($db->jdate($objp->date_commande)) . ""; print '\n"; print '\n"; - print ''; + print ''; print "\n"; $i ++; - + if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $total_ht += $objp->total_ht; $total_qty += $objp->qty; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index aa9cc9fe862..0537d13b80d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1917,7 +1917,7 @@ table.liste td { background-color: #f9f9f9; } tr.pair td, tr.impair td { - padding: 4px; + padding: 2px; border-bottom: 1px solid #ddd; } div.liste_titre .tagtd {
'; - $commandestatic->id = $objp->commandeid; - $commandestatic->ref = $objp->ref; - $commandestatic->statut = $objp->statut; - print $commandestatic->getNomUrl(1); + $supplierorderstatic->id = $objp->commandeid; + $supplierorderstatic->ref = $objp->ref; + $supplierorderstatic->statut = $objp->statut; + print $supplierorderstatic->getNomUrl(1); print "' . $societestatic->getNomUrl(1) . '' . $objp->qty . "' . price($objp->total_ht) . "' . $commandestatic->getLibStatut(4) . '' . $supplierorderstatic->getLibStatut(4) . '