Exemplo n.º 1
0
 public function save(RM_Barcode_Object $obBarcode, &$error)
 {
     try {
         $obBarcode->save();
         return TRUE;
     } catch (RM_Validator_Exception $e) {
         foreach ($e->getResult()->getErrors() as $err) {
             break;
         }
         if ($err['code'] == 'not_empty' || $err['code'] == 'not_null') {
             $error = 'barcode.fill_required_fields';
         } else {
             if (in_array($err['code'], qw2('no_such_segment no_such_class no_such_family no_such_brick no_such_attributes no_attributes2brick no_such_values no_values2attribute'))) {
                 $error = 'gpc.' . $err['code'];
             } else {
                 $error = 'barcode.cannot_edit_object';
             }
         }
         return FALSE;
     }
     /*		catch (Exception $e)
     		{
     			$error = 'barcode.cannot_edit_object';
     			return FALSE;
     		}*/
 }
Exemplo n.º 2
0
 public function updateBarcodeValueByFamily(RM_Barcode_Object &$obBarcode, RM_Barcode_Family &$obFamily, $restriction = array())
 {
     $obBarcode->barcode_family_id = $obFamily->id();
     $obFamily->save();
     $obBarcode->save();
 }