Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
109 righe
3.1 KiB
109 righe
3.1 KiB
<?php |
|
|
|
require_once "IDataClass.php"; |
|
/* |
|
* To change this license header, choose License Headers in Project Properties. |
|
* To change this template file, choose Tools | Templates |
|
* and open the template in the editor. |
|
*/ |
|
|
|
/** |
|
* Description of UTENTI |
|
* |
|
* @author Stefano |
|
*/ |
|
class Impresa extends DataClass { |
|
|
|
//put your code here |
|
const TABLE_NAME = "IMPRESA"; |
|
|
|
public $ID = null; // Primary key |
|
public $PARTITA_IVA = null; |
|
public $DENOMINAZIONE = ""; |
|
|
|
public function __construct($src = null) { |
|
global $con; |
|
if ($src == null) |
|
return; |
|
if (is_array($src)) { |
|
if (isset($src['ID']) && $src['ID'] > 0) { |
|
$this->_loadAndFillObject($src['ID'], self::TABLE_NAME, $src); |
|
} else { |
|
$this->_loadByRow($src, $stripSlashes); |
|
} |
|
} elseif (intval($src)) { |
|
$this->_loadById($src, self::TABLE_NAME, true); |
|
} |
|
} |
|
|
|
/* |
|
* controllo Partita Iva |
|
*/ |
|
|
|
public function controlloPartitaIVa($partivaIva = "") { |
|
global $con; |
|
$itVerify = array(); |
|
$verify = $con->prepare("SELECT * FROM " . self::TABLE_NAME . " WHERE PARTITA_IVA=:partita_iva"); |
|
$verify->bindParam(":partita_iva", $partivaIva); |
|
try { |
|
$verify->execute(); |
|
$itVerify = $verify->fetch(PDO::FETCH_ASSOC); |
|
} catch (Exception $exc) { |
|
$itVerify['esito'] = -999; |
|
$itVerify['descrizioneErrore'] = $exc->getMessage(); |
|
} |
|
return $itVerify; |
|
} |
|
|
|
public static function LoadDataTable($searchQuery = "", $searchArray = array(), $columnName = array(), $columnSortOrder = array(), $start = 0, $offset = 0) { |
|
|
|
return parent::_loadDataTable(self::TABLE_NAME, $searchQuery, $searchArray, $columnName, $columnSortOrder, $start, $offset); |
|
} |
|
|
|
public function Save() { |
|
global $con; |
|
$vars = get_object_vars($this); |
|
$sql = Utils::prepareQuery(self::TABLE_NAME, $vars); |
|
$queryabi = $con->prepare($sql); |
|
foreach ($vars as $k => $v) { |
|
if ($k == "ID" && $v == 0) |
|
continue; |
|
$queryabi->bindValue(":" . $k, $v); |
|
} |
|
try { |
|
$it = parent::_Save($queryabi); |
|
} catch (Exception $exc) { |
|
$it['descrizioneErrore'] = $exc->getMessage(); |
|
} |
|
return $it; |
|
} |
|
|
|
public function Delete() { |
|
return parent::_Delete(self::TABLE_NAME, "id = " . $this->id); |
|
} |
|
|
|
/** |
|
* Elimina l'oggetto corrente dal database e restituisce TRUE se ha successo |
|
* |
|
* @return bool Risultato booleano dell'operazione |
|
*/ |
|
public function LogicalDelete() { |
|
return parent::_LogicalDelete(self::TABLE_NAME, "id = " . $this->id); |
|
} |
|
|
|
/** |
|
* Funzione per la visualizzazione dei logs |
|
* @param type $record |
|
* @param type $campo |
|
*/ |
|
public function Parse(&$record, $campo = "") { |
|
$props = get_class_vars(get_class($this)); |
|
switch ($campo) { |
|
|
|
default: |
|
array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); |
|
break; |
|
} |
|
} |
|
|
|
}
|
|
|