Files
2026-04-28 15:13:50 +02:00

41 lines
1.1 KiB
PHP

<?php
/**
* End of Week Collecetion.
*
* @package PaczkomatyInpost
*/
/**
* Handles End of Week Collection functionality on shipment.
*/
class WPDesk_Paczkomaty_End_Of_Week_Collection extends WPDesk_Paczkomaty_Abstract_Shipment_Field_Checkbox {
const META_PACZKOMATY_END_OF_WEEK_COLLECTION = '_paczkomaty_end_of_week_collection';
const FIELD_PACZKOMATY_END_OF_WEEK_COLLECTION = 'paczkomaty_end_of_week_collection';
/**
* WPDesk_Paczkomaty_End_Of_Week_Collection constructor.
*
* @param WPDesk_Flexible_Shipping_Shipment_Paczkomaty $shipment .
*/
public function __construct( $shipment ) {
parent::__construct( self::FIELD_PACZKOMATY_END_OF_WEEK_COLLECTION, self::META_PACZKOMATY_END_OF_WEEK_COLLECTION, $shipment );
}
/**
* .
*
* @param stdClass $shipment_data .
*
* @return stdClass
* @throws WPDesk_Paczkomaty_ShipX_Exception .
*/
public function modify_shipment_data( $shipment_data ) {
if ( intval( $this->shipment->get_meta( $this->meta_name, '0' ) ) === 1 && 'paczkomaty' === $this->shipment->get_inpost_service() ) {
$shipment_data->end_of_week_collection = true;
}
return $shipment_data;
}
}