Copy room preserving complex tariff

More
9 years 9 months ago #4588 by improntedigitali
Copy room preserving complex tariff was created by improntedigitali
Hi!
I have to finish a huge website, with a lot of different tariffs, i'm writing 36 different tariffs per room.
Some rooms have the same price, but when i "SAVE AS COPY", the system didn't keep my complex tariffs!
How can I do? There's a db query I can make?

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #4591 by vietvh
Replied by vietvh on topic Copy room preserving complex tariff
Hi,

It is because tariffs are stored in a separated table, therefore the "Save as copy" has no effect on it.

At this moment, you can hook your modification into the current save method in order to add clone:

/libraries/legacy/controller/form.php, method save()
// The save2copy task needs to be handled slightly differently.
		if ($task == 'save2copy')
		{
			// Check-in the original row.
			if ($checkin && $model->checkin($data[$key]) === false)
			{
				// Check-in failed. Go back to the item and display a notice.
				$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
				$this->setMessage($this->getError(), 'error');

				$this->setRedirect(
					JRoute::_(
						'index.php?option=' . $this->option . '&view=' . $this->view_item
						. $this->getRedirectToItemAppend($recordId, $urlVar), false
					)
				);

				return false;
			}

			// Reset the ID and then treat the request as for Apply.
			$data[$key] = 0;
			$task = 'apply';
		}

If other users have the same interest in this feature, please reply here.
The following user(s) said Thank You: improntedigitali

Please Log in or Create an account to join the conversation.

Moderators: solidres
Powered by Kunena Forum

All the things you need to make your work easier. Did you like Solidres?