Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#37524 change Warenpost to Kleinpaket #18

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Mediaopt\DHL\Controller\Admin;


use Mediaopt\DHL\Install;
use Mediaopt\DHL\Model\MoDHLInternetmarkeProductList;
use Mediaopt\DHL\Shipment\Participation;
use Mediaopt\DHL\Shipment\Process;
Expand All @@ -33,6 +34,11 @@ public function render()
if (isset($id) && $id != "-1") {
$deliverySet = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class);
$deliverySet->load($id);
if ($deliverySet->getFieldData('mo_dhl_process') === 'WARENPOST') {
Install::changeWarenpostToKleinpaket();
$deliverySet->oxdeliveryset__mo_dhl_process->setValue(Process::KLEINPAKET);
$deliverySet->load($id);
}
$this->addTplParam("edit", $deliverySet);
if ($deliverySet->isDerived()) {
$this->addTplParam('readonly', true);
Expand Down
6 changes: 6 additions & 0 deletions src/modules/mo/mo_dhl/Controller/Admin/OrderDHLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Mediaopt\DHL\Api\ParcelShipping\Client;
use Mediaopt\DHL\Api\ParcelShipping\Model\ShipmentOrderRequest;
use Mediaopt\DHL\Api\Wunschpaket;
use Mediaopt\DHL\Install;
use Mediaopt\DHL\Merchant\Ekp;
use Mediaopt\DHL\Model\MoDHLInternetmarkeRefund;
use Mediaopt\DHL\Model\MoDHLLabel;
Expand Down Expand Up @@ -265,6 +266,11 @@ protected function getParticipationNumber()
protected function getProcess()
{
if ($processNr = $this->getOrder()->oxorder__mo_dhl_process->rawValue) {
if ($processNr === 'WARENPOST') {
Install::changeWarenpostToKleinpaket();
$this->order->oxorder__mo_dhl_process->setValue('KLEINPAKET');
$processNr = 'KLEINPAKET';
}
return Process::build($processNr);
}
return null;
Expand Down
8 changes: 8 additions & 0 deletions src/modules/mo/mo_dhl/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ public static function onActivate()
static::addColumns();
static::alterColumns();
static::ensureDocumentsFolderExists();
static::changeWarenpostToKleinpaket();
static::cleanUp();
}

public static function changeWarenpostToKleinpaket()
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$db->execute("UPDATE oxorder SET MO_DHL_PROCESS = 'KLEINPAKET' WHERE MO_DHL_PROCESS = 'WARENPOST'");
$db->execute("UPDATE oxdeliveryset SET MO_DHL_PROCESS = 'KLEINPAKET' WHERE MO_DHL_PROCESS = 'WARENPOST'");
}

protected static function ensureDocumentsFolderExists()
{
$path = Registry::get(ViewConfig::class)->getModulePath('mo_dhl', '') . 'documents';
Expand Down
Loading