Skip to content

Commit

Permalink
Merge pull request #58 from omniva-baltic/Develop
Browse files Browse the repository at this point in the history
Develop from v1.0.17
  • Loading branch information
markakk authored Jun 17, 2024
2 parents 04c74c0 + c52cddb commit ef0f088
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [1.0.18] - Fixes
- fixed filtering of locations by type
- adapted to work with PHP 5.6
- fixed the barcode show when using TCPDF library version 6.7.4 or newer

## [1.0.17] - Improvements
- added error message when receiving a "401 Unauthorized" error
- added debug to all functions in Request class
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Omniva API library, to help to integrate with other systems
- List parcel terminals.

## Requirements
- Minimum PHP 7.0, tested up to PHP 7.4
- Minimum PHP 5.6, tested up to PHP 7.4

## Instalation

Expand Down Expand Up @@ -59,7 +59,7 @@ Use `example/config.php` to enter your API username and password for testing the
//new shipment package object, required
$package = new Package();
$package
->setId('54155454') //id number, optional
->setId('5454') //id number, optional. Use same ID for several Package if want use multiparcels service
->setService('QH'); //service code of package

//create additional services and add to package, optional
Expand All @@ -82,7 +82,7 @@ Use `example/config.php` to enter your API username and password for testing the
->setAmount(66.72) //set cod amount
->setBankAccount('GB33BUKB20201555555555') //set bank account
->setReceiverName('Test Company') //set company name
->setReferenceNumber('23232323232323'); //set reference number of cod
->setReferenceNumber('2323'); //set reference number of COD. For Estonia the number is generated according to Method 7-3-1 (https://www.pangaliit.ee/arveldused/viitenumber/7-3-1meetod)
$package->setCod($cod); //assign cod to package

//set sender and reeiver address
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mijora/omniva-api",
"description": "Omniva API wrapper",
"type": "library",
"version": "1.0.17",
"version": "1.0.18",
"authors": [
{
"name": "Modestas",
Expand Down
1 change: 1 addition & 0 deletions overrides/tcpdf/tcpdf_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

/* Allow generate barcode image */
define('K_TCPDF_CALLS_IN_HTML', true);
define('K_ALLOWED_TCPDF_TAGS', '|write1DBarcode|');
2 changes: 1 addition & 1 deletion src/Locations/PickupPoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getFilteredLocations($country = '', $type = '', $county = '')
$filters = [];
if($country)
$filters['A0_NAME'] = $country;
if($type)
if($type !== '')
$filters['TYPE'] = $type;
if($county)
$filters['A1_NAME'] = $county;
Expand Down
7 changes: 4 additions & 3 deletions src/Shipment/CallCourier.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private function buildXml()
$pickDay = date('Y-m-d', strtotime($pickDay . "+1 days"));
}
$shop_address = $this->sender->getAddress();
$shop_phone = (! empty($this->sender->getPhone())) ? $this->sender->getPhone() : $this->sender->getMobile();
$serviceCode = $this->getServiceCode();
$xml = '
<interchange msg_type="info11">
Expand All @@ -132,17 +133,17 @@ private function buildXml()
<measures weight="1" />
<receiverAddressee >
<person_name>' . $this->sender->getPersonName() . '</person_name>
<phone>' . ($this->sender->getPhone() ?? $this->sender->getMobile()) . '</phone>
<phone>' . $shop_phone . '</phone>
<address postcode="' . $shop_address->getPostCode() . '" deliverypoint="' . $shop_address->getDeliveryPoint() . '" country="' . $shop_address->getCountry() . '" street="' . $shop_address->getStreet() . '" />
</receiverAddressee>
<returnAddressee>
<person_name>' . $this->sender->getPersonName() . '</person_name>
<phone>' . ($this->sender->getPhone() ?? $this->sender->getMobile()) . '</phone>
<phone>' . $shop_phone . '</phone>
<address postcode="' . $shop_address->getPostCode() . '" deliverypoint="' . $shop_address->getDeliveryPoint() . '" country="' . $shop_address->getCountry() . '" street="' . $shop_address->getStreet() . '" />
</returnAddressee>
<onloadAddressee>
<person_name>' . $this->sender->getPersonName() . '</person_name>
<phone>' . ($this->sender->getPhone() ?? $this->sender->getMobile()) . '</phone>
<phone>' . $shop_phone . '</phone>
<address postcode="' . $shop_address->getPostCode() . '" deliverypoint="' . $shop_address->getDeliveryPoint() . '" country="' . $shop_address->getCountry(). '" street="' . $shop_address->getStreet() . '" />
<pick_up_time start="' . date("Y.m.d H:i", strtotime($pickDay . ' ' . $pickStart)) . '" finish="' . date("Y.m.d H:i", strtotime($pickDay . ' ' . $pickFinish)) . '"/>
</onloadAddressee>
Expand Down
8 changes: 6 additions & 2 deletions src/Shipment/Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ public function downloadManifest($mode = 'I', $name = 'Omniva manifest') {
foreach ($this->orders as $order) {
$count++;
$cell_shipment_number = '<td width="' . $this->column_lengths['shipment_number'] . '">' . $order->getTracking() . '</td>';
if ($this->show_barcode) {
$cell_shipment_number = '<td width="' . $this->column_lengths['shipment_number'] . '" style="line-height: 50%;"><tcpdf method="write1DBarcode" params="' . $pdf->serializeTCPDFtagParameters($this->getBarcodeParams($order->getTracking())) . '" /></td>';
if ($this->show_barcode && defined('K_TCPDF_CALLS_IN_HTML') && K_TCPDF_CALLS_IN_HTML === true) {
if (method_exists($pdf, 'serializeTCPDFtagParameters')) {
$cell_shipment_number = '<td width="' . $this->column_lengths['shipment_number'] . '" style="line-height: 50%;"><tcpdf method="write1DBarcode" params="' . $pdf->serializeTCPDFtagParameters($this->getBarcodeParams($order->getTracking())) . '" /></td>';
} elseif (method_exists($pdf, 'serializeTCPDFtag')) {
$cell_shipment_number = '<td width="' . $this->column_lengths['shipment_number'] . '" style="line-height: 50%;"><tcpdf data="' . $pdf->serializeTCPDFtag('write1DBarcode', $this->getBarcodeParams($order->getTracking())) . '" /></td>';
}
}
$order_table .= '<tr>
<td width = "' . $this->column_lengths['row_number'] . '" align="right">' . $count . '.</td>
Expand Down

0 comments on commit ef0f088

Please sign in to comment.