Fixed: Missing Hotel API support for nationality, room selling, and property type
Co-authored-by: Name <azharbhat.qlo098@webkul.in>
This commit is contained in:
@@ -37,11 +37,65 @@ class RoomTypeSellingObjectCore extends ObjectModel
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true),
|
||||
'plural_name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true),
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
|
||||
'plural_name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
|
||||
),
|
||||
);
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'room_type_selling_objects',
|
||||
'objectNodeName' => 'room_type_selling_object',
|
||||
'objectMethods' => array('update' => 'updateWs', 'delete' => 'deleteWs'),
|
||||
'fields' => array(
|
||||
'name' => array('required' => true),
|
||||
'plural_name' => array('required' => true),
|
||||
'active' => array('required' => false),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Webservice: update, refusing to disable a selling object that is in use.
|
||||
*
|
||||
* @param bool $nullValues
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws WebserviceException
|
||||
*/
|
||||
public function updateWs($nullValues = false)
|
||||
{
|
||||
if (!$this->active && $this->id) {
|
||||
$objOld = new RoomTypeSellingObject((int) $this->id);
|
||||
if (Validate::isLoadedObject($objOld) && $objOld->active && $objOld->isUsed()) {
|
||||
throw new WebserviceException(
|
||||
Tools::displayError('You cannot disable this selling object because it is currently assigned.'),
|
||||
array(400, 400)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->update($nullValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Webservice: delete, refusing to delete a selling object that is in use.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws WebserviceException
|
||||
*/
|
||||
public function deleteWs()
|
||||
{
|
||||
if ($this->isUsed()) {
|
||||
throw new WebserviceException(
|
||||
Tools::displayError('You cannot delete this selling object because it is currently assigned.'),
|
||||
array(400, 400)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->delete();
|
||||
}
|
||||
|
||||
public function isUsed()
|
||||
{
|
||||
return (bool) Db::getInstance()->getValue(
|
||||
|
||||
Reference in New Issue
Block a user