This commit is contained in:
2025-06-27 16:13:26 +02:00
parent 67e66e60d6
commit c7edf5e67b
6 changed files with 471 additions and 464 deletions

View File

@@ -1,11 +1,11 @@
<?php
/*
* 2012 Firmes
* 2012 Firmes
* Mechanizmy obs³ugi rozszerzenia FirmesLink B2B
* Obsluga wyswietlania historii dokumentow
*/
class B2BDocument extends ObjectModel
class B2BDocument extends ObjectModel
{
protected $_taxCalculationMethod = PS_TAX_EXC;
@@ -21,8 +21,8 @@ class B2BDocument extends ObjectModel
{
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT COUNT(do_documentId) AS count
FROM `yfi_documents`
INNER JOIN `yfi_customerinfo` ON do_payerCustomerId = ci_customerId
FROM `yfi_documents`
INNER JOIN `yfi_customerinfo` ON do_payerCustomerId = ci_customerId
WHERE ci_shopCustomerId = '.(int)$id_customer.'');
if (!$res)
return array();
@@ -35,8 +35,8 @@ class B2BDocument extends ObjectModel
global $cookie;
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
do_sourceId AS source_id
SELECT
do_sourceId AS source_id
, do_documentId AS document_id
, do_fullNumber AS number
, do_date AS date
@@ -49,12 +49,12 @@ class B2BDocument extends ObjectModel
, yfi_documents.*
, pdf.*
, epp.db_binaryId AS \'eppid\', epp.db_file AS \'eppfile\'
FROM `yfi_documents`
FROM `yfi_documents`
INNER JOIN `yfi_customerinfo` ON do_payerCustomerId = ci_customerId
LEFT JOIN `yfi_documentbinaries` pdf ON do_documentId = pdf.db_binaryId AND do_sourceId = pdf.db_sourceId
LEFT JOIN `yfi_documentbinaries` epp ON do_documentId = (epp.db_binaryId * -1) AND do_sourceId = epp.db_sourceId
LEFT JOIN `yfi_documentbinaries` pdf ON do_documentId = pdf.db_binaryId AND do_sourceId = pdf.db_sourceId
LEFT JOIN `yfi_documentbinaries` epp ON do_documentId = (epp.db_binaryId * -1) AND do_sourceId = epp.db_sourceId
WHERE ci_shopCustomerId = '.(int)$id_customer.'
ORDER BY do_date DESC, do_documentId DESC
ORDER BY do_executionDate DESC, do_documentId DESC
LIMIT '.$start.', '.$limit.'');
if (!$res)
return array();
@@ -70,7 +70,7 @@ class B2BDocument extends ObjectModel
$whereSQL = ($binary_id == 0)? '':' AND db_binaryId = '.$binary_id;
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
SELECT
do_sourceId AS source_id
, do_documentId AS document_id
, do_fullNumber AS number
@@ -83,14 +83,14 @@ class B2BDocument extends ObjectModel
, do_title AS title
, yfi_documents.*
, yfi_documentbinaries.*
FROM `yfi_documents`
FROM `yfi_documents`
INNER JOIN `yfi_customerinfo` ON do_payerCustomerId = ci_customerId
LEFT JOIN `yfi_documentbinaries` ON do_documentId = db_documentId AND do_sourceId = db_sourceId
WHERE ci_shopCustomerId = '.(int)$id_customer.' AND do_documentId = '.(int)$document_id .' AND do_sourceId = '.(int)$source_id .''.$whereSQL.'
LEFT JOIN `yfi_documentbinaries` ON do_documentId = db_documentId AND do_sourceId = db_sourceId
WHERE ci_shopCustomerId = '.(int)$id_customer.' AND do_documentId = '.(int)$document_id .' AND do_sourceId = '.(int)$source_id .''.$whereSQL.'
ORDER BY do_date DESC, do_documentId DESC');
if (!$res)
return array();
return $res[0];
}
@@ -99,7 +99,7 @@ class B2BDocument extends ObjectModel
global $cookie;
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
SELECT
di_productName AS product_name
, di_quantity AS quantity
, di_unitOfMeasure AS unit
@@ -110,7 +110,7 @@ class B2BDocument extends ObjectModel
, di_totalGros AS total_gros
, di_discount AS discount
, yfi_documentitems.*
FROM `yfi_documentitems`
FROM `yfi_documentitems`
WHERE di_documentId = '.(int)$document_id .' AND di_sourceId = '.(int)$source_id .'
ORDER BY di_documentItemId DESC');
if (!$res)
@@ -125,7 +125,7 @@ class B2BDocument extends ObjectModel
global $cookie;
$sql = '
SELECT
SELECT
bi_sourceId,
bi_binaryId,
bi_objectId,
@@ -139,7 +139,7 @@ class B2BDocument extends ObjectModel
bi_shopBinaryId,
bi_shopObjectId,
bi_timestamp
FROM `yfi_binaries`
FROM `yfi_binaries`
INNER JOIN `yfi_documents` ON bi_objectId = do_documentId AND do_sourceId = bi_sourceId
WHERE do_documentId = '.(int)$document_id.' AND bi_sourceId = '.(int)$source_id.' ORDER BY bi_objectId';
@@ -155,7 +155,7 @@ class B2BDocument extends ObjectModel
global $cookie;
$sql = '
SELECT
SELECT
bi_sourceId,
bi_binaryId,
bi_objectId,
@@ -169,7 +169,7 @@ class B2BDocument extends ObjectModel
bi_shopBinaryId,
bi_shopObjectId,
bi_timestamp
FROM `yfi_binaries`
FROM `yfi_binaries`
INNER JOIN `yfi_documents` ON bi_objectId = do_documentId AND do_sourceId = bi_sourceId
WHERE bi_binaryId = '.(int)$file_document_id.' AND bi_sourceId = '.(int)$source_id.'';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long