VDAST : ajout d'un champ de recherche define(HEADING_TITLE_SEARCH, "Rechercher"); // <- VDAST // -> VDAST : ajout du stock amélioré dans la mise à jour rapide define(TABLE_HEADING_STOCK_CHANGE, '+/- Qt'); define(STOCK_CHANGE_COMMENT_PUT_COMMENT_HERE, ''); // -> OSC-14: gestion des emplacements define(TABLE_HEADING_LOCATION, 'Emplacement'); // <- OSC-14 // -> OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // Stock d'alerte: Définition de la visibilité de la colonne // Stock d'alerte: Définition du droit de modification de la colonne // Stock d'alerte: Définition du nom/intitulé de la colonne define(DISPLAY_STOCK_ALERT, true); define(MODIFY_STOCK_ALERT, true); define(TABLE_HEADING_STOCK_ALERT, 'Qt Alerte'); // <- OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // -> OSC-34: gestion d'un stock d'inventaire define(TABLE_HEADING_STOCK_INVENT, 'Inventaire'); // <- OSC-34 // -> OSC-95 - Amélioration vue INVENTAIRE define(TABLE_HEADING_STOCK_INVENT_ECART, 'Ecart'); // <- OSC-95 - Amélioration vue INVENTAIRE define(TABLE_HEADING_SALE, 'Solde'); // -> OSC-38 - Gestion des commandes fournisseurs define(TABLE_HEADING_SUPPLIERS_ORDERS_NAME, 'Fournisseur'); define(TABLE_HEADING_SUPPLIERS_ORDERS_QT, 'Qt Cmd'); define(TABLE_HEADING_SUPPLIERS_ORDERS_DUE_DATE, 'Livraison le'); // <- OSC-38 - Gestion des commandes fournisseurs define(TEXT_ASCENDINGLY, 'par ordre croissant'); define(TEXT_DESCENDINGLY, 'par ordre décroissant'); //-Gestion des ventes define(TABLE_HEADING_SALES_BY_MONTH, "Volume mensuel"); define(TABLE_HEADING_IS_CUSTOMIZABLE, "Marquage"); ?> PEF : Product Extra fields function getProductExtraFieldsName($index, $old_new) { // return product extra fields field name return 'product_' . $old_new . '_extra_fields' . $index; } // <- PEF ($row_by_page) ? define('MAX_DISPLAY_ROW_BY_PAGE' , $row_by_page ) : $row_by_page = MAX_DISPLAY_SEARCH_RESULTS; define('MAX_DISPLAY_ROW_BY_PAGE' , MAX_DISPLAY_SEARCH_RESULTS ); // -> OSC-34: gestion d'un stock d'inventaire // -> OSC-73: mise à jour rapide : gestion des soldes // -> OSC-38 - Gestion des commandes fournisseurs if ( $display_mode == "" ) { $display_mode = "P"; } if ( $display_mode == "I" ) { define(DISPLAY_PRICE_BREAK,false); define(DISPLAY_GLOBAL_SPECIAL_CHANGE,false); define(DISPLAY_STOCK_CHANGE,false); define(DISPLAY_EXTRA_FIELDS,false); define(DISPLAY_SORT_FIELDS,true); define(DISPLAY_STOCK_INVENT, true); define(MODIFY_STOCK_INVENT, true); define(DISPLAY_LOCATION, true); define(MODIFY_LOCATION, true); define(DISPLAY_SALES, false); define(MODIFY_SALES, false); define(DISPLAY_SUPPLIERS_ORDERS, false); define(MODIFY_SUPPLIERS_ORDERS, false); define(DISPLAY_SALES_BY_MONTH, true); } else if ( $display_mode == "S" ) { define(DISPLAY_PRICE_BREAK,true); define(DISPLAY_GLOBAL_SPECIAL_CHANGE,false); define(DISPLAY_STOCK_CHANGE,false); define(DISPLAY_EXTRA_FIELDS,false); define(DISPLAY_SORT_FIELDS,false); define(DISPLAY_STOCK_INVENT, false); define(MODIFY_STOCK_INVENT, false); define(DISPLAY_LOCATION, false); define(MODIFY_LOCATION, false); define(DISPLAY_SALES, true); define(MODIFY_SALES, true); define(DISPLAY_SUPPLIERS_ORDERS, false); define(MODIFY_SUPPLIERS_ORDERS, false); define(DISPLAY_SALES_BY_MONTH, true); } else if ( $display_mode == "C" ) { define(DISPLAY_PRICE_BREAK,true); define(DISPLAY_GLOBAL_SPECIAL_CHANGE,true); define(DISPLAY_STOCK_CHANGE,true); define(DISPLAY_EXTRA_FIELDS,false); define(DISPLAY_SORT_FIELDS,true); define(DISPLAY_STOCK_INVENT, false); define(MODIFY_STOCK_INVENT, false); define(DISPLAY_LOCATION, true); define(MODIFY_LOCATION, true); define(DISPLAY_SALES, false); define(MODIFY_SALES, false); define(DISPLAY_SUPPLIERS_ORDERS, true); define(MODIFY_SUPPLIERS_ORDERS, true); define(DISPLAY_SALES_BY_MONTH, true); } else { define(DISPLAY_PRICE_BREAK,true); define(DISPLAY_GLOBAL_SPECIAL_CHANGE,true); define(DISPLAY_STOCK_CHANGE,true); define(DISPLAY_EXTRA_FIELDS,true); define(DISPLAY_SORT_FIELDS,true); define(DISPLAY_STOCK_INVENT, false); define(MODIFY_STOCK_INVENT, false); define(DISPLAY_LOCATION, true); define(MODIFY_LOCATION, true); define(DISPLAY_SALES, false); define(MODIFY_SALES, false); define(DISPLAY_SUPPLIERS_ORDERS, false); define(MODIFY_SUPPLIERS_ORDERS, false); define(DISPLAY_SALES_BY_MONTH, true); define(DISPLAY_IS_CUSTOMIZABLE, true); } // <- OSC-34 // <- OSC-73 // <- OSC-38 - Gestion des commandes fournisseurs // -> VDQPBPP : ajout des prix par pallier dans la mise à jour rapide if ( DISPLAY_PRICE_BREAK == true ) { // include the price formatter for the price breaks contribution require(DIR_WS_CLASSES . 'PriceFormatter.php'); } define(TABLE_HEADING_PRICE_BREAK_PRICE, 'Prix'); define(TABLE_HEADING_PRICE_BREAK_QT, 'Qt'); function getProductPriceBreakName($index, $old_new) { // return product price break field name return 'product_' . $old_new . '_price_break' . $index; } function getProductQtyBreakName($index, $old_new) { // return product price break field name return 'product_' . $old_new . '_qty_break' . $index; } // <- VDQPBPP //// Tax Row $tax_class_array = array(array('id' => '0', 'text' => NO_TAX_TEXT)); $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title"); while ($tax_class = tep_db_fetch_array($tax_class_query)) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); } ////Info Row pour le champ fabriquant $manufacturers_array = array(array('id' => '0', 'text' => NO_MANUFACTURER)); $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']); } // Display the list of the manufacturers function manufacturers_list(){ global $manufacturer; $manufacturers_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m order by m.manufacturers_name ASC"); $return_string = ''; return $return_string; } // -> PEF : Product Extra fields if ( DISPLAY_EXTRA_FIELDS == true ) { $extra_fields_array = array(); function get_extra_fields_array() { global $extra_fields_array; $extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { $extra_fields_array[] = $extra_fields; } return $extra_fields_array; } get_extra_fields_array(); // set global $extra_fields_array function get_products_extra_fields($field_id, $products_id) { $products_extra_fields_query = tep_db_query("select * FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE products_extra_fields_id = " . (int)$field_id . " AND products_id = " . (int)$products_id); $ret = tep_db_fetch_array($products_extra_fields_query); global $extra_fields_array; for($i=0,$n=sizeof($extra_fields_array); $i<$n; $i++) { if ( $extra_fields_array[$i]['products_extra_fields_id'] == $field_id ) { $ret['products_extra_fields_displayed_size'] = $extra_fields_array[$i]['products_extra_fields_displayed_size']; return $ret; } } return $ret; } } // <- PEF // -> OSC-38 - Gestion des commandes fournisseurs $suppliers_orders = NULL; if ( DISPLAY_SUPPLIERS_ORDERS == true ) { require(DIR_WS_CLASSES . 'suppliers_orders.php'); $suppliers_orders = new SuppliersOrders(); $suppliers_orders->retrieveOrderedProducts(); } // <- OSC-38 - Gestion des commandes fournisseurs ##// Uptade database switch ($HTTP_GET_VARS['action']) { // -> OSC-34: gestion d'un stock d'inventaire case 'commit_invent': $count_update=0; // -> VDAST : ajout du stock amélioré dans la mise à jour rapide $stock_invent_query = tep_db_query("select distinct p.products_id, p.products_quantity, p.products_model, p.products_stock_invent, p.products_cost, pd.products_name from products p, products_description pd where pd.products_id = p.products_id"); while ($stock_invent = tep_db_fetch_array($stock_invent_query)) { $count_update++; $qtyadd = $stock_invent['products_stock_invent'] - $stock_invent['products_quantity']; $sql = "INSERT INTO " . TABLE_AUDITED_STOCK . " SET qtyold = '".$stock_invent['products_quantity'] ."', products_id = '".(int)$stock_invent['products_id']."', products_model = '".$stock_invent['products_model']."', products_name ='". $stock_invent['products_name'] ."', date=now(), info ='Stock Inventaire', qtynew = '" .$stock_invent['products_stock_invent'] ."', qtyadd ='" . $qtyadd . "', date_created=now(), products_cost = '" . $stock_invent['products_cost'] . "'"; // echo $sql; mysql_query($sql); $sql = "UPDATE " . TABLE_PRODUCTS . " SET products_stock_invent = 0, products_quantity = '" . $stock_invent['products_stock_invent'] . "' WHERE products_id = '".(int)$stock_invent['products_id'] . "'"; // echo $sql; mysql_query($sql); } if ($count_update > 0) $messageStack->add($count_update.' '.TEXT_PRODUCTS_UPDATED); break; // <- OSC-34 case 'update' : $count_update=0; $item_updated = array(); // <- OSC-44 : Mise à jour rapide : stock théorique faussé en cas de commandes pendant la mise à jour // définition $y_count_item['OSC_44'] servant à vérifier combien de commandes auraient étés impactées par le bug (mis en évidence par la tâche OSC-44). $y_count_item['OSC_44'] = 0; // -> OSC-44 : Mise à jour rapide : stock théorique faussé en cas de commandes pendant la mise à jour // -> VDAST : ajout du stock amélioré dans la mise à jour rapide if($HTTP_POST_VARS['stock_change']){ foreach($HTTP_POST_VARS['stock_change'] as $id => $new_stock_change) { if (trim($HTTP_POST_VARS['stock_change'][$id]) != "") { $count_update++; $item_updated[$id] = 'updated'; $products_name = trim($HTTP_POST_VARS['product_old_name'][$id]); $products_model = trim($HTTP_POST_VARS['product_old_model'][$id]); $qtyold = trim($HTTP_POST_VARS['product_old_quantity'][$id]); // <- OSC-44 : Mise à jour rapide : stock théorique faussé en cas de commandes pendant la mise à jour // correction d'un bug qui provoque la non prise en compte des commandes intervenues après l'affichage de l'écran de mise à jour rapide. // le stock se faussait irrémédiablement du coup.. /* * ajout d'une variable $qtyold_db dans la boucle UPDATE des mises à jours rapide * * Cette variable est remplie par le résultat d'un SELECT (d'une requête SQL) visant à récupérer la quantité véritable: * * Ainsi, cette variable contiendra la quantité réélle inscrite dans la base de données et non celle inscrite dans le champ de texte de l'interface * des mises à jours rapide. */ //echo ''; die(); /* DEBUG AUDIT DU STOCK (table: stockadd) : $sqlRequest_OSC44 = tep_db_query("SELECT qtyold FROM stockadd WHERE products_id=".$id); $qtyold_db = $sqlResultRow['qtyold']; */ $sqlRequest_OSC44 = tep_db_query("SELECT products_quantity FROM products WHERE products_id=".$id); $sqlResultRow = tep_db_fetch_array($sqlRequest_OSC44); $qtyold_db = $sqlResultRow['products_quantity']; // DEBUG: echo ''; die(); // maintenant que l'on a récupéré la véritable valeur du stock théorique ACTUEL et non celui du champ du formulaire (interface), // on effectue une vérification pour savoir SI LE stock a changé. if ($qtyold != $qtyold_db) { // si oui: on utilise plutôt la véritable valeur: $qtynew = (int)$qtyold_db + (int)$new_stock_change; // et on incrémente le compteur : $y_count_item['OSC_44'] de 1. // visant à montrer combien de commandes ne sont plus impactées par le bug $y_count_item['OSC_44']++; } else { // si non: on utilise la valeur du formulaire: $qtynew = (int)$qtyold + (int)$new_stock_change; } // DEBUG : echo ''; die(); // -> OSC-44 : Mise à jour rapide : stock théorique faussé en cas de commandes pendant la mise à jour $products_cost = (float)trim($HTTP_POST_VARS['product_new_cost'][$id]); $stockinfo = trim($HTTP_POST_VARS['stock_change_comment']); $stockdate = trim($HTTP_POST_VARS['stock_change_date']); // echo "stockdate=" . $stockdate; $stockdate_array = strptime($stockdate, "%d/%m/%Y"); // var_dump ($stockdate_array); $stockdate = strftime("%Y/%m/%d", mktime(0,0,0,$stockdate_array['tm_mon']+1, $stockdate_array['tm_mday'], 1900+$stockdate_array['tm_year'])); // echo "stockdate=" . $stockdate; $sql = "INSERT INTO " . TABLE_AUDITED_STOCK . " SET qtyold = '".$qtyold."', products_id = '".(int)$id."', products_model = '".$products_model."', products_name ='". $products_name ."', date='". $stockdate ."', info ='". $stockinfo ."', qtynew = '" .$qtynew ."', qtyadd ='" .$new_stock_change ."', date_created=now(), products_cost = '" . $products_cost . "'"; // echo $sql; mysql_query($sql); $sql = "UPDATE " . TABLE_PRODUCTS . " SET products_quantity = '".$qtynew."' WHERE products_id = '".(int)$id."'"; // echo $sql; mysql_query($sql); // -> OSC-38 - Gestion des commandes fournisseurs $product_ordered_id = trim($HTTP_POST_VARS['product_ordered_old_id'][$id]); if ( $product_ordered_id != '' ) { $suppliers_orders->archiveOrderedProducts($product_ordered_id, $stockdate); $suppliers_orders->clearCache(); } // <- OSC-38 - Gestion des commandes fournisseurs } } } // <- VDAST // -> OSC-34: gestion d'un stock d'inventaire if($HTTP_POST_VARS['product_new_stock_invent']){ foreach($HTTP_POST_VARS['product_new_stock_invent'] as $id => $new_stock_invent) { if (trim($HTTP_POST_VARS['product_new_stock_invent'][$id]) != trim($HTTP_POST_VARS['product_old_stock_invent'][$id])) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_stock_invent='" . $new_stock_invent . "', products_last_modified=now() WHERE products_id=$id"); } } } // <- OSC-34 // -> OSC-14: gestion des emplacements if($HTTP_POST_VARS['product_new_location']){ foreach($HTTP_POST_VARS['product_new_location'] as $id => $new_location) { if (trim($HTTP_POST_VARS['product_new_location'][$id]) != trim($HTTP_POST_VARS['product_old_location'][$id])) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_location='" . $new_location . "', products_last_modified=now() WHERE products_id=$id"); } } } // <- OSC-14 // -> OSC-73: mise à jour rapide : gestion des soldes if($HTTP_POST_VARS['product_new_sales']){ foreach($HTTP_POST_VARS['product_new_sales'] as $id => $new_sales) { $old_sales = trim($HTTP_POST_VARS['product_old_sales'][$id]); $new_sales = trim($HTTP_POST_VARS['product_new_sales'][$id]); $old_sales_price = trim($HTTP_POST_VARS['product_old_sales_price'][$id]); if (substr($new_sales, -1) == '%') $new_sales = ($old_sales_price - (($new_sales / 100) * $old_sales_price)); if ( $old_sales != $new_sales ) { $count_update++; $item_updated[$id] = 'updated'; $expires_date = ''; if ( $old_sales == "" ) { tep_db_query("INSERT into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$id . "', '" . tep_db_input($new_sales) . "', now(), '" . tep_db_input($expires_date) . "', '1')"); } else if ( $new_sales == "" ) { tep_db_query("DELETE from " . TABLE_SPECIALS . " where products_id = '" . (int)$id . "'"); } else { tep_db_query("UPDATE " . TABLE_SPECIALS . " SET specials_new_products_price = '" . tep_db_input($new_sales) . "' where products_id = '" . (int)$id . "'"); } } } } // <- OSC-73 // -> OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // définition des actions à effectuer concernant Le stock d'Alerte pour chaque produit // ne seront réalisées que si la valeur du champ html relatif au stock d'alerte a été changé entre temps (Si AJAX est activé) ou après validation dans les deux cas. // le nom de la nouvelle valeur du Stock d'Alerte postée est: product_new_stock_alert // le nom de l'ancienne valeur du Stock d'Alerte postée est: product_old_stock_alert // On doit entreprendre des actions MySQL visant à mettre à jour la valeur du Stock d'Alerte if($HTTP_POST_VARS['product_new_stock_alert']){ foreach($HTTP_POST_VARS['product_new_stock_alert'] as $id => $new_stock_alert) { if (trim($HTTP_POST_VARS['product_new_stock_alert'][$id]) != trim($HTTP_POST_VARS['product_old_stock_alert'][$id])) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_stock_alert='" . $new_stock_alert . "', products_last_modified=now() WHERE products_id=$id"); } } } // <- OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // -> OSC-38 - Gestion des commandes fournisseurs if($HTTP_POST_VARS['product_ordered_new_products_quantity']){ foreach($HTTP_POST_VARS['product_ordered_new_products_quantity'] as $id => $new_products_quantity) { $supplier_name = trim($HTTP_POST_VARS['product_ordered_new_supplier_name'][$id]); $due_date = trim($HTTP_POST_VARS['product_ordered_new_due_date'][$id]); $products_quantity = trim($HTTP_POST_VARS['product_ordered_new_products_quantity'][$id]); $old_supplier_name = trim($HTTP_POST_VARS['product_ordered_old_supplier_name'][$id]); $old_due_date = trim($HTTP_POST_VARS['product_ordered_old_due_date'][$id]); $old_products_quantity = trim($HTTP_POST_VARS['product_ordered_old_products_quantity'][$id]); $product_ordered_id = trim($HTTP_POST_VARS['product_ordered_old_id'][$id]); // echo "id=" . $id; echo "qt=" . $products_quantity; echo "poid=" . $product_ordered_id; // echo "before check : " . $supplier_name . ";" . $old_supplier_name . ";" . $due_date . ";" . $old_due_date . ";" . $products_quantity . ";" . $old_products_quantity . "\n"; if ( $supplier_name != $old_supplier_name or $due_date != $old_due_date or $products_quantity != $old_products_quantity ) { $updated = false; if ( $products_quantity == '' ) { if ($product_ordered_id != '') { $updated = $suppliers_orders->deleteOrderedProducts($product_ordered_id); } } else { if ($product_ordered_id=='') { if ( $supplier_name == "" ) $supplier_name = $global_product_ordered_supplier_name; if ( $due_date == "" ) $due_date = $global_product_ordered_due_date; // echo "insertOrderedProducts" . ";" . $id . ";" . $supplier_name . ";" . $due_date . ";" . $products_quantity; $updated = $suppliers_orders->insertOrderedProducts($id, $supplier_name, $due_date, $products_quantity); } else $updated = $suppliers_orders->updateOrderedProducts($product_ordered_id, $id, $supplier_name, $due_date, $products_quantity); } if ( $updated ) { $count_update++; $item_updated[$id] = 'updated'; $suppliers_orders->clearCache(); } } } } // <- OSC-38 - Gestion des commandes fournisseurs if($HTTP_POST_VARS['product_new_model']){ foreach($HTTP_POST_VARS['product_new_model'] as $id => $new_model) { if (trim($HTTP_POST_VARS['product_new_model'][$id]) != trim($HTTP_POST_VARS['product_old_model'][$id])) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_model='" . $new_model . "', products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_name']){ foreach($HTTP_POST_VARS['product_new_name'] as $id => $new_name) { if (trim($HTTP_POST_VARS['product_new_name'][$id]) != trim($HTTP_POST_VARS['product_old_name'][$id])) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS_DESCRIPTION . " SET products_name='" . $new_name . "' WHERE products_id=$id and language_id=" . $languages_id); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_sort_order']){ foreach($HTTP_POST_VARS['product_new_sort_order'] as $id => $new_sort_order) { if ($HTTP_POST_VARS['product_new_sort_order'][$id] != $HTTP_POST_VARS['product_old_sort_order'][$id]) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_sort_order=$new_sort_order, products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_price']){ foreach($HTTP_POST_VARS['product_new_price'] as $id => $new_price) { if ($HTTP_POST_VARS['product_new_price'][$id] != $HTTP_POST_VARS['product_old_price'][$id] && $HTTP_POST_VARS['update_price'][$id] == 'yes') { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_price=$new_price, products_last_modified=now() WHERE products_id=$id"); } } } // -> VDMODQU : modification de la mise à jour rapide if($HTTP_POST_VARS['product_new_cost']){ foreach($HTTP_POST_VARS['product_new_cost'] as $id => $new_cost) { if ($HTTP_POST_VARS['product_new_cost'][$id] != $HTTP_POST_VARS['product_old_cost'][$id] && $HTTP_POST_VARS['update_cost'][$id] == 'yes') { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_cost=$new_cost, products_last_modified=now() WHERE products_id=$id"); } } } // <- VDMODQU : modification de la mise à jour rapide // -> PEF : Product Extra fields if(DISPLAY_EXTRA_FIELDS == true && $HTTP_POST_VARS[getProductExtraFieldsName(0, "new")]) { foreach($HTTP_POST_VARS['product_old_out'] as $id => $old_out_of_stock) { // seulement l'$id est utilisé for($i=0,$n=sizeof($extra_fields_array); $i<$n; $i++) { $old_value = $HTTP_POST_VARS[getProductExtraFieldsName($i, "old")][$id]; $new_value = $HTTP_POST_VARS[getProductExtraFieldsName($i, "new")][$id]; if ( $old_value != $new_value ) { tep_db_query("delete from " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " where products_id = '" . $id . "' AND products_extra_fields_id= '" . $extra_fields_array[$i]['products_extra_fields_id'] . "'"); if( isset($new_value) && tep_not_null($new_value) ) { tep_db_perform(TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS, array( 'products_id' => $id, 'products_extra_fields_id' => $extra_fields_array[$i]['products_extra_fields_id'], 'products_extra_fields_value' => $new_value )); } $count_update++; $item_updated[$id] = 'updated'; } } } } // <- PEF if($HTTP_POST_VARS['product_new_weight']){ foreach($HTTP_POST_VARS['product_new_weight'] as $id => $new_weight) { if ($HTTP_POST_VARS['product_new_weight'][$id] != $HTTP_POST_VARS['product_old_weight'][$id]) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_weight=$new_weight, products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_quantity']){ foreach($HTTP_POST_VARS['product_new_quantity'] as $id => $new_quantity) { if ($HTTP_POST_VARS['product_new_quantity'][$id] != $HTTP_POST_VARS['product_old_quantity'][$id]) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity=$new_quantity, products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_manufacturer']){ foreach($HTTP_POST_VARS['product_new_manufacturer'] as $id => $new_manufacturer) { if ($HTTP_POST_VARS['product_new_manufacturer'][$id] != $HTTP_POST_VARS['product_old_manufacturer'][$id]) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET manufacturers_id=$new_manufacturer, products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_image']){ foreach($HTTP_POST_VARS['product_new_image'] as $id => $new_image) { if (trim($HTTP_POST_VARS['product_new_image'][$id]) != trim($HTTP_POST_VARS['product_old_image'][$id])) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_image='" . $new_image . "', products_last_modified=now() WHERE products_id=$id"); } } } if($HTTP_POST_VARS['product_new_status']){ foreach($HTTP_POST_VARS['product_new_status'] as $id => $new_status) { if ($HTTP_POST_VARS['product_new_status'][$id] != $HTTP_POST_VARS['product_old_status'][$id]) { $count_update++; $item_updated[$id] = 'updated'; tep_set_product_status($id, $new_status); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_last_modified=now() WHERE products_id=$id"); } } } // -> VDOFS : gestion des articles épuisés if($HTTP_POST_VARS['product_new_out']){ foreach($HTTP_POST_VARS['product_old_out'] as $id => $old_out_of_stock) { $new_out_of_stock = ( $HTTP_POST_VARS['product_new_out'][$id] )?1:0; $old_out_of_stock = ( $HTTP_POST_VARS['product_old_out'][$id] )?1:0; if ($new_out_of_stock != $old_out_of_stock) { $count_update++; $item_updated[$id] = 'updated'; tep_set_outofstock_status($id, $new_out_of_stock); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_last_modified=now() WHERE products_id=$id"); } } } // -> VDOFS : gestion des articles épuisés if($HTTP_POST_VARS['is_customizable']){ foreach($HTTP_POST_VARS['product_old_marquage'] as $id => $old_marquage) { $new_marquage = ( $HTTP_POST_VARS['is_customizable'][$id] )?1:0; $old_marquage = ( $HTTP_POST_VARS['product_old_marquage'][$id] )?1:0; if ($new_marquage != $old_marquage) { $count_update++; $item_updated[$id] = 'updated'; tep_set_customizable($id,$new_marquage); mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_last_modified=now() WHERE products_id=$id"); } } } // <- VDOFS // -> VDQPBPP : ajout des prix par pallier dans la mise à jour rapide if(DISPLAY_PRICE_BREAK == true && $HTTP_POST_VARS[getProductPriceBreakName(0, "new")]) { foreach($HTTP_POST_VARS['product_old_out'] as $id => $old_out_of_stock) { // seulement l'$id est utilisé $modified = 0; for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) { if ( ($HTTP_POST_VARS[getProductPriceBreakName($count, "old")][$id] != $HTTP_POST_VARS[getProductPriceBreakName($count, "new")][$id]) || ($HTTP_POST_VARS[getProductQtyBreakName($count, "old")][$id] != $HTTP_POST_VARS[getProductQtyBreakName($count, "new")][$id]) ) { $modified = 1; } } if ( $modified ) { tep_db_query("delete from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_id = '" . $id . "'"); for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) { $new_price = getProductPriceBreakName($count, "new"); $new_qty = getProductQtyBreakName($count, "new"); if(isset($HTTP_POST_VARS[$new_price][$id]) && tep_not_null($HTTP_POST_VARS[$new_price][$id]) && isset($HTTP_POST_VARS[$new_qty][$id]) && tep_not_null($HTTP_POST_VARS[$new_qty][$id])) { tep_db_perform(TABLE_PRODUCTS_PRICE_BREAK, array( 'products_id' => $id, 'products_price' => $HTTP_POST_VARS[$new_price][$id], 'products_qty' => $HTTP_POST_VARS[$new_qty][$id]) ); } } $count_update++; $item_updated[$id] = 'updated'; } } } // <- VDQPBPP if($HTTP_POST_VARS['product_new_tax']){ foreach($HTTP_POST_VARS['product_new_tax'] as $id => $new_tax_id) { if ($HTTP_POST_VARS['product_new_tax'][$id] != $HTTP_POST_VARS['product_old_tax'][$id]) { $count_update++; $item_updated[$id] = 'updated'; mysql_query("UPDATE " . TABLE_PRODUCTS . " SET products_tax_class_id=$new_tax_id, products_last_modified=now() WHERE products_id=$id"); } } } $count_item = array_count_values($item_updated); // <- OSC-44 : Mise à jour rapide : stock théorique faussé en cas de commandes pendant la mise à jour // modification du message (le mettre déjà en VERT au lieu du ROUGE ROSÂTRE) // Pour cela, on utilise la classe messageStack via l'instance déjà créé $messageStack et on se sert de la méthode (add) // à qui l'on donne en paramètre $message le message, et le $type "success" // ce qui rend le message en vert au lieu d'un message en rouge rosé quand un paramètre // de $type n'est pas spécifié passe automatiquement en valeur 'error'. // $count_item['updated'] symbolise les produits MIS A JOURS // $y_count_item['OSC_44'] symbolise les produits QUI ONT ETES COMMANDES PENDANT LA MISE A JOUR (cette valeur est définie plus haut, dans le UPDATE avant la conditionnelle) // // l'ajout de cette information vise à sensibiliser le client sur l'impact qu'avait le bug AVANT la réalisation de ce fix (OSC-44). // // ajout d'une correction cosmétique /* si "y" == 0: "x Produit(s) actualisé(s)" si "y" == 1: "x Produit actualisé dont 1 Produit qui vient d'être commandé" sinon : "x Produits actualisés dont y Produits qui viennent d'être commandés" */ if ($count_item['updated'] > 0) { if ($y_count_item['OSC_44'] == 0) { $messageStack->add($count_item['updated'].' '.TEXT_PRODUCTS_UPDATED.TEXT_PRODUCTS_PURCHASED_ZERO_BETWEEN_QUICKUPDATE, 'success'); } else if ($y_count_item['OSC_44'] == 1) { $messageStack->add($count_item['updated'].' '.TEXT_PRODUCTS_UPDATED.TEXT_PRODUCTS_PURCHASED_PREFIX_BETWEEN_QUICKUPDATE.(string)$y_count_item['OSC_44'].TEXT_PRODUCTS_PURCHASED_ONE_BETWEEN_QUICKUPDATE, 'success'); } else if ($y_count_item['OSC_44'] > 1) { $messageStack->add($count_item['updated'].' '.TEXT_PRODUCTS_UPDATED.TEXT_PRODUCTS_PURCHASED_PREFIX_BETWEEN_QUICKUPDATE.(string)$y_count_item['OSC_44'].TEXT_PRODUCTS_PURCHASED_MANY_BETWEEN_QUICKUPDATE, 'success'); } } // -> OSC-44 : Mise à jour rapide : stock théorique faussé en cas de commandes pendant la mise à jour break; case 'calcul' : if ($HTTP_POST_VARS['spec_price']) $preview_global_price = 'true'; break; } //// explode string parameters from preview product if($info_back && $info_back!="-") { $infoback = explode('-',$info_back); $sort_by = $infoback[0]; $page = $infoback[1]; $current_category_id = $infoback[2]; $row_by_page = $infoback[3]; $manufacturer = $infoback[4]; $display_mode = $infoback[5]; $filter_by_oqt = $infoback[6]; $search = $infoback[7]; } //// define the step for rollover lines per page $row_bypage_array = array(array()); // -> VDMODQU : modification de la mise à jour rapide $row_bypage_array[] = array('id' => 10, 'text' => 10); for ($i = 100; $i <=1000 ; $i=$i+100) { // <- VDMODQU : modification de la mise à jour rapide $row_bypage_array[] = array('id' => $i, 'text' => $i); } // -> VDMODQU : modification de la mise à jour rapide $row_bypage_array[] = array('id' => 10000, 'text' => 10000); // <- VDMODQU : modification de la mise à jour rapide ##// Let's start displaying page with forms ?> > <?php echo TITLE; ?> OSC-73: mise à jour rapide : gestion des soldes ?>
VDMODQU ?> OSC-33: optimisation mise à jour rapide, filtre par emplacement ?>
OSC-34: gestion d'un stock d'inventaire ?> OSC-33: optimisation mise à jour rapide, filtre par emplacement ?> VDAST : ajout d'un champ de recherche ?> OSC-38 - Gestion des commandes fournisseurs ?>
' . '  '; $checked = ($display_mode=='I')?"checked":""; echo 'INVENTAIRE' . '  '; $checked = ($display_mode=='S')?"checked":""; echo 'SOLDES' . '  '; // -> OSC-38 - Gestion des commandes fournisseurs $checked = ($display_mode=='C')?"checked":""; echo 'COMMANDES' . '  '; // <- OSC-38 - Gestion des commandes fournisseurs // -> OSC-60: Export des articles à commander auprès des fournisseurs // Ajout d'un bouton d'accès direct vers l'export du CSV concernant les Commandes Fournisseurs (Stock d'alerte). // BugFix: lors du clic sur le bouton "Export commandes" il y a une erreur SQL, celle-ci est provoquée par le fait que la valeur recherchée pour le fabricant n'est pas renseignée et est donc nulle. if ( !empty($manufacturer) && @$manufacturer != '0' ) { $osc_60_fabricant = $manufacturer; } else { $osc_60_fabricant = 'ALL'; } if ( !empty($current_category_id) || $current_category_id != '0' ) { $osc_60_categorie_actuelle = $current_category_id; } else { $osc_60_categorie_actuelle = 'ALL'; } echo ''; // <- OSC-60: Export des articles à commander auprès des fournisseurs ?>
OSC-34: gestion d'un stock d'inventaire ?>
0000008: le texte de recherche est oubliée après changement de page ou mise à jour ?> method="post">
0000008: le texte de recherche est oubliée après changement de page ou mise à jour echo '  ' . tep_image_submit('button_preview.gif', IMAGE_PREVIEW, "page=$page&sort_by=$sort_by&cPath=$current_category_id&row_by_page=$row_by_page&manufacturer=$manufacturer&display_mode=$display_mode&filter_by_oqt=$filter_by_oqt&search=" . urlencode($search)); // -> OSC-33: optimisation mise à jour rapide, filtre par emplacement } else echo '  ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '' . '  ' . TEXT_SPEC_PRICE_INFO2; // <- OSC-33 // <- 0000008 ?>
OSC-34: gestion d'un stock d'inventaire ?>
0000008: le texte de recherche est oubliée après changement de page ou mise à jour ?> "> OSC-38 - Gestion des commandes fournisseurs ?> VDAST : ajout du stock amélioré dans la mise à jour rapide ?> OSC-33: optimisation mise à jour rapide, filtre par emplacement ?> " . '' . "\n"; ?> OSC-34: gestion d'un stock d'inventaire ?> OSC-95 - Amélioration vue INVENTAIRE ?>
Etape 2 - réception des marchandises : On saisit la quantité réceptionnée dans le champ \"+/- Qt\" ou on clique sur le bouton '=>' pour recopier le champ \"Qt Cmd\", puis on clique sur \"mise à jour\" pour mettre à jour le stock.
NOTE: on peut supprimer une commande fournisseur en vidant le champ \"Qt Cmd\" et en cliquant sur \"mise à jour\"."); echo "     "; echo TABLE_HEADING_SUPPLIERS_ORDERS_NAME; echo "   "; echo TABLE_HEADING_SUPPLIERS_ORDERS_DUE_DATE; echo " "; ?>
Réception de commandes : "; echo tep_draw_input_field('stock_change_date', $stock_change_date, 'maxlength="10" size="8"') . "-->" . tep_draw_input_field('stock_change_comment', $stock_change_comment, 'maxlength="60" size="60"'); ?>
OSC-38 - Gestion des commandes fournisseurs ?> OSC-34: gestion d'un stock d'inventaire ?> OSC-95 - Amélioration vue INVENTAIRE ?> OSC-14: gestion des emplacements ?> OSC-73: mise à jour rapide : gestion des soldes ?> VDMODQU ?> VDQPBPP : ajout des prix par pallier dans la mise à jour rapide if(DISPLAY_PRICE_BREAK == 'true') { for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) { echo ""; echo ""; } } // <- VDQPBPP ?> OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // On va ici créér la cellule d'intitulé pour la colonne Stock Alerte (Qt Alerte) // On rend cette colonne triable (Du Plus Grand/Du plus Petit) // On y utilise les constantes php définies plus haut, pour intitulé, affichage // On trie par quantité de stock alerte (products_stock_alert) ?> PEF : Product Extra fields ?> 0000008: le texte de recherche est oubliée après changement de page ou mise à jour $origin = FILENAME_QUICK_UPDATES."?info_back=$sort_by-$page-$current_category_id-$row_by_page-$manufacturer-$display_mode-$filter_by_oqt$search"; // <- 0000008 //// controle lenght (lines per page) $split_page = $page; if ($split_page > 1) $rows = $split_page * MAX_DISPLAY_ROW_BY_PAGE - MAX_DISPLAY_ROW_BY_PAGE; // -> OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte /* Ajout de p.products_stock_alert (pour gérer la récupération de la valeur du Stock d'Alerte de MySQL) */ // -> OSC-14: gestion des emplacements // -> VDOFS : gestion des articles épuisés // -> VDAST : ajout d'un champ de recherche // -> 0000008: le texte de recherche est oubliée après changement de page ou mise à jour // -> OSC-38 - Gestion des commandes fournisseurs $where_filter = ""; if ( $HTTP_GET_VARS['filter_by_oqt'] == 'y' ) $where_filter .= " AND p.products_id in (select distinct products_id from suppliers_orders_products where date_received is NULL)"; if (isset($HTTP_GET_VARS['search']) && $HTTP_GET_VARS['search'] != "" ) // <- 0000008 { $search = tep_db_prepare_input($HTTP_GET_VARS['search']); // var_dump($HTTP_GET_VARS); echo $search; // -> OSC-33: optimisation mise à jour rapide, filtre par emplacement if ( $search[0] == '#' ) /// commence par '#' ? c'est une recherche par emplacement { preg_match("/^#(\d+)(.*)/", $search, $search_array); if ( $search_array[2] != "" ) { $where_location = " REGEXP '^" . $search_array[1] . $search_array[2] . ".*'"; } else if ( $search_array[1] != "" ) { $where_location = " REGEXP '(^" . $search_array[1] . "[A-Za-z].*|^" . $search_array[1] . "[ /,.-].*|^" . $search_array[1] . "[ /,.-]*$)'"; } else { $where_location = " = ''"; } if($manufacturer) $where_manufacturer = " and p.manufacturers_id = " . $manufacturer . " "; else $where_manufacturer = ""; $sort_by = tep_db_prepare_input($HTTP_GET_VARS['sort_by']); if($sort_by == "") $order_by = "p.products_location, pd.products_name"; else $order_by = $sort_by; $products_query_raw = "select distinct p.products_id,p.is_customizable, p.products_image, p.products_stock_invent, p.products_location, p.products_stock_alert, p.products_model, pd.products_name, p.products_status, p.products_weight, p.products_quantity, p.manufacturers_id, p.products_price, p.products_cost, p.products_tax_class_id, p.products_out_of_stock from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '$languages_id' and p.products_id = p2c.products_id and p.products_location " . $where_location . $where_manufacturer . $where_filter . " order by " . $order_by; } else { // -> 0000006: problème bascule épuisé $products_query_raw = "select distinct p.products_id,p.is_customizable, p.products_image, p.products_stock_invent, p.products_location, p.products_stock_alert, p.products_model, pd.products_name, p.products_status, p.products_weight, p.products_quantity, p.manufacturers_id, p.products_price, p.products_cost, p.products_tax_class_id, p.products_out_of_stock from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '$languages_id' and p.products_id = p2c.products_id and (pd.products_name like '%" . tep_db_input($search) . "%' or p.products_model like '%" . tep_db_input($search) . "%' or pd.products_description like '%" . tep_db_input($search) . "%') $where_filter $sort_by "; // <- 0000006 } // <- OSC-33 } else { // <- VDAST //// select categories if ($current_category_id == 0){ if($manufacturer){ $products_query_raw = "select distinct p.products_id,p.is_customizable, p.products_image, p.products_stock_invent, p.products_location, p.products_stock_alert, p.products_model, pd.products_name, p.products_status, p.products_weight, p.products_quantity, p.manufacturers_id, p.products_price, p.products_cost, p.products_tax_class_id, p.products_out_of_stock from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_id = pd.products_id and pd.language_id = '$languages_id' and p.manufacturers_id = m.manufacturers_id and p.manufacturers_id = " . $manufacturer . " $where_filter $sort_by "; }else{ $products_query_raw = "select distinct p.products_id,p.is_customizable, p.products_image, p.products_stock_invent, p.products_location, p.products_stock_alert, p.products_model, pd.products_name, p.products_status, p.products_weight, p.products_quantity, p.manufacturers_id, p.products_price, p.products_cost, p.products_tax_class_id, p.products_out_of_stock from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '$languages_id' $where_filter $sort_by "; } } else { if($manufacturer){ $products_query_raw = "select distinct p.products_id,p.is_customizable, p.products_image, p.products_stock_invent, p.products_location, p.products_stock_alert, p.products_model, pd.products_name, p.products_status, p.products_weight, p.products_quantity, p.manufacturers_id, p.products_price, p.products_cost, p.products_tax_class_id, p.products_out_of_stock from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc, " . TABLE_MANUFACTURERS . " m where p.products_id = pd.products_id and pd.language_id = '$languages_id' and p.manufacturers_id = m.manufacturers_id and p.products_id = pc.products_id and pc.categories_id = '" . $current_category_id . "' and p.manufacturers_id = " . $manufacturer . " $where_filter $sort_by "; }else{ $products_query_raw = "select distinct p.products_id,p.is_customizable, p.products_image, p.products_stock_invent, p.products_location, p.products_stock_alert, p.products_model, pd.products_name, p.products_status, p.products_weight, p.products_quantity, p.manufacturers_id, p.products_price, p.products_cost, p.products_tax_class_id, p.products_out_of_stock from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc where p.products_id = pd.products_id and pd.language_id = '$languages_id' and p.products_id = pc.products_id and pc.categories_id = '" . $current_category_id . "' $where_filter $sort_by "; } } // -> VDAST : ajout d'un champ de recherche } // <- VDAST // <- VDOFS // <- OSC-14 // <- OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // <- OSC-38 - Gestion des commandes fournisseurs $total_cost_qt = 0; //// page splitter and display each products info // -> 0000006: evite certaines pages blanches suite à la suppression des doublons générés par les articles dans plusieurs catégories $products_split = new splitPageResults($split_page, MAX_DISPLAY_ROW_BY_PAGE, $products_query_raw, $products_query_numrows, "distinct p.products_id"); // <- 0000006 $products_query = tep_db_query($products_query_raw); while ($products = tep_db_fetch_array($products_query)) { $rows++; if (strlen($rows) < 2) { $rows = '0' . $rows; } //// check for global add value or rates, calcul and round values rates if ($HTTP_POST_VARS['spec_price']){ $flag_spec = 'true' ; if (substr($HTTP_POST_VARS['spec_price'],-1) == '%') { if($HTTP_POST_VARS['marge'] && substr($HTTP_POST_VARS['spec_price'],0,1) != '-'){ $valeur = (1 - (ereg_replace("%", "", $HTTP_POST_VARS['spec_price']) / 100)); $price = sprintf("%01.2f", round($products['products_price'] / $valeur,2)); }else{ $price = sprintf("%01.2f", round($products['products_price'] + (($spec_price / 100) * $products['products_price']),2)); } } else $price = sprintf("%01.2f", round($products['products_price'] + $spec_price,2)); } else $price = $products['products_price'] ; // -> VDMODQU : modification de la mise à jour rapide if ($HTTP_POST_VARS['spec_cost']){ $flag_spec = 'true' ; if (substr($HTTP_POST_VARS['spec_cost'],-1) == '%') { if($HTTP_POST_VARS['marge'] && substr($HTTP_POST_VARS['spec_cost'],0,1) != '-'){ $valeur = (1 - (ereg_replace("%", "", $HTTP_POST_VARS['spec_cost']) / 100)); $cost = sprintf("%01.2f", round($products['products_cost'] / $valeur,2)); }else{ $cost = sprintf("%01.2f", round($products['products_cost'] + (($spec_cost / 100) * $products['products_cost']),2)); } } else $cost = sprintf("%01.2f", round($products['products_cost'] + $spec_cost,2)); } else $cost = $products['products_cost'] ; // <- VDMODQU : modification de la mise à jour rapide // -> OSC-38 - Gestion des commandes fournisseurs $product_ordered = NULL; if(DISPLAY_SUPPLIERS_ORDERS == 'true') $product_ordered = $suppliers_orders->getOrderedProducts($products['products_id']); // <- OSC-38 - Gestion des commandes fournisseurs //// Check Tax_rate for displaying TTC $tax_query = tep_db_query("select r.tax_rate, c.tax_class_title from " . TABLE_TAX_RATES . " r, " . TABLE_TAX_CLASS . " c where r.tax_class_id=" . $products['products_tax_class_id'] . " and c.tax_class_id=" . $products['products_tax_class_id']); $tax_rate = tep_db_fetch_array($tax_query); if($tax_rate['tax_rate'] == '')$tax_rate['tax_rate'] = 0; if(MODIFY_MANUFACTURER == 'false'){ $manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id=" . $products['manufacturers_id']); $manufacturer = tep_db_fetch_array($manufacturer_query); } //// display infos per row if($flag_spec){echo ''; }else{ echo '';} // -> VDMODQU : modification de la mise à jour rapide if(DISPLAY_COST == 'true'){echo ''; }else{ echo '';} if(DISPLAY_COST_QT == 'true'){echo ''; }else{ echo '';} // -> OSC-38 - Gestion des commandes fournisseurs if(DISPLAY_SUPPLIERS_ORDERS == 'true') { if (is_null($product_ordered)) { $product_ordered = array('supplier_name' => '', 'products_quantity' => '', 'due_date' => ''); } if(MODIFY_SUPPLIERS_ORDERS == 'true') { if ( $product_ordered['products_quantity'] != '' ) { $is_valid = 1; $disabled = ""; } else { $is_valid = 0; $disabled = "disabled"; } echo "\n"; $all = $suppliers_orders->getLastArchivedOrderedProducts($products['products_id'], 5); $txt = ""; for($i=0;$i"; } if ( $i>0 ) { if ( $i == 1 ) { $txt = "DERNIÈRE COMMANDE:
" . $txt; } else { $txt = $i . " DERNIÈRES COMMANDES
" . $txt; } } echo "
\n"; echo "\n"; echo "\n"; } else { echo "\n"; echo "\n"; echo "\n"; } } // <- OSC-38 - Gestion des commandes fournisseurs // -> OSC-34: gestion d'un stock d'inventaire if ( $display_mode == "I" ) { if (DISPLAY_STOCK_INVENT == 'true') { echo "\n"; $ecart = (int)$products['products_stock_invent'] - (int)$products['products_quantity']; if ( $ecart > 0 ) $ecart = sprintf("+%d", $ecart); else $ecart = sprintf("%d", $ecart); echo "\n"; } } else { // -> VDAST : ajout du stock amélioré dans la mise à jour rapide if (DISPLAY_STOCK_CHANGE == 'true') { echo "\n"; } // <- VDAST } // <- OSC-34 // <- VDMODQU : modification de la mise à jour rapide // -> OSC-14: gestion des emplacements if(DISPLAY_LOCATION == 'true'){if(MODIFY_LOCATION == 'true')echo "\n";else echo "\n";}else{ echo "\n";else echo "\n";}else{ echo "\n";else echo "\n"; //// Product status radio button // -> VDOFS : gestion des articles épuisés if(DISPLAY_STATUT == 'true'){ if ($products['products_status'] == '1') { echo "\n"; } // <- VDOFS if(DISPLAY_WEIGHT == 'true')echo "\n";else echo ""; // -> VDAST : ajout du stock amélioré dans la mise à jour rapide if(DISPLAY_QUANTITY == 'true')echo "\n";else echo ""; // <- VDAST if ( DISPLAY_SALES_BY_MONTH == true ) { require_once(DIR_WS_CLASSES."sales_stat.php"); $date = new \DateTime('now -1 year'); $date = $date->format('Y-m-d H:i:s'); $annual_sales = get_product_purchased_from($products['products_id'],$date); $monthly_sales = round($annual_sales/12); echo "\n"; } if ( DISPLAY_IS_CUSTOMIZABLE == true ) echo "\n"; { } if(DISPLAY_IMAGE == 'true')echo "\n";else echo ""; if(DISPLAY_MANUFACTURER == 'true'){if(MODIFY_MANUFACTURER == 'true')echo "\n";else echo "";}else{ echo "";} // -> OSC-73: mise à jour rapide : gestion des soldes //// check specials if ( in_array($products['products_id'],$specials_array)) { $spec_query = tep_db_query("select s.products_id, s.specials_new_products_price, s.specials_id from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s where s.products_id = " . (int)$products['products_id'] . ""); $spec = tep_db_fetch_array($spec_query); } else { $spec = array(); } if(DISPLAY_SALES == 'true'){echo "\n";} if ($flag_spec == 'true') { echo "\n"; } else { echo "\n";} // <- OSC-73 // -> VDMODQU : modification de la mise à jour rapide if (DISPLAY_COST == 'true') { echo "\n"; } // -> VDQPBPP : ajout des prix par pallier dans la mise à jour rapide if(DISPLAY_PRICE_BREAK == 'true') { $price_breaks_array = array(); $price_breaks_query = tep_db_query("select products_price, products_qty from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_id = '" . $products['products_id'] . "' order by products_qty"); while ($price_break = tep_db_fetch_array($price_breaks_query)) { $price_breaks_array[] = $price_break; } for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) { echo ""; echo ""; } } // <- VDQPBPP if (DISPLAY_COST_QT == 'true') { // -> VDOFS : gestion des articles épuisés if ( $products['products_out_of_stock'] == 0 ) // <- VDOFS { $total_cost_qt += $cost*$products['products_quantity']; } echo "\n"; } // <- VDMODQU : modification de la mise à jour rapide if(DISPLAY_TAX == 'true'){if(MODIFY_TAX == 'true')echo "\n";else echo "";}else{ echo "";} // -> OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // Sert pour afficher les valeurs des champs Qt Alerte (définissant le Stock Alerte pour chaque produits). // On utilise les mêmes variables *_stock_alert (définie plus haut concernant la définition des actions à effectuer concernant Le stock d'Alerte pour chaque produit) // Concernant les constantes php utilisée, on se sert de celles définies en début de fichier qui concerne le Stock Alerte. // Ici on ne fait que récupérer les données SQL concernant le Stock Alerte // Donc on utilise products_stock_alert, vu que c'est le nom du champ SQL que l'on demande à retourner. if(DISPLAY_STOCK_ALERT == 'true'){if(MODIFY_STOCK_ALERT == 'true')echo "\n";else echo "\n";}else{ echo "\n"; } } // <- PEF //// links to preview or full edit if(DISPLAY_PREVIEW == 'true')echo "\n"; if(DISPLAY_EDIT == 'true')echo "\n"; //// Hidden parameters for cache old values // -> VDAST : ajout du stock amélioré dans la mise à jour rapide if(DISPLAY_STOCK_CHANGE == 'true' or MODIFY_NAME == 'true') echo tep_draw_hidden_field('product_old_name['.$products['products_id'].'] ',$products['products_name']); // <- VDAST // -> OSC-34: gestion d'un stock d'inventaire if(MODIFY_STOCK_INVENT == 'true') echo tep_draw_hidden_field('product_old_stock_invent['.$products['products_id'].'] ',$products['products_stock_invent']); // <- OSC-34 // -> OSC-14: gestion des emplacements if(MODIFY_LOCATION == 'true') echo tep_draw_hidden_field('product_old_location['.$products['products_id'].'] ',$products['products_location']); // <- OSC-14 // -> OSC-73: mise à jour rapide : gestion des soldes if(MODIFY_SALES == 'true') { echo tep_draw_hidden_field('product_old_sales['.$products['products_id'].'] ',$spec['specials_new_products_price']); echo tep_draw_hidden_field('product_old_sales_price['.$products['products_id'].']',$products['products_price']); } // <- OSC-73 // -> OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // Sert pour modifier les valeurs des champs Qt Alerte (définissant le Stock Alerte pour chaque produits). // On utilise les mêmes variables *_stock_alert (définie plus haut concernant la définition des actions à effectuer concernant Le stock d'Alerte pour chaque produit) // Concernant les constantes php utilisée, on se sert de celles définies en début de fichier qui concerne le Stock Alerte. // Ici on ne fait que récupérer les données POST concernant l'ancien Stock Alerte // Donc on utilise products_stock_alert, vu que c'est le nom du champ SQL que l'on demande à retourner. if(MODIFY_STOCK_ALERT == 'true') echo tep_draw_hidden_field('product_old_stock_alert['.$products['products_id'].'] ',$products['products_stock_alert']); // <- OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // -> OSC-38 - Gestion des commandes fournisseurs if(MODIFY_SUPPLIERS_ORDERS == 'true') { // echo "product_ordered=" . var_dump($product_ordered); echo tep_draw_hidden_field('product_ordered_old_id['.$products['products_id'].'] ',$product_ordered['id']); echo tep_draw_hidden_field('product_ordered_old_supplier_name['.$products['products_id'].'] ',$product_ordered['supplier_name']); echo tep_draw_hidden_field('product_ordered_old_products_quantity['.$products['products_id'].'] ',$product_ordered['products_quantity']); echo tep_draw_hidden_field('product_ordered_old_due_date['.$products['products_id'].'] ',$product_ordered['due_date']); } // <- OSC-38 - Gestion des commandes fournisseurs if(MODIFY_MODEL == 'true') echo tep_draw_hidden_field('product_old_model['.$products['products_id'].'] ',$products['products_model']); echo tep_draw_hidden_field('product_old_sort_order['.$products['products_id'].']',$products['products_sort_order']); echo tep_draw_hidden_field('product_old_make_an_offer['.$products['products_id'].']',$products['products_make_an_offer']); echo tep_draw_hidden_field('product_old_zusatz3['.$products['products_id'].']',$products['products_zusatz3']); echo tep_draw_hidden_field('product_old_status['.$products['products_id'].']',$products['products_status']); // -> VDOFS : gestion des articles épuisés echo tep_draw_hidden_field('product_old_out['.$products['products_id'].']',$products['products_out_of_stock']); //MODIF ICI echo tep_draw_hidden_field('product_old_marquage['.$products['products_id'].']',$products['is_customizable']); // <- VDOFS // -> VDQPBPP : ajout des prix par pallier dans la mise à jour rapide if(DISPLAY_PRICE_BREAK == 'true') { for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) { echo tep_draw_hidden_field(getProductPriceBreakName($count, "old").'['.$products['products_id'].']',$price_breaks_array[$count]['products_price']); echo tep_draw_hidden_field(getProductQtyBreakName($count, "old").'['.$products['products_id'].']',$price_breaks_array[$count]['products_qty']); } } // <- VDQPBPP // -> PEF : Product Extra fields if ( DISPLAY_EXTRA_FIELDS == true ) { for($i=0,$n=sizeof($extra_fields_array); $i<$n; $i++) { $product_extra_fields = get_products_extra_fields($extra_fields_array[$i]['products_extra_fields_id'], $products['products_id']); echo tep_draw_hidden_field(getProductExtraFieldsName($i, "old") . "[".$products['products_id']."]", $product_extra_fields['products_extra_fields_value']); } } // <- PEF echo tep_draw_hidden_field('product_old_quantity['.$products['products_id'].']',$products['products_quantity']); echo tep_draw_hidden_field('product_old_image['.$products['products_id'].']',$products['products_image']); if(MODIFY_MANUFACTURER == 'true')echo tep_draw_hidden_field('product_old_manufacturer['.$products['products_id'].']',$products['manufacturers_id']); echo tep_draw_hidden_field('product_old_weight['.$products['products_id'].']',$products['products_weight']); echo tep_draw_hidden_field('product_old_base_price['.$products['products_id'].']',$products['products_base_price']); echo tep_draw_hidden_field('product_old_base_unit['.$products['products_id'].']',$products['products_base_unit']); echo tep_draw_hidden_field('product_old_price_ek['.$products['products_id'].']',$products['products_price_ek']); echo tep_draw_hidden_field('product_old_price['.$products['products_id'].']',$products['products_price']); // -> VDMODQU : modification de la mise à jour rapide echo tep_draw_hidden_field('product_old_cost['.$products['products_id'].']',$products['products_cost']); // <- VDMODQU : modification de la mise à jour rapide if(MODIFY_TAX == 'true')echo tep_draw_hidden_field('product_old_tax['.$products['products_id'].']',$products['products_tax_class_id']); //// hidden display parameters echo tep_draw_hidden_field( 'row_by_page', $row_by_page); echo tep_draw_hidden_field( 'sort_by', $sort_by); echo tep_draw_hidden_field( 'page', $split_page); // -> 0000008: le texte de recherche est oubliée après changement de page ou mise à jour echo tep_draw_hidden_field( 'search', $search); // <- 0000008 echo tep_draw_hidden_field( 'display_mode', $display_mode); } echo "
" .TABLE_HEADING_STOCK_CHANGE; ?> ".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_LOCATION . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_LOCATION; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_MODEL . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_MODEL; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_PRODUCTS . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_PRODUCTS; ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . 'OFF ' . TEXT_ASCENDINGLY)."    
"; echo TABLE_HEADING_STATUS; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_WEIGHT . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_WEIGHT; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_QUANTITY . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_QUANTITY; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_IMAGE . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_IMAGE; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_MANUFACTURERS . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_MANUFACTURERS; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_PRICE . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_PRICE;?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_COST . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_COST; } ?>

" . TABLE_HEADING_PRICE_BREAK_PRICE . "

" . TABLE_HEADING_PRICE_BREAK_QT . "
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_COST_QT . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_COST_QT; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_TAX . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_TAX; } ?>
".tep_image(DIR_WS_IMAGES . 'icon_up.gif', TEXT_SORT_ALL . TABLE_HEADING_STOCK_ALERT . ' ' . TEXT_ASCENDINGLY)."
"; echo TABLE_HEADING_STOCK_ALERT; } ?>
" . $heading; ?>    
" . tep_get_infobulle("", $txt) . "\" " . $disabled . " onClick=\"document.getElementsByName('stock_change[" ; echo $products['products_id']. "]')[0].value = document.getElementsByName('product_ordered_new_products_quantity[" . $products['products_id']."]')[0].value\"" . ">" . $product_ordered['supplier_name'] . "" . $product_ordered['products_quantity'] . "" . $product_ordered['due_date'] . "" . $products['products_location'] . "";} // <- OSC-14 // -> OSC-16: agrandissement de la cellule reference if(DISPLAY_MODEL == 'true'){if(MODIFY_MODEL == 'true')echo "" . $products['products_model'] . "";} // <- OSC-16 if(MODIFY_NAME == 'true')echo "".$products['products_name'].""; } else { echo ""; } echo " " . tep_draw_hidden_field('product_new_out['.$products['products_id'].']') . tep_draw_checkbox_field('product_new_out['.$products['products_id'].']', "1", ( $products['products_out_of_stock'] == 1)) . "".$monthly_sales."" . tep_draw_hidden_field('is_customizable['.$products['products_id'].']') . tep_draw_checkbox_field('is_customizable['.$products['products_id'].']', "1", ( $products['is_customizable'] == 1)) . "".tep_draw_pull_down_menu("product_new_manufacturer[".$products['products_id']."]\"", $manufacturers_array, $products['manufacturers_id'])."" . $manufacturer['manufacturers_name'] . "".tep_draw_checkbox_field('update_price['.$products['products_id'].']','yes','checked','no')."".tep_draw_hidden_field('update_price['.$products['products_id'].']','yes'). "".tep_draw_hidden_field('update_cost['.$products['products_id'].']','yes'). "" .$cost*$products['products_quantity'] . "".tep_draw_pull_down_menu("product_new_tax[".$products['products_id']."]\"", $tax_class_array, $products['products_tax_class_id'])."" . $tax_rate['tax_class_title'] . "" . $products['products_stock_alert'] . "";} // <- OSC-61: Mise à jour rapide : ajout de la colonne stock d'alerte // -> PEF : Product Extra fields if ( DISPLAY_EXTRA_FIELDS == true ) { for($i=0,$n=sizeof($extra_fields_array); $i<$n; $i++) { $product_extra_fields = get_products_extra_fields($extra_fields_array[$i]['products_extra_fields_id'], $products['products_id']); echo "". tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', TEXT_IMAGE_SWITCH_EDIT) ."
\n"; ?>
Valeur du stock des produits affichés (hors produits épuisés) :
' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; echo '  ' . tep_image_submit('button_print.gif', PRINT_TEXT) . ''; ?>
display_count($products_query_numrows, MAX_DISPLAY_ROW_BY_PAGE, $split_page, TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> display_links($products_query_numrows, MAX_DISPLAY_ROW_BY_PAGE, MAX_DISPLAY_PAGE_LINKS, $split_page, '&cPath='. $current_category_id .'&sort_by='.$sort_by . '&row_by_page=' . $row_by_page . '&manufacturer=' . $manufacturer . '&display_mode=' . $display_mode . '&filter_by_oqt=' . $filter_by_oqt . '&search=' . urlencode($search)); ?>