Update REST: copy sale from Twinpol

This commit is contained in:
2025-04-16 18:04:18 +00:00
parent 8095cfe88a
commit 62658a1fbb
7 changed files with 864 additions and 814 deletions

View File

@@ -56,6 +56,17 @@
$gotAllProducts = false; $gotAllProducts = false;
continue; continue;
} else { } else {
// pricebook price?
$pricebookPrice = $db->fetchByAssoc($db->query("
SELECT price FROM ecmpricebooks_ecmproducts
WHERE ecmpricebook_id = '3e78ac33-7c46-1b94-0a67-653a17c06f9e'
AND ecmproduct_id='$p->id'
AND deleted=0 LIMIT 0,1"));
if (isset($pricebookPrice)) {
$price_start = $pricebookPrice['price'];
echo " Cena: ".$price_start." (<a href=\"https://crm.e5.pl/index.php?module=EcmPriceBooks&action=DetailView&record=3e78ac33-7c46-1b94-0a67-653a17c06f9e\" target=\"new\">Amazon_2023</a>)<br>";
} else {
// invoice price?
$fvPrice = $db->fetchByAssoc($db->query(" $fvPrice = $db->fetchByAssoc($db->query("
SELECT i.id, i.document_no, ii.price_start, ii.ecmvat_value, ii.ecmvat_name, ii.ecmvat_id SELECT i.id, i.document_no, ii.price_start, ii.ecmvat_value, ii.ecmvat_name, ii.ecmvat_id
FROM ecminvoiceoutitems AS ii FROM ecminvoiceoutitems AS ii
@@ -74,7 +85,8 @@
echo " <b>Brak ceny</b><br>"; echo " <b>Brak ceny</b><br>";
} else { } else {
$price_start = $fvPrice['price_start']; $price_start = $fvPrice['price_start'];
echo " cena: ".$price_start." (<a href=\"https://crm.e5.pl/index.php?module=EcmInvoiceOuts&action=DetailView&record=".$fvPrice['id']."\" target=\"new\">".$fvPrice['document_no']."</a>)<br>"; echo " Cena: ".$price_start." (<a href=\"https://crm.e5.pl/index.php?module=EcmInvoiceOuts&action=DetailView&record=".$fvPrice['id']."\" target=\"new\">".$fvPrice['document_no']."</a>)<br>";
}
} }
$prod = array(); $prod = array();
@@ -176,7 +188,6 @@
NIP: ".$sale->shipping_nip." NIP: ".$sale->shipping_nip."
ILN: ".$sale->shipping_iln; ILN: ".$sale->shipping_iln;
$newId = $new->save(true); $newId = $new->save(true);
//update E5 number in Twinpol //update E5 number in Twinpol

View File

@@ -1,5 +1,5 @@
<?php <?php
// created: 2025-03-31 14:19:04 // created: 2025-04-10 09:38:48
$customDoms = array ( $customDoms = array (
'ecmproducts_attribute_dom' => 'ecmproducts_attribute_dom' =>
array ( array (
@@ -75,6 +75,7 @@ $customDoms = array (
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g', '225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g',
'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml', 'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml',
'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Bottle B1_30ml', 'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Bottle B1_30ml',
'8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack',
), ),
'ecmproducts_brand_dom' => 'ecmproducts_brand_dom' =>
array ( array (
@@ -163,6 +164,7 @@ $customDoms = array (
'661388b9-ac42-d5a8-2503-67b856a06f52' => 'Coffeeano', '661388b9-ac42-d5a8-2503-67b856a06f52' => 'Coffeeano',
'1f9d4c5d-670e-4c77-d4de-67cddc908559' => 'DeCal', '1f9d4c5d-670e-4c77-d4de-67cddc908559' => 'DeCal',
'5c883b90-f1fb-83d1-6347-67dbd49469f0' => 'EntertainME', '5c883b90-f1fb-83d1-6347-67dbd49469f0' => 'EntertainME',
'b1df2c57-aef2-290f-c207-67f7916afed9' => 'Mistify',
), ),
'ecmproducts_category_dom' => 'ecmproducts_category_dom' =>
array ( array (

View File

@@ -1,5 +1,5 @@
<?php <?php
// created: 2025-03-31 14:19:04 // created: 2025-04-10 09:38:48
$customDoms = array ( $customDoms = array (
'ecmproducts_attribute_dom' => 'ecmproducts_attribute_dom' =>
array ( array (
@@ -75,6 +75,7 @@ $customDoms = array (
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g', '225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g',
'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml', 'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml',
'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Butelka B1_30ml', 'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Butelka B1_30ml',
'8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack',
), ),
'ecmproducts_brand_dom' => 'ecmproducts_brand_dom' =>
array ( array (
@@ -163,6 +164,7 @@ $customDoms = array (
'661388b9-ac42-d5a8-2503-67b856a06f52' => 'Coffeeano', '661388b9-ac42-d5a8-2503-67b856a06f52' => 'Coffeeano',
'1f9d4c5d-670e-4c77-d4de-67cddc908559' => 'DeCal', '1f9d4c5d-670e-4c77-d4de-67cddc908559' => 'DeCal',
'5c883b90-f1fb-83d1-6347-67dbd49469f0' => 'EntertainME', '5c883b90-f1fb-83d1-6347-67dbd49469f0' => 'EntertainME',
'b1df2c57-aef2-290f-c207-67f7916afed9' => 'Mistify',
), ),
'ecmproducts_category_dom' => 'ecmproducts_category_dom' =>
array ( array (

View File

@@ -114,9 +114,11 @@ class EcmInvoiceOut extends SugarBean {
var $user; var $user;
var $mfp; var $mfp;
var $canceled; var $canceled;
// added 4.03.2009
var $pricebook_id; var $pricebook_id;
var $show_recipient_code; var $show_recipient_code;
var $total_netto;
var $total_brutto;
var $vats_summary;
// RELATED FIELDS // RELATED FIELDS
var $created_by; var $created_by;
var $created_by_name; var $created_by_name;

View File

@@ -55,7 +55,8 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
// SHOULD INCLUDE SELECTIVELY // SHOULD INCLUDE SELECTIVELY
class EcmProduct extends SugarBean { class EcmProduct extends SugarBean
{
var $field_name_map = array(); var $field_name_map = array();
// STANDARD FIELDS // STANDARD FIELDS
var $id; var $id;
@@ -162,11 +163,8 @@ class EcmProduct extends SugarBean {
var $status; var $status;
var $add_status; var $add_status;
var $models; var $models;
var $position_list; var $position_list;
var $th; var $th;
var $url1; var $url1;
var $url2; var $url2;
var $url3; var $url3;
@@ -176,6 +174,7 @@ class EcmProduct extends SugarBean {
var $url7; var $url7;
var $url8; var $url8;
var $url9; var $url9;
var $ean;
// RELATED FIELDS // RELATED FIELDS
var $created_by; var $created_by;
@@ -194,34 +193,36 @@ class EcmProduct extends SugarBean {
// USED TO RETRIEVE RELATED FIELDS FROM FORM POSTS. // USED TO RETRIEVE RELATED FIELDS FROM FORM POSTS.
var $additional_column_fields = Array( var $additional_column_fields = array(
'assigned_user_name', 'assigned_user_name',
'assigned_user_id', 'assigned_user_id',
'modified_user_id', 'modified_user_id',
'created_by', 'created_by',
); );
var $relationship_fields = Array( var $relationship_fields = array(
//RELATIONSHIP FIELDS //RELATIONSHIP FIELDS
); );
function EcmProduct() { function EcmProduct()
{
parent::SugarBean(); parent::SugarBean();
$this->setupCustomFields('EcmProducts'); $this->setupCustomFields('EcmProducts');
foreach ($this->field_defs as $field) foreach ($this->field_defs as $field) {
{
$this->field_name_map[$field['name']] = $field; $this->field_name_map[$field['name']] = $field;
} }
} }
var $new_schema = true; var $new_schema = true;
function get_summary_text(){ function get_summary_text()
{
return "$this->name"; return "$this->name";
} }
function create_list_query($order_by, $where, $show_deleted = 0){ function create_list_query($order_by, $where, $show_deleted = 0)
{
// Fill in the assigned_user_name // Fill in the assigned_user_name
$custom_join = $this->custom_fields->getJOIN(); $custom_join = $this->custom_fields->getJOIN();
$query = "SELECT "; $query = "SELECT ";
@@ -253,8 +254,7 @@ class EcmProduct extends SugarBean {
$query .= "where " . $where_auto; $query .= "where " . $where_auto;
if (substr_count($order_by, '.') > 0) { if (substr_count($order_by, '.') > 0) {
$query .= " ORDER BY $order_by"; $query .= " ORDER BY $order_by";
} } else if ($order_by != "")
else if($order_by != "")
$query .= " ORDER BY $order_by"; $query .= " ORDER BY $order_by";
else else
$query .= " ORDER BY ecmproducts.name"; $query .= " ORDER BY ecmproducts.name";
@@ -262,7 +262,8 @@ class EcmProduct extends SugarBean {
return $query; return $query;
} }
function create_export_query($order_by, $where){ function create_export_query($order_by, $where)
{
$custom_join = $this->custom_fields->getJOIN(); $custom_join = $this->custom_fields->getJOIN();
$query = "SELECT $query = "SELECT
ecmproducts.*, ecmproducts.*,
@@ -294,10 +295,10 @@ class EcmProduct extends SugarBean {
return $query; return $query;
} }
function fill_in_additional_list_fields(){ function fill_in_additional_list_fields() {}
}
function fill_in_additional_detail_fields(){ function fill_in_additional_detail_fields()
{
// FILL IN THE ASSIGNED_USER_NAME // FILL IN THE ASSIGNED_USER_NAME
$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
$this->created_by_name = get_assigned_user_name($this->created_by); $this->created_by_name = get_assigned_user_name($this->created_by);
@@ -319,7 +320,8 @@ class EcmProduct extends SugarBean {
//$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='".$this->id."'")); //$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='".$this->id."'"));
//$this->ems_qty_in_stock = $r['qty']; //$this->ems_qty_in_stock = $r['qty'];
} }
function getSale($date){ function getSale($date)
{
foreach ($date as $d) { foreach ($date as $d) {
$z = "select $z = "select
sum( sum(
@@ -394,10 +396,10 @@ class EcmProduct extends SugarBean {
} }
//echo $total_s." ".$total_p." ".$total_q."<br>"; //echo $total_s." ".$total_p." ".$total_q."<br>";
return array("sale" => $total_s, "purchase" => $total_p, "quantity" => $total_q); return array("sale" => $total_s, "purchase" => $total_p, "quantity" => $total_q);
} }
function get_list_view_data(){ function get_list_view_data()
{
global $current_language, $current_user; global $current_language, $current_user;
global $numerek; global $numerek;
$numerek = $this->id; $numerek = $this->id;
@@ -416,7 +418,6 @@ class EcmProduct extends SugarBean {
//chmod('modules/EcmProducts/upload/images/'.$this->product_picture,777); //chmod('modules/EcmProducts/upload/images/'.$this->product_picture,777);
if (file_exists('modules/EcmProducts/upload/images/' . $this->product_picture) && $this->product_picture) { if (file_exists('modules/EcmProducts/upload/images/' . $this->product_picture) && $this->product_picture) {
$the_array['IMAGE'] = '<img src="pic.php?p=modules/EcmProducts/upload/images/' . $this->product_picture . '&w=90&h=84" border="0">'; $the_array['IMAGE'] = '<img src="pic.php?p=modules/EcmProducts/upload/images/' . $this->product_picture . '&w=90&h=84" border="0">';
} }
$the_array['STOCK_QTY'] = 0; $the_array['STOCK_QTY'] = 0;
$op = new EcmStockOperation(); $op = new EcmStockOperation();
@@ -434,12 +435,10 @@ class EcmProduct extends SugarBean {
if ($_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_basic']) { if ($_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_basic']) {
$sid = $_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_basic']; $sid = $_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_basic'];
$st = " and stock_id='" . $sid . "'"; $st = " and stock_id='" . $sid . "'";
} } elseif ($_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_advanced']) {
elseif($_SESSION[$current_user->user_name.'_PREFERENCES']['global']['EcmProductsQ']['stock_id_advanced']) {
$sid = $_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_advanced']; $sid = $_SESSION[$current_user->user_name . '_PREFERENCES']['global']['EcmProductsQ']['stock_id_advanced'];
$st = " and stock_id='" . $sid . "'"; $st = " and stock_id='" . $sid . "'";
} } else $st = "";
else $st="";
$this->retrieve($this->id); $this->retrieve($this->id);
@@ -517,8 +516,7 @@ class EcmProduct extends SugarBean {
if ($this->flag) { if ($this->flag) {
$flag = 0; $flag = 0;
$color = "red"; $color = "red";
} } else {
else {
$flag = 1; $flag = 1;
$color = "#cccccc"; $color = "#cccccc";
} }
@@ -540,8 +538,9 @@ class EcmProduct extends SugarBean {
BUILDS A GENERIC SEARCH BASED ON THE QUERY STRING USING OR. BUILDS A GENERIC SEARCH BASED ON THE QUERY STRING USING OR.
DO NOT INCLUDE ANY $THIS-> BECAUSE THIS IS CALLED ON WITHOUT HAVING THE CLASS INSTANTIATED. DO NOT INCLUDE ANY $THIS-> BECAUSE THIS IS CALLED ON WITHOUT HAVING THE CLASS INSTANTIATED.
*/ */
function build_generic_where_clause ($the_query_string) { function build_generic_where_clause($the_query_string)
$where_clauses = Array(); {
$where_clauses = array();
$the_query_string = PearDatabase::quote(from_html($the_query_string)); $the_query_string = PearDatabase::quote(from_html($the_query_string));
array_push($where_clauses, "ecmproducts.name like '$the_query_string%'"); array_push($where_clauses, "ecmproducts.name like '$the_query_string%'");
@@ -553,7 +552,8 @@ class EcmProduct extends SugarBean {
return $the_where; return $the_where;
} }
function set_notification_body($xtpl, $simplemodule){ function set_notification_body($xtpl, $simplemodule)
{
global $mod_strings, $app_list_strings; global $mod_strings, $app_list_strings;
$xtpl->assign("NAME", $simplemodule->name); $xtpl->assign("NAME", $simplemodule->name);
@@ -561,19 +561,23 @@ class EcmProduct extends SugarBean {
return $xtpl; return $xtpl;
} }
function bean_implements($interface){ function bean_implements($interface)
{
switch ($interface) { switch ($interface) {
case 'ACL':return true; case 'ACL':
return true;
} }
return false; return false;
} }
function r($t){ function r($t)
{
$t = str_replace(".", "", $t); $t = str_replace(".", "", $t);
$t = str_replace(",", ".", $t); $t = str_replace(",", ".", $t);
$t = floatval($t); $t = floatval($t);
return $t; return $t;
} }
function save($check_notify = FALSE){ function save($check_notify = FALSE)
{
include("modules/EcmProducts/generateEAN.php"); include("modules/EcmProducts/generateEAN.php");
if ($_REQUEST['newEan'] == '1') $_REQUEST['ean'] = generateEan(1); if ($_REQUEST['newEan'] == '1') $_REQUEST['ean'] = generateEan(1);
if ($_REQUEST['newEan2'] == '1') $this->ean2 = generateEAN(2); if ($_REQUEST['newEan2'] == '1') $this->ean2 = generateEAN(2);
@@ -592,8 +596,7 @@ class EcmProduct extends SugarBean {
//echo $z; //echo $z;
$GLOBALS['db']->query($z); $GLOBALS['db']->query($z);
header("Location: index.php?module=EcmProducts&action=index"); header("Location: index.php?module=EcmProducts&action=index");
} } else {
else{
$return_id = parent::save($check_notify); $return_id = parent::save($check_notify);
//$components = self::ParseComponentsFromPOST(); //$components = self::ParseComponentsFromPOST();
@@ -611,7 +614,8 @@ class EcmProduct extends SugarBean {
} }
static function ParseComponentsFromPOST() { static function ParseComponentsFromPOST()
{
if (isset($_POST['position_list'])) { if (isset($_POST['position_list'])) {
$c_ = $_POST['position_list']; $c_ = $_POST['position_list'];
$json = getJSONobj(); $json = getJSONobj();
@@ -621,7 +625,8 @@ class EcmProduct extends SugarBean {
return false; return false;
} }
//***************************Start Managing Positions*************************// //***************************Start Managing Positions*************************//
function constructInsertQuery($data, $table = '') { function constructInsertQuery($data, $table = '')
{
if ($table == '' && isset($this->object_name) && $this->object_name != '') { if ($table == '' && isset($this->object_name) && $this->object_name != '') {
$table = strtolower($this->object_name) . "components"; $table = strtolower($this->object_name) . "components";
@@ -645,7 +650,8 @@ class EcmProduct extends SugarBean {
return $q; return $q;
} }
function savePositions($id = null, $position_list = null) { function savePositions($id = null, $position_list = null)
{
global $current_user, $timedate; global $current_user, $timedate;
@@ -719,9 +725,9 @@ class EcmProduct extends SugarBean {
$this->db->query($this->constructInsertQuery($arr)); $this->db->query($this->constructInsertQuery($arr));
$position++; $position++;
} }
} }
function getPosition($position) { function getPosition($position)
{
global $app_list_strings; global $app_list_strings;
@@ -774,9 +780,9 @@ LIMIT 0,1
$return_array['ems_price'] = $c['purchase_price']; $return_array['ems_price'] = $c['purchase_price'];
return $return_array; return $return_array;
} }
function getPositionList($array = false) { function getPositionList($array = false)
{
if (isset($this->id) && $this->id != '') { if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM `ecmproductcomponents` WHERE `ecmproduct_id`='" . $this->id . "' order by position asc"; $query = "SELECT * FROM `ecmproductcomponents` WHERE `ecmproduct_id`='" . $this->id . "' order by position asc";
$r = $this->db->query($query); $r = $this->db->query($query);
@@ -791,7 +797,8 @@ LIMIT 0,1
} }
return $array ? false : '[]'; return $array ? false : '[]';
} }
function deleteAssignedPositions() { function deleteAssignedPositions()
{
if (isset($this->id) && $this->id != '') { if (isset($this->id) && $this->id != '') {
$query = "DELETE FROM `" . strtolower($this->object_name) . "components` WHERE `" . strtolower($this->object_name) . "_id`='" . $this->id . "'"; $query = "DELETE FROM `" . strtolower($this->object_name) . "components` WHERE `" . strtolower($this->object_name) . "_id`='" . $this->id . "'";
$r = $this->db->query($query); $r = $this->db->query($query);
@@ -801,7 +808,8 @@ LIMIT 0,1
} }
//***************************End Managing Positions*************************// //***************************End Managing Positions*************************//
//start managing categories //start managing categories
function savePositions3($pl) { function savePositions3($pl)
{
global $current_user; global $current_user;
$exists = array(); $exists = array();
@@ -828,7 +836,6 @@ LIMIT 0,1
$GLOBALS['db']->query($q); $GLOBALS['db']->query($q);
$exists[] = $p['id']; $exists[] = $p['id'];
} else { } else {
//insert new record //insert new record
$id = create_guid(); $id = create_guid();
@@ -853,7 +860,8 @@ LIMIT 0,1
$GLOBALS['db']->query("UPDATE ecmproductcategories_bean SET deleted='1', modified_user_id='" . $current_user->id . "',date_modified = '" . date("Y-m-d H:i:s") . "' WHERE bean_id='" . $this->id . "' AND id NOT IN ('" . implode("','", $exists) . "')"); $GLOBALS['db']->query("UPDATE ecmproductcategories_bean SET deleted='1', modified_user_id='" . $current_user->id . "',date_modified = '" . date("Y-m-d H:i:s") . "' WHERE bean_id='" . $this->id . "' AND id NOT IN ('" . implode("','", $exists) . "')");
} }
function getPositionList3($array = false) { function getPositionList3($array = false)
{
if (isset($this->id) && $this->id != '') { if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM ecmproductcategories_bean WHERE bean_id='" . $this->id . "' AND deleted='0' AND bean_name='EcmProducts'"; $query = "SELECT * FROM ecmproductcategories_bean WHERE bean_id='" . $this->id . "' AND deleted='0' AND bean_name='EcmProducts'";
@@ -867,7 +875,6 @@ LIMIT 0,1
$w['ecmproductcategory_name'] = $n['name']; $w['ecmproductcategory_name'] = $n['name'];
$w['assigned_file'] = $n['assigned_file']; $w['assigned_file'] = $n['assigned_file'];
$return_array[] = $w; $return_array[] = $w;
} }
$json = getJSONobj(); $json = getJSONobj();
@@ -877,7 +884,8 @@ LIMIT 0,1
return $array ? false : '[]'; return $array ? false : '[]';
} }
function showPositions3(){ function showPositions3()
{
$arr = $this->getPositionList3(true); $arr = $this->getPositionList3(true);
@@ -917,7 +925,8 @@ LIMIT 0,1
//end managing categories //end managing categories
//prices manage //prices manage
function savePrices($prices) { function savePrices($prices)
{
if (!is_array($prices)) return null; if (!is_array($prices)) return null;
$fields = array('id', 'ecmprice_id', 'ecmproduct_id', 'price'); $fields = array('id', 'ecmprice_id', 'ecmproduct_id', 'price');
@@ -944,7 +953,8 @@ LIMIT 0,1
$db->query("delete from ecmprices_ecmproducts where ecmproduct_id='" . $this->id . "' AND id NOT IN ('" . implode("','", $new) . "')"); $db->query("delete from ecmprices_ecmproducts where ecmproduct_id='" . $this->id . "' AND id NOT IN ('" . implode("','", $new) . "')");
} }
function getPricePosition($position) { function getPricePosition($position)
{
if (!is_array($position)) return ''; if (!is_array($position)) return '';
global $timedate; global $timedate;
@@ -960,7 +970,8 @@ LIMIT 0,1
//var_dump($return_array); //var_dump($return_array);
return $return_array; return $return_array;
} }
function getPricesList($array = false) { function getPricesList($array = false)
{
if (isset($this->id) && $this->id != '') { if (isset($this->id) && $this->id != '') {
$query = "SELECT p.id as id, p.name as name, pp.price as price FROM ecmprices as p $query = "SELECT p.id as id, p.name as name, pp.price as price FROM ecmprices as p
LEFT JOIN ecmprices_ecmproducts as pp LEFT JOIN ecmprices_ecmproducts as pp
@@ -983,7 +994,8 @@ LIMIT 0,1
return $array ? false : '[]'; return $array ? false : '[]';
} }
function showPrices(){ function showPrices()
{
$arr = $this->getPricesList(true); $arr = $this->getPricesList(true);
if (count($arr) > 0) { if (count($arr) > 0) {
$table = ' $table = '
@@ -1008,7 +1020,8 @@ LIMIT 0,1
return $table; return $table;
} }
//end manage prices //end manage prices
function getProductResInfo($product_id, $stock_id) { function getProductResInfo($product_id, $stock_id)
{
$info = array(); $info = array();
global $db; global $db;
@@ -1043,7 +1056,8 @@ LIMIT 0,1
//search product by EAN //search product by EAN
//simply try found product_id and executa function below //simply try found product_id and executa function below
static function mobile_getProductInfoByEAN($params) { static function mobile_getProductInfoByEAN($params)
{
$ean = trim($params['product_ean']); $ean = trim($params['product_ean']);
if (!$ean || $ean == "") if (!$ean || $ean == "")
return -2; return -2;
@@ -1065,14 +1079,16 @@ LIMIT 0,1
return EcmProduct::mobile_getProductInfo( return EcmProduct::mobile_getProductInfo(
array( array(
'product_id' => $prod['id'] 'product_id' => $prod['id']
)); )
);
} }
//ERROR CODES //ERROR CODES
// -2 - wrong paramaters // -2 - wrong paramaters
// -3 - can't find object // -3 - can't find object
static function mobile_getProductInfo($params) { static function mobile_getProductInfo($params)
{
$app_list_strings = return_app_list_strings_language("pl_pl"); $app_list_strings = return_app_list_strings_language("pl_pl");
$product_id = $params['product_id']; $product_id = $params['product_id'];
@@ -1127,4 +1143,3 @@ LIMIT 0,1
return $result; return $result;
} }
} }
?>

View File

@@ -119,6 +119,24 @@ class EcmSale extends SugarBean
// added 4.03.2009 // added 4.03.2009
var $pricebook_id; var $pricebook_id;
var $show_recipient_code; var $show_recipient_code;
var $vats_summary;
var $shipping_address_name;
var $shipping_address_street;
var $shipping_address_postalcode;
var $shipping_address_city;
var $shipping_address_country;
var $shipping_iln;
var $shipping_nip;
var $edi_zs_id;
var $edi_zs_document_no;
var $pdf_text;
var $parent_nip;
var $parent_iln;
var $total_netto;
var $total_brutto;
var $send_date;
var $delivery_date;
var $parent_document_no;
// RELATED FIELDS // RELATED FIELDS
var $created_by; var $created_by;
var $created_by_name; var $created_by_name;

View File

@@ -29,12 +29,12 @@ if (isset($_GET['ids'])) {
order by date_entered"); order by date_entered");
} }
brecho($codes);
//die();
while($r=$GLOBALS['db']->fetchByAssoc($w)){ while($r=$GLOBALS['db']->fetchByAssoc($w)){
if(!in_array($r['stock_id'],$sarr))$sarr[]=$r['stock_id']; if(!in_array($r['stock_id'],$sarr))$sarr[]=$r['stock_id'];
if(!in_array($r['product_id'],$parr))$parr[]=$r['product_id']; if(!in_array($r['product_id'],$parr))$parr[]=$r['product_id'];
brecho($r['stock_id'],$r['product_id']);
} }
for($i=0;$i<count($parr);$i++){ for($i=0;$i<count($parr);$i++){