Fix: class not defined

This commit is contained in:
Laurent Destailleur 2015-04-02 17:35:07 +02:00
parent f3ad345930
commit 4241244345
6 changed files with 59 additions and 49 deletions

View File

@ -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';

View File

@ -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

View File

@ -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

View File

@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
print '</div>';
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 .= '&amp;id='.$product->id;
if (! empty($search_month))
$option .= '&amp;search_month='.$search_month;
if (! empty($search_year))
$option .= '&amp;search_year='.$search_year;
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
if (! empty($sortfield))
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
@ -186,7 +186,7 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="page" value="' . $page . '"/>';
$option .= '&amp;page=' . $page;
}
print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&amp;id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,'');
print '<div class="liste_titre">';
print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
@ -197,7 +197,7 @@ if ($id > 0 || ! empty($ref))
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</div>';
print '</div>';
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -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 "</tr>\n";
if ($num > 0)
{
$var=True;
@ -217,7 +217,7 @@ if ($id > 0 || ! empty($ref))
{
$objp = $db->fetch_object($result);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>';
$orderstatic->id=$objp->commandeid;
@ -232,10 +232,10 @@ if ($id > 0 || ! empty($ref))
print dol_print_date($db->jdate($objp->date_commande))."</td>";
print '<td align="center">'.$objp->qty."</td>\n";
print '<td align="right">'.price($objp->total_ht)."</td>\n";
print '<td align="right">'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
print '<td align="right">'.$orderstatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
print "</tr>\n";
$i++;
if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$total_ht+=$objp->total_ht;
$total_qty+=$objp->qty;

View File

@ -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 '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($product, 'ref', '', 1, 'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>' . $langs->trans("Label") . '</td><td colspan="3">' . $product->libelle . '</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 1);
print '</td></tr>';
show_stats_for_company($product, $socid);
print "</table>";
print '</div>';
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 .= '&amp;id=' . $product->id;
if (! empty($search_month))
$option .= '&amp;search_month=' . $search_month;
if (! empty($search_year))
$option .= '&amp;search_year=' . $search_year;
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
if (! empty($sortfield))
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
@ -196,7 +196,7 @@ if ($id > 0 || ! empty($ref)) {
print '<input type="hidden" name="page" value="' . $page . '"/>';
$option .= '&amp;page=' . $page;
}
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&amp;id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
print '<div class="liste_titre">';
print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - ';
@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref)) {
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</div>';
print '</div>';
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -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 "</tr>\n";
if ($num > 0) {
$var = True;
while ( $i < $num && $i < $conf->liste_limit ) {
$objp = $db->fetch_object($result);
$var = ! $var;
print '<tr ' . $bc[$var] . '>';
print '<td>';
$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 "</td>\n";
$societestatic->fetch($objp->socid);
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
@ -240,10 +240,10 @@ if ($id > 0 || ! empty($ref)) {
print dol_print_date($db->jdate($objp->date_commande)) . "</td>";
print '<td align="center">' . $objp->qty . "</td>\n";
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
print '<td align="right">' . $commandestatic->getLibStatut(4) . '</td>';
print '<td align="right">' . $supplierorderstatic->getLibStatut(4) . '</td>';
print "</tr>\n";
$i ++;
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$total_ht += $objp->total_ht;
$total_qty += $objp->qty;

View File

@ -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 {