diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 4d8f0264e5f7f83fe0d624fa809140f3cfa0c167..4d442c0dbd3c307f48cc69da61c299d7bb82425c 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -25,6 +25,15 @@ * \brief Include to show main page for cashdesk module */ + + + +/* + * View + */ + +$form=new Form($db); + // Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled) if ( GETPOST('filtre') ) { diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index bb638918dd586bc36ff3aaf42191ba86b22dd4d0..d8e4049f92279b8eb15ed786713a16dc258d250c 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -22,6 +22,8 @@ $langs->load("main"); $langs->load("bills"); $langs->load("cashdesk"); +// Object $form must de defined + ?> <script type="text/javascript" src="javascript/facturation1.js"></script> diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index 5b02cb597d794b2fa329a398c82f5e8aec39c93c..15762ecf4941169e066364299804a58545a11862 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -18,6 +18,8 @@ $langs->load("main"); +// Object $form must de defined + ?> <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Summary"); ?></legend> diff --git a/htdocs/cashdesk/validation.php b/htdocs/cashdesk/validation.php index fc4172f3d2dbf00de8bf8c58aced3be4cab02e17..d9cd286691c0a6b3fbc96e606f86eea8d79ad2c0 100644 --- a/htdocs/cashdesk/validation.php +++ b/htdocs/cashdesk/validation.php @@ -21,6 +21,8 @@ * \brief validation.php */ +$form=new Form($db); + // Affichage des templates require ('tpl/validation1.tpl.php'); diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 2c79a0bb3444aa3d3da5fd2b35e9ef6c207916a2..fee53c412b8e830df62d3aab5b63835a313c53fb 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com> - * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * @@ -267,7 +267,7 @@ if ($result) if ($action == 'delete_categ') { print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$rowid."&cat1=".GETPOST("fk_categ")."&orig_account=".$orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); - + } print '<form name="update" method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'">'; @@ -341,6 +341,12 @@ if ($result) print $langs->trans("VATPayment"); print '</a>'; } + else if ($links[$key]['type']=='payment_salary') { + print '<a href="'.DOL_URL_ROOT.'/compta/salaries/fiche.php?id='.$links[$key]['url_id'].'">'; + print img_object($langs->trans('ShowPaymentSalary'),'payment').' '; + print $langs->trans("SalaryPayment"); + print '</a>'; + } else if ($links[$key]['type']=='member') { print '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$links[$key]['url_id'].'">'; print img_object($langs->trans('ShowMember'),'user').' '; @@ -353,6 +359,12 @@ if ($result) print $langs->trans("TransactionOnTheOtherAccount"); print '</a>'; } + else if ($links[$key]['type']=='user') { + print '<a href="'.DOL_URL_ROOT.'/user/fiche?id='.$links[$key]['url_id'].'">'; + print img_object($langs->trans('ShowUser'),'user').' '; + print $langs->trans("User"); + print '</a>'; + } else { print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; print img_object('','generic').' '; diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 0e4f12104199bb8395d5336cbab2c87ab954d28e..ecf4b16212b15b754975c3b27d21a27e92ea3e2d 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -359,20 +359,12 @@ class PaymentSalary extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO should be called payment_salary + $ok=1; - // Start triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // End triggers + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); if ($this->id > 0) { - $ok=1; if (! empty($conf->banque->enabled) && ! empty($this->amount)) { // Insert into llx_bank @@ -406,42 +398,53 @@ class PaymentSalary extends CommonObject $ok=0; } - // Add link 'payment_salary' in bank_url between payment and bank transaction - $url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id='; + if ($ok) + { + // Add link 'payment_salary' in bank_url between payment and bank transaction + $url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id='; + + $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); + if ($result <= 0) + { + $this->error=$acc->error; + $ok=0; + } + } + + $fuser=new User($this->db); + $fuser->fetch($this->fk_user); + + // Add link 'user' in bank_url between operation and bank transaction + $result=$acc->add_url_line( + $bank_line_id, + $this->fk_user, + DOL_URL_ROOT.'/user/fiche.php?id=', + $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), + '(User)', + 'user' + ); - $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); if ($result <= 0) { $this->error=$acc->error; $ok=0; } + } - // Add link 'user' in bank_url between operation and bank transaction - $linkaddedforthirdparty=array(); - foreach ($this->amounts as $key => $value) - { - $sal = new PaymentSalary($this->db); - - $sal->fetch($key); - $sal->fetch_user($this->fk_user); - - if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty - { - $result=$acc->add_url_line( - $bank_line_id, - $sal->user->id, - DOL_URL_ROOT.'/user/fiche.php?id=', - $sal->user->lastname, - 'user' - ); - - if ($result <= 0) dol_print_error($this->db); - $linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty - } - - } + // Start triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; } + // End triggers + } + else $ok=0; + + if ($ok) + { if ($ok) { $this->db->commit(); diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index b4816b10c6130cd473decb735dff76275377f6b3..ae74344ccf8289968059a8cb0a440775f1949ad4 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -78,6 +78,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $sal->note=GETPOST("note"); $sal->type_payment=GETPOST("paymenttype"); $sal->num_payment=GETPOST("num_payment"); + $sal->fk_user_creat=$user->id; if (empty($datep) || empty($datesp) || empty($dateep)) { @@ -215,11 +216,11 @@ if ($action == 'create') print "<tr>"; print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>'; - print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add'); + print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print '</td></tr>'; print '<tr><td>'.$langs->trans("DateValue").'</td><td>'; - print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add'); + print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print '</td></tr>'; // Employee diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 19d9ca500319b79c576a8731217811d7cd380790..dbdfed9003b7e776fb7a48f13d75717dadaba7dd 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -206,6 +206,32 @@ class modProduct extends DolibarrModules if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + // Exports product multiprice + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$key; + $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r]=array(array("produit","export")); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref", + 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", + 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'PriceLevelVATRate', + 'pr.date_price'=>'DateCreation'); + $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", + 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", + 'pr.price_ttc'=>"product", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'product', + 'pr.date_price'=>"product"); + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product'; + $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; + } + + // Imports //-------- @@ -239,15 +265,15 @@ class modProduct extends DolibarrModules if (! empty($conf->fournisseur->enabled)) { - // Import product suppliers + // Import suppliers prices (note: this code is duplicated into module service) $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="SuppliersPrices"; // Translation key - $this->import_icon[$r]='product'; + $this->import_code[$r]=$this->rights_class.'_supplierprices'; + $this->import_label[$r]="SuppliersPricesOfProductsOrServices"; // Translation key + $this->import_icon[$r]=$this->picto; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price'); $this->import_tables_creator_array[$r]=array('sp'=>'fk_user'); - $this->import_fields_array[$r]=array('sp.fk_product'=>"Product*", + $this->import_fields_array[$r]=array('sp.fk_product'=>"ProductOrService*", 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate', 'sp.price'=>"PriceQtyMinHT*", 'sp.unitprice'=>'UnitPriceHT*', // TODO Make this file not required and calculate it from price and qty @@ -266,55 +292,29 @@ class modProduct extends DolibarrModules ); } - if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - // Exports product multiprice - //-------- - $r++; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_permission[$r]=array(array("produit","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref", - 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", - 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.tva_tx'=>'PriceLevelVATRate', - 'pr.date_price'=>'DateCreation'); - $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", - 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", - 'pr.price_ttc'=>"product", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.tva_tx'=>'product', - 'pr.date_price'=>"product"); - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product'; - $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; - - - // Import product multiprice - //-------- - $r=0; - - $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="ProductsMultiPrice"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price'); - $this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*", - 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", - 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.tva_tx'=>'PriceLevelVATRate', - 'pr.date_price'=>'DateCreation*'); - $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1", - 'pr.price_base_type'=>"HT",'pr.price_level'=>"1", - 'pr.price'=>"100",'pr.price_ttc'=>"110", - 'pr.price_min'=>"100",'pr.price_min_ttc'=>"110", - 'pr.tva_tx'=>'19.6', - 'pr.date_price'=>'2013-04-10'); + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + // Import product multiprice + $r++; + $this->import_code[$r]=$this->rights_class.'_multiprice'; + $this->import_label[$r]="ProductsOrServiceMultiPrice"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price'); + $this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id + $this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*", + 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", + 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'PriceLevelVATRate', + 'pr.date_price'=>'DateCreation*'); + $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); + $this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1", + 'pr.price_base_type'=>"HT",'pr.price_level'=>"1", + 'pr.price'=>"100",'pr.price_ttc'=>"110", + 'pr.price_min'=>"100",'pr.price_min_ttc'=>"110", + 'pr.tva_tx'=>'19.6', + 'pr.date_price'=>'2013-04-10'); } } diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 2309bd7f06bbf900fced37a0669bc860080bc0d2..a998f41298eb7388f59e1e0039317dc5b5b04d85 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -168,6 +168,35 @@ class modService extends DolibarrModules $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity("product", 1).')'; + if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries) + { + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + // Exports product multiprice + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r]=array(array("produit","export")); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref", + 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", + 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'PriceLevelVATRate', + 'pr.date_price'=>'DateCreation'); + $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product", + 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product", + 'pr.price_ttc'=>"product", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'product', + 'pr.date_price'=>"product"); + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product'; + $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; + } + } + + // Imports //-------- $r=0; @@ -196,6 +225,64 @@ class modService extends DolibarrModules $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r]=array('p.ref'=>"PR123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31'); + + + if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries) + { + if (! empty($conf->fournisseur->enabled)) + { + // Import suppliers prices (note: this code is duplicated into module product) + $r++; + $this->import_code[$r]=$this->rights_class.'_supplierprices'; + $this->import_label[$r]="SuppliersPricesOfProductsOrServices"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price'); + $this->import_tables_creator_array[$r]=array('sp'=>'fk_user'); + $this->import_fields_array[$r]=array('sp.fk_product'=>"ProductOrService*", + 'sp.fk_soc'=>"Supplier*", 'sp.ref_fourn'=>'SupplierRef', 'sp.quantity'=>"QtyMin*", 'sp.tva_tx'=>'VATRate', + 'sp.price'=>"PriceQtyMinHT*", + 'sp.unitprice'=>'UnitPriceHT*', // TODO Make this file not required and calculate it from price and qty + 'sp.remise_percent'=>'DiscountQtyMin' + ); + + $this->import_convertvalue_array[$r]=array( + 'sp.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), + 'sp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'Product') + ); + $this->import_examplevalues_array[$r]=array('sp.fk_product'=>"PREF123456", + 'sp.fk_soc'=>"My Supplier",'sp.ref_fourn'=>"SupplierRef", 'sp.quantity'=>"1", 'sp.tva_tx'=>'21', + 'sp.price'=>"50", + 'sp.unitprice'=>'50', + 'sp.remise_percent'=>'0' + ); + } + + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + // Import product multiprice + $r++; + $this->import_code[$r]=$this->rights_class.'_multiprice'; + $this->import_label[$r]="ProductsOrServiceMultiPrice"; // Translation key + $this->import_icon[$r]=$this->picto; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('pr'=>MAIN_DB_PREFIX.'product_price'); + $this->import_tables_creator_array[$r]=array('pr'=>'fk_user_author'); // Fields to store import user id + $this->import_fields_array[$r]=array('pr.fk_product'=>"ProductRowid*", + 'pr.price_base_type'=>"PriceLevelPriceBase",'pr.price_level'=>"PriceLevel", + 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC", + 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", + 'pr.tva_tx'=>'PriceLevelVATRate', + 'pr.date_price'=>'DateCreation*'); + $this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); + $this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1", + 'pr.price_base_type'=>"HT",'pr.price_level'=>"1", + 'pr.price'=>"100",'pr.price_ttc'=>"110", + 'pr.price_min'=>"100",'pr.price_min_ttc'=>"110", + 'pr.tva_tx'=>'19.6', + 'pr.date_price'=>'2013-04-10'); + } + } } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index b7fc38eaa4c7e7a10860668d0036b4b41bb6892c..41a82de36b1be39914c488255f53f2a8a50d09ed 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -352,10 +352,13 @@ if ($step == 1 || ! $datatoimport) { foreach ($objimport->array_import_code as $key => $value) { + //var_dump($objimport->array_import_code[$key]); $val=!$val; print '<tr '.$bc[$val].'><td nospan="nospan">'; - //print img_object($objimport->array_import_module[$key]->getName(),$import->array_import_module[$key]->picto).' '; - print $objimport->array_import_module[$key]->getName(); + $titleofmodule=$objimport->array_import_module[$key]->getName(); + // Special cas for import common to module/services + if (in_array($objimport->array_import_code[$key], array('produit_supplierprices','produit_multiprice'))) $titleofmodule=$langs->trans("ProductOrService"); + print $titleofmodule; print '</td><td>'; //print $value; print img_object($objimport->array_import_module[$key]->getName(),$objimport->array_import_icon[$key]).' '; @@ -407,8 +410,10 @@ if ($step == 2 && $datatoimport) // Module print '<tr><td width="25%">'.$langs->trans("Module").'</td>'; print '<td>'; - //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' '; - print $objimport->array_import_module[0]->getName(); + $titleofmodule=$objimport->array_import_module[0]->getName(); + // Special cas for import common to module/services + if (in_array($objimport->array_import_code[0], array('produit_supplierprices','produit_multiprice'))) $titleofmodule=$langs->trans("ProductOrService"); + print $titleofmodule; print '</td></tr>'; // Lot de donnees a importer @@ -490,8 +495,10 @@ if ($step == 3 && $datatoimport) // Module print '<tr><td width="25%">'.$langs->trans("Module").'</td>'; print '<td>'; - //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' '; - print $objimport->array_import_module[0]->getName(); + $titleofmodule=$objimport->array_import_module[0]->getName(); + // Special cas for import common to module/services + if (in_array($objimport->array_import_code[0], array('produit_supplierprices','produit_multiprice'))) $titleofmodule=$langs->trans("ProductOrService"); + print $titleofmodule; print '</td></tr>'; // Lot de donnees a importer @@ -695,8 +702,10 @@ if ($step == 4 && $datatoimport) // Module print '<tr><td width="25%">'.$langs->trans("Module").'</td>'; print '<td>'; - //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' '; - print $objimport->array_import_module[0]->getName(); + $titleofmodule=$objimport->array_import_module[0]->getName(); + // Special cas for import common to module/services + if (in_array($objimport->array_import_code[0], array('produit_supplierprices','produit_multiprice'))) $titleofmodule=$langs->trans("ProductOrService"); + print $titleofmodule; print '</td></tr>'; // Lot de donnees a importer @@ -1144,8 +1153,10 @@ if ($step == 5 && $datatoimport) // Module print '<tr><td width="25%">'.$langs->trans("Module").'</td>'; print '<td>'; - //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' '; - print $objimport->array_import_module[0]->getName(); + $titleofmodule=$objimport->array_import_module[0]->getName(); + // Special cas for import common to module/services + if (in_array($objimport->array_import_code[0], array('produit_supplierprices','produit_multiprice'))) $titleofmodule=$langs->trans("ProductOrService"); + print $titleofmodule; print '</td></tr>'; // Lot de donnees a importer @@ -1487,8 +1498,10 @@ if ($step == 6 && $datatoimport) // Module print '<tr><td width="25%">'.$langs->trans("Module").'</td>'; print '<td>'; - //print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' '; - print $objimport->array_import_module[0]->getName(); + $titleofmodule=$objimport->array_import_module[0]->getName(); + // Special cas for import common to module/services + if (in_array($objimport->array_import_code[0], array('produit_supplierprices','produit_multiprice'))) $titleofmodule=$langs->trans("ProductOrService"); + print $titleofmodule; print '</td></tr>'; // Lot de donnees a importer diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index f7696ea8ecf9bc6a13e5392bcef9c3f55468eeb7..fea1d7afbb689958be0e368a1761aee52ab2b69c 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -179,6 +179,7 @@ ProductIsUsed=This product is used NewRefForClone=Ref. of new product/service CustomerPrices=Customers prices SuppliersPrices=Suppliers prices +SuppliersPricesOfProductsOrServices=Suppliers prices (of products or services) CustomCode=Customs code CountryOrigin=Origin country HiddenIntoCombo=Hidden into select lists @@ -208,6 +209,7 @@ CostPmpHT=Net total VWAP ProductUsedForBuild=Auto consumed by production ProductBuilded=Production completed ProductsMultiPrice=Product multi-price +ProductsOrServiceMultiPrice=Customers prices (of products or services, multi-prices) ProductSellByQuarterHT=Products turnover quarterly VWAP ServiceSellByQuarterHT=Services turnover quarterly VWAP Quarter1=1st. Quarter