',
'state' => false
);
} else {
$this->delete_acte();
$query = "delete from rent_accounts where id_account = ".$this->id;
pmb_mysql_query($query);
return array(
'msg_to_display' => '',
'state' => true
);
}
}
return array(
'msg_to_display' => '',
'state' => false
);
}
/**
* Sélecteur des exercices comptables en cours
*/
protected function gen_selector_exercices() {
global $msg;
$display = '';
$query = exercices::listByEntite($this->get_entity()->id_entite,1);
$display=gen_liste($query,'id_exercice','libelle', 'account_exercices', 'update_pricing_systems();', (isset($this->exercice) ? $this->exercice->id_exercice : ''), 0,$msg['pricing_system_exercices_empty'],0,'');
return $display;
}
public function get_entity(){
if (!isset($this->entity)) {
$this->entity = new entites(entites::getSessionBibliId()*1);
}
return $this->entity;
}
public function get_invoice_address_entity(){
$query_result = entites::get_coordonnees(entites::getSessionBibliId()*1, '1');
return pmb_mysql_fetch_object($query_result);
}
public function get_user() {
$query ='select * from users where userid='.$this->num_user;
$result = pmb_mysql_query($query);
return pmb_mysql_fetch_object($result);
}
public function get_total_price() {
return number_format($this->get_price() + $this->get_web_price(), 2, '.', '');
}
public function get_state_invoice() {
global $base_path;
global $msg;
if($this->num_invoice) {
$link_edit_invoice = "onclick=\"document.location='".$base_path."/acquisition.php?categ=rent&sub=invoices&action=edit&id_bibli=&id=".$this->num_invoice."';\" style=\"cursor:pointer;\"";
$invoice=new rent_invoice($this->num_invoice);
if($invoice->get_status() == 1) {
return "";
} elseif($invoice->get_status() == 2) {
return "";
} else {
return "";
}
} else {
$link_invoices_selector = "onclick=\"account_show_invoices_selector('".$this->id."');\"";
return "";
}
}
protected function get_selector_request_status(){
global $msg;
return '';
}
public function get_supplier_coords() {
if(is_object($this->supplier)) {
$result = entites::get_coordonnees($this->supplier->id_entite,1);
if(pmb_mysql_num_rows($result)){
$row = pmb_mysql_fetch_object($result);
return $row;
}
}
}
public function get_id() {
return $this->id;
}
public function get_num_user() {
return $this->num_user;
}
public function get_exercice() {
return $this->exercice;
}
public function get_request_type() {
return $this->request_type;
}
public function get_request_type_name() {
return $this->request_type_name;
}
public function get_type() {
return $this->type;
}
public function get_type_name() {
return $this->type_name;
}
public function get_desc() {
return $this->desc;
}
public function get_date() {
return $this->date;
}
public function get_formatted_date() {
return $this->formatted_date;
}
public function get_short_year_date() {
return substr($this->date, 2, 2);
}
public function get_receipt_limit_date() {
return $this->receipt_limit_date;
}
public function get_formatted_receipt_limit_date() {
return $this->formatted_receipt_limit_date;
}
public function get_receipt_effective_date() {
return $this->receipt_effective_date;
}
public function get_formatted_receipt_effective_date() {
return $this->formatted_receipt_effective_date;
}
public function get_return_date() {
return $this->return_date;
}
public function get_formatted_return_date() {
return $this->formatted_return_date;
}
public function get_uniform_title() {
return $this->uniform_title;
}
public function get_title() {
return $this->title;
}
public function get_event_date() {
return $this->event_date;
}
public function get_formatted_event_date() {
return $this->formatted_event_date;
}
public function get_event_formation() {
return $this->event_formation;
}
public function get_event_orchestra() {
return $this->event_orchestra;
}
public function get_event_place() {
return $this->event_place;
}
public function get_publisher() {
return $this->publisher;
}
public function get_supplier() {
return $this->supplier;
}
public function get_author() {
return $this->author;
}
public function get_pricing_system() {
return $this->pricing_system;
}
public function get_time() {
return $this->time;
}
public function get_formatted_time() {
return sprintf('%02d',floor($this->time/60)).':'.sprintf('%02d',$this->time % 60);
}
public function get_percent() {
return $this->percent;
}
public function get_price() {
return $this->price;
}
public function is_web() {
return $this->web;
}
public function get_web_percent() {
return $this->web_percent;
}
public function get_web_price() {
return $this->web_price;
}
public function get_comment() {
return $this->comment;
}
public function get_request_status() {
return $this->request_status;
}
public function get_request_status_label() {
global $msg;
switch ($this->request_status) {
case 2 :
return $msg['acquisition_account_request_status_ordered'];
break;
case 3 :
return $msg['acquisition_account_request_status_account'];
break;
case 1:
return $msg['acquisition_account_request_status_not_ordered'];
break;
default :
return '';
break;
}
}
public function get_num_acte() {
return $this->num_acte;
}
public function get_num_invoice() {
return $this->num_invoice;
}
public function is_editable() {
return $this->editable;
}
public function set_id($id) {
$this->id = intval($id);
}
public function set_num_user($num_user) {
$this->num_user = intval($num_user);
}
public function set_exercice($exercice) {
$this->exercice = $exercice;
}
public function set_request_type($request_type) {
$this->request_type = $request_type;
}
public function set_type($type) {
$this->type = $type;
}
public function set_desc($desc) {
$this->desc = $desc;
}
public function set_date($date) {
$this->date = $date;
}
public function set_receipt_limit_date($receipt_limit_date) {
$this->receipt_limit_date = $receipt_limit_date;
}
public function set_receipt_effective_date($receipt_effective_date) {
$this->receipt_effective_date = $receipt_effective_date;
}
public function set_return_date($return_date) {
$this->return_date = $return_date;
}
public function set_uniform_title($uniform_title) {
$this->uniform_title = $uniform_title;
}
public function set_title($title) {
$this->title = $title;
}
public function set_event_date($event_date) {
$this->event_date = $event_date;
}
public function set_event_formation($event_formation) {
$this->event_formation = $event_formation;
}
public function set_event_orchestra($event_orchestra) {
$this->event_orchestra = $event_orchestra;
}
public function set_event_place($event_place) {
$this->event_place = $event_place;
}
public function set_publisher($publisher) {
$this->publisher = $publisher;
}
public function set_supplier($supplier) {
$this->supplier = $supplier;
}
public function set_author($author) {
$this->author = $author;
}
public function set_pricing_system($pricing_system) {
$this->pricing_system = $pricing_system;
}
public function set_time($time) {
$this->time = intval($time);
}
public function set_percent($percent) {
$this->percent = $percent;
}
public function set_price($price) {
$this->price = $price;
}
public function set_web($web) {
$this->web = $web;
}
public function set_web_percent($web_percent) {
$this->web_percent = $web_percent;
}
public function set_web_price($web_price) {
$this->web_price = $web_price;
}
public function set_comment($comment) {
$this->comment = $comment;
}
public function set_request_status($request_status) {
$this->request_status = $request_status;
}
public function set_num_acte($num_acte) {
$this->num_acte = $num_acte;
}
public function set_num_invoice($num_invoice) {
$num_invoice = intval($num_invoice);
if($num_invoice) {
$this->editable = false;
} else {
$this->editable = true;
}
$this->num_invoice = $num_invoice;
}
public static function get_uniform_title_fields($uniform_title_id) {
$tu= new titre_uniforme($uniform_title_id);
return $tu;
}
public function get_invoices_to_select(){
if($this->num_invoice) return "";
$filters = array(
'id_type' => $this->get_type(),
'status' => 1,
'num_pricing_system' => $this->pricing_system->get_id(),
);
$invoices=new rent_invoices($filters);
return $invoices->get_display_selector_list($this->id);
}
public function add_account_in_invoice($invoice_id){
global $msg, $charset;
$invoice=new rent_invoice($invoice_id);
$invoice->add_account($this);
$invoice->save();
$this->num_invoice = $invoice_id;
return array(
'id' => $this->id,
'invoice_id' => $invoice_id,
'icon' => "",
);
}
protected function get_default_exercice_num() {
$query = exercices::listByEntite($this->get_entity()->id_entite,1).' limit 1';
$result = pmb_mysql_query($query);
if (pmb_mysql_num_rows($result)) {
return pmb_mysql_result($result, 0, 0);
}
}
}