コード例 #1
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $prefix = $this->getObjectPrefix();
     $uiconf_id = $this->getPM("{$prefix}_id");
     $uiconf = uiConfPeer::retrieveByPK($uiconf_id);
     if (!$uiconf) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $uiconf_id);
         return;
     }
     if ($uiconf && !$uiconf->isValid()) {
         $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$uiconf->getId()}] is not valid");
         return;
     }
     // get the new properties for the uiconf from the request
     $uiconf_update_data = new uiConf();
     $uiconf_update_data->setPartnerId($partner_id);
     // set this once before filling the object and once after
     $obj_wrapper = objectWrapperBase::getWrapperClass($uiconf_update_data, 0);
     $updateable_fields = $obj_wrapper->getUpdateableFields();
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $uiconf_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($uiconf_update_data) {
             baseObjectUtils::fillObjectFromObject($updateable_fields, $uiconf_update_data, $uiconf, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $uiconf->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($uiconf, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #2
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $detailed = $this->getDetailed();
     //$this->getP ( "detailed" , false );
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     // get the new properties for the kuser from the request
     $ui_conf = new uiConf();
     $ui_conf->setPartnerId($partner_id);
     // set this once before filling the object and once after
     // this is called for the first time to set the type and media type for fillObjectFromMap
     $this->setObjType($ui_conf);
     $obj_wrapper = objectWrapperBase::getWrapperClass($ui_conf, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     // TODO - always use fillObjectFromMapOrderedByFields rather than fillObjectFromMap
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $ui_conf, $this->getObjectPrefix() . "_", $updateable_fields);
     // check that mandatory fields were set
     // TODO
     if (count($fields_modified) > 0) {
         $ui_conf->setPartnerId($partner_id);
         // this is now called for the second time to force the obj_type
         $this->setObjType($ui_conf);
         $ui_conf->save();
         $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($ui_conf, $level));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_UI_CONF, $this->getObjectPrefix());
     }
 }