/**
  * AvailabilityAttributes constructor.
  *
  * @param array $raw
  */
 public function __construct(array $raw = [])
 {
     parent::__construct($raw);
     $this->availabilityType = $this->get('AvailabilityType');
     $this->minimumHours = (int) $this->get('MinimumHours') ?: null;
     $this->maximumHours = (int) $this->get('MaximumHours') ?: null;
 }
Exemplo n.º 2
0
 function UpdateProfile($params)
 {
     $procname = "sp_UpdateMember";
     $procresult = parent::RunQueryProc($procname, $params);
     $status = $procresult[0];
     $this->StatusNo = $status["StatusNo"];
     switch ($status["StatusNo"]) {
         case 0:
             $this->StatusMessage = "Successful";
             break;
         case 1:
             $this->StatusMessage = "Card is already in use";
             break;
         case 2:
             $this->StatusMessage = "Card is Deactivated";
             break;
         case 3:
             $this->StatusMessage = "Card is Invalid";
             break;
         case 7:
             $this->StatusMessage = "Invalid Username";
             break;
     }
     return $procresult;
 }
Exemplo n.º 3
0
 function processPost($formvalues)
 {
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
         $formvalues['companyid'] = getCompanyID();
     }
     if (isArrayKeyAnEmptyString('defaultquantity', $formvalues)) {
         unset($formvalues['defaultquantity']);
     }
     if (isArrayKeyAnEmptyString('quantitytype', $formvalues)) {
         unset($formvalues['quantitytype']);
     }
     if (isArrayKeyAnEmptyString('deductfromallowance', $formvalues)) {
         unset($formvalues['deductfromallowance']);
     }
     if (isArrayKeyAnEmptyString('paid', $formvalues)) {
         unset($formvalues['paid']);
     }
     if (isArrayKeyAnEmptyString('bookable', $formvalues)) {
         unset($formvalues['bookable']);
     }
     if (isArrayKeyAnEmptyString('authorised', $formvalues)) {
         unset($formvalues['authorised']);
     }
     if (isArrayKeyAnEmptyString('viewoncalendar', $formvalues)) {
         unset($formvalues['viewoncalendar']);
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 4
0
 function processPost($formvalues)
 {
     $session = SessionWrapper::getInstance();
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('parentid', $formvalues)) {
         unset($formvalues['parentid']);
     }
     if (isArrayKeyAnEmptyString('sectorid', $formvalues)) {
         unset($formvalues['sectorid']);
         if (!isEmptyString($formvalues['parentid'])) {
             $category = new Category();
             $category->populate($formvalues['parentid']);
             $formvalues['sectorid'] = $category->getSectorID();
         }
     }
     if (isArrayKeyAnEmptyString('level', $formvalues)) {
         unset($formvalues['level']);
     }
     if (isArrayKeyAnEmptyString('type', $formvalues)) {
         unset($formvalues['type']);
     }
     if (isArrayKeyAnEmptyString('status', $formvalues)) {
         unset($formvalues['status']);
     }
     if (isArrayKeyAnEmptyString('uneditable', $formvalues)) {
         unset($formvalues['uneditable']);
     }
     if (isArrayKeyAnEmptyString('sortorder', $formvalues)) {
         if (!isEmptyString($formvalues['parentid']) && !isEmptyString($formvalues['sectorid'])) {
             $formvalues['sortorder'] = $this->getNextSortOrder($formvalues['sectorid'], $formvalues['parentid']);
         }
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 5
0
 public static function Save(BaseEntity $object)
 {
     $properties = $object->GetValues(null, true, true);
     if (isset($properties['id'])) {
         $id = $properties['id'];
         unset($properties['id']);
         $values = Storage::Update(Storage::MYSQL, $id, $properties, self::$_STORAGE_NAMESPACE, static::$_KEY);
     } else {
         $id = Storage::Create(Storage::MYSQL, $properties, self::$_STORAGE_NAMESPACE, static::$_KEY);
         $object->SetValue('id', $id);
     }
     if (!isset(static::$objects[$id])) {
         static::$objects[$id] = $object;
     }
     return true;
 }
Exemplo n.º 6
0
 /**
  * @param array $raw
  */
 public function __construct(array $raw)
 {
     parent::__construct($raw);
     $this->merchant = new Merchant($this->get('Merchant', []));
     $this->offerAttributes = new ItemAttributes($this->get('OfferAttributes'));
     $this->offerListing = new OfferListing($this->get('OfferListing', []));
 }
Exemplo n.º 7
0
 /**
  * Price constructor.
  *
  * @param array $raw
  */
 public function __construct(array $raw)
 {
     parent::__construct($raw);
     $this->amount = (int) $this->get('Amount') ?: null;
     $this->currencyCode = $this->get('CurrencyCode');
     $this->formattedPrice = $this->get('FormattedPrice');
 }
Exemplo n.º 8
0
 function processPost($formvalues)
 {
     $session = SessionWrapper::getInstance();
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('create', $formvalues)) {
         $formvalues['create'] = 0;
     }
     if (isArrayKeyAnEmptyString('edit', $formvalues)) {
         $formvalues['edit'] = 0;
     }
     if (isArrayKeyAnEmptyString('view', $formvalues)) {
         $formvalues['view'] = 0;
     }
     if (isArrayKeyAnEmptyString('list', $formvalues)) {
         $formvalues['list'] = 0;
     }
     if (isArrayKeyAnEmptyString('delete', $formvalues)) {
         $formvalues['delete'] = 0;
     }
     if (isArrayKeyAnEmptyString('export', $formvalues)) {
         $formvalues['export'] = 0;
     }
     if (isArrayKeyAnEmptyString('approve', $formvalues)) {
         $formvalues['approve'] = 0;
     }
     if (isArrayKeyAnEmptyString('flag', $formvalues)) {
         $formvalues['flag'] = 0;
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 9
0
 /**
  * Custom model validation
  */
 function validate()
 {
     # execute the column validation
     parent::validate();
     if ($this->valueExists()) {
         $this->getErrorStack()->add("lookupvaluedescription.unique", "The value <b>" . $this->getlookupvaluedescription() . "</b> already exists. <br />Please specify another.");
     }
 }
Exemplo n.º 10
0
 function Withdraw($sessionid, $amount, $posaccountno, $serviceid = 3)
 {
     $procname = "sp_withdraw";
     $params[] = $sessionid;
     $params[] = $amount;
     $params[] = $posaccountno;
     $params[] = $serviceid;
     return parent::RunQueryProc($procname, $params);
 }
Exemplo n.º 11
0
 /**
  * @param array $raw
  */
 public function __construct(array $raw)
 {
     parent::__construct($raw);
     $this->lowestNewPrice = new Price($this->get('LowestNewPrice', []));
     $this->totalNew = (int) $this->get('TotalNew') ?: null;
     $this->totalUsed = (int) $this->get('TotalUsed') ?: null;
     $this->totalCollectible = (int) $this->get('TotalCollectible') ?: null;
     $this->totalRefurbished = (int) $this->get('TotalRefurbished') ?: null;
 }
Exemplo n.º 12
0
 /**
  * OfferListing constructor.
  *
  * @param array $raw
  */
 public function __construct(array $raw = [])
 {
     parent::__construct($raw);
     $this->salePrice = new Price($this->get('SalePrice', []));
     $this->amountSaved = new Price($this->get('AmountSaved', []));
     $this->percentageSaved = (int) $this->get('PercentageSaved', 0);
     $this->availability = $this->get('Availability');
     $this->availabilityAttributes = new AvailabilityAttributes($this->get('AvailabilityAttributes'));
     $this->isEligibleForSuperSaverShipping = $this->get('IsEligibleForSuperSaverShipping') != '0';
     $this->isEligibleForPrime = $this->get('IsEligibleForPrime') != '0';
 }
Exemplo n.º 13
0
 function processPost($formvalues)
 {
     // check if the active is not specified and set to default value
     if (isArrayKeyAnEmptyString('active', $formvalues)) {
         unset($formvalues['active']);
     }
     if (isArrayKeyAnEmptyString('editable', $formvalues)) {
         unset($formvalues['editable']);
     }
     # debugMessage($formvalues);
     parent::processPost($formvalues);
 }
Exemplo n.º 14
0
 function processPost($formvalues)
 {
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
         unset($formvalues['companyid']);
     }
     if (isArrayKeyAnEmptyString('status', $formvalues)) {
         unset($formvalues['status']);
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 15
0
 function processPost($formvalues)
 {
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
         $formvalues['companyid'] = 1;
     }
     if (isArrayKeyAnEmptyString('defaultamount', $formvalues)) {
         unset($formvalues['defaultamount']);
     }
     if (isArrayKeyAnEmptyString('amounttype', $formvalues)) {
         unset($formvalues['amounttype']);
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 16
0
 function processPost($formvalues)
 {
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('headid', $formvalues)) {
         if (isArrayKeyAnEmptyString('headid_old', $formvalues)) {
             unset($formvalues['headid']);
         } else {
             $formvalues['headid'] = NULL;
         }
     }
     if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
         $formvalues['companyid'] = DEFAULT_COMPANYID;
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 17
0
 public function isModified()
 {
     foreach ($this->getExtensionObjects() as $object) {
         if ($object->isModified()) {
             return true;
         }
     }
     return parent::isModified();
 }
Exemplo n.º 18
0
 function CheckSession($sessionid)
 {
     $params[] = $sessionid;
     $procname = "sp_CheckSessionID";
     return parent::RunQueryProc($procname, $params);
 }
Exemplo n.º 19
0
 /**
  * Updates an entity in the given table.
  * @param string $table Name of the table.
  * @param BaseEntity $entity The entity to be updated.
  * @return bool True on success or false on failure.  
  */
 public function updateEntity($table, $entity)
 {
     $entity->preUpdate();
     $where = "`id` = " . $entity->getId();
     return $this->update($table, $entity->toArray(), $where);
 }
Exemplo n.º 20
0
 public function __construct(array $datas = [])
 {
     parent::__construct($datas);
     $this->skipResult();
 }
Exemplo n.º 21
0
 public function __construct($properties = null)
 {
     parent::__construct($this->convertNameProperties($properties));
 }
Exemplo n.º 22
0
 /**
  * Checks this ticket is creatable
  */
 public function checkCreatable()
 {
     parent::checkCreatable();
     $this->checkFieldsSet(array('name', 'description'));
 }
Exemplo n.º 23
0
 /**
  * Checks this ticket is creatable
  */
 public function checkCreatable()
 {
     parent::checkCreatable();
     $this->checkFieldsSet(array('title', 'body'));
 }
Exemplo n.º 24
0
 /**
  * Clean out the data received from the screen by:
  * - remove empty/blank groupid  - the groupid is not required and therefore is an empty value is maintained will cause an out of range exception 
  *
  * @param Array $post_array
  */
 function processPost($post_array)
 {
     $session = SessionWrapper::getInstance();
     // check if the groupid is blank then remove it
     $permissions = $this->getPermissions();
     $permissions_array = $permissions->toArray();
     if (array_key_exists('permissions', $post_array)) {
         if (is_array($post_array['permissions'])) {
             $data = array();
             foreach ($post_array['permissions'] as $key => $value) {
                 $data[$key] = $value;
                 if (array_key_exists('groupid', $value)) {
                     if (isEmptyString($value['groupid'])) {
                         unset($post_array['permissions'][$key]['groupid']);
                     }
                 }
                 if (isArrayKeyAnEmptyString('create', $value)) {
                     $post_array['permissions'][$key]['create'] = 0;
                 } else {
                     $post_array['permissions'][$key]['create'] = trim(intval($value['create']));
                 }
                 if (isArrayKeyAnEmptyString('edit', $value)) {
                     $post_array['permissions'][$key]['edit'] = 0;
                 } else {
                     $post_array['permissions'][$key]['edit'] = trim(intval($value['edit']));
                 }
                 if (isArrayKeyAnEmptyString('view', $value)) {
                     $post_array['permissions'][$key]['view'] = 0;
                 } else {
                     $post_array['permissions'][$key]['view'] = trim(intval($value['view']));
                 }
                 if (isArrayKeyAnEmptyString('list', $value)) {
                     $post_array['permissions'][$key]['list'] = 0;
                 } else {
                     $post_array['permissions'][$key]['list'] = trim(intval($value['list']));
                 }
                 if (isArrayKeyAnEmptyString('delete', $value)) {
                     $post_array['permissions'][$key]['delete'] = 0;
                 } else {
                     $post_array['permissions'][$key]['delete'] = trim(intval($value['delete']));
                 }
                 if (isArrayKeyAnEmptyString('approve', $value)) {
                     $post_array['permissions'][$key]['approve'] = 0;
                 } else {
                     $post_array['permissions'][$key]['approve'] = trim(intval($value['approve']));
                 }
                 if (isArrayKeyAnEmptyString('export', $value)) {
                     $post_array['permissions'][$key]['export'] = 0;
                 } else {
                     $post_array['permissions'][$key]['export'] = trim(intval($value['export']));
                 }
                 if (isArrayKeyAnEmptyString('id', $value)) {
                     unset($post_array['permissions'][$key]['id']);
                     $post_array['permissions'][$key]['createdby'] = $session->getVar('userid');
                     $post_array['permissions'][$key]['datecreated'] = getCurrentMysqlTimestamp();
                 }
                 if (!isArrayKeyAnEmptyString('id', $value)) {
                     $post_array['permissions'][$key]['lastupdatedby'] = $session->getVar('userid');
                     $post_array['permissions'][$key]['lastupdatedate'] = getCurrentMysqlTimestamp();
                     $data = $post_array['permissions'][$key];
                     unset($post_array['permissions'][$key]);
                     $newkey = array_search_key_by_id($permissions_array, $value['id']);
                     // debugMessage($data);
                     $post_array['permissions'][$newkey] = $data;
                 }
             }
             // end loop through permissions to unset empty groupids
         }
     }
     // now process the data
     // debugMessage($post_array['permissions']); // exit();
     parent::processPost($post_array);
 }
Exemplo n.º 25
0
 function processPost($formvalues)
 {
     $config = Zend_Registry::get("config");
     // trim spaces from the name field
     if (isArrayKeyAnEmptyString('status', $formvalues)) {
         unset($formvalues['status']);
     }
     if (isArrayKeyAnEmptyString('returndate', $formvalues)) {
         unset($formvalues['returndate']);
     }
     if (isArrayKeyAnEmptyString('durationtype', $formvalues)) {
         unset($formvalues['durationtype']);
     } else {
         if ($formvalues['durationtype'] == 2) {
             $formvalues['duration'] = $formvalues['duration'] * getHoursInDay();
             $formvalues['durationtype'] = 1;
         }
     }
     if (isArrayKeyAnEmptyString('dateapproved', $formvalues)) {
         unset($formvalues['dateapproved']);
     }
     if (isArrayKeyAnEmptyString('approvedbyid', $formvalues)) {
         unset($formvalues['approvedbyid']);
     }
     if (isArrayKeyAnEmptyString('starttime', $formvalues)) {
         unset($formvalues['starttime']);
     } else {
         $formvalues['starttime'] = date("H:i:s", strtotime($formvalues['starttime']));
     }
     if (isArrayKeyAnEmptyString('endtime', $formvalues)) {
         unset($formvalues['endtime']);
     } else {
         $formvalues['endtime'] = date("H:i:s", strtotime($formvalues['endtime']));
     }
     if (isArrayKeyAnEmptyString('returntime', $formvalues)) {
         unset($formvalues['returntime']);
     } else {
         $formvalues['returntime'] = date("H:i:s", strtotime($formvalues['returntime']));
     }
     if (!isArrayKeyAnEmptyString('istaken', $formvalues)) {
         $formvalues['status'] = 4;
     }
     // debugMessage($formvalues); //exit();
     parent::processPost($formvalues);
 }
 /**
  * @param Pdffiller $client
  * @param int $signatureRequestId
  */
 public function __construct(Pdffiller $client, $signatureRequestId)
 {
     parent::__construct($client);
     $this->fillRequestId = $signatureRequestId;
 }
Exemplo n.º 27
0
 function processPost($formvalues)
 {
     $session = SessionWrapper::getInstance();
     //debugMessage($formvalues);
     if (!isArrayKeyAnEmptyString('firstname', $formvalues)) {
         $formvalues['firstname'] = ucwords(strtolower($formvalues['firstname']));
     }
     if (!isArrayKeyAnEmptyString('lastname', $formvalues)) {
         $formvalues['lastname'] = ucwords(strtolower($formvalues['lastname']));
     }
     if (!isArrayKeyAnEmptyString('othername', $formvalues)) {
         $formvalues['othername'] = ucwords(strtolower($formvalues['othername']));
     }
     if (!isArrayKeyAnEmptyString('displayname', $formvalues)) {
         $formvalues['displayname'] = ucwords(strtolower($formvalues['displayname']));
     }
     # if the passwords are not changed , set value to null
     if (isArrayKeyAnEmptyString('password', $formvalues)) {
         unset($formvalues['password']);
     } else {
         $formvalues['password'] = sha1($formvalues['password']);
         // $formvalues['password'] = encode(sha1($formvalues['password']));
         $formvalues['trx'] = sha1('password');
     }
     if (!isArrayKeyAnEmptyString('oldpassword', $formvalues)) {
         $this->setoldpassword($formvalues['oldpassword']);
     }
     if (!isArrayKeyAnEmptyString('confirmpassword', $formvalues)) {
         $this->setconfirmpassword($formvalues['confirmpassword']);
     }
     if (!isArrayKeyAnEmptyString('newpassword', $formvalues)) {
         $this->setNewPassword($formvalues['newpassword']);
         $formvalues['password'] = sha1($formvalues['newpassword']);
     }
     /*if(!isArrayKeyAnEmptyString('phone', $formvalues)){
     			$formvalues['phone'] = str_pad(ltrim($formvalues['phone'], '0'), 12, getCountryCode(), STR_PAD_LEFT); 
     		}*/
     if (!isArrayKeyAnEmptyString('email', $formvalues) && !isArrayKeyAnEmptyString('oldemail', $formvalues) && !isArrayKeyAnEmptyString('status', $formvalues)) {
         if ($formvalues['email'] != $formvalues['oldemail'] && $session->getVar('userid') == $formvalues['id']) {
             $this->setChangeEmail('1');
             $this->setOldEmail($formvalues['oldemail']);
             $formvalues['email2'] = $formvalues['email'];
             $formvalues['email'] = $formvalues['oldemail'];
             $formvalues['activationkey'] = $this->generateActivationKey();
         }
     }
     # force setting of default none string column values. enum, int and date
     if (isArrayKeyAnEmptyString('companyid', $formvalues)) {
         unset($formvalues['companyid']);
     }
     if (isArrayKeyAnEmptyString('status', $formvalues)) {
         unset($formvalues['status']);
     }
     if (isArrayKeyAnEmptyString('agreedtoterms', $formvalues)) {
         unset($formvalues['agreedtoterms']);
     }
     if (isArrayKeyAnEmptyString('gender', $formvalues)) {
         unset($formvalues['gender']);
     }
     if (isArrayKeyAnEmptyString('dateofbirth', $formvalues)) {
         unset($formvalues['dateofbirth']);
     } else {
         $formvalues['dateofbirth'] = date('Y-m-d', strtotime($formvalues['dateofbirth']));
     }
     if (isArrayKeyAnEmptyString('activationdate', $formvalues)) {
         unset($formvalues['activationdate']);
     }
     if (isArrayKeyAnEmptyString('type', $formvalues)) {
         unset($formvalues['type']);
     }
     if (isArrayKeyAnEmptyString('salutation', $formvalues)) {
         unset($formvalues['salutation']);
     }
     if (isArrayKeyAnEmptyString('maritalstatus', $formvalues)) {
         unset($formvalues['maritalstatus']);
     }
     if (isArrayKeyAnEmptyString('profession', $formvalues)) {
         unset($formvalues['profession']);
     }
     if (isArrayKeyAnEmptyString('contactid', $formvalues)) {
         unset($formvalues['contactid']);
     }
     if (isArrayKeyAnEmptyString('isinvited', $formvalues)) {
         $formvalues['isinvited'] = NULL;
     }
     if (isArrayKeyAnEmptyString('hasacceptedinvite', $formvalues)) {
         $formvalues['hasacceptedinvite'] = NULL;
     }
     if (isArrayKeyAnEmptyString('dateinvited', $formvalues)) {
         unset($formvalues['dateinvited']);
     }
     if (!isArrayKeyAnEmptyString('isinvited', $formvalues)) {
         if ($formvalues['isinvited'] == 1) {
             $this->setIsBeingInvited($formvalues['isinvited']);
             $formvalues['invitedbyid'] = $session->getVar('userid');
             $formvalues['dateinvited'] = date('Y-m-d');
             $formvalues['hasacceptedinvite'] = 0;
         }
     }
     if (isArrayKeyAnEmptyString('county', $formvalues)) {
         if (isArrayKeyAnEmptyString('county_old', $formvalues)) {
             unset($formvalues['county']);
         } else {
             $formvalues['county'] = NULL;
         }
     }
     # move the data from $formvalues['usergroups_groupid'] into $formvalues['usergroups'] array
     # the key for each group has to be the groupid
     if (isArrayKeyAnEmptyString('id', $formvalues)) {
         if (!isArrayKeyAnEmptyString('type', $formvalues)) {
             if (!isArrayKeyAnEmptyString('type', $formvalues)) {
                 $formvalues['usergroups_groupid'] = array($formvalues['type']);
             }
             if (isArrayKeyAnEmptyString('createdby', $formvalues)) {
                 $formvalues['createdby'] = DEFAULT_ID;
             }
             $formvalues['activationkey'] = $this->generateActivationKey();
         }
     }
     if (array_key_exists('usergroups_groupid', $formvalues)) {
         $groupids = $formvalues['usergroups_groupid'];
         $usergroups = array();
         foreach ($groupids as $id) {
             $usergroups[]['groupid'] = $id;
         }
         $formvalues['usergroups'] = $usergroups;
         # remove the usergroups_groupid array, it will be ignored, but to be on the safe side
         unset($formvalues['usergroups_groupid']);
     }
     # add the userid if the UserAccount is being edited
     if (!isArrayKeyAnEmptyString('id', $formvalues)) {
         if (array_key_exists('usergroups', $formvalues)) {
             $usergroups = $formvalues['usergroups'];
             foreach ($usergroups as $key => $value) {
                 $formvalues['usergroups'][$key]["userid"] = $formvalues["id"];
                 if (!isArrayKeyAnEmptyString('type', $formvalues)) {
                     $formvalues['usergroups'][$key]["groupid"] = $formvalues['type'];
                 }
             }
         }
     }
     if (!isArrayKeyAnEmptyString('type', $formvalues) && !isArrayKeyAnEmptyString('type_old', $formvalues)) {
         if (!isEmptyString($formvalues['type']) && !isEmptyString($formvalues['type_old'])) {
             if (!isArrayKeyAnEmptyString('id', $formvalues)) {
                 $formvalues['usergroups'][0]["userid"] = $formvalues["id"];
             }
             $formvalues['usergroups'][0]["groupid"] = $formvalues['type'];
         }
     }
     if (isArrayKeyAnEmptyString('contactname', $formvalues)) {
         unset($formvalues['contactname']);
     }
     if (!isArrayKeyAnEmptyString('workingdaysids', $formvalues)) {
         $formvalues['workingdays'] = implode(',', $formvalues['workingdaysids']);
     } else {
         if (!isArrayKeyAnEmptyString('workingdays_old', $formvalues)) {
             if (isArrayKeyAnEmptyString('workingdaysids', $formvalues)) {
                 $formvalues['workingdays'] = NULL;
             }
         } else {
             unset($formvalues['workingdays']);
         }
     }
     if (isArrayKeyAnEmptyString('startdate', $formvalues)) {
         unset($formvalues['startdate']);
     } else {
         $formvalues['startdate'] = date('Y-m-d', strtotime($formvalues['startdate']));
     }
     if (isArrayKeyAnEmptyString('enddate', $formvalues)) {
         unset($formvalues['enddate']);
     } else {
         $formvalues['enddate'] = date('Y-m-d', strtotime($formvalues['enddate']));
     }
     if (isArrayKeyAnEmptyString('probationend', $formvalues)) {
         unset($formvalues['probationend']);
     } else {
         $formvalues['probationend'] = date('Y-m-d', strtotime($formvalues['probationend']));
     }
     if (isArrayKeyAnEmptyString('managerid', $formvalues)) {
         unset($formvalues['managerid']);
     }
     if (isArrayKeyAnEmptyString('departmentid', $formvalues)) {
         unset($formvalues['departmentid']);
     }
     if (isArrayKeyAnEmptyString('istimesheetuser', $formvalues)) {
         unset($formvalues['istimesheetuser']);
     }
     if (isArrayKeyAnEmptyString('payrolltype', $formvalues)) {
         unset($formvalues['payrolltype']);
     }
     if (!isArrayKeyAnEmptyString('hasbenefits', $formvalues)) {
         $benefitsarray = array();
         $totcash = countCashBenefits();
         // debugMessage($totcash.' <<');
         $tottime = countTimeBenefits();
         // debugMessage($tottime.' <<');
         $benefitsarray[md5(1)]['benefitid'] = $formvalues['benefitid_1'];
         $benefitsarray[md5(1)]['amount'] = isArrayKeyAnEmptyString('rate', $formvalues) ? "0" : $formvalues['rate'];
         $benefitsarray[md5(1)]['accrualfrequency'] = $formvalues['ratetype'];
         if (!isArrayKeyAnEmptyString('id_1', $formvalues)) {
             $benefitsarray[md5(1)]['id'] = $formvalues['id_1'];
         }
         $counter = 0;
         for ($i = 2; $i <= $totcash; $i++) {
             if (!isArrayKeyAnEmptyString('amount_' . $i, $formvalues)) {
                 if ($formvalues['amount_' . $i] > 0) {
                     if (!isArrayKeyAnEmptyString('id_' . $i, $formvalues)) {
                         $benefitsarray[md5($i)]['id'] = $formvalues['id_' . $i];
                     }
                     $benefitsarray[md5($i)]['type'] = 1;
                     $benefitsarray[md5($i)]['benefitid'] = $formvalues['benefitid_' . $i];
                     $benefitsarray[md5($i)]['amount'] = $formvalues['amount_' . $i];
                     $benefitsarray[md5($i)]['benefitfrequency'] = $formvalues['benefitfrequency_' . $i];
                     $benefitsarray[md5($i)]['benefitterms'] = $formvalues['benefitterms_' . $i];
                     $benefitsarray[md5($i)]['accrualtype'] = NULL;
                     $benefitsarray[md5($i)]['accrualfrequency'] = NULL;
                     $benefitsarray[md5($i)]['accrualvalue'] = NULL;
                     if (!isArrayKeyAnEmptyString('istaxable_' . $i, $formvalues)) {
                         $benefitsarray[md5($i)]['istaxable'] = $formvalues['istaxable_' . $i];
                     } else {
                         $benefitsarray[md5($i)]['istaxable'] = 0;
                     }
                     $counter++;
                 }
             }
         }
         for ($x = 0; $x <= $tottime + $totcash + 4; $x++) {
             if (!isArrayKeyAnEmptyString('accrualvalue_' . $x, $formvalues)) {
                 // debugMessage($formvalues['accrualvalue_'.$x]);
                 if ($formvalues['accrualvalue_' . $x] > 0) {
                     if (!isArrayKeyAnEmptyString('id_' . $x, $formvalues)) {
                         $benefitsarray[md5($x)]['id'] = $formvalues['id_' . $x];
                     }
                     if (!isArrayKeyAnEmptyString('accrualfrequency_' . $x, $formvalues)) {
                         $benefitsarray[md5($x)]['accrualfrequency'] = $formvalues['accrualfrequency_' . $x];
                     }
                     $benefitsarray[md5($x)]['type'] = 2;
                     $benefitsarray[md5($x)]['leavetypeid'] = $formvalues['leavetypeid_' . $x];
                     $benefitsarray[md5($x)]['accrualtype'] = $formvalues['accrualtype_' . $x];
                     $benefitsarray[md5($x)]['accrualvalue'] = $formvalues['accrualvalue_' . $x];
                     $benefitsarray[md5($x)]['amount'] = NULL;
                     $benefitsarray[md5($x)]['benefitfrequency'] = NULL;
                     $benefitsarray[md5($x)]['benefitterms'] = NULL;
                     $counter++;
                 }
             }
         }
         if (count($benefitsarray) > 0) {
             $formvalues['userbenefits'] = $benefitsarray;
         }
     }
     if (!isArrayKeyAnEmptyString("type", $formvalues) && !isArrayKeyAnEmptyString('selfregistered', $formvalues)) {
         if ($formvalues['type'] == 3 && $formvalues['selfregistered'] == '1') {
             $formvalues["company"]["name"] = $formvalues["companyname"];
             $formvalues["company"]["status"] = 1;
             if (companiesRequireApproval()) {
                 $formvalues["company"]["status"] = 2;
             }
             $formvalues["company"]["contactperson"] = $formvalues["firstname"] . " " . $formvalues["lastname"];
             $formvalues["company"]["industrycode"] = $formvalues["industrycode"];
             $formvalues["company"]["createdby"] = NULL;
             $formvalues["company"]["datecreated"] = DEFAULT_DATETIME;
             $formvalues["company"]["email"] = $formvalues["email"];
             if (!isArrayKeyAnEmptyString('c_username', $formvalues)) {
                 $formvalues["company"]["username"] = $formvalues['c_username'];
             }
         }
     }
     if (isArrayKeyAnEmptyString("emailon_tsheet_approvalcompleted", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_tsheet_approvalcompleted_old", $formvalues)) {
             $formvalues["emailon_tsheet_approvalcompleted"] = 0;
         } else {
             unset($formvalues["emailon_tsheet_approvalcompleted"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_tsheeton_approvalrequired", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_tsheeton_approvalrequired_old", $formvalues)) {
             $formvalues["emailon_tsheeton_approvalrequired"] = 0;
         } else {
             unset($formvalues["emailon_tsheeton_approvalrequired"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_benefit_approvalcompleted", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_benefit_approvalcompleted_old", $formvalues)) {
             $formvalues["emailon_benefit_approvalcompleted"] = 0;
         } else {
             unset($formvalues["emailon_benefit_approvalcompleted"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_benefit_approvalrequired", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_benefit_approvalrequired_old", $formvalues)) {
             $formvalues["emailon_benefit_approvalrequired"] = 0;
         } else {
             unset($formvalues["emailon_benefit_approvalrequired"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_leave_approvalcompleted", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_leave_approvalcompleted_old", $formvalues)) {
             $formvalues["emailon_leave_approvalcompleted"] = 0;
         } else {
             unset($formvalues["emailon_leave_approvalcompleted"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_leave_approvalrequired", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_leave_approvalrequired_old", $formvalues)) {
             $formvalues["emailon_leave_approvalrequired"] = 0;
         } else {
             unset($formvalues["emailon_leave_approvalrequired"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_payslip_completed", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_payslip_completed_old", $formvalues)) {
             $formvalues["emailon_payslip_completed"] = 0;
         } else {
             unset($formvalues["emailon_payslip_completed"]);
         }
     }
     if (isArrayKeyAnEmptyString("emailon_directmessage_recieved", $formvalues)) {
         if (!isArrayKeyAnEmptyString("emailon_directmessage_recieved_old", $formvalues)) {
             $formvalues["emailon_directmessage_recieved"] = 0;
         } else {
             unset($formvalues["emailon_directmessage_recieved"]);
         }
     }
     /* debugMessage($formvalues); // debugMessage($benefitsarray);
     		exit(); */
     parent::processPost($formvalues);
 }
Exemplo n.º 28
0
 /**
  * Merchant constructor.
  *
  * @param array $raw
  */
 public function __construct(array $raw = [])
 {
     parent::__construct($raw);
     $this->name = $this->get('Name');
 }
Exemplo n.º 29
0
 function processPost($formvalues)
 {
     $session = SessionWrapper::getInstance();
     // debugMessage($formvalues);
     // trim spaces from the name field
     if (!isArrayKeyAnEmptyString('c_username', $formvalues)) {
         $formvalues['username'] = $formvalues['c_username'];
     }
     if (isArrayKeyAnEmptyString('status', $formvalues)) {
         unset($formvalues['status']);
     }
     if (isArrayKeyAnEmptyString('defaultdepartmentid', $formvalues)) {
         unset($formvalues['defaultdepartmentid']);
     }
     if (isArrayKeyAnEmptyString('defaultuserid', $formvalues)) {
         unset($formvalues['defaultuserid']);
     }
     if (!isArrayKeyAnEmptyString('workingdaysids', $formvalues)) {
         $formvalues['workingdays'] = implode(',', $formvalues['workingdaysids']);
     } else {
         if (!isArrayKeyAnEmptyString('workingdays_old', $formvalues)) {
             if (isArrayKeyAnEmptyString('workingdaysids', $formvalues)) {
                 $formvalues['workingdays'] = NULL;
             }
         } else {
             unset($formvalues['workingdays']);
         }
     }
     if (isArrayKeyAnEmptyString('isinvited', $formvalues)) {
         $formvalues['isinvited'] = NULL;
     }
     if (isArrayKeyAnEmptyString('hasacceptedinvite', $formvalues)) {
         $formvalues['hasacceptedinvite'] = NULL;
     }
     if (isArrayKeyAnEmptyString('dateinvited', $formvalues)) {
         unset($formvalues['dateinvited']);
     }
     if (isArrayKeyAnEmptyString('id', $formvalues)) {
         $formvalues['startdate'] = DEFAULT_DATETIME;
     }
     if (!isArrayKeyAnEmptyString('sendinvite', $formvalues)) {
         if ($formvalues['sendinvite'] == 1) {
             $this->setIsBeingInvited(1);
             $formvalues['isinvited'] = 1;
             $formvalues['invitedbyid'] = $session->getVar('userid');
             $formvalues['dateinvited'] = DEFAULT_DATETIME;
             $formvalues['hasacceptedinvite'] = 0;
         }
     }
     $updateuser = false;
     if (!isArrayKeyAnEmptyString('defaultuserid', $formvalues)) {
         $user = new UserAccount();
         $user->populate($formvalues['defaultuserid']);
         if ($user->isUserInActive()) {
             $updateuser = true;
             $formvalues['defaultuser']['id'] = $formvalues['defaultuserid'];
         }
     } else {
         $updateuser = true;
         $formvalues['defaultuser']['status'] = 0;
         $formvalues['defaultuser']['datecreated'] = date('Y-m-d', time());
         $formvalues['defaultuser']['createdby'] = $session->getVar('userid');
         $formvalues['defaultuser']['usergroups'][0]["groupid"] = 3;
         $formvalues['defaultuser']['type'] = 3;
     }
     if ($updateuser) {
         $names = explode(' ', $this->getContactPerson());
         debugMessage($names);
         $formvalues['defaultuser']['firstname'] = $names[0];
         if (!isArrayKeyAnEmptyString(1, $names)) {
             $formvalues['defaultuser']['lastname'] = $names[1];
         } else {
             $formvalues['defaultuser']['lastname'] = '.';
         }
         if (!isArrayKeyAnEmptyString(2, $names)) {
             $formvalues['defaultuser']['othername'] = $names[2];
         }
         $formvalues['defaultuser']['email'] = $this->getEmail();
         if ($this->getIsBeinginvited() == '1') {
             $formvalues['defaultuser']['hasacceptedinvite'] = 0;
             $formvalues['defaultuser']['dateinvited'] = date('Y-m-d', time());
             $formvalues['defaultuser']['invitedbyid'] = $session->getVar('userid');
             $formvalues['defaultuser']['isinvited'] = 1;
         }
     }
     if (isArrayKeyAnEmptyString('openinghour', $formvalues)) {
         unset($formvalues['openinghour']);
     } else {
         $formvalues['openinghour'] = date("H:i:s", strtotime($formvalues['openinghour']));
     }
     if (isArrayKeyAnEmptyString('closinghour', $formvalues)) {
         unset($formvalues['closinghour']);
     } else {
         $formvalues['closinghour'] = date("H:i:s", strtotime($formvalues['closinghour']));
     }
     if (isArrayKeyAnEmptyString('yearstart', $formvalues)) {
         unset($formvalues['yearstart']);
     } else {
         $formvalues['yearstart'] = date('Y-m-d', strtotime($formvalues['yearstart']));
     }
     if (isArrayKeyAnEmptyString('yearend', $formvalues)) {
         unset($formvalues['yearend']);
     } else {
         $formvalues['yearend'] = date('Y-m-d', strtotime($formvalues['yearend']));
     }
     if (isArrayKeyAnEmptyString('headertype', $formvalues)) {
         $formvalues['headertype'] = 0;
     }
     // debugMessage($formvalues); exit();
     parent::processPost($formvalues);
 }
Exemplo n.º 30
0
 /**
  * returns an array[] filled with entities
  * the entities are filled with metadata and the values
  * you can use this function only if the query retuns more than one row
  * @param bool $meta_data_is_qry if set to true use the query for the metadata
  * @return array[]
  * @access protected
  */
 function getReport($qry)
 {
     $meta_data = $this->mysql_conn->metaData($qry);
     $data = $this->mysql_conn->resultTable($qry);
     $ret_arr = array();
     //print_r($data);
     #count how many rows are returned and for every row create an entity
     #fill every entity with the metadata and values
     for ($i = 0; $i < count($data); $i++) {
         $ret_ent = new BaseEntity();
         $ret_ent->setProperties($meta_data, $data[$i]);
         $ret_arr[$i] = $ret_ent;
     }
     return $ret_arr;
 }