Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034 class ilPaymentBillVendor
00035 {
00036 var $db = null;
00037 var $lang = null;
00038 var $pobject_id = null;
00039
00040 var $has_data = false;
00041
00042
00047 function ilPaymentBillVendor($a_pobject_id)
00048 {
00049 global $ilDB,$lng;
00050
00051 $this->db =& $ilDB;
00052 $this->lng =& $lng;
00053 $this->pobject_id = $a_pobject_id;
00054
00055 $this->__read();
00056 }
00057
00058
00059 function getMessage()
00060 {
00061 return $this->message;
00062 }
00063 function setMessage($a_message)
00064 {
00065 $this->message = $a_message;
00066 }
00067 function appendMessage($a_message)
00068 {
00069 $this->message .= "<br />".$a_message;
00070 }
00071
00072 function delete()
00073 {
00074 $query = "DELETE FROM payment_bill_vendor ".
00075 "WHERE pobject_id = '".$this->pobject_id."'";
00076
00077 $this->db->query($query);
00078
00079 return true;
00080 }
00081
00082
00083
00084
00085
00086 function getPobjectId()
00087 {
00088 return $this->pobject_id;
00089 }
00090 function hasData()
00091 {
00092 return (bool) $this->has_data;
00093 }
00094 function setGender($a_gender)
00095 {
00096 $this->gender = $a_gender;
00097 }
00098 function getGender()
00099 {
00100 return $this->gender;
00101 }
00102 function setFirstname($a_firstname)
00103 {
00104 $this->firstname = $a_firstname;
00105 }
00106 function getFirstname()
00107 {
00108 return $this->firstname;
00109 }
00110 function setLastname($a_lastname)
00111 {
00112 $this->lastname = $a_lastname;
00113 }
00114 function getLastname()
00115 {
00116 return $this->lastname;
00117 }
00118 function getTitle()
00119 {
00120 return $this->title;
00121 }
00122 function setTitle($a_title)
00123 {
00124 $this->title = $a_title;
00125 }
00126 function getInstitution()
00127 {
00128 return $this->institution;
00129 }
00130 function setInstitution($a_institution)
00131 {
00132 $this->institution = $a_institution;
00133 }
00134 function getDepartment()
00135 {
00136 return $this->department;
00137 }
00138 function setDepartment($a_department)
00139 {
00140 $this->department = $a_department;
00141 }
00142 function getStreet()
00143 {
00144 return $this->street;
00145 }
00146 function setStreet($a_street)
00147 {
00148 $this->street = $a_street;
00149 }
00150 function getZipcode()
00151 {
00152 return $this->zipcode;
00153 }
00154 function setZipcode($a_zipcode)
00155 {
00156 $this->zipcode = $a_zipcode;
00157 }
00158 function getCity()
00159 {
00160 return $this->city;
00161 }
00162 function setCity($a_city)
00163 {
00164 $this->city = $a_city;
00165 }
00166 function getCountry()
00167 {
00168 return $this->country;
00169 }
00170 function setCountry($a_country)
00171 {
00172 $this->country = $a_country;
00173 }
00174 function getPhone()
00175 {
00176 return $this->phone;
00177 }
00178 function setPhone($a_phone)
00179 {
00180 $this->phone = $a_phone;
00181 }
00182 function getFax()
00183 {
00184 return $this->fax;
00185 }
00186 function setFax($a_fax)
00187 {
00188 $this->fax = $a_fax;
00189 }
00190 function getEmail()
00191 {
00192 return $this->email;
00193 }
00194 function setEmail($a_email)
00195 {
00196 $this->email = $a_email;
00197 }
00198 function getAccountNumber()
00199 {
00200 return $this->account_number;
00201 }
00202 function setAccountNumber($a_account_number)
00203 {
00204 $this->account_number = $a_account_number;
00205 }
00206 function getBankcode()
00207 {
00208 return $this->bankcode;
00209 }
00210 function setBankcode($a_bankcode)
00211 {
00212 $this->bankcode = $a_bankcode;
00213 }
00214 function getIban()
00215 {
00216 return $this->iban;
00217 }
00218 function setIban($a_iban)
00219 {
00220 $this->iban = $a_iban;
00221 }
00222 function getBic()
00223 {
00224 return $this->bic;
00225 }
00226 function setBic($a_bic)
00227 {
00228 $this->bic = $a_bic;
00229 }
00230 function getBankname()
00231 {
00232 return $this->bankname;
00233 }
00234 function setBankname($a_bankname)
00235 {
00236 $this->bankname = $a_bankname;
00237 }
00238
00239 function validate()
00240 {
00241 $this->setMessage('');
00242
00243 if(!$this->getGender())
00244 {
00245 $this->appendMessage($this->lng->txt('gender'));
00246 }
00247 if(!$this->getFirstname())
00248 {
00249 $this->appendMessage($this->lng->txt('firstname'));
00250 }
00251 if(!$this->getLastname())
00252 {
00253 $this->appendMessage($this->lng->txt('lastname'));
00254 }
00255 if(!$this->getStreet())
00256 {
00257 $this->appendMessage($this->lng->txt('street'));
00258 }
00259 if(!$this->getZipcode())
00260 {
00261 $this->appendMessage($this->lng->txt('zipcode'));
00262 }
00263 if(!$this->getCity())
00264 {
00265 $this->appendMessage($this->lng->txt('city'));
00266 }
00267 if(!$this->getCountry())
00268 {
00269 $this->appendMessage($this->lng->txt('country'));
00270 }
00271 if(!$this->getEmail())
00272 {
00273 $this->appendMessage($this->lng->txt('email'));
00274 }
00275 if(!$this->getAccountNumber())
00276 {
00277 $this->appendMessage($this->lng->txt('account_number'));
00278 }
00279 if(!$this->getBankcode())
00280 {
00281 $this->appendMessage($this->lng->txt('bankcode'));
00282 }
00283 if(!$this->getBankname())
00284 {
00285 $this->appendMessage($this->lng->txt('bankname'));
00286 }
00287
00288 return $this->getMessage() ? false : true;
00289 }
00290 function update()
00291 {
00292 if(!$this->hasData())
00293 {
00294 $query = "INSERT INTO payment_bill_vendor ".
00295 "SET pobject_id = '".$this->getPobjectId()."'";
00296
00297 $this->db->query($query);
00298 }
00299 $query = "UPDATE payment_bill_vendor ".
00300 "SET ".
00301 "gender = '".ilUtil::prepareDBString($this->getGender())."',".
00302 "firstname = '".ilUtil::prepareDBString($this->getFirstname())."',".
00303 "lastname = '".ilUtil::prepareDBString($this->getLastname())."',".
00304 "title = '".ilUtil::prepareDBString($this->getTitle())."',".
00305 "institution = '".ilUtil::prepareDBString($this->getInstitution())."',".
00306 "department = '".ilUtil::prepareDBString($this->getDepartment())."',".
00307 "street = '".ilUtil::prepareDBString($this->getStreet())."',".
00308 "zipcode = '".ilUtil::prepareDBString($this->getZipcode())."',".
00309 "city = '".ilUtil::prepareDBString($this->getCity())."',".
00310 "country = '".ilUtil::prepareDBString($this->getCountry())."',".
00311 "phone = '".ilUtil::prepareDBString($this->getPhone())."',".
00312 "fax = '".ilUtil::prepareDBString($this->getFax())."',".
00313 "email = '".ilUtil::prepareDBString($this->getEmail())."', ".
00314 "account_number = '".ilUtil::prepareDBString($this->getAccountNumber())."',".
00315 "bankcode = '".ilUtil::prepareDBString($this->getBankcode())."',".
00316 "iban = '".ilUtil::prepareDBString($this->getIban())."',".
00317 "bic = '".ilUtil::prepareDBString($this->getBic())."',".
00318 "bankname = '".ilUtil::prepareDBString($this->getBankname())."'".
00319 "WHERE pobject_id = '".$this->getPobjectId()."'";
00320
00321 $this->db->query($query);
00322 $this->__read();
00323 }
00324
00325
00326
00327 function __read()
00328 {
00329 $query = "SELECT * FROM payment_bill_vendor ".
00330 "WHERE pobject_id = '".$this->getPobjectId()."'";
00331
00332 $res = $this->db->query($query);
00333 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00334 {
00335 $this->has_data = true;
00336
00337 $this->setGender($row->gender);
00338 $this->setFirstname($row->firstname);
00339 $this->setLastname($row->lastname);
00340 $this->setTitle($row->title);
00341 $this->setInstitution($row->institution);
00342 $this->setDepartment($row->department);
00343 $this->setStreet($row->street);
00344 $this->setZipcode($row->zipcode);
00345 $this->setCity($row->city);
00346 $this->setCountry($row->country);
00347 $this->setPhone($row->phone);
00348 $this->setFax($row->fax);
00349 $this->setEmail($row->email);
00350 $this->setAccountNumber($row->account_number);
00351 $this->setBankcode($row->bankcode);
00352 $this->setIban($row->iban);
00353 $this->setBic($row->bic);
00354 $this->setBankname($row->bankname);
00355 }
00356 return true;
00357 }
00358
00359
00360 }
00361 ?>