Skip to content
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
8 changes: 8 additions & 0 deletions ajax/createmetademands.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@
$meta_validated = $_POST['meta_validated'];
}

if (isset($PLUGIN_HOOKS['metademands'])) {
foreach ($PLUGIN_HOOKS['metademands'] as $plug => $method) {
if (Plugin::isPluginActive($plug)) {
echo PluginMetademandsMetademand::pluginPreItemAdd($plug);
}
}
}

if ($nofreetable == false) {
if (isset($_POST['see_basket_summary']) && $_POST['see_basket_summary'] == 1) {
$_POST['see_basket_summary'] = 0;
Expand Down
22 changes: 22 additions & 0 deletions inc/metademand.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -8932,6 +8932,28 @@ public static function getPluginUniqueDropdown($plug)
}
}

public static function pluginPreItemAdd($plug)
{
global $PLUGIN_HOOKS;

$dbu = new DbUtils();
if (isset($PLUGIN_HOOKS['metademands'][$plug])) {
$pluginclasses = $PLUGIN_HOOKS['metademands'][$plug];

foreach ($pluginclasses as $pluginclass) {
if (!class_exists($pluginclass)) {
continue;
}
$form[$pluginclass] = [];
$item = $dbu->getItemForItemtype($pluginclass);
if ($item && is_callable([$item, 'preItemAdd'])) {
return $item->preItemAdd();
}
}
}
}


public static function checkPluginUniqueItilcategory($plug, $dbu)
{
global $PLUGIN_HOOKS;
Expand Down