forked from webERP-team/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PO_Chk_ShiptRef_JobRef.php
42 lines (38 loc) · 2.93 KB
/
PO_Chk_ShiptRef_JobRef.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/* $Revision: 1.7 $ */
/*Code to check that ShiptRef and Contract or JobRef entered are valid entries
This is used by the UpdateLine button when a purchase order line item is updated and
by the EnterLine button when a new purchase order line item is entered
*/
if (($_POST['ShiptRef']!="" AND $_POST['ShiptRef']!=0) or !isset($_POST['ShiptRef'])) { /*Dont bother if no shipt ref selected */
/*Check for existance of Shipment Selected */
$sql = "SELECT COUNT(*) FROM shipments WHERE shiptref ='". $_POST['ShiptRef'] . "' AND closed =0";
$ShiptResult = DB_query($sql,'','',false,false);
if (DB_error_no!=0 OR DB_num_rows($ShiptResult)==0){
$AllowUpdate = False;
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');
} else {
$ShiptRow = DB_fetch_row($ShiptResult);
if($ShiptRow[0]!=1){
$AllowUpdate = False;
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');
}
}
}
/*
if (($_POST['JobRef']!='' AND $_POST['JobRef']!='0') OR !isset($_POST['JobRef'])) { //Dont bother with this lot if there was not Contract selected
$sql = "SELECT COUNT(*) FROM contracts WHERE contractref ='". $_POST['JobRef'] . "'";
$JobResult = DB_query($sql);
if (DB_error_no!=0 OR DB_num_rows($JobResult)==0){
$AllowUpdate = False;
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');
} else {
$JobRow = DB_fetch_row($JobResult);
if($JobRow[0]!=1){
$AllowUpdate = False;
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');
}
}
}
*/
?>