vtiger Forum Index vtiger
The Honest Open Source CRM
 

Tip: Purchase Order prevent automatic shipping address
Click here to go to the original topic

 
       vtiger Forum Index -> Usability & Themes - 5.0.3
Previous topic :: Next topic  
Author Message
jshope



Joined: 09 Aug 2005
Posts: 191

Posted: Tue Aug 14, 2007 6:00 pm    Post subject: Tip: Purchase Order prevent automatic shipping address  

Hi all,

Here is a code change for use when creating a new Purchase Order that prevents the automatic insertion of the shipping address into the order. The reason this is needed is that the Billing and Shipping addresses are BOTH gotten from the Vendor's address. Since you almost never will be purchasing something from a Vendor and then having it shipped to that SAME Vendor's address rather than to your own or someone else's, it makes sense to have the shipping address fields start "not filled in" and ready for you to type in the actual destination. There is also the added benefit that if you then leave those shipping address fields blank yourself, you will be warned when trying to save the Purchase Order, that these fields are blank and that you need to put something there in the "street" field, even if it is only a word or Note to fill it in with the proper information later.

Ready for this "big" change that makes the purchase order work flow considerably smoother :wink:

In the file

/modules/Vendors/Vendors.js

Comment out all the lines in the function set_return_address beginning with “window.opener.document” that have a shipping address related item in it,

For example:

Code: function set_return_address(vendor_id, vendor_name, street, city, state, code, country,pobox )
{
        window.opener.document.EditView.vendor_name.value = vendor_name;
        window.opener.document.EditView.vendor_id.value = vendor_id;
        window.opener.document.EditView.bill_street.value = street;
        //window.opener.document.EditView.ship_street.value = street;
        window.opener.document.EditView.bill_city.value = city;
        //window.opener.document.EditView.ship_city.value = city;
        window.opener.document.EditView.bill_state.value = state;
        //window.opener.document.EditView.ship_state.value = state;
        window.opener.document.EditView.bill_code.value = code;
        //window.opener.document.EditView.ship_code.value = code;
        window.opener.document.EditView.bill_country.value = country;
        //window.opener.document.EditView.ship_country.value = country;
        window.opener.document.EditView.bill_pobox.value = pobox;
        //window.opener.document.EditView.ship_pobox.value = pobox;
}

Hope it helps someone,

~jim (Central PA)
Back to top  
edlentz



Joined: 18 Nov 2005
Posts: 525
Location: Midland, Mi.

Posted: Tue Aug 14, 2007 11:36 pm    Post subject: Re: Tip: Purchase Order prevent automatic shipping address  

Jim,
I am sorry to say that that makes WAY to much sense! :)

Thanks
Back to top  
jshope



Joined: 09 Aug 2005
Posts: 191

Posted: Mon Aug 20, 2007 4:09 am    Post subject: Re: Tip: Purchase Order prevent automatic shipping address  

UPDATE:

There is another place where a change is necessary to prevent the Shipping Address info from being placed into the Purchase Order automatically. This is for when you are starting from the Vendor's page and choose to create a Purchase Order using the "Create New Purchase Order" button. (Note: The changes in the first post are for when you are creating a Purchase Order and select the Vendor from the Vendor field in the PO)

In the file /modules/PurchaseOrder/EditView.php around line ~61 where this comment is shown.

"// Get vtiger_vendor address if vtiger_vendorid is given"

Comment out all the lines that have to do with the shipping address.

Example:


Code: // Get vtiger_vendor address if vtiger_vendorid is given
if(isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id']!='' && $_REQUEST['record']==''){
   require_once('modules/Vendors/Vendors.php');
   $vend_focus = new Vendors();

   $vend_focus->retrieve_entity_info($_REQUEST['vendor_id'],"Vendors");
   $focus->column_fields['bill_city']=$vend_focus->column_fields['city'];
   //$focus->column_fields['ship_city']=$vend_focus->column_fields['city'];
   $focus->column_fields['bill_street']=$vend_focus->column_fields['street'];
   //$focus->column_fields['ship_street']=$vend_focus->column_fields['street'];
   $focus->column_fields['bill_state']=$vend_focus->column_fields['state'];
   //$focus->column_fields['ship_state']=$vend_focus->column_fields['state'];
   $focus->column_fields['bill_code']=$vend_focus->column_fields['postalcode'];
   //$focus->column_fields['ship_code']=$vend_focus->column_fields['postalcode'];
   $focus->column_fields['bill_country']=$vend_focus->column_fields['country'];
   //$focus->column_fields['ship_country']=$vend_focus->column_fields['country'];
   $focus->column_fields['bill_pobox']=$vend_focus->column_fields['pobox'];
   //$focus->column_fields['ship_pobox']=$vend_focus->column_fields['pobox'];
}


Regards,
~jim (Central PA)
Back to top  
opto



Joined: 21 Jul 2007
Posts: 148

Posted: Wed Aug 22, 2007 7:48 pm    Post subject: Re: Tip: Purchase Order prevent automatic shipping address  

A third way to do this - having to touch less of the vtiger code - is to change the PO PDF (createpdf and the header.pdf).

what we did is we replaced the vendor's shipping address by the (our) company address, which is also available in the createpdf in PHP variables.

Doing this, one could leave to the vtiger team the following change:

In the company section, add a section for the (our) company's shipping address. Use this shipping address in the PO PDF.

The shipping address of the vendor would only be relevant for products returned to the vendor.

Klaus
Back to top  
jrtorrent



Joined: 05 Dec 2007
Posts: 9
Location: Connecticut-USA

Posted: Thu Dec 13, 2007 12:57 am    Post subject: Re: Tip: Purchase Order prevent automatic shipping address  

JSHOPE,

Thank you so much for the posting and the detail which made it easy for me to do the changes and clean the PO.

Opto,

I read with interest your solution but you talk to the advanced developer, those who probably don't need the guidance.

It would be nice and useful to many (me included) if you could, like jshope did, write down the how-to in some detail. Then your post would be really useful to many.

As far as reducing the code changes I'm assuming you think of future code revisions or new versions. I would like to think that the people who developed Vtiger are smart and will incorporate such a basic change in any new version so the business processes make business sense and people don't have to waste time changing the ship to addresses every time they send POs. After all who would want or care for the manufacturer to makes the product and sends it to himself/herself.

Vtiger team ... taking note?

Thank you to both for improving Vtiger and to the Vtiger team a big THANK YOU for a beautiful USABLE product.

Juan
Back to top  
 
       vtiger Forum Index -> Usability & Themes - 5.0.3
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group