1<?php 2/* $Revision: 1.7 $ */ 3 4/*Code to check that ShiptRef and Contract or JobRef entered are valid entries 5This is used by the UpdateLine button when a purchase order line item is updated and 6by the EnterLine button when a new purchase order line item is entered 7*/ 8 9 if (($_POST['ShiptRef']!="" AND $_POST['ShiptRef']!=0) or !isset($_POST['ShiptRef'])) { /*Dont bother if no shipt ref selected */ 10 11 /*Check for existance of Shipment Selected */ 12 $sql = "SELECT COUNT(*) FROM shipments WHERE shiptref ='". $_POST['ShiptRef'] . "' AND closed =0"; 13 $ShiptResult = DB_query($sql,'','',false,false); 14 if (DB_error_no!=0 OR DB_num_rows($ShiptResult)==0){ 15 $AllowUpdate = False; 16 prnMsg(_('The update could not be processed') . '<br />' . _('There was some snag in retrieving the shipment reference entered') . ' - ' . _('see the listing of open shipments to ensure a valid shipment reference is entered'),'error'); 17 } else { 18 $ShiptRow = DB_fetch_row($ShiptResult); 19 if($ShiptRow[0]!=1){ 20 $AllowUpdate = False; 21 prnMsg( _('The update could not be processed') . '<br />' . _('The shipment entered is either closed or not set up in the database') . '. ' . _('Please refer to the list of open shipments from the link to ensure a valid shipment reference is entered'),'error'); 22 } 23 } 24 } 25 /* 26 if (($_POST['JobRef']!='' AND $_POST['JobRef']!='0') OR !isset($_POST['JobRef'])) { //Dont bother with this lot if there was not Contract selected 27 28 $sql = "SELECT COUNT(*) FROM contracts WHERE contractref ='". $_POST['JobRef'] . "'"; 29 $JobResult = DB_query($sql); 30 if (DB_error_no!=0 OR DB_num_rows($JobResult)==0){ 31 $AllowUpdate = False; 32 prnMsg(_('The update could not be processed') . '<br />' . _('There was a problem retrieving the contract reference entered') . ' - ' . _('see the listing of contracts to ensure a valid contract reference is entered'),'error'); 33 } else { 34 $JobRow = DB_fetch_row($JobResult); 35 if($JobRow[0]!=1){ 36 $AllowUpdate = False; 37 prnMsg( _('The update could not be processed') . '<br />' . _('The contract reference entered is not set up in the database') . '. ' . _('Please refer to the list of contracts from the link to ensure a valid contract reference is entered') . '. ' . _('If you do not wish to reference the cost of this item to a contract then leave the contract reference field blank'),'error'); 38 } 39 } 40 } 41 */ 42?>