Changeset 485 for trunk/phpbms/modules/bms/include/addresses.php
- Timestamp:
- 04/07/09 11:44:18 (3 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/modules/bms/include/addresses.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/bms/include/addresses.php
r384 r485 41 41 class addresses extends phpbmsTable{ 42 42 43 function getName($tabledefid, $recordid){ 43 44 44 function getName($tabledefid, $recordid){45 46 45 switch($tabledefid){ 47 46 48 47 case 2: 49 48 default: 50 49 $querystatement = " 51 SELECT 50 SELECT 52 51 if(clients.lastname!='',concat(clients.lastname,', ',clients.firstname,if(clients.company!='',concat(' (',clients.company,')'),'')),clients.company) AS thename 53 52 FROM … … 56 55 id = ".$recordid; 57 56 break; 58 57 59 58 }//endswitch tabledefid 60 59 61 60 $queryresult = $this->db->query($querystatement); 62 61 63 62 if($this->db->numRows($queryresult)){ 64 63 65 64 $therecord = $this->db->fetchArray($queryresult); 66 65 return htmlQuotes($therecord["thename"]); 67 66 68 67 } else 69 68 return "orphaned record: tableDefinitionID=".$tabledefid.", RecordID:".$recordid; 70 69 71 70 }//end method - getName 72 71 73 72 74 73 function showAssociations($addressid){ 75 // This function generates a table listing all the records 74 // This function generates a table listing all the records 76 75 // associated with the address record. 77 76 78 77 $querystatement = " 79 78 SELECT … … 81 80 addresstorecord.recordid, 82 81 addresstorecord.primary, 83 addresstorecord.defaultshipto 84 FROM 82 addresstorecord.defaultshipto 83 FROM 85 84 addresstorecord 86 85 WHERE … … 89 88 addresstorecord.tabledefid 90 89 "; 91 90 92 91 $queryresult = $this->db->query($querystatement); 93 92 94 93 ?> 95 94 <table class="querytable" cellspacing="0" cellpadding="0" border="0"> … … 108 107 </tfoot> 109 108 <tbody> 110 <?php 109 <?php 111 110 $row =1; 112 111 while($therecord = $this->db->fetchArray($queryresult)) { 113 112 114 113 $row = ($row==1)? 2:1; 115 114 116 115 ?><tr class="qr<?php echo $row?>"> 117 116 <td><?php echo $therecord["recordid"]?></td> … … 121 120 </tr> 122 121 <?php 123 124 }//endwhile - therecord 122 123 }//endwhile - therecord 125 124 ?> 126 125 </tbody> 127 126 </table> 128 127 <?php 129 128 130 129 }//end method - showAssociation 131 130 131 }//end class 132 132 133 // CLASS OVERRIDES =================================================134 135 function formatVariables($variables){136 137 return $variables;138 139 }//end function140 141 142 function updateRecord($variables, $modifiedby = NULL){143 144 $variables = $this->formatVariables($variables);145 146 $thereturn = parent::updateRecord($variables, $modifiedby);147 148 return $thereturn;149 150 }//end method151 152 153 function insertRecord($variables, $createdby = NULL){154 155 $variables = $this->formatVariables($variables);156 157 $newid = parent::insertRecord($variables, $createdby);158 159 return $newid;160 161 }//end method162 163 }//end class164 165 133 }//end if 166 134 167 135 if(class_exists("searchFunctions")){ 168 136 class filesSearchFunctions extends searchFunctions{ 169 137 170 138 function delete_record(){ 171 139 172 140 $whereclause = $this->buildWhereClause(); 173 141 $attachmentwhereclause = $this->buildWhereClause("attachments.fileid"); 174 142 175 143 $querystatement = "DELETE FROM attachments WHERE ".$attachmentwhereclause." AND attachments.fileid!=1;"; 176 144 $queryresult = $this->db->query($querystatement); 177 145 178 146 $querystatement = "DELETE FROM files WHERE ".$whereclause." AND files.id!=1;"; 179 147 $queryresult = $this->db->query($querystatement); 180 148 181 149 $message = $this->buildStatusMessage(); 182 150 $message.=" deleted"; 183 151 return $message; 184 152 } 185 153 186 154 }//end class 187 155 }//end if