AnsweredAssumed Answered

Prevent deletion of some products

Question asked by karl el escobar on Apr 25, 2019
Latest reply on Apr 25, 2019 by karl el escobar

Hello i want to disable delete or prevent them from deleting certain products in some module when user clicks delete button. Is there any experts who knows this ? Thanks in advance any help would be appreciated.

found a sample code trying to put it together but i think there something more missing. sorry im pretty new with this:

<?php

if (isset($_REQUEST['action'])
    && $_REQUEST['action'] == 'DetailView'){

    $sql = 'update AOS_Products set deleted = 0 where id ="'.$bean->id.'"p';
    $result = $GLOBALS['db']->query($sql);
    $GLOBALS['db']->fetchByAssoc($result);

} else{
    SugarApplication::appendErrorMessage("Warning: this product shouldn't be deleted.");
}

 

Outcomes