Example #1
0
 function delete()
 {
     $q = prepare("DELETE from projectPerson WHERE projectID = %d", $this->get_id());
     $db = new db_alloc();
     $db->query($q);
     return parent::delete();
 }
Example #2
0
 function delete()
 {
     $db = new db_alloc();
     $q = prepare("DELETE FROM invoiceEntity WHERE invoiceID = %d", $this->get_id());
     $db->query($q);
     return parent::delete();
 }
Example #3
0
 function delete()
 {
     $q = prepare("DELETE FROM reminderRecipient WHERE reminderID = %d", $this->get_id());
     $db = new db_alloc();
     $db->query($q);
     return parent::delete();
 }
Example #4
0
 function delete()
 {
     $db = new db_alloc();
     $q = prepare("DELETE FROM transaction WHERE invoiceItemID = %d", $this->get_id());
     $db->query($q);
     $invoiceID = $this->get_value("invoiceID");
     $status = parent::delete();
     $status2 = invoice::update_invoice_dates($invoiceID);
     return $status && $status2;
 }
Example #5
0
 function delete()
 {
     $db = new db_alloc();
     $query = prepare("SELECT * \n                        FROM productSaleItem \n                       WHERE productSaleID = %d", $this->get_id());
     $db->query($query);
     while ($db->next_record()) {
         $productSaleItem = new productSaleItem();
         $productSaleItem->read_db_record($db);
         $productSaleItem->delete();
     }
     $this->delete_transactions();
     return parent::delete();
 }
Example #6
0
 function delete()
 {
     if ($this->get_id()) {
         $dir = ATTACHMENTS_DIR . "comment" . DIRECTORY_SEPARATOR . $this->get_id();
         if (is_dir($dir)) {
             $handle = opendir($dir);
             clearstatcache();
             while (false !== ($file = readdir($handle))) {
                 if ($file != "." && $file != ".." && file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
                     unlink($dir . DIRECTORY_SEPARATOR . $file);
                     clearstatcache();
                 }
             }
             is_dir($dir) && rmdir($dir);
         }
     }
     parent::delete();
 }
Example #7
0
 function delete()
 {
     // delete all contacts and comments linked with this client as well
     $db = new db_alloc();
     $query = prepare("SELECT * FROM clientContact WHERE clientID=%d", $this->get_id());
     $db->query($query);
     while ($db->next_record()) {
         $clientContact = new clientContact();
         $clientContact->read_db_record($db);
         $clientContact->delete();
     }
     $query = prepare("SELECT * FROM comment WHERE commentType = 'client' and commentLinkID=%d", $this->get_id());
     $db->query($query);
     while ($db->next_record()) {
         $comment = new comment();
         $comment->read_db_record($db);
         $comment->delete();
     }
     return parent::delete();
 }
Example #8
0
 function delete()
 {
     if ($this->can_be_deleted()) {
         return parent::delete();
     }
 }
Example #9
0
 function delete()
 {
     // have to null out any records that point to this clientContact first to satisfy the referential integrity constraints
     if ($this->get_id()) {
         $db = new db_alloc();
         $q = prepare("UPDATE interestedParty SET clientContactID = NULL where clientContactID = %d", $this->get_id());
         $db->query($q);
         $q = prepare("UPDATE comment SET commentCreatedUserClientContactID = NULL where commentCreatedUserClientContactID = %d", $this->get_id());
         $db->query($q);
         $q = prepare("UPDATE project SET clientContactID = NULL where clientContactID = %d", $this->get_id());
         $db->query($q);
     }
     return parent::delete();
 }
Example #10
0
 function delete()
 {
     $timeSheetID = $this->get_value("timeSheetID");
     $db = new db_alloc();
     $q = prepare("SELECT invoiceItem.*\n                    FROM invoiceItem\n               LEFT JOIN invoice ON invoiceItem.invoiceID = invoice.invoiceID\n                   WHERE timeSheetID = %d\n                     AND invoiceStatus != 'finished'", $timeSheetID);
     $db->query($q);
     while ($row = $db->row()) {
         $ii = new invoiceItem();
         $ii->set_id($row["invoiceItemID"]);
         $ii->select();
         if ($ii->get_value("timeSheetItemID") == $this->get_id()) {
             $ii->delete();
         } else {
             if (!$ii->get_value("timeSheetItemID")) {
                 invoiceEntity::save_invoice_timeSheet($row["invoiceID"], $timeSheetID);
                 // will update the existing invoice item
             }
         }
     }
     return parent::delete();
 }