From: <dai...@us...> - 2016-05-28 05:44:36
|
Revision: 7544 http://sourceforge.net/p/web-erp/reponame/7544 Author: daintree Date: 2016-05-28 05:44:34 +0000 (Sat, 28 May 2016) Log Message: ----------- dont print statements if there is an email address set up for the customer Modified Paths: -------------- trunk/PrintCustStatements.php trunk/SelectCustomer.php trunk/doc/Manual/ManualAccountsReceivable.html Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2016-05-28 04:41:56 UTC (rev 7543) +++ trunk/PrintCustStatements.php 2016-05-28 05:44:34 UTC (rev 7544) @@ -34,6 +34,7 @@ } If (isset($_POST['PrintPDF']) AND isset($_POST['FromCust']) AND $_POST['FromCust']!=''){ + $_POST['FromCust'] = mb_strtoupper($_POST['FromCust']); If (!isset($_POST['ToCust'])){ @@ -123,23 +124,29 @@ while ($StmtHeader=DB_fetch_array($StatementResults)){ /*loop through all the customers returned */ + if (isset($RecipientArray)) { + unset($RecipientArray); + } + $RecipientArray = array(); + $RecipientsResult = DB_query("SELECT email FROM custcontacts WHERE statement=1 AND debtorno='" . $StmtHeader['debtorno'] . "'"); + while ($RecipientRow = DB_fetch_row($RecipientsResult)){ + if (IsEmailAddress($RecipientRow[0])){ + $RecipientArray[] = $RecipientRow[0]; + } + } if ($_POST['EmailOrPrint']=='email'){ - if (isset($RecipientArray)) { - unset($RecipientArray); - } - $RecipientArray = array(); include('includes/PDFStarter.php'); $pdf->addInfo('Title', $_SESSION['CompanyRecord']['coyname'] . ' - ' . _('Customer Statement') ); $pdf->addInfo('Subject', _('For customer') . ': ' . $StmtHeader['name']); $PageNumber = 1; - $RecipientsResult = DB_query("SELECT email FROM custcontacts WHERE statement=1 AND debtorno='" . $StmtHeader['debtorno'] . "'"); - while ($RecipientRow = DB_fetch_row($RecipientsResult)){ - if (IsEmailAddress($RecipientRow[0])){ - $RecipientArray[] = $RecipientRow[0]; - } } - if ($_POST['EmailOrPrint']=='print' OR +/*Only create the pdf for this customer if + * set to print and there are no email addresses defined + * OR + * set to email and there are email addresses defined. + */ + if (($_POST['EmailOrPrint']=='print' AND count($RecipientArray)==0) OR ($_POST['EmailOrPrint']=='email' AND count($RecipientArray)>0) ){ $line_height=16; Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2016-05-28 04:41:56 UTC (rev 7543) +++ trunk/SelectCustomer.php 2016-05-28 05:44:34 UTC (rev 7544) @@ -262,12 +262,11 @@ echo '<tr> <td colspan="2">', _('Enter a partial Name'), ':</td> - <td><input type="text" maxlength="25" name="Keywords" size="20" ', + <td><input type="text" maxlength="25" name="Keywords" title="', _('If there is an entry in this field then customers with the text entered in their name will be returned') , '" size="20" ', ( isset($_POST['Keywords']) ? 'value="' . $_POST['Keywords'] . '" ' : '' ), '/></td>'; echo '<td><b>', _('OR'), '</b></td><td>', _('Enter a partial Code'), ':</td> - <td><input maxlength="18" name="CustCode" pattern="[\w-]*" size="15" type="text" ', - (isset($_POST['CustCode']) ? 'value="' . $_POST['CustCode'] . '" ' : '' ), '/></td> + <td><input maxlength="18" name="CustCode" pattern="[\w-]*" size="15" type="text" title="', _('If there is an entry in this field then customers with the text entered in their customer code will be returned') , '" ', (isset($_POST['CustCode']) ? 'value="' . $_POST['CustCode'] . '" ' : '' ), '/></td> </tr>'; echo '<tr> Modified: trunk/doc/Manual/ManualAccountsReceivable.html =================================================================== --- trunk/doc/Manual/ManualAccountsReceivable.html 2016-05-28 04:41:56 UTC (rev 7543) +++ trunk/doc/Manual/ManualAccountsReceivable.html 2016-05-28 05:44:34 UTC (rev 7544) @@ -186,6 +186,7 @@ <h2><a id="CustomerStatements">Customer Statements</a></h2> <p>Customer statements can either be printed or emailed directly to all the customers in the selected range, that have a contact defined as receiving a statement. If there are no contacts defined for the customer that have the statement flag set to yes then their statement will not be emailed to them. If the customer has many contacts with several of them having the statement flag set to yes then all those contacts will receive a copy of the pdf statement.</p> +<p>If the customer has any contacts that have the statement flag set then it will not be possible to print their statement so as to avoid sending both a printed statement and an email statement</p> <div class="floatright"> |