[IMP] Improvement in thunderbird
bzr revid: ksa@tinyerp.co.in-20100804090515-120elt0h4pxgcd3v
This commit is contained in:
parent
ee6ccde777
commit
8f859de191
|
@ -2,7 +2,7 @@
|
|||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -32,7 +32,6 @@ class thunderbird_partner(osv.osv_memory):
|
|||
_rec_name="sender"
|
||||
|
||||
def mailcreate(self,cr,user,vals):
|
||||
print "vvvvvvvvvvv",vals
|
||||
dictcreate = dict(vals)
|
||||
import email
|
||||
header_name = email.Header.decode_header(dictcreate['name'])
|
||||
|
@ -82,23 +81,25 @@ class thunderbird_partner(osv.osv_memory):
|
|||
def update_contact(self,cr,user,vals):
|
||||
dictcreate = dict(vals)
|
||||
res_id = dictcreate.get('res_id',False)
|
||||
result={}
|
||||
if res_id:
|
||||
address_obj = self.pool.get('res.partner.address')
|
||||
address_data = address_obj.read(cr, user, int(res_id), [])
|
||||
result={
|
||||
'partner_id': dictcreate.get('partner_id',False),
|
||||
'country_id': dictcreate.get('country_id', False),
|
||||
'state_id': dictcreate('state_id', False),
|
||||
'name': dictcreate.get('name', False),
|
||||
'street': dictcreate.get('street', False),
|
||||
'street2': dictcreate.get('street2', False),
|
||||
'zip': dictcreate.get('zip', False),
|
||||
'city': dictcreate.get('city', False),
|
||||
'phone': dictcreate.get('phone', False),
|
||||
'fax': dictcreate.get('fax', False),
|
||||
'mobile': dictcreate.get('mobile', False),
|
||||
'email': dictcreate.get('email', False),
|
||||
}
|
||||
address_obj.write(cr, user,res_id,result )
|
||||
'partner_id': address_data['partner_id'] and address_data['partner_id'][0] or False,
|
||||
'country_id': dictcreate['country_id'] and int(dictcreate['country_id'][0]) or False,
|
||||
'state_id': dictcreate['state_id'] and int(dictcreate['state_id'][0]) or False,
|
||||
'name': dictcreate['name'],
|
||||
'street': dictcreate['street'],
|
||||
'street2': dictcreate['street2'],
|
||||
'zip': dictcreate['zip'],
|
||||
'city': dictcreate['city'],
|
||||
'phone': dictcreate['phone'],
|
||||
'fax': dictcreate['fax'],
|
||||
'mobile': dictcreate['mobile'],
|
||||
'email': dictcreate['email'],
|
||||
}
|
||||
address_obj.write(cr, user,res_id,result )
|
||||
return True
|
||||
|
||||
def create_partner(self,cr,user,vals):
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/config_change.dtd">
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load()"
|
||||
title="Server" height="160" width="320">
|
||||
title="Server" height="140" width="240">
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/tiny_xmlrpc.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/config.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/loaddata.js"></script>
|
||||
|
@ -18,7 +18,8 @@
|
|||
<hbox>
|
||||
<label id="lblport" control="txtcport" value="&lblport.label;" width="80"/>
|
||||
<textbox id="txtcport" width="100" />
|
||||
</hbox>
|
||||
</hbox>
|
||||
|
||||
</groupbox>
|
||||
<hbox align="rightr">
|
||||
<spacer width="50"/>
|
||||
|
|
|
@ -45,11 +45,12 @@ var myPrefObserver =
|
|||
//set the initial value of name and email field of create contact window
|
||||
createContact: function()
|
||||
{
|
||||
//document.getElementById("txtselectpartner").value= getPartnerName();
|
||||
//document.getElementById("txtselectpartner").value= getPartnerID();
|
||||
document.getElementById("txtname").value= getSenderName();
|
||||
document.getElementById("txtemail").value= getSenderEmail();
|
||||
document.getElementById("country").value=getAllCountry();
|
||||
document.getElementById("state").value=getAllState();
|
||||
setPartnerId(0);
|
||||
},
|
||||
|
||||
//sets the value of email information in preferences and adds observer for the window
|
||||
|
@ -98,14 +99,13 @@ var myPrefObserver =
|
|||
document.getElementById("txtstreet2").value= getStreet2();
|
||||
document.getElementById("txtzip").value= getZipCode();
|
||||
document.getElementById("txtcity").value= getCity();
|
||||
// document.getElementById("txtcountry").value= getCountry();
|
||||
// document.getElementById("txtstate").value= getState();
|
||||
document.getElementById("txtoffice").value= getOfficenumber();
|
||||
document.getElementById("txtfax").value= getFax();
|
||||
document.getElementById("txtmobile").value= getMobilenumber();
|
||||
document.getElementById("txtemail").value= getSenderEmail();
|
||||
document.getElementById("country").value=getAllCountry();
|
||||
document.getElementById("state").value=getAllState();
|
||||
|
||||
},
|
||||
|
||||
//unregistering the window observer
|
||||
|
|
|
@ -176,7 +176,73 @@ function searchmail()
|
|||
window.open("chrome://openerp_plugin/content/plugin.xul", "", "chrome, resizable=yes");
|
||||
}
|
||||
}
|
||||
|
||||
function open_contact()
|
||||
{
|
||||
setTimeout("createConnection()",5000)
|
||||
if (getconnect_server() == "false")
|
||||
{
|
||||
alert("Please Login To The Database First !")
|
||||
return false;
|
||||
}
|
||||
setTimeout("module_install()", 10000)
|
||||
if (getmodule_install() == "no")
|
||||
{
|
||||
alert("Please install the thunderbird module on your '" + getDbName() +"' database Or try again !");
|
||||
return false
|
||||
}
|
||||
if(GetNumSelectedMessages() < 1 || GetNumSelectedMessages() > 1){
|
||||
alert("You must select only one mail For Open Contact Detail");
|
||||
return false
|
||||
}
|
||||
|
||||
//gives the selected email uri
|
||||
var messageUri= gDBView.URIForFirstSelectedMessage;
|
||||
|
||||
var messenger = Components.classes['@mozilla.org/messenger;1'].createInstance(Components.interfaces.nsIMessenger);
|
||||
|
||||
//gives the selected email object
|
||||
var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri);
|
||||
|
||||
//functionality to split the author name and email
|
||||
if(message.author.charAt(0) == '"'){
|
||||
sendername = message.author.split('"')[1].split('"')[0];
|
||||
}
|
||||
else if(message.author.indexOf('<')!=-1){
|
||||
sendername = message.author.split('<')[0];
|
||||
}
|
||||
else{
|
||||
sendername = message.author;
|
||||
}
|
||||
if(message.author.indexOf('<')!=-1){
|
||||
senderemail = message.author.split('<')[1].split('>')[0];
|
||||
}
|
||||
else{
|
||||
senderemail = message.author
|
||||
}
|
||||
|
||||
//set the initial information for the selected email
|
||||
setSenderEmail(senderemail);
|
||||
setSenderName(sendername);
|
||||
setPartnerName("");
|
||||
setStreet("");
|
||||
setStreet2("");
|
||||
setZipCode("");
|
||||
setCity("");
|
||||
setOfficenumber("");
|
||||
setFax("");
|
||||
setMobilenumber("");
|
||||
|
||||
if (getmodule_install() == "no")
|
||||
{
|
||||
alert("Please install the thunderbird module on your '" + getDbName() +"' database Or try again !");
|
||||
return false
|
||||
}
|
||||
window.open("chrome://openerp_plugin/content/address.xul", "", "chrome, resizable=yes");
|
||||
|
||||
}
|
||||
|
||||
|
||||
//function to open the configuration window
|
||||
var Config = {
|
||||
onLoad: function() {
|
||||
|
@ -219,13 +285,9 @@ var Address = {
|
|||
this.initialized=true;
|
||||
},
|
||||
|
||||
onMenuItemCommand: function(){
|
||||
// if(GetNumSelectedMessages() < 1 || GetNumSelectedMessages() > 1){
|
||||
// alert("You must select only one mail to archive");
|
||||
//return false
|
||||
//}
|
||||
onMenuItemCommand: function(){
|
||||
open_contact();
|
||||
searchContact();
|
||||
window.open("chrome://openerp_plugin/content/address.xul", "", "chrome");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<hbox id="root">
|
||||
<vbox width="400">
|
||||
<groupbox height="30" id="existsobjectgroup" width="400">
|
||||
<caption label="&gptinydoc.label;" />
|
||||
<caption label="&gptinyobj.label;" />
|
||||
<hbox>
|
||||
<label id="lblsearch" control="txtvalueobj" value="&search.label;"/>
|
||||
<textbox id="txtvalueobj" size="30"/>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<vbox align="left" id="checkbox-dynamic">
|
||||
</vbox>
|
||||
<hbox align="center">
|
||||
<image src='chrome://openerp_plugin/skin/perform.gif'/>
|
||||
<image src='chrome://tiny_plugin/skin/perform.gif'/>
|
||||
<checkbox id="cbxselectall" oncommand="selectAllCheckbox();" label="&cbxselectall.label;" checked="false"/>
|
||||
<spacer width="10"/>
|
||||
<button label="&bsearch.label;" oncommand="searchCheckbox()" image="&imagesearch.value;" accesskey="s"/>
|
||||
|
@ -48,10 +48,10 @@
|
|||
</vbox>
|
||||
<vbox>
|
||||
<groupbox id="newobjectgroup" align="center" width="170" height="375">
|
||||
<caption label="&newdocument.label;" />
|
||||
<caption label="&newobject.label;" />
|
||||
<hbox>
|
||||
<label id="lblex" value=" "/>
|
||||
<label id="lblex3" control="section" value="&document.label;"/>
|
||||
<label id="lblex3" control="section" value="&object.label;"/>
|
||||
<menulist id="section" width="150">
|
||||
<menupopup>
|
||||
<menuitem label="" value=""/>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<label id="lblsection" value=" "/>
|
||||
<separator class="groove-thin" orient="horizontal" width="180"/>
|
||||
|
||||
<tabpanels>
|
||||
<tabpanels>
|
||||
<tabpanel id="contact">
|
||||
<hbox>
|
||||
<label id="lblsection" control="section" value="&partner.label;"/>
|
||||
|
|
|
@ -303,7 +303,7 @@ function setCity(argCity){
|
|||
|
||||
//set preference value for country
|
||||
function setCountry(argCountry){
|
||||
getPref().setCharPref('country',argCountry)
|
||||
getPref().setCharPref('country',argCountry)
|
||||
}
|
||||
|
||||
//set preference value for state
|
||||
|
@ -940,6 +940,7 @@ var listSearchContactHandler = {
|
|||
var strlResult = arrIdList.QueryElementAt(i, Components.interfaces.nsISupportsArray);
|
||||
var strlSearchResult = strlResult.QueryElementAt(0, Components.interfaces.nsISupportsCString);
|
||||
var strlSearchResultValue = strlResult.QueryElementAt(1, Components.interfaces.nsISupportsCString);
|
||||
|
||||
if(strlSearchResult=="partner_name"){
|
||||
setPartnerName(strlSearchResultValue);
|
||||
var t = getPartnerName();}
|
||||
|
@ -1326,8 +1327,8 @@ function archivemail(){
|
|||
strmethod.data = 'mailcreate';
|
||||
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
|
||||
strobj.data = 'thunderbird.partner';
|
||||
var a = ['sender','receiver','date','title','description'];
|
||||
var b = [getSenderEmail(),getReceiverEmail(),getReceivedDate(),getSubject(),getMessageBody()];
|
||||
var a = ['name','object','date','email_from','email_cc','description','user_id'];
|
||||
var b = [getSubject(),object,getReceivedDate(),getSenderEmail(),getCCList(),getMessageBody(),branchobj.getIntPref('userid')];
|
||||
var arrofarr = dictcontact(a,b);
|
||||
xmlRpcClient.asyncCall(listArchiveHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
|
||||
}
|
||||
|
@ -1367,23 +1368,23 @@ var listCreateContactHandler = {
|
|||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
|
||||
var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
|
||||
setContactId(createId);
|
||||
//alert("Contact Created Successfully.");
|
||||
alert("Contact Created Successfully.");
|
||||
window.close();
|
||||
},
|
||||
onFault: function (client, ctxt, fault) {
|
||||
//alert('XML-RPC Fault: '+fault);
|
||||
alert('XML-RPC Fault: '+fault);
|
||||
},
|
||||
|
||||
onError: function (client, ctxt, status, errorMsg) {
|
||||
//alert('Error: '+errorMsg);
|
||||
alert('Error: '+errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
var listUpdateContactHandler = {
|
||||
onResult: function(client, context, result) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
|
||||
var partnerId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
|
||||
setResourceId(partnerId);
|
||||
var ResourceId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
|
||||
setResourceId(ResourceId);
|
||||
//alert("Contact Created Successfully.");
|
||||
window.close();
|
||||
},
|
||||
|
@ -1417,7 +1418,7 @@ function createContact(){
|
|||
var arrofarr = dictcontact(a,b);
|
||||
xmlRpcClient.asyncCall(listCreateContactHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
|
||||
}
|
||||
//ksa
|
||||
|
||||
function UpdateContact(){
|
||||
var branchobj = getPref();
|
||||
setServerService('xmlrpc/object');
|
||||
|
@ -1433,6 +1434,7 @@ function UpdateContact(){
|
|||
strmethod.data = 'update_contact';
|
||||
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
|
||||
strobj.data = 'thunderbird.partner';
|
||||
alert(getResourceId());
|
||||
var a = ['res_id','partner_id','name','street','street2','zip','city','country_id','state_id','phone','fax','mobile','email'];
|
||||
var b = [getResourceId(),getPartnerName(),getSenderName(),document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,getSenderEmail()];
|
||||
var arrofarr = dictcontact(a,b);
|
||||
|
|
|
@ -35,8 +35,8 @@ Licenced under the terms of OpenERP Public License (OEPL) v1.1 ">
|
|||
<!ENTITY tinyerp_s.value "The Tiny Company">
|
||||
|
||||
<!ENTITY imageicon.value "chrome://openerp_plugin/skin/NEWT1.png">
|
||||
<!ENTITY gpAbout.label "About Plugin">
|
||||
<!ENTITY develop.value "This Thunderbird Plug-in for OpenERP has been developed by OpenERP SA & Axelor">
|
||||
<!ENTITY gpAbout.label "About OpenERP Thunderbird Plugin">
|
||||
<!ENTITY develop.value "This Thunderbird Plugin for OpenERP has been developed by OpenERP SA & Axelor">
|
||||
<!ENTITY information.value "For more information, please visit our website">
|
||||
<!ENTITY contact.label "Contact Us">
|
||||
<!ENTITY contact.value "info@axelor.com">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!ENTITY title.label "Archieve To OpenERP">
|
||||
<!ENTITY gptinydoc.label "Link to an Existing Document">
|
||||
<!ENTITY newdocument.label "New Documents">
|
||||
<!ENTITY gptinyobj.label "Link to an Existing Document">
|
||||
<!ENTITY newobject.label "New Documents">
|
||||
<!ENTITY bsearch.label "Search">
|
||||
<!ENTITY close.label "Close">
|
||||
<!ENTITY attach.label "Upload to OpenERP">
|
||||
|
@ -17,7 +17,7 @@
|
|||
<!ENTITY cbxcase.label "Case">
|
||||
<!ENTITY cbxtask.label "Task">
|
||||
<!ENTITY cbxselectall.label "Select All">
|
||||
<!ENTITY document.label "Type of Document :">
|
||||
<!ENTITY object.label "Type of Document :">
|
||||
<!ENTITY partner.label "Create New Contact :">
|
||||
<!ENTITY search.label "Search :">
|
||||
<!ENTITY listSearchBox.header "Name">
|
||||
|
|
Loading…
Reference in New Issue