Beispiel #1
0
 /**
  * add customers to group
  */
 public function addCustomersToGroup($group_id, $group_ids_remove)
 {
     require_once 'models/client/client_group.php';
     require_once 'models/client/client_customer.php';
     $ClientGroup = new client_group();
     $Customer = new client_customer();
     //force cache even for back office user
     $Customer->setCacheable(true);
     if ($group_filter = $this->getGroupFilter($group_id)) {
         $customer_list = $Customer->getClientList(0, $group_filter);
         $list_count = count($customer_list);
         if ($Customer->addCustomersToGroupFromList($customer_list, $group_id, $group_ids_remove)) {
             msg("All {$list_count} customers were added to group ID {$group_id}");
             //flush cache as we are using forced cache for client_customer in backoffice
             $Customer->flushCache();
         } else {
             msg("Cannot add {$list_count} customers to group ID {$group_id}", 'error');
             return false;
         }
     } else {
         return false;
     }
 }