Exemplo n.º 1
0
 case 'edit':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an subrg_ID:
     param('subrg_ID', 'integer', true);
     break;
 case 'create':
     // Record new subregion
 // Record new subregion
 case 'create_new':
     // Record subregion and create new
 // Record subregion and create new
 case 'create_copy':
     // Record subregion and create similar
     // Insert new subregion:
     $edited_Subregion = new Subregion();
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('subregion');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Load data from request
     if ($edited_Subregion->load_from_Request()) {
         // We could load data from form without errors:
         // Insert in DB:
         $DB->begin();
         $q = $edited_Subregion->dbexists();
         if ($q) {
             // We have a duplicate entry:
             param_error('subrg_code', sprintf(T_('This sub-region already exists. Do you want to <a %s>edit the existing sub-region</a>?'), 'href="?ctrl=subregions&amp;action=edit&amp;subrg_ID=' . $q . '"'));
         } else {
             unset($edited_Subregion->dbchanges['subrg_ctry_ID']);