[Vtigercrm-commits] [vtiger-commits] r9829 - in /vtigercrm/branches/5.1_jens: ./ Smarty/templates/ Smarty/templates/Inventory/ Smarty/templates/Settings/ cron/ data/ include/ include/database/ include/js/ include/language/ include/nusoap/ include/utils/ install/ jscalendar/ modules/Accounts/ modules/Accounts/language/ modules/Calendar/ modules/Calendar/language/ modules/Campaigns/ modules/Contacts/ modules/Contacts/language/ modules/CustomView/ modules/CustomView/language/ modules/Dashboard/ modules/Emails/ modules/Faq/ modules/HelpDesk/ modules/Home/ modules/Import/ modules/Import/language/ modules/Invoice/ modules/Invoice/language/ modules/Leads/ modules/Leads/language/ modules/Migration/ modules/Migration/ModifyDatabase/ modules/Notes/ modules/Portal/ modules/Potentials/ modules/Potentials/language/ modules/PriceBooks/ modules/PriceBooks/language/ modules/Products/ modules/Products/language/ modules/PurchaseOrder/ modules/PurchaseOrder/language/ modules/Quotes/ modules/Quotes/language/ modules/Reports/ modules/Rss/ modules/SalesOrder/ modules/SalesOrder/language/ modules/Settings/ modules/Settings/language/ modules/Users/ modules/Users/language/ modules/Vendors/ modules/Vendors/language/ modules/Webmails/ modules/uploads/ pkg/bin/ schema/ soap/ themes/alphagrey/ themes/alphagrey/images/ themes/bluelagoon/ themes/bluelagoon/images/ themes/woodspice/ themes/woodspice/images/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Nov 14 05:22:28 EST 2006


Author: jensh
Date: Tue Nov 14 03:16:10 2006
New Revision: 9829

Log:
FCR 2035 - MultiOrganization and Organization Unit supoprt
Postgres fixes
Upgrade to 5.0.2
FormLetter Support


Added:
    vtigercrm/branches/5.1_jens/modules/Contacts/Contacts.php
    vtigercrm/branches/5.1_jens/modules/Notes/Notes.php
Modified:
    vtigercrm/branches/5.1_jens/Popup.php
    vtigercrm/branches/5.1_jens/Release_Notes.html
    vtigercrm/branches/5.1_jens/Smarty/templates/ActivityDetailView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ActivityEditView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ActivityListView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/AddMailAccount.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/AddProductToPriceBooks.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/AddProductsToPriceBook.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List1.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/CreateEmailTemplate.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/CreateView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/CreateWordTemplate.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/DetailView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewFields.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewHidden.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewUI.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/DisplayFields.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/EditViewHidden.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetailView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetails.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Header.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/HomePage.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ImportStep2.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryCreateView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryDetailView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryEditView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ListEmailTemplates.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ListRoles.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ListView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/MigrationStep1.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Popup.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/ProfileDetailView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/QuickCreate.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/RelatedListContents.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/SetMenu.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Settings.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Settings/PickList.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/Settings/TaxConfig.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/TagCloudDisplay.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/UserDetailView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/UserEditView.tpl
    vtigercrm/branches/5.1_jens/Smarty/templates/salesEditView.tpl
    vtigercrm/branches/5.1_jens/connection.php
    vtigercrm/branches/5.1_jens/cron/intimateTaskStatus.php
    vtigercrm/branches/5.1_jens/data/CRMEntity.php
    vtigercrm/branches/5.1_jens/data/SugarBean.php
    vtigercrm/branches/5.1_jens/data/Tracker.php
    vtigercrm/branches/5.1_jens/include/CustomFieldUtil.php
    vtigercrm/branches/5.1_jens/include/RelatedListView.php
    vtigercrm/branches/5.1_jens/include/database/PearDatabase.php
    vtigercrm/branches/5.1_jens/include/database/Postgres8.php
    vtigercrm/branches/5.1_jens/include/js/Inventory.js
    vtigercrm/branches/5.1_jens/include/js/ListView.js
    vtigercrm/branches/5.1_jens/include/js/customview.js
    vtigercrm/branches/5.1_jens/include/js/dtlviewajax.js
    vtigercrm/branches/5.1_jens/include/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/include/nusoap/class.soap_transport_http.php
    vtigercrm/branches/5.1_jens/include/utils/CommonUtils.php
    vtigercrm/branches/5.1_jens/include/utils/DeleteUtils.php
    vtigercrm/branches/5.1_jens/include/utils/DetailViewUtils.php
    vtigercrm/branches/5.1_jens/include/utils/EditViewUtils.php
    vtigercrm/branches/5.1_jens/include/utils/InventoryUtils.php
    vtigercrm/branches/5.1_jens/include/utils/ListViewUtils.php
    vtigercrm/branches/5.1_jens/include/utils/UserInfoUtil.php
    vtigercrm/branches/5.1_jens/include/utils/export.php
    vtigercrm/branches/5.1_jens/include/utils/utils.php
    vtigercrm/branches/5.1_jens/index.php
    vtigercrm/branches/5.1_jens/install/0welcome.php
    vtigercrm/branches/5.1_jens/install/1checkSystem.php
    vtigercrm/branches/5.1_jens/install/2setConfig.php
    vtigercrm/branches/5.1_jens/install/4createConfigFile.php
    vtigercrm/branches/5.1_jens/install/5createTables.inc.php
    vtigercrm/branches/5.1_jens/install/5createTables.php
    vtigercrm/branches/5.1_jens/install/populateSeedData.php
    vtigercrm/branches/5.1_jens/jscalendar/calendar.js
    vtigercrm/branches/5.1_jens/modules/Accounts/Account.php
    vtigercrm/branches/5.1_jens/modules/Accounts/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Accounts/Delete.php
    vtigercrm/branches/5.1_jens/modules/Accounts/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Accounts/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Accounts/EditView.php
    vtigercrm/branches/5.1_jens/modules/Accounts/HeadLines.php
    vtigercrm/branches/5.1_jens/modules/Accounts/ListView.php
    vtigercrm/branches/5.1_jens/modules/Accounts/ListViewTop.php
    vtigercrm/branches/5.1_jens/modules/Accounts/Merge.php
    vtigercrm/branches/5.1_jens/modules/Accounts/Save.php
    vtigercrm/branches/5.1_jens/modules/Accounts/Tickerdetail.php
    vtigercrm/branches/5.1_jens/modules/Accounts/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Calendar/Activity.php
    vtigercrm/branches/5.1_jens/modules/Calendar/ActivityAjax.php
    vtigercrm/branches/5.1_jens/modules/Calendar/Appointment.php
    vtigercrm/branches/5.1_jens/modules/Calendar/CalendarCommon.php
    vtigercrm/branches/5.1_jens/modules/Calendar/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Calendar/ListView.php
    vtigercrm/branches/5.1_jens/modules/Calendar/OpenListView.php
    vtigercrm/branches/5.1_jens/modules/Calendar/RenderRelatedListUI.php
    vtigercrm/branches/5.1_jens/modules/Calendar/addEventUI.php
    vtigercrm/branches/5.1_jens/modules/Calendar/calendarLayout.php
    vtigercrm/branches/5.1_jens/modules/Calendar/calendar_share.php
    vtigercrm/branches/5.1_jens/modules/Calendar/header.php
    vtigercrm/branches/5.1_jens/modules/Calendar/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Calendar/new_calendar.php
    vtigercrm/branches/5.1_jens/modules/Calendar/updateRelations.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/Delete.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/EditView.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/ListView.php
    vtigercrm/branches/5.1_jens/modules/Campaigns/Save.php
    vtigercrm/branches/5.1_jens/modules/Contacts/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Contacts/Contact.php
    vtigercrm/branches/5.1_jens/modules/Contacts/Delete.php
    vtigercrm/branches/5.1_jens/modules/Contacts/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Contacts/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Contacts/EditView.php
    vtigercrm/branches/5.1_jens/modules/Contacts/ListView.php
    vtigercrm/branches/5.1_jens/modules/Contacts/Save.php
    vtigercrm/branches/5.1_jens/modules/Contacts/chat.php
    vtigercrm/branches/5.1_jens/modules/Contacts/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Contacts/vtchat.php
    vtigercrm/branches/5.1_jens/modules/CustomView/CustomView.php
    vtigercrm/branches/5.1_jens/modules/CustomView/EditView.php
    vtigercrm/branches/5.1_jens/modules/CustomView/PopulateCustomView.php
    vtigercrm/branches/5.1_jens/modules/CustomView/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Dashboard/HomepageDB.php
    vtigercrm/branches/5.1_jens/modules/Emails/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Emails/ChooseEmail.php
    vtigercrm/branches/5.1_jens/modules/Emails/Delete.php
    vtigercrm/branches/5.1_jens/modules/Emails/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Emails/EditView.php
    vtigercrm/branches/5.1_jens/modules/Emails/Email.php
    vtigercrm/branches/5.1_jens/modules/Emails/EmailsAjax.php
    vtigercrm/branches/5.1_jens/modules/Emails/ListView.php
    vtigercrm/branches/5.1_jens/modules/Emails/Save.php
    vtigercrm/branches/5.1_jens/modules/Emails/gotodownload.php
    vtigercrm/branches/5.1_jens/modules/Emails/mail.php
    vtigercrm/branches/5.1_jens/modules/Emails/mailsend.php
    vtigercrm/branches/5.1_jens/modules/Emails/sendmail.php
    vtigercrm/branches/5.1_jens/modules/Faq/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Faq/Faq.php
    vtigercrm/branches/5.1_jens/modules/Faq/ListView.php
    vtigercrm/branches/5.1_jens/modules/Faq/index.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/ConvertAsFAQ.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/EditView.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/HelpDesk.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/ListView.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/Merge.php
    vtigercrm/branches/5.1_jens/modules/HelpDesk/Save.php
    vtigercrm/branches/5.1_jens/modules/Home/UnifiedSearch.php
    vtigercrm/branches/5.1_jens/modules/Home/index.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportAccount.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportAjax.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportContact.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportLead.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportMap.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportOpportunity.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportProduct.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportStep2.php
    vtigercrm/branches/5.1_jens/modules/Import/ImportSteplast.php
    vtigercrm/branches/5.1_jens/modules/Import/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Invoice/CreatePDF.php
    vtigercrm/branches/5.1_jens/modules/Invoice/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Invoice/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Invoice/EditView.php
    vtigercrm/branches/5.1_jens/modules/Invoice/Invoice.php
    vtigercrm/branches/5.1_jens/modules/Invoice/ListTopInvoice.php
    vtigercrm/branches/5.1_jens/modules/Invoice/ListView.php
    vtigercrm/branches/5.1_jens/modules/Invoice/Popup.php
    vtigercrm/branches/5.1_jens/modules/Invoice/Save.php
    vtigercrm/branches/5.1_jens/modules/Invoice/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Leads/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Leads/Delete.php
    vtigercrm/branches/5.1_jens/modules/Leads/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Leads/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Leads/EditView.php
    vtigercrm/branches/5.1_jens/modules/Leads/Lead.php
    vtigercrm/branches/5.1_jens/modules/Leads/LeadConvertToEntities.php
    vtigercrm/branches/5.1_jens/modules/Leads/ListView.php
    vtigercrm/branches/5.1_jens/modules/Leads/Save.php
    vtigercrm/branches/5.1_jens/modules/Leads/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Leads/result.php
    vtigercrm/branches/5.1_jens/modules/Migration/MigrationStep1.php
    vtigercrm/branches/5.1_jens/modules/Migration/ModifyDatabase/42P2_to_50.php
    vtigercrm/branches/5.1_jens/modules/Notes/Delete.php
    vtigercrm/branches/5.1_jens/modules/Notes/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Notes/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Notes/EditView.php
    vtigercrm/branches/5.1_jens/modules/Notes/ListView.php
    vtigercrm/branches/5.1_jens/modules/Notes/Note.php
    vtigercrm/branches/5.1_jens/modules/Notes/Save.php
    vtigercrm/branches/5.1_jens/modules/Portal/Popup.php
    vtigercrm/branches/5.1_jens/modules/Portal/Portal.js
    vtigercrm/branches/5.1_jens/modules/Portal/Portal.php
    vtigercrm/branches/5.1_jens/modules/Portal/Save.php
    vtigercrm/branches/5.1_jens/modules/Potentials/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Potentials/Charts.php
    vtigercrm/branches/5.1_jens/modules/Potentials/Delete.php
    vtigercrm/branches/5.1_jens/modules/Potentials/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Potentials/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Potentials/EditView.php
    vtigercrm/branches/5.1_jens/modules/Potentials/ListView.php
    vtigercrm/branches/5.1_jens/modules/Potentials/ListViewTop.php
    vtigercrm/branches/5.1_jens/modules/Potentials/Opportunity.js
    vtigercrm/branches/5.1_jens/modules/Potentials/Opportunity.php
    vtigercrm/branches/5.1_jens/modules/Potentials/Save.php
    vtigercrm/branches/5.1_jens/modules/Potentials/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/Delete.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/DetailView.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/EditView.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/ListView.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/PriceBook.js
    vtigercrm/branches/5.1_jens/modules/PriceBooks/Save.php
    vtigercrm/branches/5.1_jens/modules/PriceBooks/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Products/AddProductToPriceBooks.php
    vtigercrm/branches/5.1_jens/modules/Products/AddProductsToPriceBook.php
    vtigercrm/branches/5.1_jens/modules/Products/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Products/Delete.php
    vtigercrm/branches/5.1_jens/modules/Products/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Products/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Products/EditView.php
    vtigercrm/branches/5.1_jens/modules/Products/ListView.php
    vtigercrm/branches/5.1_jens/modules/Products/Popup.php
    vtigercrm/branches/5.1_jens/modules/Products/Product.js
    vtigercrm/branches/5.1_jens/modules/Products/Product.php
    vtigercrm/branches/5.1_jens/modules/Products/Save.php
    vtigercrm/branches/5.1_jens/modules/Products/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Products/updateRelations.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/CreatePDF.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/Delete.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/DetailView.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/EditView.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/ListTopPurchaseOrder.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/ListView.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/Popup.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/PurchaseOrder.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/Save.php
    vtigercrm/branches/5.1_jens/modules/PurchaseOrder/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Quotes/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Quotes/CreatePDF.php
    vtigercrm/branches/5.1_jens/modules/Quotes/Delete.php
    vtigercrm/branches/5.1_jens/modules/Quotes/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Quotes/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Quotes/EditView.php
    vtigercrm/branches/5.1_jens/modules/Quotes/ListTopQuotes.php
    vtigercrm/branches/5.1_jens/modules/Quotes/ListView.php
    vtigercrm/branches/5.1_jens/modules/Quotes/Quote.php
    vtigercrm/branches/5.1_jens/modules/Quotes/Save.php
    vtigercrm/branches/5.1_jens/modules/Quotes/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Reports/PopulateReports.php
    vtigercrm/branches/5.1_jens/modules/Reports/ReportColumns.php
    vtigercrm/branches/5.1_jens/modules/Reports/ReportRun.php
    vtigercrm/branches/5.1_jens/modules/Reports/Reports.php
    vtigercrm/branches/5.1_jens/modules/Reports/Save.php
    vtigercrm/branches/5.1_jens/modules/Reports/SaveReportFolder.php
    vtigercrm/branches/5.1_jens/modules/Rss/RssAjax.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/CreateSOPDF.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/DetailView.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/EditView.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/ListTopSalesOrder.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/ListView.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/Popup.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/SalesOrder.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/Save.php
    vtigercrm/branches/5.1_jens/modules/SalesOrder/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Settings/AddCustomFieldToDB.php
    vtigercrm/branches/5.1_jens/modules/Settings/CreateCustomField.php
    vtigercrm/branches/5.1_jens/modules/Settings/CustomFieldList.php
    vtigercrm/branches/5.1_jens/modules/Settings/DeleteCustomField.php
    vtigercrm/branches/5.1_jens/modules/Settings/EditComboField.php
    vtigercrm/branches/5.1_jens/modules/Settings/SettingsAjax.php
    vtigercrm/branches/5.1_jens/modules/Settings/TaxConfig.php
    vtigercrm/branches/5.1_jens/modules/Settings/UpdateComboValues.php
    vtigercrm/branches/5.1_jens/modules/Settings/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Users/Authenticate.php
    vtigercrm/branches/5.1_jens/modules/Users/ChangePassword.php
    vtigercrm/branches/5.1_jens/modules/Users/CreateUserPrivilegeFile.php
    vtigercrm/branches/5.1_jens/modules/Users/DefaultDataPopulator.php
    vtigercrm/branches/5.1_jens/modules/Users/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Users/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Users/EditView.php
    vtigercrm/branches/5.1_jens/modules/Users/ListLoginHistory.php
    vtigercrm/branches/5.1_jens/modules/Users/ListView.php
    vtigercrm/branches/5.1_jens/modules/Users/Logout.php
    vtigercrm/branches/5.1_jens/modules/Users/Save.php
    vtigercrm/branches/5.1_jens/modules/Users/ShowAuditTrail.php
    vtigercrm/branches/5.1_jens/modules/Users/ShowHistory.php
    vtigercrm/branches/5.1_jens/modules/Users/about_us.php
    vtigercrm/branches/5.1_jens/modules/Users/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Users/listnotificationschedulers.php
    vtigercrm/branches/5.1_jens/modules/Users/massChangeStatus.php
    vtigercrm/branches/5.1_jens/modules/Users/massdelete.php
    vtigercrm/branches/5.1_jens/modules/Users/notify_detail.php
    vtigercrm/branches/5.1_jens/modules/Users/populatetemplate.php
    vtigercrm/branches/5.1_jens/modules/Users/profilePrivileges.php
    vtigercrm/branches/5.1_jens/modules/Users/updateLeadDBStatus.php
    vtigercrm/branches/5.1_jens/modules/Users/upload.php
    vtigercrm/branches/5.1_jens/modules/Vendors/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Vendors/Delete.php
    vtigercrm/branches/5.1_jens/modules/Vendors/DetailView.php
    vtigercrm/branches/5.1_jens/modules/Vendors/DetailViewAjax.php
    vtigercrm/branches/5.1_jens/modules/Vendors/EditView.php
    vtigercrm/branches/5.1_jens/modules/Vendors/ListView.php
    vtigercrm/branches/5.1_jens/modules/Vendors/Popup.php
    vtigercrm/branches/5.1_jens/modules/Vendors/Save.php
    vtigercrm/branches/5.1_jens/modules/Vendors/language/en_us.lang.php
    vtigercrm/branches/5.1_jens/modules/Webmails/CallRelatedList.php
    vtigercrm/branches/5.1_jens/modules/Webmails/Save.php
    vtigercrm/branches/5.1_jens/modules/uploads/add2db.php
    vtigercrm/branches/5.1_jens/pkg/bin/startvTiger.bat
    vtigercrm/branches/5.1_jens/pkg/bin/startvTiger.sh
    vtigercrm/branches/5.1_jens/pkg/bin/stopvTiger.bat
    vtigercrm/branches/5.1_jens/schema/DatabaseSchema.xml
    vtigercrm/branches/5.1_jens/soap/firefoxtoolbar.php
    vtigercrm/branches/5.1_jens/soap/thunderbirdplugin.php
    vtigercrm/branches/5.1_jens/soap/vtigerolservice.php
    vtigercrm/branches/5.1_jens/soap/webforms.php
    vtigercrm/branches/5.1_jens/soap/wordplugin.php
    vtigercrm/branches/5.1_jens/themes/alphagrey/header.php
    vtigercrm/branches/5.1_jens/themes/alphagrey/images/aboutUS.jpg
    vtigercrm/branches/5.1_jens/themes/alphagrey/style.css
    vtigercrm/branches/5.1_jens/themes/bluelagoon/header.php
    vtigercrm/branches/5.1_jens/themes/bluelagoon/images/aboutUS.jpg
    vtigercrm/branches/5.1_jens/themes/bluelagoon/style.css
    vtigercrm/branches/5.1_jens/themes/woodspice/header.php
    vtigercrm/branches/5.1_jens/themes/woodspice/images/aboutUS.jpg
    vtigercrm/branches/5.1_jens/themes/woodspice/style.css
    vtigercrm/branches/5.1_jens/vtigerservice.php
    vtigercrm/branches/5.1_jens/vtigerversion.php

Modified: vtigercrm/branches/5.1_jens/Popup.php
==============================================================================
--- vtigercrm/branches/5.1_jens/Popup.php (original)
+++ vtigercrm/branches/5.1_jens/Popup.php Tue Nov 14 03:16:10 2006
@@ -29,12 +29,13 @@
 if (!isset($where)) $where = "";
 
 $popuptype = '';
+$filter = '';
 $popuptype = $_REQUEST["popuptype"];
 switch($currentModule)
 {
 	case 'Contacts':
-		require_once("modules/$currentModule/Contact.php");
-		$focus = new Contact();
+		require_once("modules/$currentModule/Contacts.php");
+		$focus = new Contacts();
 		$log = LoggerManager::getLogger('contact_list');
 		$comboFieldNames = Array('leadsource'=>'leadsource_dom');
 		$comboFieldArray = getComboArray($comboFieldNames);
@@ -45,10 +46,45 @@
 			$smarty->assign("RETURN_MODULE",'Emails');
 		if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','lastname','true','basic',$popuptype,"","","");
+
+		//set up a filter if we got a parent
+		if(isset($_REQUEST['Parent']) && $_REQUEST['Parent'] !='') {
+		    $sql = "SELECT tablename,entityidfield FROM vtiger_entityname
+				JOIN vtiger_crmentity ON
+				    vtiger_entityname.modulename = vtiger_crmentity.setype
+				WHERE crmid=".$_REQUEST['Parent'];
+		    $result = $adb->query($sql);
+		    $tablename = $adb->query_result($result,0,"tablename");
+		    if( $tablename == "vtiger_quotes" ||
+			$tablename == "vtiger_salesorder" ||
+			$tablename == "vtiger_invoice") {
+			$fieldname = "accountid";
+		    /*
+		    } elseif( $tablename == "vtiger_purchaseorder") {
+			$fieldname = "vendorid";
+		    */
+		    } else {
+			$fieldname = "";
+		    }
+
+		    //get the fieldvalue to filter on. We cannot just set 
+		    //up a filter addon, because the listquery is to hard
+		    //to change ...
+		    if( $fieldname != "") {
+			$tableindex = $adb->query_result($result,0,"entityidfield");
+			$sql = "SELECT ".$fieldname." FROM ".$tablename."
+				  WHERE ".$tableindex."=".$_REQUEST['Parent'];
+			$result = $adb->query($sql);
+			$filter = $adb->query_result($result,0,$fieldname);
+
+			if( $filter != '') 
+			    $filter = "vtiger_contactdetails.accountid=".$filter;
+		    }
+		}
 		break;
 	case 'Campaigns':
-		require_once("modules/$currentModule/Campaign.php");
-		$focus = new Campaign();
+		require_once("modules/$currentModule/Campaigns.php");
+		$focus = new Campaigns();
 		$log = LoggerManager::getLogger('campaign_list');
 		$comboFieldNames = Array('campaignstatus'=>'campaignstatus_dom',
 					 'campaigntype'=>'campaigntype_dom');
@@ -60,8 +96,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','campaignname','true','basic',$popuptype,"","","");
 		break;
 	case 'Accounts':
-		require_once("modules/$currentModule/Account.php");
-		$focus = new Account();
+		require_once("modules/$currentModule/Accounts.php");
+		$focus = new Accounts();
 		$log = LoggerManager::getLogger('account_list');
 		$comboFieldNames = Array('accounttype'=>'account_type_dom'
 				,'industry'=>'industry_dom');
@@ -74,8 +110,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','accountname','true','basic',$popuptype,"","","");
 		break;
 	case 'Leads':
-		require_once("modules/$currentModule/Lead.php");
-		$focus = new Lead();
+		require_once("modules/$currentModule/Leads.php");
+		$focus = new Leads();
 		$log = LoggerManager::getLogger('contact_list');
 		$comboFieldNames = Array('leadsource'=>'leadsource_dom'
 				,'leadstatus'=>'leadstatus_dom'
@@ -91,8 +127,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','lastname','true','basic',$popuptype,"","","");
 		break;
 	case 'Potentials':
-		require_once("modules/$currentModule/Opportunity.php");
-		$focus = new Potential();
+		require_once("modules/$currentModule/Potentials.php");
+		$focus = new Potentials();
 		$log = LoggerManager::getLogger('potential_list');
 		$comboFieldNames = Array('leadsource'=>'leadsource_dom'
 				,'opportunity_type'=>'opportunity_type_dom'
@@ -104,8 +140,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','potentialname','true','basic',$popuptype,"","","");
 		break;
 	case 'Quotes':
-		require_once("modules/$currentModule/Quote.php");	
-		$focus = new Quote();
+		require_once("modules/$currentModule/Quotes.php");	
+		$focus = new Quotes();
 		$log = LoggerManager::getLogger('quotes_list');
 		$comboFieldNames = Array('quotestage'=>'quotestage_dom');
 		$comboFieldArray = getComboArray($comboFieldNames);
@@ -121,8 +157,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 		break;
 	case 'Products':
-		require_once("modules/$currentModule/Product.php");
-		$focus = new Product();
+		require_once("modules/$currentModule/Products.php");
+		$focus = new Products();
 		$smarty->assign("SINGLE_MOD",'Product');
 		if(isset($_REQUEST['curr_row']))
 		{
@@ -135,8 +171,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','productname','true','basic',$popuptype,"","","");
 		break;
 	case 'Vendors':
-		require_once("modules/$currentModule/Vendor.php");
-		$focus = new Vendor();
+		require_once("modules/$currentModule/Vendors.php");
+		$focus = new Vendors();
 		$smarty->assign("SINGLE_MOD",'Vendor');
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','vendorname','true','basic',$popuptype,"","","");
 		break;
@@ -150,15 +186,15 @@
 		break;
 	case 'PurchaseOrder':
 		require_once("modules/$currentModule/PurchaseOrder.php");
-		$focus = new Order();
+		$focus = new PurchaseOrder();
 		$smarty->assign("SINGLE_MOD",'PurchaseOrder');
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','subject','true','basic',$popuptype,"","","");
 		break;
 	case 'PriceBooks':
-		require_once("modules/$currentModule/PriceBook.php");
-		$focus = new PriceBook();
+		require_once("modules/$currentModule/PriceBooks.php");
+		$focus = new PriceBooks();
 		$smarty->assign("SINGLE_MOD",'PriceBook');
 		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
 			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
@@ -175,8 +211,8 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','bookname','true','basic',$popuptype,"","","");
 		break;
 	case 'Users':
-                require_once("modules/$currentModule/User.php");
-                $focus = new User();
+                require_once("modules/$currentModule/Users.php");
+                $focus = new Users();
                 $smarty->assign("SINGLE_MOD",'Users');
                 if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
                     $smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
@@ -192,9 +228,18 @@
 		$alphabetical = AlphabeticalSearch($currentModule,'Popup','ticket_title','true','basic',$popuptype,"","","");
 		if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
 		break;
-
-
-}
+	case 'Organization':
+		require_once("modules/$currentModule/Organization.php");
+		$focus = new Organization();
+		$log = LoggerManager::getLogger('organization_list');
+		$smarty->assign("SINGLE_MOD",'Organization');
+		if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] !='')
+			$smarty->assign("RETURN_MODULE",$_REQUEST['return_module']);
+		if (isset($_REQUEST['select'])) $smarty->assign("SELECT",'enable');
+		$alphabetical = AlphabeticalSearch($currentModule,'Popup','organizationname','true','basic',$popuptype,"","","");
+		break;
+}
+$smarty->assign("RETURN_ACTION",$_REQUEST['return_action']);
 
 
 $theme_path="themes/".$theme."/";
@@ -228,6 +273,10 @@
 {
 	list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
 	$url_string .="&query=true".$ustring;
+}
+
+if(isset($filter) && $filter != '') {
+        $query .= ' and '.$filter;
 }
 
 if(isset($where) && $where != '')
@@ -304,6 +353,8 @@
 	$url_string .='&select=enable';
 if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != '')
 	$url_string .='&return_module='.$_REQUEST['return_module'];
+if(isset($_REQUEST['Parent']) && $_REQUEST['Parent'] != '')
+	$url_string .='&Parent='.$_REQUEST['Parent'];
 $listview_header_search=getSearchListHeaderValues($focus,"$currentModule",$url_string,$sorder,$order_by);
 $smarty->assign("SEARCHLISTHEADER", $listview_header_search);
 

Modified: vtigercrm/branches/5.1_jens/Release_Notes.html
==============================================================================
--- vtigercrm/branches/5.1_jens/Release_Notes.html (original)
+++ vtigercrm/branches/5.1_jens/Release_Notes.html Tue Nov 14 03:16:10 2006
@@ -1,3711 +1,3889 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html lang="en"><head><title>vtiger CRM 5 Beta: Release Notes</title>
-  
-  <style>
-p {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
-td{  font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
-li{  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; margin-top: 12pt}
-h1{  font-family: Arial, Helvetica, sans-serif; font-size: 16pt}
-h2{  font-family: Arial, Helvetica, sans-serif; font-size: 14pt}
-h3{  font-family: Arial, Helvetica, sans-serif; font-size: 12pt}
-.background{
-background-image: url(themes/images/vtiger-paw.jpg);
-background-repeat: no-repeat;
-background-position: bottom center;
-background-attachment: fixed;
-}
-  .style1 {
-	color: #FF0000;
-	font-weight: bold;
-}
-  .style2 {
-	color: #0000FF;
-	font-weight: bold;
-}
-  </style>
-</head>
-
-<body class="background">
-<p><img src="themes/images/vtiger.jpg" height="48" width="112"></p>
-<h1>vtiger CRM 5.0.0: Release Notes</h1>
-<p><b>Date: Sep 14, 2006</b></p>
-<p>Welcome to vtiger CRM!</p>
-<p>vtiger CRM is an enterprise-ready open source CRM solution for managing sales, marketing, customer support and order management functions effectively. Before version 5 release, vtiger CRM has passed through more than 10 development cycles. </p>
-<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5-v5">Summary</a></li>
-  <li><a href="#Features5-v5">Features</a></li>
-  <li><a href="#v5_Bug_Fixes-v5">Bug Fixes</a></li>
-  <li><a href="#KI5-v5">Known Issues </a></li>
-</ol>
-<h3><a name="Summary5-v5" id="Summary5-v5"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="73%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="40%"><b><font color="#990000">Item</font></b></td>
-      <td width="55%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1 </td>
-      <td width="40%">Features</td>
-      <td width="55%">
-        &nbsp;</td>
-    </tr>
-    <tr>
-	    <td width="5%">2</td>
-      <td width="40%">Product Size</td>
-      <td width="55%">Platform Independent - <b>6.1 MB<br />
-        </b>Windows (EXE) - <b>26 MB</b><br />
-        Linux (BIN) - <b>40 MB</b></td>
-    </tr>
-    <tr>
-	    <td width="5%">3</td>
-      <td width="40%">Database Migration</td>
-      <td width="55%"><span class="style2">Available for migrating data from 4.2.3 , 4.2.4, or 5.0 RC to v5.0</span></td>
-    </tr>
-    <tr>
-	    <td>4</td>
-      <td>Product Download </td>
-      <td><a href="http://www.vtiger.com/index.php?option=com_content&task=view&id=30&Itemid=57" target="_blank">Click Here</a></td>
-    </tr>
-    <tr>
-	    <td width="5%">5</td>
-      <td width="40%">vtiger CRM - PHP Documentation</td>
-      <td width="55%"> URL: <a href="http://api.vtiger.com/index.php" target="_blank">Click Here</a></td>
-    </tr>
-    <tr>
-	    <td width="5%">6</td>
-      <td width="40%">Product Documentation</td>
-      <td width="55%"><p>Available at the <a href="http://wiki.vtiger.com/index.php" target="_blank">Wiki</a></p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5-v5" id="Features5-v5"></a>2. Features</h3>
-<ul>
-  <li>AJAX based User Interface</li>
-  <li>Color Schemes</li>
-  <li> Enterprise-grade Security Management</li>
-  <li>Calendaring</li>
-  <li>Email Client</li>
-  <li> Customization</li>
-  <li>Reports &amp; Dashboard </li>
-  <li>Order Management </li>
-  <li> Marketing Automation </li>
-</ul>
-<p>For more details refer to: <a href="http://www.vtiger.com/products/crm/vtigercrm-5-release-notes.pdf">http://www.vtiger.com/products/crm/v5-release-notes.pdf</a></p>
-<h3><a name="v5_Bug_Fixes-v5" id="v5_Bug_Fixes-v5"></a>3. Bug Fixes</h3>
-<p>We have fixed about 200 issues after v5 RC release. For more details, kindly refer to the <strong><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&group=owner&version=5.0.0&order=priority%20" target="_blank">vtiger CRM Bug Tracker</a>.</strong></p>
-<h3><a name="KI5-v5" id="KI5-v5"></a>4. Known Issues</h3>
-<p>As on Sep 14, 2006 there are about 178 open issues. For more details, kindly refer to the<a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&status=assigned&status=reopened&milestone=5.0.1&milestone=&type=defect&order=priority" target="_blank"><strong> vtiger CRM Bug Tracker</strong></a>:</p>
-<hr />
-<h1>vtiger CRM 5.0 RC1: Release Notes</h1>
-<p><b>Date: Aug 14, 2006</b></p>
-<p> vtiger CRM 5.0 RC1, is ready for the last-round of validation before GA release!</p>
-<p>Last few days, we  have worked hard to make vtiger CRM more user friendly, bug free, and ready for real-time deployment. We thank our community members who spent their valuable time &amp; energy with us and making the RC release successful.</p>
-<p>We have few bugs remained in our basket and there are some formalities need to be completed before  announcing the public release for the real time deployments. In the meantime, kindly help us by reporting bugs that you might have encountered in RC release version. Your suggestions and feedback will definitely help us providing a smooth transition from v4.2.x to  next the generation  vtiger CRM. </p>
-<p>Major changes in the current update are new &quot;woodspice&quot; theme, calendar enhancements, fully customizable tax calculations, and re-desigend post-installation configuration wizard. We have also fixed about 350 bugs after version 5 Beta 2 release. </p>
-<p><b>IMPORTANT NOTES:</b> </p>
-<ul>
-  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 RC1 </b>for any deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
-  <li>Database migration script is provided for migrating data from v4.2.3 to v5 RC1 only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration scripts.</li>
-  <li class="style1">Database migration script is not provided for migrating data from v 5 Beta releases to v5 RC1. Hence users are strongly recommended to take a backup of the the v 5 Beta data before testing the migration script.</li>
-</ul>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
-<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 RC1,</p>
-<p><b><font size="3">Step 1:</font></b> Browse through <a href="http://en.vtiger.com"><b>Live Demo</b></a></p>
-<p><b><font size="3">Step 2:</font></b> Download product from the <a href="http://vtiger.com/index.php?option=com_content&amp;task=view&amp;id=70&amp;Itemid=109"><b>vtiger.com</b></a> and install in your favorite OS.</p>
-<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger CRM 5.x</b></a> category</p>
-<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_RC1">Summary</a></li>
-  <li><a href="#Features5_RC1">Features</a></li>
-  <li><a href="#v5_Bug_Fixes_RC1">Bug Fixes</a></li>
-  <li><a href="#KI5_RC1">Known Issues </a></li>
-</ol>
-<h3><a name="Summary5_RC1" id="Summary5_RC1"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="73%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="40%"><b><font color="#990000">Item</font></b></td>
-      <td width="55%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1 </td>
-      <td width="40%">Features</td>
-      <td width="55%">
-        <p>10</p></td>
-    </tr>
-    <tr>
-      <td width="5%">3</td>
-      <td width="40%">Product Size</td>
-      <td width="55%">Platform Independent - <b>5.6 MB<br />
-        </b>Windows (EXE) - <b>26 MB</b><br />
-        Linux (BIN) - <b>40 MB</b></td>
-    </tr>
-    <tr>
-      <td width="5%">4</td>
-      <td width="40%">Database Migration</td>
-      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 RC1) </font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">5</td>
-      <td width="40%">vtiger CRM - PHP Documentation</td>
-      <td width="55%"> URL: <a href="http://api.vtiger.com/index.php">Click Here</a></td>
-    </tr>
-    <tr>
-      <td width="5%">6</td>
-      <td width="40%">Product Documentation</td>
-      <td width="55%"><p>Available at the <a href="http://wiki.vtiger.com/index.php">Wiki</a></p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5_RC1" id="Features5_RC1"></a>2. Features</h3>
-<table border="1">
-  <tr>
-    <td><strong>S. No </strong></td>
-    <td><strong>Feature</strong></td>
-  </tr>
-  <tr>
-    <td>1</td>
-    <td>Customizable tax calculations for quotes, orders, and invoices. </td>
-  </tr>
-  <tr>
-    <td>2</td>
-    <td>Add  new values to the Status field in Inventory, Potentials, and FAQ modules
-.    </td>
-  </tr>
-  <tr>
-    <td>3</td>
-    <td>PO, SO, Invoice - Status and Quote Stage history.</td>
-  </tr>
-  <tr>
-    <td>4</td>
-    <td>Manage product wise discounts and grand discount while generating quotes, orders, and invoices.</td>
-  </tr>
-  <tr>
-    <td>5</td>
-    <td>Manage individual or group taxes.</td>
-  </tr>
-  <tr>
-    <td>6</td>
-    <td>Adding same product more than once in line items list.</td>
-  </tr>
-  <tr>
-    <td>7</td>
-    <td>Attach documents to the tickets.</td>
-  </tr>
-  <tr>
-    <td>8</td>
-    <td>Add negative adjustments in quotes, orders, and invoices . </td>
-  </tr>
-  <tr>
-    <td>9</td>
-    <td>Enhancements in Live Chat tool. </td>
-  </tr>
-  <tr>
-    <td>10</td>
-    <td>Unsubscribe form in compliance with CAN Spam act.</td>
-  </tr>
-</table>
-<p>&nbsp;</p>
-<table border="1" width="60%">
-  <tbody>
-    <tr>
-      <td>
-        <p><b>Note: </b></p>
-        <p><b>Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
-        <p>Line: 166</p>
-        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="v5_Bug_Fixes_RC1" id="v5_Bug_Fixes_RC1"></a>Bug Fixes</h3>
-<p>We have fixed about 350 issues after v5 Beta 2 release. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
-<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&amp;group=owner&amp;version=5.0.0&amp;order=priority%20">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&amp;group=owner&amp;version=5.0.0&amp;order=priority </a></p>
-<h3><a name="KI5_RC1" id="KI5_RC1"></a>4. Known Issues</h3>
-<p>As on Aug 13, 2006 there are about 100 open issues. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
-<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=owner&amp;version=5.0.0&amp;order=priority">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=owner&amp;version=5.0.0&amp;order=priority</a></p>
-<hr />
-<h1>vtiger CRM 5.0 Beta 2: Release Notes</h1>
-<p><b>Date: July 05, 2006</b></p>
-<p> vtiger CRM 5.0 Beta 2 release is ready for end-user community testing. The intent of this release is to showcase to the vtiger community, the significant changes made after v5 Beta release i.e., changes since May, 06'. The noteworthy features in v5 Beta 2 are New user interface for Settings module, Audit Trails as part of the security management, complete Web mail integration (including Outgoing and Incoming mail capability),  edit custom fields, enhanced user interface for Calendar, optimized the database queries further for List Views function in all the modules, and others.</p>
-<p><b>IMPORTANT NOTES:</b> </p>
-<ul>
-  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 Beta 2 </b>for any real-time deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
-  <li>vtiger CRM user interface can be best viewed in Mozilla/Firefox. We have some page loading page formatting issues in Internet Explorer, which will be fixed very soon. </li>
-  <li>JpGraph used for generating dashboards has been replaced by ImageGraph, a third party charting software.</li>
-  <li class="style1">Database migration script is provided for migrating data from v4.2.3 to v5 Beta 2 only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration script.</li>
-  <li class="style1">Database migration script is not provided for migrating data from v 5 Beta to v5 Beta 2. Hence users are strongly recommended to take a backup of the the v 5 Beta data before testing the migration script.</li>
-</ul>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
-<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 Beta 2,</p>
-<p><b><font size="3">Step 1:</font></b> Browse through <a href="http://www.vtiger.com/products/crm/demo_5beta/index.php"><b>Live Demo</b></a></p>
-<p><b><font size="3">Step 2:</font></b> Download product from the <a href="http://vtiger.com/index.php?option=com_content&amp;task=view&amp;id=70&amp;Itemid=109"><b>vtiger.com</b></a> and install in your favorite Operating System.</p>
-<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger CRM 5.x</b></a> category</p>
-<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Beta2">Summary</a></li>
-  <li><a href="#Features5_Beta2">Features</a></li>
-  <li><a href="#v5_Bug_Fixes_Beta2">Bug Fixes</a></li>
-  <li><a href="#KI5_Beta2">Known Issues </a></li>
-</ol>
-<h3><a name="Summary5_Beta2" id="Summary5_Beta2"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="73%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="40%"><b><font color="#990000">Item</font></b></td>
-      <td width="55%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1 </td>
-      <td width="40%">Features</td>
-      <td width="55%">
-        <p>12</p></td>
-    </tr>
-    <tr>
-      <td width="5%">3</td>
-      <td width="40%">Product Size</td>
-      <td width="55%">Platform Independent - <b>5.2 MB<br />
-        </b>Windows (EXE) - <b>26 MB</b><br />
-        Linux (BIN) - <b>40 MB</b></td>
-    </tr>
-    <tr>
-      <td width="5%">4</td>
-      <td width="40%">Database Migration</td>
-      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 Beta 2) </font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">5</td>
-      <td width="40%">vtiger CRM - PHP Documentation</td>
-      <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://api.vtiger.com/index.php">Click Here</a></td>
-    </tr>
-    <tr>
-      <td width="5%">6</td>
-      <td width="40%">Product Documentation</td>
-      <td width="55%"><p>Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5_Beta2" id="Features5_Beta2"></a>2. Features</h3>
-<table border="1">
-  <tr>
-    <td><strong>S. No </strong></td>
-    <td><strong>Feature</strong></td>
-  </tr>
-  <tr>
-    <td>1</td>
-    <td>Proxy Server configuration for accessing RSS feeds and information based on Ticker Symbol</td>
-  </tr>
-  <tr>
-    <td>2</td>
-    <td>Vertical bar chart in Home page </td>
-  </tr>
-  <tr>
-    <td>3</td>
-    <td>Security Management support for Emails module</td>
-  </tr>
-  <tr>
-    <td>4</td>
-    <td>Database table prefix support for a deploying vtiger CRM in other working databases</td>
-  </tr>
-  <tr>
-    <td>5</td>
-    <td>Audit Trial support for tracking all users system access details </td>
-  </tr>
-  <tr>
-    <td>6</td>
-    <td>Last 5 records visited</td>
-  </tr>
-  <tr>
-    <td>7</td>
-    <td>New User interface for Settings module</td>
-  </tr>
-  <tr>
-    <td>8</td>
-    <td>Print Report function</td>
-  </tr>
-  <tr>
-    <td>9</td>
-    <td>Email Detail View from Related List </td>
-  </tr>
-  <tr>
-    <td>10</td>
-    <td>Attach multiple documents to email message</td>
-  </tr>
-  <tr>
-    <td>11</td>
-    <td>Delete option for Tag cloud</td>
-  </tr>
-  <tr>
-    <td>12</td>
-    <td>AJAX based edit option for User details </td>
-  </tr>
-</table>
-<p>&nbsp;</p>
-<table border="1" width="60%">
-  <tbody>
-    <tr>
-      <td>
-        <p><b>Note: </b></p>
-        <p><b>Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
-        <p>Line: 166</p>
-        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="v5_Bug_Fixes_Beta2" id="v5_Bug_Fixes_Beta2"></a>Bug Fixes</h3>
-<p>We have fixed about 1000 issues after v5 Beta release. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
-<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&group=owner&version=5.0.0&order=priority%20">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&amp;group=owner&amp;version=5.0.0&amp;order=priority </a></p>
-<h3><a name="KI5_Beta2" id="KI5_Beta2"></a>4. Known Issues</h3>
-<p>As on July 5, 2006 there are about 100 open issues. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
-<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&status=assigned&status=reopened&group=owner&version=5.0.0&order=priority">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=owner&amp;version=5.0.0&amp;order=priority</a></p>
-<hr />
-<h1>vtiger CRM 5.0 Beta: Release Notes</h1>
-<p><b>Date: May 31, 2006</b></p>
-<p> vtiger CRM 5.0 Beta release is ready for end-user community testing. The intent of this release is to showcase to the vtiger community, the significant changes made after v5 Alpha 5 release i.e., changes since Apr , 06' . The noteworthy features in v5 Beta are complete Web mail integration (including Outgoing and Incoming mail capability), Office Plugin, Outlook Plugin, Customer Portal, Web-Forms, Firefox Toolbar, 
-
-
- edit custom fields,
-
-new user interface for Calendar, optimized the database queries for List Views function in all the modules, and others. In addition to this, we have&nbsp; conducted performance testing for some of the modules using a popular Web Based Testing Software (<a href="http://www.adventnet.com/products/qengine/index.html"><strong>AdventNet QEngine 6.0</strong></a>), which helped us to identify some of the bottlenecks in performance. We have also published the Performance Testing reports. We thank AdventNet for permitting us to make use of this interesting software and we gladly recommend it to everyone too, not because AdventNet allowed us to use it but because it is really good. </p>
-<p><strong>Note:</strong> </p>
-<p><b>IMPORTANT NOTES:</b> </p>
-<ul>
-  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 Beta </b>for any real-time deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
-  <li>vtiger CRM user interface can be best viewed in Mozilla/Firefox. We have some page loading page formatting issues in Internet Explorer, which will be fixed very soon. </li>
-  <li>JpGraph used for generating dashboards has been replaced by ImageGraph, a third party charting software.</li>
-  <li class="style1">Database migration script is provided for migrating data from v4.2.3 to v5 Beta only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration script.</li>
-</ul>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
-<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 Beta,</p>
-<p><b><font size="3">Step 1:</font></b> Browse through <a href="http://www.vtiger.com/products/crm/demo_5beta/index.php"><b>Live Demo</b></a></p>
-<p><b><font size="3">Step 2:</font></b> Download product from the <a href="http://vtiger.com/index.php?option=com_content&amp;task=view&amp;id=70&amp;Itemid=109"><b>vtiger.com</b></a> and install in your favorite Operating System.</p>
-<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger CRM 5.x</b></a> category</p>
-<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Beta">Summary</a></li>
-  <li><a href="#Features5_Beta">Features</a></li>
-  <li><a href="#KI5_Beta">Known Issues </a></li>
-</ol>
-<h3><a name="Summary5_Beta" id="Summary5_Beta"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="73%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="40%"><b><font color="#990000">Item</font></b></td>
-      <td width="55%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1 </td>
-      <td width="40%">Features</td>
-      <td width="55%">
-        <p>28</p></td>
-    </tr>
-    <tr>
-      <td width="5%">3</td>
-      <td width="40%">Product Size</td>
-      <td width="55%">Platform Independent - <b>5.0 MB<br />
-        </b>Windows (EXE) - <b>26 MB</b><br />
-        Linux (BIN) - <b>40 MB</b></td>
-    </tr>
-    <tr>
-      <td width="5%">4</td>
-      <td width="40%">Database Migration</td>
-      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 Beta) </font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">5</td>
-      <td width="40%">vtiger CRM - PHP Documentation</td>
-      <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://api.vtiger.com/index.php">Click Here</a></td>
-    </tr>
-    <tr>
-      <td width="5%">6</td>
-      <td width="40%">Product Documentation</td>
-      <td width="55%"><ul>
-          <li>Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></li>
-          <li> <a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_5_Test_Cases">Security Management</a> Document is bundled with the product.</li>
-      </ul></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5_Beta" id="Features5_Beta"></a>2. Features</h3>
-<table border="1" cellpadding="5" cellspacing="0" >
-  <ul>
-    <tr>
-      <td><strong>S.No</strong></td>
-      <td><strong>Feature</strong></td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>Organization Hierarchy (Roles) can be defined using tree based structure</td>
-    </tr>
-    <tr>
-      <td>2</td>
-      <td>Recalculate sharing rules option is provided</td>
-    </tr>
-    <tr>
-      <td>3</td>
-      <td>Security Support for Campaigns module</td>
-    </tr>
-    <tr>
-      <td>4</td>
-      <td>Security Support for Ajax actions done</td>
-    </tr>
-    <tr>
-      <td>5</td>
-      <td>Role selection popup integrated.</td>
-    </tr>
-    <tr>
-      <td>6</td>
-      <td>Duplicate handling for Roles, Profiles and Groups done</td>
-    </tr>
-    <tr>
-      <td>7</td>
-      <td>Module and record-level security support for Create/Edit/Duplicate/Delete Mass Delete, Mass Change Owner, Mass Change Status functions</td>
-    </tr>
-    <tr>
-      <td>8</td>
-      <td>Security Support for Quick Create functions</td>
-    </tr>
-    <tr>
-      <td>9</td>
-      <td>Security Support for Lookup</td>
-    </tr>
-    <tr>
-      <td>10</td>
-      <td>Security Support for Settings module</td>
-    </tr>
-    <tr>
-      <td>11</td>
-      <td>Security Support for Convert Lead feature</td>
-    </tr>
-    <tr>
-      <td>12</td>
-      <td>Email Templates are fully functional with merge field value substitution for Leads, Contacts, Accounts, and Users Modules</td>
-    </tr>
-    <tr>
-      <td>13</td>
-      <td>Module and Record Level Security implemented for Mass Delete, Change Owner &amp; Change Status Buttons across product</td>
-    </tr>
-    <tr>
-      <td>14</td>
-      <td>Internationalization of the product across all modules</td>
-    </tr>
-    <tr>
-      <td>15</td>
-      <td>Smarty templates are used for My Preferences / List Mail Server</td>
-    </tr>
-    <tr>
-      <td>16</td>
-      <td>Option to create Multi select combo-box in Custom Field</td>
-    </tr>
-    <tr>
-      <td>17</td>
-      <td>Option to edit custom fields</td>
-    </tr>
-    <tr>
-      <td>18</td>
-      <td>Calendar module is completely redesigned</td>
-    </tr>
-    <tr>
-      <td>19</td>
-      <td>List View, Detail View and Edit View queries are optimized for a better performance</td>
-    </tr>
-    <tr>
-      <td>20</td>
-      <td>New user interface for Currency Configuration and Custom Field Settings</td>
-    </tr>
-    <tr>
-      <td>21</td>
-      <td>New user interface for Convert Lead function</td>
-    </tr>
-    <tr>
-      <td>22</td>
-      <td>Log entry for all functions are incorporated</td>
-    </tr>
-    <tr>
-      <td>23</td>
-      <td>AJAXified New Email functionality</td>
-    </tr>
-    <tr>
-      <td>24</td>
-      <td>New user interface for Reports</td>
-    </tr>
-    <tr>
-      <td>25</td>
-      <td>New user interface for MySites</td>
-    </tr>
-    <tr>
-      <td>26</td>
-      <td>New user interface for Attachments</td>
-    </tr>
-    <tr>
-      <td>27</td>
-      <td>New RSS reader has been integrated for a better performance</td>
-    </tr>
-    <tr>
-      <td>28</td>
-      <td>Mass Change owner option in various modules </td>
-    </tr>
-    <tr>
-      <td>29</td>
-      <td>Inventory Revamped</td>
-    </tr>
-	<tr>
-	<td>30</td>
-	<td>Advanced and Basic Search UI changed</td>
-	</tr>
-	<tr>
-	<td>31</td>
-	<td>Automatic Tax Calculator Integrated</td>
-	</tr>
-	<tr>
-	<td>32</td>
-	<td>Pagination to the related list added</td>
-	</tr>
-	<tr>
-	<td>33</td>
-	<td>Migration support from 4.2.3 to 5.0 Beta Integrated</td>
-	</tr>
-
-
-
-
-  </ul>
-</table>
-<p>&nbsp; </p>
-<table border="1" width="60%">
-  <tbody>
-    <tr>
-      <td>
-        <p><b>Note: </b></p>
-        <p><b>1. Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
-        <p>Line: 166</p>
-        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="KI5_Beta" id="KI5_Beta"></a>3. Known Issues</h3>
-<table border="1">
-  <tr>
-    <td><strong>S.No</strong></td>
-    <td><strong>Known Issue</strong></td>
-  </tr>
-  <tr>
-    <td>1</td>
-    <td>While creating a new e-mail using the e-mail template, the values for the fields will not appear in the e-mail</td>
-  </tr>
-  <tr>
-    <td>2</td>
-    <td>Web mail has been moved from ajax/js to prototype framework</td>
-  </tr>
-  <tr>
-    <td>3</td>
-    <td> Error are not handled properly in Web mail module</td>
-  </tr>
-  <tr>
-    <td>4</td>
-    <td> Attachments will not work properly in Web mail module </td>
-  </tr>
-  <tr>
-    <td>5</td>
-    <td> When deleting the groups, the ownership of the records that are owned by the group that is being deleted should be changed. This functionality is not handled in v5 Beta</td>
-  </tr>
-  <tr>
-    <td>6</td>
-    <td> When the data of a group is shared with other users/groups, the&nbsp; records owned by the sub groups users will be shared properly but the records owned by the sub-group will not be shared </td>
-  </tr>
-  <tr>
-    <td>7</td>
-    <td> PHP 5 related exception while saving a ticket or potential</td>
-  </tr>
-  <tr>
-    <td>8</td>
-    <td> Security support not done for New Emails Module</td>
-  </tr>
-  <tr>
-    <td>9</td>
-    <td>Security implementation in Custom View, Reports, Dashboards has some issues</td>
-  </tr>
-  <tr>
-    <td>10</td>
-    <td> Detail View Ajax edit has security issues</td>
-  </tr>
-  <tr>
-    <td>11</td>
-    <td> Security support for Calendar is not done</td>
-  </tr>
-  <tr>
-    <td>12</td>
-    <td> Security is not implemented in import and export queries</td>
-  </tr>
-  <tr>
-    <td>13</td>
-    <td> Home Page Security Support has issues</td>
-  </tr>
-  <tr>
-    <td>14</td>
-    <td> Form Validation for Notes non-functional</td>
-  </tr>
-  <tr>
-    <td>15</td>
-    <td> Events Scheduled after more than 1 hour gets displayed only at the start of the Hour - Calendar</td>
-  </tr>
-  <tr>
-    <td>16</td>
-    <td> Navigation missing in mini calendar</td>
-  </tr>
-  <tr>
-    <td>17</td>
-    <td> While editing the custom field, the field length and type are mismatched</td>
-  </tr>
-  <tr>
-    <td>18</td>
-    <td> custom field create Pop UI is not proper in IE browser</td>
-  </tr>
-  <tr>
-    <td>19</td>
-    <td> Send reminder will not work for To do</td>
-  </tr>
-  <tr>
-    <td>20</td>
-    <td> In campaign related list we have shown the newly created contacts and leads. but in Contact and Lead related list we are not showing the campaign relationship. i.e.., in contact and lead related list there is no table for campaigns. whether we should show this relationship or is this the expected behavior?</td>
-  </tr>
-  <tr>
-    <td>21</td>
-    <td> In the week calendar you can create event for any old day (even for year 2005). It is better to have a date validation.</td>
-  </tr>
-  <tr>
-    <td>22</td>
-    <td> From a entity detail view, if we click on edit button then the edit view page shows. now there is one more tan more information. if i click on that tab it shows the related list now if we click on Entity information it goes to detail view instead of edit view</td>
-  </tr>
-  <tr>
-    <td>23</td>
-    <td> If i add a to do it is not showing the to do list instead it is showing the Events </td>
-  </tr>
-  <tr>
-    <td>24</td>
-    <td> Not able to delete template documents if there is not more that one</td>
-  </tr>
-  <tr>
-    <td>25</td>
-    <td> All file types are allowed while uploading template documents</td>
-  </tr>
-  <tr>
-    <td>26</td>
-    <td>Multiple attachments is not supported in Emails</td>
-  </tr>
-  <tr>
-    <td>27</td>
-    <td> Export to excel is not working in PHP5 </td>
-  </tr>
-</table>
-<hr />
-<h1>vtiger CRM 5.0 Alpha 5: Release Notes</h1>
-<p><b>Date: April 07, 2006</b></p>
-<p> vtiger CRM 5.0  release is another release in v5 alpha release cycle, which is currently in active development phase. The intent of this release is to showcase to the vtiger community, the significant changes made after v5 Alpha 4 release i.e., changes since Mar 31, 06' . The noteworthy features in v5 Alpha 5 are new user interface for Company Information, Email templates, Company information, Outgoing mail server, Announcements, RSS, optimized the database queries for List Views function in all the modules, and others. In addition to this, we have&nbsp; conducted performance testing for some of the modules using a popular Web Based Testing Software (<a href="http://www.adventnet.com/products/qengine/index.html"><strong>AdventNet QEngine 6.0</strong></a>), which helped us to identify some of the bottlenecks in performance. We will publish the performance reports soon. We thank AdventNet for permitting us to make use of this interesting software and we gladly recommend it to everyone too, not because AdventNet allowed us to use it but because it is really good. </p>
-<p><b>IMPORTANT NOTES:</b> </p>
-<ul>
-  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 Alpha 5 </b>for any real-time deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
-  <li>JpGraph used for generating dashboards has been replaced by ImageGraph, a third party charting software.</li>
-  <li class="style1">Database migration script is provided for migrating data from v4.2.3 to v5 Alpha 5 only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration script.</li>
-</ul>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
-<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 Alpha 5,</p>
-<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Alpha5">Summary</a></li>
-  <li><a href="#Features5_Alpha5">Features</a></li>
-  <li><a href="#v5_Bug_Fixes_alpha5">Bug Fixes</a></li>
-  <li><a href="#KI5_Alpha5">Known Issues </a></li>
-</ol>
-<h3><a name="Summary5_Alpha5" id="Summary5_Alpha5"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="73%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="40%"><b><font color="#990000">Item</font></b></td>
-      <td width="55%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1 </td>
-      <td width="40%">Features</td>
-      <td width="55%">
-        <p>15</p></td>
-    </tr>
-    <tr>
-      <td>2</td>
-      <td>Bug Fixes </td>
-      <td>2</td>
-    </tr>
-    <tr>
-      <td width="5%">3</td>
-      <td width="40%">Product Size</td>
-      <td width="55%">Platform Independent - <b>5.3 MB<br />
-        </b>Windows (EXE) - <b>26 MB</b><br />
-        Linux (BIN) - <b>40 MB</b></td>
-    </tr>
-    <tr>
-      <td width="5%">4</td>
-      <td width="40%">Database Migration</td>
-      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 alpha 5) </font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">5</td>
-      <td width="40%">vtiger CRM - PHP Documentation</td>
-      <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://prdownloads.sourceforge.net/vtigercrm/vtiger_CRM_5_alpha4_PhpDocs.zip?download">Click Here</a></td>
-    </tr>
-    <tr>
-      <td width="5%">6</td>
-      <td width="40%">Product Documentation</td>
-      <td width="55%"><ul>
-        <li>Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></li>
-        <li>        <a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_5_Test_Cases">Security Management</a> Document is bundled with the product. </li>
-      </ul></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5_Alpha5" id="Features5_Alpha5"></a>2. Features</h3>
-<table style="width: 65%; text-align: left;" border="1" cellpadding="2"
- cellspacing="2">
-  <tbody>
-    <tr>
-      <td  width="9%"><b>S. No</b></td>
-      <td  width="91%"><b>Feature</b></td>
-    </tr>
-    <tr>
-      <td  width="9%">1 </td>
-      <td  width="91%"> Smarty template applied to Currency Configuration Feature </td>
-    </tr>
-    <tr>
-      <td  width="9%">2 </td>
-      <td  width="91%"> List View feature database queries  are optimized for all the modules </td>
-    </tr>
-    <tr>
-      <td  width="9%">3 </td>
-      <td  width="91%">PHP API documentation for some of the major functions </td>
-    </tr>
-    <tr>
-      <td  width="9%">4</td>
-      <td  width="91%"> New module called Marketing is added. Campaigns module is now part of Marketing primary module. </td>
-    </tr>
-    <tr>
-      <td  width="9%">5</td>
-      <td  width="91%"> AJAXified Notification Schedulers</td>
-    </tr>
-    <tr>
-      <td  width="9%">6</td>
-      <td  width="91%"> AJAXified Inventory Notifications</td>
-    </tr>
-    <tr>
-      <td  width="9%">7</td>
-      <td  width="91%"> AJAXified Picklist Settings</td>
-    </tr>
-    <tr>
-      <td  width="9%">8</td>
-      <td  width="91%"> AJAXified Assign Module Owners</td>
-    </tr>
-    <tr>
-      <td>9</td>
-      <td> New UI for Integration of Mail Merge Templates</td>
-    </tr>
-    <tr>
-      <td>10</td>
-      <td> New UI for Company Information</td>
-    </tr>
-    <tr>
-      <td>11</td>
-      <td> New UI for Outgoing Mail Server</td>
-    </tr>
-    <tr>
-      <td>12</td>
-      <td> New UI for Backup Server Configuration</td>
-    </tr>
-    <tr>
-      <td>13</td>
-      <td> New UI for Terms and Conditions</td>
-    </tr>
-    <tr>
-      <td>14</td>
-      <td> New UI for Announcements</td>
-    </tr>
-    <tr>
-      <td>15</td>
-      <td> New UI for RSS module </td>
-    </tr>
-  </tbody>
-</table>
-<p>&nbsp; </p>
-<table border="1" width="60%">
-  <tbody>
-    <tr>
-      <td>
-        <p><b>Note: </b></p>
-        <p><b>1. Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
-        <p>Line: 166</p>
-        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="v5_Bug_Fixes_alpha5" id="v5_Bug_Fixes_alpha5"></a>Bug Fixes</h3>
-<table width="65%" border="1" cellpadding="2" cellspacing="2" text-align="left">
-  <tbody>
-    <tr>
-      <td  width="37"><b>SL No. </b></td>
-      <td  width="80"><b>Ticket ID </b></td>
-      <td  width="352"><b>Description</b></td>
-    </tr>
-    <tr>
-      <td  width="37">1 </td>
-      <td  width="80">-</td>
-      <td  width="352"> There seems to be two "search in emails" icons on the email page </td>
-    </tr>
-    <tr>
-      <td  width="37">2 </td>
-      <td  width="80">-</td>
-      <td  width="352"> Quick create drop down menu enabled. </td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="KI5_Alpha5" id="KI5_Alpha5"></a>3. Known Issues</h3>
-<ul>
-  <li> While creating a new e-mail using the e-mail template, the values for the  fields will not appear in the e-mail</li>
-  <li>Webmail has been moved from ajax/js to prototype framework</li>
-  <li> Error are not handled properly in Webmail module</li>
-  <li> Attachments will not work properly in Webmail module </li>
-  <li> When deleting the groups, the ownership of the records that are owned by the group that is being deleted should be changed. This functionality is  not handled in v5 Alpha 5</li>
-  <li> When the data of a group is shared with other users/groups, the&nbsp; records owned by the sub groups users will be shared properly but the records owned by the sub-group  will not be shared </li>
-  <li> PHP 5 related exception while saving a ticket or potential</li>
-</ul>
-<hr />
-<h1>vtiger CRM 5.0 Alpha 4: Release Notes</h1>
-<p><b>Date: March 31, 2006</b></p>
-<p>vtiger CRM 5.0 Alpha 4 release is currently in active development phase. The 
-  intent of this release is to showcase to the vtiger community, the significant 
-  changes made after v5 Alpha 3 release i.e., changes since Mar 21, 06' . The 
-  noteworthy features in v5 Alpha 3 are create database for vtiger CRM online 
-  through Configuration Wizard, edit custom fields,and so others. In addition, 
-  we are also supporting much awaited <b>PHP 5</b> and <b>MySQL 5.1.x</b> database. 
-  Please note, the vtiger CRM 5 Alpha 4 will not work with MySQL 4.0.x.<br>
-</p>
-<p><b>NOTE:</b> We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 
-  Alpha 4</b> for real-time deployment. In case you are looking for an immediate 
-  CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> 
-  (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</p>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and end users! </i> 
-  </b></p>
-<p>Jump-start to vtiger Public Discussions and post your valuable suggestions 
-  &amp; comments to help us deliver a world class open source CRM for you in another 
-  few weeks time. It is very simple,</p>
-<p><b><a name="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Alpha4">Summary</a></li>
-  <li><a href="#Features5_Alpha4">Features</a></li>
-</ol>
-<h3><a name="Summary5_Alpha4"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="65%">
-  <tbody> 
-  <tr bgcolor="#ccccff"> 
-    <td width="5%"><b><font color="#990000">S. No</font></b></td>
-    <td width="40%"><b><font color="#990000">Item</font></b></td>
-    <td width="55%"><b><font color="#990000">Status</font></b></td>
-  </tr>
-  <tr> 
-    <td width="5%">1 </td>
-    <td width="40%">Features</td>
-    <td width="55%"> 
-      <p>8</p>
-    </td>
-  </tr>
-  <tr> 
-    <td width="5%">2 </td>
-    <td width="40%">Product Size</td>
-    <td width="55%">Platform Independent - <b>8.3 MB<br>
-      </b>Windows (EXE) - <b>28 MB</b><br>
-      Linux (BIN) - <b>43 MB</b></td>
-  </tr>
-  <tr> 
-	  <td width="5%">3</td>
-    <td width="40%">Database Migration</td>
-    <td width="55%"><b><font color="#ff0000">Not Available</font></b></td>
-  </tr>
-  <tr> 
-	  <td width="5%">4</td>
-    <td width="40%">vtiger CRM - PHP Documentation</td>
-    <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://prdownloads.sourceforge.net/vtigercrm/vtiger_CRM_5_alpha4_PhpDocs.zip?download">Click 
-      Here</a></td>
-  </tr>
-  <tr> 
-	  <td width="5%">5 </td>
-    <td width="40%">Product Documentation</td>
-    <td width="55%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
-  </tr>
-  </tbody> 
-</table>
-<h3><a name="Features5_Alpha4"></a>2. Features</h3>
-<table style="width: 65%; text-align: left;" border="1" cellpadding="2"
- cellspacing="2">
-  <tbody> 
-  <tr> 
-    <td  width="9%"><b>S. No</b></td>
-    <td  width="91%"><b>Feature</b></td>
-  </tr>
-  <tr> 
-    <td  width="9%">1 </td>
-    <td  width="91%">Support for PHP5</td>
-  </tr>
-  <tr> 
-    <td  width="9%">2 </td>
-    <td  width="91%"> Support for MySQL 5</td>
-  </tr>
-  <tr> 
-    <td  width="9%">3 </td>
-    <td  width="91%">Removed duplicate code base</td>
-  </tr>
-  <tr> 
-    <td  width="9%">4</td>
-    <td  width="91%"> Removed junk methods in code base</td>
-  </tr>
-  <tr> 
-    <td  width="9%">5</td>
-    <td  width="91%">Product API cleanup operation initiated</td>
-  </tr>
-  <tr> 
-    <td  width="9%">6</td>
-    <td  width="91%">Optimized the product performance a bit by restricting the 
-      database queries, used flat files to store commonly used data instead of 
-      repeated database queries. </td>
-  </tr>
-  <tr> 
-    <td  width="9%">7</td>
-    <td  width="91%">Create database for vtiger CRM online through Configuration 
-      Wizard</td>
-  </tr>
-  <tr> 
-    <td  width="9%">8</td>
-    <td  width="91%">Modify custom fields</td>
-  </tr>
-  </tbody> 
-</table>
-<p>&nbsp; </p>
-<table border="1" width="60%">
-  <tbody> 
-  <tr> 
-    <td> 
-      <p><b><a name="Refer_Note"></a>Note: </b></p>
-      <p><b>1. Configuring Web services to update Publicly traded company profiles 
-        (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol 
-        is specified, company profile will be displayed on top of Edit view page. 
-        For this specify the server name, port number, user name and password 
-        has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
-      <p>Line: 166</p>
-      <p>Assign values to the given variables: $server,$port,$user,$pwd</p>
-      </td>
-  </tr>
-  </tbody> 
-</table>
-<h3><a name="KI5_Alpha4"></a>3. Known Issues</h3>
-<ul>
-  <li>Dashboards feature will not function in Alpha 4 because of PHP 5 support. 
-    We are working with an alternative graphs package, which will be available 
-    during next update.</li>
-</ul>
-<hr>
-<h1>vtiger CRM 5.0 Alpha 3: Release Notes</h1>
-<p><b>Date: March 21, 2006</b></p>
-<p>vtiger CRM 5.0 Alpha 3 release is currently in active development phase. The 
-  intent of this release is to showcase to the vtiger community, the significant 
-  changes made after v5 Alpha 2 release i.e., changes since Feb 28, 06' . The 
-  noteworthy features in v5 Alpha 3 are enhanced user interface for Home page, 
-  security scope for reports and dashboards, integration of AJAX based Chat application, 
-  new user interface for System Administration, global search function for all 
-  the modules, tag based grouping of the records, and so forth. In addition, we 
-  are also supporting much awaited <b>MySQL 5.0.19</b> and <b>MySQL 4.1.x</b> 
-  database systems. Please note, the vtiger CRM 5 Alpha 3 will not work with MySQL 
-  4.0.x.<br>
-</p>
-<p><b>NOTE:</b> We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 
-  Alpha 3</b> for real-time deployment. In case you are looking for an immediate 
-  CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> 
-  (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</p>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and end users! </i> 
-  </b></p>
-<p>Jump-start to vtiger Public Discussions and post your valuable suggestions 
-  &amp; comments to help us deliver a world class open source CRM for you in another 
-  few weeks time. It is very simple,</p>
-<p><b><a name="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Alpha3">Summary</a></li>
-  <li><a href="#Features5_Alpha3">Features</a></li>
-</ol>
-<h3><a name="Summary5_Alpha3"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="65%">
-  <tbody> 
-  <tr bgcolor="#ccccff"> 
-    <td width="5%"><b><font color="#990000">S. No</font></b></td>
-    <td width="40%"><b><font color="#990000">Item</font></b></td>
-    <td width="55%"><b><font color="#990000">Status</font></b></td>
-  </tr>
-  <tr> 
-    <td width="5%">1 </td>
-    <td width="40%">Features</td>
-    <td width="55%"> 
-      <p>23</p>
-    </td>
-  </tr>
-  <tr> 
-    <td width="5%">2 </td>
-    <td width="40%">Product Size</td>
-    <td width="55%">Platform Independent - <b>9.3 MB<br>
-      </b>Windows (EXE) - <b>26 MB</b><br>
-      Linux (BIN) - <b>39 MB</b></td>
-  </tr>
-  <tr> 
-    <td width="5%">4 </td>
-    <td width="40%">Database Migration</td>
-    <td width="55%"><b><font color="#ff0000">Not Available/Will Not be Available</font></b></td>
-  </tr>
-  <tr> 
-    <td width="5%">5 </td>
-    <td width="40%">vtiger CRM - PHP Documentation</td>
-    <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha3_PhpDocs.zip?download">Click 
-      Here</a></td>
-  </tr>
-  <tr> 
-    <td width="5%">6 </td>
-    <td width="40%">Product Documentation</td>
-    <td width="55%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
-  </tr>
-  <tr> 
-    <td width="5%">8 </td>
-    <td width="40%">Source Code Label</td>
-    <td width="55%">VTIGERCRM_5_ALPHA3</td>
-  </tr>
-  </tbody> 
-</table>
-<h3><a name="Features5_Alpha3"></a>2. Features</h3>
-<table style="width: 65%; text-align: left;" border="1" cellpadding="2"
- cellspacing="2">
-  <tbody> 
-  <tr> 
-    <td  width="9%"><b>S. No</b></td>
-    <td  width="91%"><b>Feature</b></td>
-  </tr>
-  <tr> 
-    <td  width="9%">1 </td>
-    <td  width="91%">Sleek Home page user interface</td>
-  </tr>
-  <tr> 
-    <td  width="9%">2 </td>
-    <td  width="91%">Demo data populated across the 
-      modules</td>
-  </tr>
-  <tr> 
-    <td  width="9%">3 </td>
-    <td  width="91%">Manage RSS feeds completely</td>
-  </tr>
-  <tr> 
-    <td  width="9%">4</td>
-    <td  width="91%"> Manage frequently visited sites 
-      in mySites module</td>
-  </tr>
-  <tr> 
-    <td  width="9%">5</td>
-    <td  width="91%">Prototype, a third-party package 
-      bundled with the product </td>
-  </tr>
-  <tr> 
-    <td  width="9%">6</td>
-    <td  width="91%">Email Templates module redesigned 
-    </td>
-  </tr>
-  <tr> 
-    <td  width="9%">7</td>
-    <td  width="91%">Custom Views in all the modules 
-      are redesigned using Smarty templates</td>
-  </tr>
-  <tr> 
-    <td  width="9%">9</td>
-    <td  width="91%">Shared/Group Calendar with multiple 
-      users</td>
-  </tr>
-  <tr> 
-    <td  width="9%">10</td>
-    <td  width="91%">Slide show of the users' photos 
-      in Users List View</td>
-  </tr>
-  <tr> 
-    <td  width="9%">11</td>
-    <td  width="91%">Search records easily by tagging 
-      a set of records</td>
-  </tr>
-  <tr> 
-    <td  width="9%">12</td>
-    <td  width="91%">Newly designed Calculator and 
-      Clock are integrated</td>
-  </tr>
-  <tr> 
-    <td  width="9%">13</td>
-    <td  width="91%">Fade effect while accessing different 
-      sub-tabs in User Detail View</td>
-  </tr>
-  <tr> 
-    <td  width="9%">14</td>
-    <td  width="91%">Integrated AJAX based third-party 
-      Chat application.</td>
-  </tr>
-  <tr> 
-    <td  width="9%">15</td>
-    <td  width="91%">AJAXified Mass Delete function 
-      in all the modules</td>
-  </tr>
-  <tr> 
-    <td  width="9%">16</td>
-    <td  width="91%">AJAXified Custom View for all 
-      modules</td>
-  </tr>
-  <tr> 
-    <td  width="9%">17</td>
-    <td  width="91%"> AJAXified Change Owner and Change 
-      Status functions in Leads module</td>
-  </tr>
-  <tr> 
-    <td  width="9%">18</td>
-    <td  width="91%">Security Management User Interface 
-      is completely redesigned </td>
-  </tr>
-  <tr> 
-    <td  width="9%">19</td>
-    <td  width="91%">Advance search functions integrated 
-      only for Leads module</td>
-  </tr>
-  <tr> 
-    <td  width="9%">20</td>
-    <td  width="91%">Security feature enabled for 
-      Reports and Dashbords Home Page</td>
-  </tr>
-  <tr> 
-    <td  width="9%">21</td>
-    <td  width="91%">Global search for all the modules</td>
-  </tr>
-  <tr> 
-    <td  width="9%">22</td>
-    <td  width="91%">MySQL 5.0.19 database support</td>
-  </tr>
-  <tr> 
-    <td  width="9%">23</td>
-    <td  width="91%">Delete handling in security module</td>
-  </tr>
-  </tbody> 
-</table>
-<p>&nbsp; </p>
-<table border="1" width="60%">
-  <tbody>
-  <tr> 
-    <td> 
-      <p><b><a name="Refer_Note"></a>Note: </b></p>
-      <p><b>1. Configuring Web services to update Publicly traded company profiles 
-        (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol 
-        is specified, company profile will be displayed on top of Edit view page. 
-        For this specify the server name, port number, user name and password 
-        has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
-      <p>Line: 166</p>
-      <p>Assign values to the given variables: $server,$port,$user,$pwd</p>
-      <p>2. Shoutbox feature has been phased out.</p>
-    </td>
-  </tr>
-  </tbody>
-</table>
-<hr>
-<h1>vtiger CRM 5.0 Alpha 2: Release Notes</h1>
-<p><b>Date: February 28, 2006</b></p>
-<p>vtiger CRM 5.0 Alpha 2 release is currently in active development phase. The 
-  intent of this release is to showcase to the vtiger community, the
-significant changes made after v5 Alpha release ie changes since Jan
-16, 06' . The noteworthy features in v5 Alpha 2 are Campaign management
-for marketing folks, enhanced predefined dashboards, AJAXified myPortal
-module, intuitive System Administration, integration of Web services to
-update all your public listed customer/company profiles, view
-multidimensional models for product catalog, latest news on company
-updates, redesigned Customer Self-service portal,etc. In addition, we
-are also supporting much awaited <b>MySQL 4.1.x</b> database system. Please note, the Alpha2 will not work with MySQL 4.0.x<br>
-</p>
-<p><b>NOTE:</b> We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 
-  Alpha 2</b> for real-time deployment. In case you are looking for an immediate 
-  CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> 
-  (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</p>
-<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and end users! </i> 
-  </b></p>
-<p>Jump-start to vtiger Public Discussions and post your valuable suggestions 
-  &amp; comments to help us deliver a world class open source CRM for you in another 
-  few weeks time. It is very simple,</p>
-<p><b><font size="3">Step 1:</font></b> Browse through Live Demo: <a href="http://vtiger.com/demo/alpha2">http://vtiger.com/demo/alpha2</a></p>
-<p><b><font size="3">Step 2:</font></b> Ready with LAMP/WAMP, Download product 
-  from: </p>
-<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at 
-  vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger 
-  CRM 5.x</b></a> category</p>
-<p><b><a name="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Alpha2">Summary</a></li>
-  <li><a href="#Features5_Alpha2">Features</a></li>
-  <li><a href="#BugFixes5_Alpha2">Bug Fixes</a></li>
-  <li><a href="#KI5_Alpha2">Known Issues</a></li>
-</ol>
-<h3><a name="Summary5_Alpha2"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="65%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      
-    <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      
-    <td width="40%"><b><font color="#990000">Item</font></b></td>
-      
-    <td width="55%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      
-    <td width="5%">1
-      </td>
-      
-    <td width="40%">Features</td>
-      
-    <td width="55%"> 
-      <p>27</p>
-      </td>
-    </tr>
-    <tr>
-      
-    <td width="5%">2
-      </td>
-      
-    <td width="40%">Product Size</td>
-      
-    <td width="55%">Source - <b>9.3 MB</b></td>
-    </tr>
-    <tr>
-      
-    <td width="5%">3
-      </td>
-      
-    <td width="40%">Bug Fixes</td>
-      
-    <td width="55%">18</td>
-    </tr>
-    <tr>
-      
-    <td width="5%">4
-      </td>
-      
-    <td width="40%">Database Migration</td>
-    <td width="55%"><b><font color="#ff0000">Not Available/Will Not be Available</font></b></td>
-    </tr>
-    <tr>
-      
-    <td width="5%">5
-      </td>
-      
-    <td width="40%">vtiger CRM - PHP Documentation</td>
-      
-    <td width="55%">Download from vtigercrm project in SF.net. 
-      URL: <a href="http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha2_PhpDocs.zip?download">Click 
-      Here</a></td>
-    </tr>
-    <tr>
-      
-    <td width="5%">6
-      </td>
-      
-    <td width="40%">Product Documentation</td>
-      
-    <td width="55%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
-    </tr>
-    <tr>
-      
-    <td  width="5%">7
-      </td>
-      
-    <td  width="40%">List of files modified between 
-      alpha and alpha 2
-      </td>
-      
-    <td  width="55%">&nbsp;</td>
-    </tr>
-    <tr>
-      
-    <td width="5%">8
-      </td>
-      
-    <td width="40%">Source Code Label</td>
-      
-    <td width="55%">VTIGERCRM_5_ALPHA2</td>
-    </tr>
-    <tr>
-      
-    <td width="5%">9
-      </td>
-      
-    <td width="40%">Known Issues</td>
-      
-    <td width="55%">11</td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5_Alpha2"></a>2. Features</h3>
-<table style="text-align: left; width: 646px; height: 224px;" border="1" cellpadding="2" cellspacing="2">
-  <tbody> 
-  <tr> 
-    <td style="width: 64px; vertical-align: top;" width="69"><b>Sl No.
-      </b></td>
-    <td  width="57"><b>Ticket ID</b></td>
-    <td  width="492"><b>Description</b></td>
-  </tr>
-  <tr> 
-    <td  width="69">1</td>
-    <td  width="57">-</td>
-    <td  width="492">Enhanced Dashboards with more 
-      than 20 charts</td>
-  </tr>
-  <tr> 
-    <td  width="69">2
-    </td>
-    <td  width="57">-</td>
-    <td  width="492">Multiple currency support and 
-      currency conversion through Web service integration</td>
-  </tr>
-  <tr> 
-    <td  width="69">3</td>
-    <td  width="57">-</td>
-    <td  width="492">Campaign Management module for 
-      Marketing automation</td>
-  </tr>
-  <tr> 
-    <td  width="69">4
-    </td>
-    <td  width="57">-</td>
-    <td  width="492">Update some of your publicly 
-      traded accounts details online using Web services integration. Input only 
-      the Ticker Symbol in Account page and update the other real-time data. (<a href="#Refer_Note"><b>Refer 
-      to Note</b></a>)</td>
-  </tr>
-  <tr> 
-    <td  width="69">5
-    </td>
-    <td  width="57">-</td>
-    <td  width="492">Stay-in-touch with your customers' 
-      by uploading their photos.</td>
-  </tr>
-  <tr> 
-    <td  width="69">6
-    </td>
-    <td  width="57">&nbsp;
-    </td>
-    <td  width="492">Analyze your customers business 
-      performance based on their Web traffic.</td>
-  </tr>
-  <tr> 
-    <td  width="69">7
-    </td>
-    <td  width="57">779
-    </td>
-    <td  width="492">Show/Hide HTML Editor (FCKEditior).</td>
-  </tr>
-  <tr> 
-    <td  width="69">8
-    </td>
-    <td  width="57">1000</td>
-    <td  width="492">Send E-mail notification to assigned 
-      users when potential is updated.</td>
-  </tr>
-  <tr> 
-    <td  width="69">9
-    </td>
-    <td  width="57">1006 </td>
-    <td  width="492">Send E-mail notification to other 
-      users.</td>
-  </tr>
-  <tr> 
-    <td  width="69">10
-    </td>
-    <td  width="57">736</td>
-    <td  width="492">Show latest/new leads on a Home 
-      page.</td>
-  </tr>
-  <tr> 
-    <td  width="69">11</td>
-    <td  width="57">-</td>
-    <td  width="492"> Ajax-based multidimensional 
-      product images upload.</td>
-  </tr>
-  <tr> 
-    <td  width="69">12
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Contact Images Scrolling in Contact 
-      ListView</td>
-  </tr>
-  <tr> 
-    <td  width="69">13
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Ajax-based <b>my Portal</b> module 
-      under Tools tab.</td>
-  </tr>
-  <tr> 
-    <td  width="69">14</td>
-    <td  width="57">-</td>
-    <td  width="492">In Home page, display the status 
-      of modified records since last logout for users.</td>
-  </tr>
-  <tr> 
-    <td  width="69">15
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Tag&nbsp;Cloud - Integration 
-      (http://tagcloud.com)</td>
-  </tr>
-  <tr> 
-    <td  width="69">16
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Company-wide Announcements configuration 
-      from Settings.</td>
-  </tr>
-  <tr> 
-    <td  width="69">17
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Thumbnail view on Mouseover for 
-      Contact images in List View.</td>
-  </tr>
-  <tr> 
-    <td  height="21" width="69">18
-    </td>
-    <td  height="21" width="57">-
-    </td>
-    <td  height="21" width="492"><font color="#FF0000">Upload vtiger CRM 
-    Users' photos.(Not Working)</font></td>
-  </tr>
-  <tr> 
-    <td  width="69">19
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492"><font color="#FF0000">Resize the users photos and create 
-    thumbnails.(Not Working)</font></td>
-  </tr>
-  <tr> 
-    <td  width="69">20
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Attach multiple files in single 
-      step.</td>
-  </tr>
-  <tr> 
-    <td  width="69">21
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">FCK editor upgraded to the latest 
-      version (v2.2).</td>
-  </tr>
-  <tr> 
-    <td  width="69">22
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Shout Box integration with vtiger 
-      CRM Home page for vtiger users to chat online.</td>
-  </tr>
-  <tr> 
-    <td  width="69">23
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Tabbed approach of Detail View 
-      information. Sections are spited to <b class="moz-txt-star"><span class="moz-txt-tag"></span>Basic<span class="moz-txt-tag"></span></b> &amp; <b class="moz-txt-star"><span class="moz-txt-tag"></span>More<span class="moz-txt-tag"></span></b> for Leads, 
-      Accounts, Contacts, Potentials &amp; Product modules.</td>
-  </tr>
-  <tr> 
-    <td  height="21" width="69">24
-    </td>
-    <td  height="21" width="57">445
-    </td>
-    <td  height="21" width="492">Addition of multiple 
-      <b>Contacts</b> in Activities, Emails, Potentials, Vendors related lists.</td>
-  </tr>
-  <tr> 
-    <td  width="69">25
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Add New E-mail in Related List 
-      of Leads &amp; Contacts.</td>
-  </tr>
-  <tr> 
-    <td  width="69">26
-    </td>
-    <td  width="57">502</td>
-    <td  width="492"> Address Inheritance for Contacts.</td>
-  </tr>
-  <tr> 
-    <td  width="69">27
-    </td>
-    <td  width="57">-
-    </td>
-    <td  width="492">Ajaxified detail view for all 
-      modules.</td>
-  </tr>
-  <tr> 
-    <td  width="69">28</td>
-    <td  width="57">-</td>
-    <td  width="492">Separate Log Messages for Security 
-      Management.</td>
-  </tr>
-  </tbody> 
-</table>
-<p>&nbsp; </p>
-<table border="1" width="60%">
-  <tbody><tr>
-    <td> 
-      <p><b><a name="Refer_Note"></a>Note: Configuring Web services to update 
-        Publicly traded company profiles (With Ticker symbol in Accounts)</b>
-        
-        In Account module, if ticker symbol is specified, company profile will 
-        be displayed on top of Edit view page. For this specify the server name, 
-        port number, user name and password has in class_http/class_http.php under 
-        &lt;vtiger CRM Home&gt; directory.</p>
-      <p>Line: 166</p>
-      <p>Assign values to the given variables: $server,$port,$user,$pwd</p>
-      <p>&nbsp; </p>
-</td>
-  </tr>
-</tbody></table>
-<h3><a name="Bugs5_Alpha2"></a>3. Bug Fixes</h3>
-<table style="text-align: left; width: 650px; height: 224px;" border="1" cellpadding="2" cellspacing="2">
-  <tbody> 
-  <tr> 
-    <td  width="45"><b>SL No.
-      </b></td>
-    <td  width="62"><b>Ticket ID
-      </b></td>
-    <td  width="515"><b>Description</b></td>
-  </tr>
-  <tr> 
-    <td  width="45">1
-    </td>
-    <td  width="62">1058</td>
-    <td  width="515">While creating customview for 
-      salesorder return action is not redirected to Salesorder Listview.</td>
-  </tr>
-  <tr> 
-    <td  width="45">2
-    </td>
-    <td  width="62">1070</td>
-    <td  width="515">In activity related list,when 
-      I click on "Activity Information" link,activity detailview is not displayed 
-    </td>
-  </tr>
-  <tr> 
-    <td  height="19" width="45">3
-    </td>
-    <td  height="19" width="62">1067</td>
-    <td  height="19" width="515">minute combo box 
-      of duration field is not displaying proper values </td>
-  </tr>
-  <tr> 
-    <td  width="45">4
-    </td>
-    <td  width="62">-</td>
-    <td  width="515">In Popup SalesOrder and PurchaseOrder 
-      "Hacking attempt" exception is thrown.</td>
-  </tr>
-  <tr> 
-    <td  width="45">5
-    </td>
-    <td  width="62">-
-    </td>
-    <td  width="515">Adding New Event in Potential 
-      Relatedlist will not be working</td>
-  </tr>
-  <tr> 
-    <td  width="45">6
-    </td>
-    <td  width="62">-
-    </td>
-    <td  width="515">In Listview when a set of accounts 
-      are selected and 'sendmail' button is clicked, finally in email editview 
-      the addresses are populated both in To and cc field</td>
-  </tr>
-  <tr> 
-    <td  width="45">7
-    </td>
-    <td  width="62">866</td>
-    <td  width="515">Problem with ticket creation</td>
-  </tr>
-  <tr> 
-    <td  width="45">8
-    </td>
-    <td  width="62">898 </td>
-    <td  width="515">Attachment Error Message not 
-      proper</td>
-  </tr>
-  <tr> 
-    <td  width="45">9
-    </td>
-    <td  width="62">913 </td>
-    <td  width="515">parent email id is not selected 
-      when select a single contact or lead from listview-send mail</td>
-  </tr>
-  <tr> 
-    <td  width="45">10
-    </td>
-    <td  width="62">1011</td>
-    <td  width="515">Customer portal issue</td>
-  </tr>
-  <tr> 
-    <td  width="45">11
-    </td>
-    <td  width="62">1034 </td>
-    <td  width="515"> export of accounts</td>
-  </tr>
-  <tr> 
-    <td  width="45">12
-    </td>
-    <td  width="62">1077</td>
-    <td  width="515">can not add email id in 'To' 
-      field of email</td>
-  </tr>
-  <tr> 
-    <td  width="45">13
-    </td>
-    <td  width="62">1088</td>
-    <td  width="515">Ticket notification with wrong 
-      signature</td>
-  </tr>
-  <tr> 
-    <td  width="45">14
-    </td>
-    <td  width="62">-
-    </td>
-    <td  width="515">Create New User, Edit &amp; Detail 
-      View of the My Preference/Settings Smartified
-    </td>
-  </tr>
-  <tr> 
-    <td  width="45">15
-    </td>
-    <td  width="62">-
-    </td>
-    <td  width="515">In create customview 'Choose 
-      columns' the 'Event information' and 'Event Description' does'nt list</td>
-  </tr>
-  <tr> 
-    <td  width="45">16
-    </td>
-    <td  width="62">-
-    </td>
-    <td  width="515">Security Support for Reports
-    </td>
-  </tr>
-  <tr> 
-    <td  width="45">17
-    </td>
-    <td  width="62">-
-    </td>
-    <td  width="515">Activity Reminder Notification 
-      email<span style="font-weight: bold;"> </span></td>
-  </tr>
-  <tr> 
-    <td  width="45">18
-    </td>
-    <td  width="62">964
-    </td>
-    <td  width="515">Activities are not in start date 
-      order and not configurable</td>
-  </tr>
-  </tbody> 
-</table>
-<h3><a name="KI5_Alpha2"></a>4. Known Issues</h3>
-<ul>
-  <li>Added the Product Details Block in the Inventory module of SalesOrder, PurchaseOrder, 
-    Invoice &amp; Quotes. But the functionality of the same is to be worked upon.. 
-    This has to be done for create, edit &amp; detail view.</li>
-  <li>Event created from calendar will not be displayed in the calendar</li>
-  <li>Some of the features in the Inventory management related modules will not 
-    function properly. The Smarty templates are not applied fully.</li>
-  <li>In this release only one theme (blue) is supported. You cannot use the other 
-    bundled themes.</li>
-  <li>Some of the Related List View functions may not work properly.</li>
-  <li>In the Basic search, Search by Alphabets, and some of the field Search like 
-    Quote ID, Notes, Related To will not work.</li>
-  <li>Advance Search will not work in all the modules.</li>
-  <li>Calendar functionality is not functional, we are providing only the UI.</li>
-  <li>In home page pipeline and calendar will not be displayed.</li>
-  <li>Reports are not fully functional. You may experience some errors while working 
-    with reports.</li>
-  <li>Quick create and global search are not supported.</li>
-</ul>
-<h3><a name="v5atov5a2"></a>5. List of Files Changed from V 5 alpha to V 5 alpha 
-  2</h3>
-<ul>
-  <li>List of Changed files</li>
-  <li>Files Moved to Attic&nbsp; </li>
-</ul>
-<hr>
-<h1>vtiger CRM 5.0 Alpha 1: Release Notes</h1>
-<p><b>Date: January 16, 2006</b></p>
-<p>vtiger CRM 5.0 Alpha release is only for the testing purpose. The
-complete front-end architecture has been redesigned using the Smarty
-Template Engine (<a href="http://smarty.php.net/download.php" target="_blank">http://www.smarty.php.net/download.php</a> ) and some
-of the features and bugs fixed in earlier versions may not work. Please
-feel free to report bugs at:</p>
-<p><a href="http://bugs.vtiger.com"><b>http://bugs.vtiger.com</b></a></p>
-<p><b><a name="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary5_Alpha2">Summary</a></li>
-  <li><a href="#Features5_Alpha2">Features</a></li>
-  <li><a href="#BugFixes5_Alpha2">Bug Fixes</a></li>
-  <li><a href="#KI5_Alpha2">Known Issues</a></li>
-</ol>
-<h3><a name="Summary5_Alpha"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="65%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="31%"><b><font color="#990000">Item</font></b></td>
-      <td width="64%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1
-      </td>
-      <td width="31%">Features</td>
-      <td width="64%">
-      <p>3
-      </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">2
-      </td>
-      <td width="31%">Product Size</td>
-      <td width="64%">Windows - <b>27.5 MB</b>
-Linux - <b>39 MB</b>
-Source - <b>9.8 MB</b></td>
-    </tr>
-    <tr>
-      <td width="5%">3
-      </td>
-      <td width="31%">Bug Fixes</td>
-      <td width="64%">103</td>
-    </tr>
-    <tr>
-      <td width="5%">4
-      </td>
-      <td width="31%">Code Contributions</td>
-      <td width="64%"><a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions">http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions</a>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">5
-      </td>
-      <td width="31%">Database Migration
-      </td>
-      <td width="64%"><b>Not Available</b></td>
-    </tr>
-    <tr>
-      <td width="5%">6
-      </td>
-      <td width="31%">vtiger CRM - PHP Documentation</td>
-      <td width="64%">Download from vtigercrm project in SF.net. 
-URL: <a href="http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha_PhpDocs.zip?download">http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha_PhpDocs.zip?download</a></td>
-    </tr>
-    <tr>
-      <td width="5%">7</td>
-      <td width="31%">Product Documentation</td>
-      <td width="64%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
-    </tr>
-    <tr>
-      <td width="5%">8</td>
-      <td width="31%">Source Code Label</td>
-      <td width="64%">VTIGERCRM_5_ALPHA</td>
-    </tr>
-    <tr>
-      <td width="5%">9
-      </td>
-      <td width="31%">Known Issues</td>
-      <td width="64%">10</td>
-    </tr>
-  </tbody>
-</table>
-<h3><a name="Features5_Alpha"></a>2. Features</h3>
-<ul>
-  <li>UI interface has been redesigned based on Smarty template engine.</li>
-  <li>Bug fixes based on the Operation Consolidation list.</li>
-  <li>Security Management enhancements. For more detail refer to <a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_5_Test_Cases">vtigercrm5_alpha_Security.html</a></li>
-</ul>
-<h3><a name="Bugs5_Alpha"></a>3. Bug Fixes</h3>
-<p>Refer to the following links:</p>
-<ul>
-  <li><a href="#Bugs3">v.4.5 Dev 3 Bug Fixes</a></li>
-  <li><a href="#Bugs2">v4.5 Dev 2 Bug FIxes</a></li>
-  <li><a href="#Bugs1">v4.5 Dev 1Bug Fixes</a></li>
-</ul>
-<h3><a name="KI5_Alpha"></a>4. Known Issues</h3>
-<ul>
-  <li>Some of the features in the Inventory management related modules
-will not function properly. The Smarty templates are not applied fully.</li>
-  <li>In this release only one theme (blue) is supported. You cannot
-use the other bundled themes.</li>
-  <li>Some of the Related List View functions may not work properly.</li>
-  <li>In the Basic search, Search by Alphabets, and some of the field
-Search like Quote ID, Notes, Related To will not work.</li>
-  <li>Advance Search will not work in all the modules.</li>
-  <li>Calendar functionality is not functional, we are providing only
-the UI.</li>
-  <li>In home page pipeline and calendar will not be displayed.</li>
-  <li>Reports are not fully functional. You may experience some errors
-while working with reports.</li>
-  <li>Some of the Popup window may not function properly.</li>
-  <li>Quick create and global search are not supported.</li>
-  <li>Problem in Search UI with IE browser</li>
-</ul>
-<hr>
-<h1>vtiger CRM 4.5 : Development Version 3 - Release Notes</h1>
-<p><b>Date: November 23, 2005</b></p>
-<p><b><a name="TOC3"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary3">Summary</a></li>
-  <li><a href="#Features3">Features</a></li>
-  <li><a href="#Bugs3">Bug Fixes</a></li>
-  <li><a href="#KI3">Known Issues</a></li>
-</ol>
-<h3><a name="Summary5_Alpha"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="65%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="5%"><b><font color="#990000">S. No</font></b></td>
-      <td width="31%"><b><font color="#990000">Item</font></b></td>
-      <td width="64%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1
-      </td>
-      <td width="31%">Features</td>
-      <td width="64%">
-      <p> </p>
-8
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">2
-      </td>
-      <td width="31%">Product Size</td>
-      <td width="64%">Windows - 30MB
-Linux - 42MB</td>
-    </tr>
-    <tr>
-      <td width="5%">3
-      </td>
-      <td width="31%">Bug Fixes</td>
-      <td width="64%">29</td>
-    </tr>
-    <tr>
-      <td width="5%">4
-      </td>
-      <td width="31%">Code Contributions</td>
-      <td width="64%"><a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions">http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions</a>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">5
-      </td>
-      <td width="31%">Database Migration
-      </td>
-      <td width="64%">Not Available.&nbsp; </td>
-    </tr>
-    <tr>
-      <td width="5%">6
-      </td>
-      <td width="31%">vtiger CRM - PHP Documentation</td>
-      <td width="64%">Bundled with the Product (&lt;vtiger CRM
-Home&gt;/vtigerCRM_docs directory)</td>
-    </tr>
-    <tr>
-      <td width="5%">7</td>
-      <td width="31%">Product Documentation</td>
-      <td width="64%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
-    </tr>
-    <tr>
-      <td width="5%">8</td>
-      <td width="31%">Source Code Label</td>
-      <td width="64%">VTIGERCRM_4_5_M3</td>
-    </tr>
-    <tr>
-      <td width="5%">9
-      </td>
-      <td width="31%">Known Issues</td>
-      <td width="64%">4</td>
-    </tr>
-    <tr>
-      <td width="5%">10
-      </td>
-      <td width="31%">List of Files Changed from V 4.5 Development 2 to
-V 4.5 Development 3</td>
-      <td width="64%">110</td>
-    </tr>
-    <tr>
-      <td width="5%">11</td>
-      <td width="31%">List of Files Changed from V 4.2 Development 1 to
-V 4.5 Development 3</td>
-      <td width="64%">277</td>
-    </tr>
-    <tr>
-      <td width="5%">12</td>
-      <td width="31%">List of Files Changed from V 4.2 Patch 2 to V 4.5
-Development 3</td>
-      <td width="64%">190</td>
-    </tr>
-  </tbody>
-</table>
-<p align="right"><b><a href="#TOC3">Back
-to Top</a></b></p>
-<h3><a name="Features3"></a>2. Features</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="80%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="56"><b><font color="#990000">S. No </font></b></td>
-      <td ><b><font color="#990000">Ticket
-ID
-      </font></b></td>
-      <td width="764"><b><font color="#990000">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td >
-      <br>
-</td>
-      <td>
-      <p> Progress bar display during the vtiger CRM database creation
-in Installation wizard. </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td >
-      <br>
-</td>
-      <td>Default Organization Sharing in Security is modified
-according to the new Security Schema. Migration support is also
-provided for this feature.</td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td >588
-      </td>
-      <td>Suppress sending mail to account when a ticket is submitted.</td>
-    </tr>
-    <tr>
-      <td width="56">4</td>
-      <td >
-      <br>
-</td>
-      <td>Product quantity in stock is automatically updated when
-the&nbsp; goods specified in the Purchase Order are received.
-      
-      <b>Note:</b> To update the product quantity in stock, users have
-to change the Status drop-down list value to 'Received Shipment'
-immediately after receiving the shipment.</td>
-    </tr>
-    <tr>
-      <td width="56">5</td>
-      <td ><br>
-      </td>
-      <td>In Office Plug-in, fields from multiple modules (Accounts,
-Contacts, Leads, HelpDesk, and Users) can be merged while creating mail
-merge templates.</td>
-    </tr>
-    <tr>
-      <td width="56">6</td>
-      <td ><br>
-      </td>
-      <td>In vtiger CRM create mail merge documents by merging fields
-from multiple modules (Accounts,Contacts, Users)</td>
-    </tr>
-    <tr>
-      <td width="56">7</td>
-      <td ><br>
-      </td>
-      <td>Provided support for User field in mail merge documents</td>
-    </tr>
-    <tr>
-      <td width="56">8</td>
-      <td ><br>
-      </td>
-      <td>Mail merge all the records from a module by selecting "Select
-All" checkbox in ListView of Accounts, Contacts, Leads, and HelpDesk
-modules.</td>
-    </tr>
-  </tbody>
-</table>
-<div align="right">
-<p><b><a href="#TOC">Back to Top</a></b> </p>
-</div>
-<h3><a name="Size3"></a>3. Product Size</h3>
-<table style="text-align: left; width: 80%;" border="1" cellpadding="2" cellspacing="2">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td><b><font color="#990000">Distribution</font></b></td>
-      <td><font color="#990000"><b>Version 4.2 Build Size </b></font></td>
-      <td><b><font color="#990000">Version 4.5 Milestone 3 Build Size</font></b></td>
-    </tr>
-    <tr>
-      <td>Windows (EXE)</td>
-      <td>42 MB
-      <p> </p>
-      </td>
-      <td><b>30 MB</b></td>
-    </tr>
-    <tr>
-      <td>Linux (BIN)</td>
-      <td>39 MB
-      <p> </p>
-      </td>
-      <td><b>42 MB</b></td>
-    </tr>
-  </tbody>
-</table>
-<div align="right">
-<p><b><a href="#TOC3">Back to Top</a></b> </p>
-</div>
-<h3><a name="Bugs3"></a>4. Bug Fixes</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="80%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="56"><b><font color="#990000">S. No </font></b></td>
-      <td width="110"><b><font color="#990000">Bug ID</font></b></td>
-      <td width="764"><b><font color="#990000">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td>539</td>
-      <td>In the Potential related list view the currency value should
-be aligned right, and the currency symbol should be shown in the title
-instead of in front of every value. </td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td>640</td>
-      <td>&nbsp;Issue in Pop-up New link</td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td>665 <br>
-      </td>
-      <td>&nbsp;Check-all checkbox checks wrong checkboxes</td>
-    </tr>
-    <tr>
-      <td width="56">4</td>
-      <td>761</td>
-      <td>&nbsp;Added dash after Potential Name when converting from
-Lead</td>
-    </tr>
-    <tr>
-      <td width="56">5</td>
-      <td>644</td>
-      <td>&nbsp;Start/End date options in Custom View</td>
-    </tr>
-    <tr>
-      <td width="56">6</td>
-      <td>643</td>
-      <td>Issue in Group Activities display in Home page</td>
-    </tr>
-    <tr>
-      <td width="56">7</td>
-      <td>689</td>
-      <td>utils.php call time pass reference error </td>
-    </tr>
-    <tr>
-      <td width="56">8</td>
-      <td>770</td>
-      <td>Checkbox fields are saved with null instead of 0 value.</td>
-    </tr>
-    <tr>
-      <td width="56">9</td>
-      <td>570</td>
-      <td>Missing information when converting Lead to Contact</td>
-    </tr>
-    <tr>
-      <td width="56">10</td>
-      <td>754</td>
-      <td>Date Format on Quotes, Invoices and Orders</td>
-    </tr>
-    <tr>
-      <td width="56">11</td>
-      <td>511</td>
-      <td>Custom view-&nbsp; if lastname is selected the first
-name and the last name are displayed</td>
-    </tr>
-    <tr>
-      <td width="56">12</td>
-      <td>645</td>
-      <td>Html tags are not shown properly in activity description</td>
-    </tr>
-    <tr>
-      <td width="56">13</td>
-      <td>463</td>
-      <td>Don't show "My group allocation" section if no group is
-defined</td>
-    </tr>
-    <tr>
-      <td width="56">14</td>
-      <td>849</td>
-      <td>user belonging to more than 2 group .issue</td>
-    </tr>
-    <tr>
-      <td width="56">15</td>
-      <td>820</td>
-      <td>Product image editing error</td>
-    </tr>
-    <tr>
-      <td width="56">16</td>
-      <td>831</td>
-      <td>custom view error</td>
-    </tr>
-    <tr>
-      <td width="56">17</td>
-      <td>695</td>
-      <td>call time pass reference is corrected</td>
-    </tr>
-    <tr>
-      <td width="56">18</td>
-      <td>484</td>
-      <td>Tickets assigned to a group error </td>
-    </tr>
-    <tr>
-      <td width="56">19</td>
-      <td>851</td>
-      <td>Wrong picklist value in edit view</td>
-    </tr>
-    <tr>
-      <td width="56">20</td>
-      <td>&nbsp;</td>
-      <td>Access to vtigercrm.log files restricted -
-vulnerability fix.</td>
-    </tr>
-    <tr>
-      <td >21<br>
-      </td>
-      <td >833<br>
-      </td>
-      <td >test mail can be sent to test
-the e-mail function on configuring the mail server </td>
-    </tr>
-    <tr>
-      <td >22<br>
-      </td>
-      <td >718<br>
-      </td>
-      <td >Signatures are double-spaced in
-e-mails </td>
-    </tr>
-    <tr>
-      <td >23<br>
-      </td>
-      <td >453<br>
-      </td>
-      <td >issue in vendor search </td>
-    </tr>
-    <tr>
-      <td >24<br>
-      </td>
-      <td >564<br>
-      </td>
-      <td >Tickets assigned to Groups </td>
-    </tr>
-    <tr>
-      <td >25<br>
-      </td>
-      <td >195<br>
-      </td>
-      <td >Email - admin mail is empty,
-then cc in email is not going </td>
-    </tr>
-    <tr>
-      <td >26<br>
-      </td>
-      <td >710<br>
-      </td>
-      <td >activity notifications -&gt;
-display further information </td>
-    </tr>
-    <tr>
-      <td >27<br>
-      </td>
-      <td >504 </td>
-      <td >New Contact -Account addressNew
-Contact -Account address</td>
-    </tr>
-    <tr>
-      <td >28</td>
-      <td >259</td>
-      <td >Office Integration account name
-in address block</td>
-    </tr>
-    <tr>
-      <td >29</td>
-      <td >378</td>
-      <td >Office Plugin field selection</td>
-    </tr>
-  </tbody>
-</table>
-<div align="right">
-<p><b><a href="#TOC3">Back to Top</a></b><br>
-</p>
-</div>
-<h3>6. Known Issues</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="80%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="56"><b><font color="#990000">S. No </font></b></td>
-      <td width="764"><b><font color="#990000">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td>
-      <p>In user creation page, by default the <b>Organization</b> is
-displayed in <b>Role</b> drop-down list field but there is no action
-associated with the <b>Organization</b> value. Kindly select roles
-other than <b>Organization</b> in the drop-down list.</p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td width="764">
-      <p>While sending mass e-mail from Leads/Contact/Accounts,
-validation check will not be performed for the <b>To</b> field.</p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td width="764"> In Block rearrangement feature, If a field is
-moved to an unused or new block, the field will not be displayed.</td>
-    </tr>
-    <tr>
-      <td width="56">4</td>
-      <td width="764"> In E-mail ListView, if mail is sent to multiple
-recipients the entries will be displayed twice.</td>
-    </tr>
-  </tbody>
-</table>
-<p>&nbsp;</p>
-<hr>
-<br>
-<h1>vtiger CRM 4.5 : Development Version 2 - Release Notes</h1>
-<p><b>Date: November 16, 2005</b></p>
-<p><b><a name="TOC"></a>Table of Contents</b></p>
-<ol>
-  <li><a href="#Summary2">Summary</a></li>
-  <li><a href="#Features2">Features</a></li>
-  <li><a href="#Size">Product Size</a></li>
-  <li><a href="#Bugs2">Bug Fixes</a></li>
-  <li><a href="#DBMigration2">Database Migration</a></li>
-  <li><a href="#KI2">Known Issues</a></li>
-  <li><a href="#v451tov452">List of Files Changed from V 4.5
-Development 1 to V 4.5 Development 2</a></li>
-  <li><a href="#v42p2tov452">List of Files Changed from V 4.2 Patch 2
-to V 4.5 Development 2</a></li>
-</ol>
-<h3><a name="Summary2"></a>1. Summary</h3>
-<table border="1" cellpadding="5" cellspacing="0" width="50%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="10%"><b><font color="#990000">S. No</font></b></td>
-      <td width="53%"><b><font color="#990000">Item</font></b></td>
-      <td width="18%"><b><font color="#990000">Status</font></b></td>
-    </tr>
-    <tr>
-      <td width="10%">1</td>
-      <td width="53%">Features</td>
-      <td width="18%">3
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="10%">2</td>
-      <td width="53%">Product Size</td>
-      <td width="18%">Windows - 31MB<br>
-Linux - 41MB</td>
-    </tr>
-    <tr>
-      <td width="10%">3</td>
-      <td width="53%">Bug Fixes</td>
-      <td width="18%">24</td>
-    </tr>
-    <tr>
-      <td width="10%">4</td>
-      <td width="53%">Code Contributions</td>
-      <td width="18%">Nil</td>
-    </tr>
-    <tr>
-      <td width="10%">5</td>
-      <td width="53%">vtiger CRM - PHP Documentation</td>
-      <td width="18%">Bundled with Product</td>
-    </tr>
-    <tr>
-      <td width="10%">6</td>
-      <td width="53%">Product Documentation</td>
-      <td width="18%">Available at <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
-    </tr>
-    <tr>
-      <td width="10%">7</td>
-      <td width="53%">Source Code Label</td>
-      <td width="18%">VTIGERCRM_4_5_M2</td>
-    </tr>
-    <tr>
-      <td width="10%">8</td>
-      <td width="53%">List of Files Changed from V 4.5 Development 1 to
-V 4.5 Development 2</td>
-      <td width="18%">137</td>
-    </tr>
-    <tr>
-      <td width="10%">9</td>
-      <td width="53%">List of Files Changed from V 4.2 Patch 2 to V 4.5
-Development 2</td>
-      <td width="18%">279</td>
-    </tr>
-  </tbody>
-</table>
-<p align="right"><b><a href="#TOC">Back to Top</a></b></p>
-<h3><a name="Features2"></a>2. Features</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="80%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="56"><b><font color="#990000">S. No </font></b></td>
-      <td width="764"><b><font color="#990000">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td>
-      <p>Profile management module is revamped completely</p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td width="764">
-      <p>Display all the records that are assigned to users dynamically
-in a scrollable format. </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td width="764">Documentation for vtiger CRM - PHP libraries is
-bundled with the product. (Present under vtigerCRM_docs directory)</td>
-    </tr>
-  </tbody>
-</table>
-<div align="right">
-<p><b><a href="#TOC">Back to Top</a></b>
-</p>
-</div>
-<h3><a name="Size"></a>3. Product Size</h3>
-<table style="text-align: left; width: 80%;" border="1" cellpadding="2" cellspacing="2">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td><b><font color="#990000">Distribution</font></b></td>
-      <td><font color="#990000"><b>Version 4.2 Build Size </b></font></td>
-      <td><b><font color="#990000">Version 4.5 Milestone 2 Build Size</font></b></td>
-    </tr>
-    <tr>
-      <td>Windows (EXE)</td>
-      <td>42 MB
-      <p> </p>
-      </td>
-      <td><b>31 MB</b>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td>Linux (BIN)</td>
-      <td>39 MB
-      <p> </p>
-      </td>
-      <td><b>41 MB</b></td>
-    </tr>
-  </tbody>
-</table>
-<div align="right">
-<p><b><a href="#TOC">Back to Top</a></b>
-</p>
-</div>
-<h3><a name="Bugs2"></a>4. Bug Fixes</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="80%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="56"><b><font color="#990000">S. No </font></b></td>
-      <td width="110"><b><font color="#990000">Bug ID</font></b></td>
-      <td width="764"><b><font color="#990000">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td>810</td>
-      <td>
-      <p>The close link in activities custom view returns to the
-default view</p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">
-      <p>E-mail functions are restructured in the following mailing
-functions:</p>
-      <ul>
-        <li>Send E-mail to assigned to user, Lead, Contact and Account
-in Emails module</li>
-        <li>Send notification to the assigned to user in Activities
-module</li>
-        <li>Send Ticket details to the assigned to user and Parent in
-HelpDesk</li>
-        <li>Send customer portal login details to the customer in
-Contact module</li>
-        <li>Send mail about the portal ticket creation to the module
-owner and the customer itself in Customer Portal</li>
-      </ul>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td width="110">768</td>
-      <td width="764">Lead Street text box restricted to 30 chars</td>
-    </tr>
-    <tr>
-      <td width="56">4</td>
-      <td width="110">486</td>
-      <td width="764">Not Held Meetings shown in Activities instead of
-History</td>
-    </tr>
-    <tr>
-      <td width="56">5</td>
-      <td width="110">771</td>
-      <td width="764">Events with status "Not Held" appear still in
-Activities instead of the history table</td>
-    </tr>
-    <tr>
-      <td width="56">6</td>
-      <td width="110">682</td>
-      <td width="764">Creating an event with status planned for past
-time</td>
-    </tr>
-    <tr>
-      <td width="56">7</td>
-      <td width="110">629</td>
-      <td width="764">Select End date as today's date</td>
-    </tr>
-    <tr>
-      <td width="56">8</td>
-      <td width="110">635</td>
-      <td width="764">End date need not be mandatory if there start
-date is mandatory</td>
-    </tr>
-    <tr>
-      <td width="56">9</td>
-      <td width="110">411</td>
-      <td width="764">New Event Creation</td>
-    </tr>
-    <tr>
-      <td width="56">10</td>
-      <td width="110">809</td>
-      <td width="764">Designation Should be converted into Title field
-of Contact</td>
-    </tr>
-    <tr>
-      <td width="56">11</td>
-      <td width="110">725</td>
-      <td width="764">Field "Designation" does not seem to get carried
-across to either the Account, Potential nor Contact entries.</td>
-    </tr>
-    <tr>
-      <td width="56">12</td>
-      <td width="110">777</td>
-      <td width="764">Converting a lead does not allow two decimal
-places</td>
-    </tr>
-    <tr>
-      <td width="56">13</td>
-      <td width="110">700</td>
-      <td width="764">Events-&gt;Status is not displayed</td>
-    </tr>
-    <tr>
-      <td width="56">14</td>
-      <td width="110">446</td>
-      <td width="764">displaying product id instead of product name in
-ticket list view</td>
-    </tr>
-    <tr>
-      <td width="56">15</td>
-      <td width="110">112</td>
-      <td width="764">Generated Reports topic change</td>
-    </tr>
-    <tr>
-      <td width="56">16</td>
-      <td width="110">359</td>
-      <td width="764">Spelling Error in Reports</td>
-    </tr>
-    <tr>
-      <td width="56">17</td>
-      <td width="110">369</td>
-      <td width="764">'Translation issue'</td>
-    </tr>
-    <tr>
-      <td width="56">18</td>
-      <td width="110">398</td>
-      <td width="764">quotation custom view</td>
-    </tr>
-    <tr>
-      <td width="56">19</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">Issue - Columns to Total in Reports</td>
-    </tr>
-    <tr>
-      <td width="56">20</td>
-      <td width="110">817</td>
-      <td width="764">table names PortalInfo and CustomerDetails should
-be changed in lower case</td>
-    </tr>
-    <tr>
-      <td width="56">21</td>
-      <td width="110">818</td>
-      <td width="764">Added module in portal and the tickets should be
-assigned to the owner of the module</td>
-    </tr>
-    <tr>
-      <td width="56">22</td>
-      <td width="110">819</td>
-      <td width="764">after saving the ticket control goes to list of
-tickets instead of new ticket's detail view(in customerportal)</td>
-    </tr>
-    <tr>
-      <td width="56">23</td>
-      <td width="110">824</td>
-      <td width="764">E-mail title is missing in E-mail DetailView</td>
-    </tr>
-    <tr>
-      <td>24
-      <p> </p>
-      </td>
-      <td>
-      <p> </p>
-      <br>
-      </td>
-      <td>nusoap version upgraded to 0.7.1
-      <p> </p>
-      </td>
-    </tr>
-  </tbody>
-</table>
-<div align="right">
-<p>&nbsp;
-</p>
-</div>
-<div align="right">
-<p><b><a href="#TOC">Back to Top</a></b>
-</p>
-</div>
-<h3><a name="DBMigration2"></a>5. Database Migration</h3>
-<p>Database migration support is provided for the following versions:
-</p>
-<p></p>
-<ul>
-  <li>From vtigerCRM 4.2 Patch2 to vtigerCRM Developer Version 2</li>
-  <li> From vtigerCRM Developer Version 1 to vtigerCRM Developer
-Version 2</li>
-</ul>
-<p><b>Database Migration Procedure:</b></p>
-<ol>
-  <li>Download the attached Migration zip and extract to the
-&lt;vtigerCRM home&gt; directory (Migration42p2_to_45dev2.zip)</li>
-  <li> Access the <b>dev_index.php</b> file through the browser.</li>
-  <li> Select the versions to migrate.<br>
-  </li>
-</ol>
-<div align="right">
-<p><b><a href="#TOC">Back to Top</a></b>
-</p>
-</div>
-<h3><a name="KI2"></a>6. Known Issues</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="80%">
-  <tbody>
-    <tr bgcolor="#ccccff">
-      <td width="56"><b><font color="#990000">S. No </font></b></td>
-      <td width="764"><b><font color="#990000">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td>
-      <p>In user creation page, by default the <b>Organization</b> is
-displayed in <b>Role</b> drop-down list field but there is no action
-associated with the <b>Organization</b> value. Kindly select roles
-other than <b>Organization</b> in the drop-down list.</p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td width="764">
-      <p>While sending mass e-mail from Leads/Contact/Accounts,
-validation check will not be performed for the <b>To</b> field.</p>
-      </td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td width="764"> In Block rearrangement feature, If a field is
-moved to an unused or new block, the field will not be displayed.</td>
-    </tr>
-    <tr>
-      <td width="56">4</td>
-      <td width="764"> In E-mail ListView, if mail is sent to multiple
-recipients the entries will be displayed twice.</td>
-    </tr>
-  </tbody>
-</table>
-<hr>
-<h1>vtiger CRM 4.5 - Development Version 1 Release Notes
-<p>Date: November 9, 2005</p>
-</h1>
-<p><b>Summary:</b></p>
-<table border="1" cellpadding="5" cellspacing="0" width="50%">
-  <tbody>
-    <tr>
-      <td width="20%"><b>S. No</b></td>
-      <td width="29%"><b>Item</b></td>
-      <td width="11%"><b>Total</b></td>
-      <td width="20%"><b>Remarks</b></td>
-    </tr>
-    <tr>
-      <td width="20%">1</td>
-      <td width="29%">Features</td>
-      <td width="11%">1</td>
-      <td width="20%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="20%">2</td>
-      <td width="29%">Bug Fixes</td>
-      <td width="11%">50</td>
-      <td width="20%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="20%">3</td>
-      <td width="29%">Code Contributions</td>
-      <td width="11%">64</td>
-      <td width="20%">&nbsp;</td>
-    </tr>
-  </tbody>
-</table>
-<p>Henceforth the Emails Send/Saved will be treated like mails in Send
-items, of our regular mail client, if such emails, need to be resent,
-the recipients to be selected again.</p>
-<h3>1. Features</h3>
-<p>Added BCC field in Emails</p>
-<h3><a name="Bugs1"></a>2. Bug Fixes</h3>
-<table border="1" cellpadding="4" cellspacing="0" width="100%">
-  <tbody>
-    <tr bgcolor="#990000">
-      <td width="56"><b><font color="#ffffff">S. No </font></b></td>
-      <td width="110"><b><font color="#ffffff">Bug ID</font></b></td>
-      <td width="764"><b><font color="#ffffff">Subject</font></b></td>
-    </tr>
-    <tr>
-      <td width="56">1</td>
-      <td width="110">638</td>
-      <td width="764">Priority for Events</td>
-    </tr>
-    <tr>
-      <td width="56">2</td>
-      <td width="110">157</td>
-      <td width="764">Inventory Mgmt Related List Show All Details</td>
-    </tr>
-    <tr>
-      <td width="56">3</td>
-      <td width="110">433</td>
-      <td width="764">Search option missing in Popup Purchase order</td>
-    </tr>
-    <tr>
-      <td width="56">4</td>
-      <td width="110">454</td>
-      <td width="764">Issue in creating new note from product detail
-view</td>
-    </tr>
-    <tr>
-      <td width="56">5</td>
-      <td width="110">384</td>
-      <td width="764">Activities not saving?</td>
-    </tr>
-    <tr>
-      <td width="56">6</td>
-      <td width="110">233</td>
-      <td width="764">Bug in invoice</td>
-    </tr>
-    <tr>
-      <td width="56">7</td>
-      <td width="110">220</td>
-      <td width="764">Some Bug in Vtiger 4.2 - Invoice</td>
-    </tr>
-    <tr>
-      <td width="56">8</td>
-      <td width="110">373</td>
-      <td width="764">No Title for description</td>
-    </tr>
-    <tr>
-      <td width="56">9</td>
-      <td width="110">256</td>
-      <td width="764">name in account's address information</td>
-    </tr>
-    <tr>
-      <td width="56">10</td>
-      <td width="110">693</td>
-      <td width="764">Select Contact option Not Available</td>
-    </tr>
-    <tr>
-      <td width="56">11</td>
-      <td width="110">205</td>
-      <td width="764">spelling error and There doesn't seem to be a way
-to add a first nam</td>
-    </tr>
-    <tr>
-      <td width="56">12</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">Thunderbird plugin dialog has to be closed twice </td>
-    </tr>
-    <tr>
-      <td width="56">13</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">ThunderBird - window problem </td>
-    </tr>
-    <tr>
-      <td width="56">14</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">print option should open new page </td>
-    </tr>
-    <tr>
-      <td width="56">15</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">email,phone fields are not validated in contacts </td>
-    </tr>
-    <tr>
-      <td width="56">16</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">Problems with Thunderbird plugin </td>
-    </tr>
-    <tr>
-      <td width="56">17</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">Thunderbird Plugin: Error importing Contacts </td>
-    </tr>
-    <tr>
-      <td width="56">18</td>
-      <td width="110">&nbsp;</td>
-      <td width="764"> Thunderbird Extn count doesn't match </td>
-    </tr>
-    <tr>
-      <td width="56">19</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">Custom view - Mandatory check </td>
-    </tr>
-    <tr>
-      <td width="56">20</td>
-      <td width="110">&nbsp;</td>
-      <td width="764">Product Custom view</td>
-    </tr>
-    <tr>
-      <td width="56">21</td>
-      <td width="110">744</td>
-      <td width="764">Terms &amp; Conditions in Company Details as well
-as in Edit View</td>
-    </tr>
-    <tr>
-      <td width="56">22</td>
-      <td width="110">692</td>
-      <td width="764">While exporting SalesOrder i got New column after
-Quote Name.</td>
-    </tr>
-    <tr>
-      <td width="56">23</td>
-      <td width="110">688</td>
-      <td width="764">while generating reports if we select reports an
-error message is displayed this issue has been fixed</td>
-    </tr>
-    <tr>
-      <td width="56">24</td>
-      <td width="110">686</td>
-      <td width="764">after integrating the code contributed by raju
-the lead names are not displayed in the popup in email module</td>
-    </tr>
-    <tr>
-      <td width="56">25</td>
-      <td width="110">&nbsp;</td>
-      <td width="764"> Having status for events in Customview of
-Activities-Customer request</td>
-    </tr>
-    <tr>
-      <td width="56">26</td>
-      <td width="110">284</td>
-      <td width="764">In populating the Demo data of leads,giving the
-companyname</td>
-    </tr>
-    <tr>
-      <td width="56">27</td>
-      <td width="110">289</td>
-      <td width="764">In populating Demo data, giving the value for
-assigned to</td>
-    </tr>
-    <tr>
-      <td width="56">28</td>
-      <td width="110">151</td>
-      <td width="764">Attachment contains footer of vitgerCRM and
-javascript (I attached license_agreement.txt of vtigercrm, but i got in
-other name and not in .txt&nbsp;format and content is mixed with
-vtigerCRM Footer)</td>
-    </tr>
-    <tr>
-      <td width="56">29</td>
-      <td width="110">194</td>
-      <td width="764">Email Email,Webmail Tab is comming for all pages
-in Email Module (While Editing email,still the listview tab
-(Emails,Webmails) is&nbsp;comming. It should be like Email : ""Subject"")</td>
-    </tr>
-    <tr>
-      <td width="56">30</td>
-      <td width="110">440</td>
-      <td width="764">issue while creating new contact&amp;account
-through add business card</td>
-    </tr>
-    <tr>
-      <td width="56">31</td>
-      <td width="110">690</td>
-      <td width="764">Problem in Close Date and Last modified of the
-list of Sales Stage History of the Potentials</td>
-    </tr>
-    <tr>
-      <td width="56">32</td>
-      <td width="110">694</td>
-      <td width="764">Date showing is incorrect in add business card
-(when add new business card, there is date for appoinment where the
-showing date is not in&nbsp;current user date format</td>
-    </tr>
-    <tr>
-      <td width="56">33</td>
-      <td width="110">158</td>
-      <td width="764">Pick list Custom field issue</td>
-    </tr>
-    <tr>
-      <td width="56">34</td>
-      <td width="110">370</td>
-      <td width="764">duplicate entry in list view</td>
-    </tr>
-    <tr>
-      <td width="56">35</td>
-      <td width="110">288</td>
-      <td width="764">Issue in Inventory Popups</td>
-    </tr>
-    <tr>
-      <td width="56">36</td>
-      <td width="110">347</td>
-      <td width="764">Error Message</td>
-    </tr>
-    <tr>
-      <td width="56">37</td>
-      <td width="110">358</td>
-      <td width="764">Filtering by Headers in Leads</td>
-    </tr>
-    <tr>
-      <td width="56">38</td>
-      <td width="110">342</td>
-      <td width="764">New users can'&acute;t login</td>
-    </tr>
-    <tr>
-      <td width="56">39</td>
-      <td width="110">360</td>
-      <td width="764">System Configuration</td>
-    </tr>
-    <tr>
-      <td width="56">40</td>
-      <td width="110">145</td>
-      <td width="764">related module is empty</td>
-    </tr>
-    <tr>
-      <td width="56">41</td>
-      <td width="110">179</td>
-      <td width="764">Potential-activities</td>
-    </tr>
-    <tr>
-      <td width="56">42</td>
-      <td width="110">203</td>
-      <td width="764">Inventory RL</td>
-    </tr>
-    <tr>
-      <td width="56">43</td>
-      <td width="110">211</td>
-      <td width="764">There is no option to create a Potential for a
-contact</td>
-    </tr>
-    <tr>
-      <td width="56">44</td>
-      <td width="110">212</td>
-      <td width="764">Create Quote from Contact</td>
-    </tr>
-    <tr>
-      <td width="56">45</td>
-      <td width="110">354</td>
-      <td width="764">Critical security vulnerability in multi-instance
-installations / multiple instance login problem</td>
-    </tr>
-    <tr>
-      <td width="56">46</td>
-      <td width="110">670</td>
-      <td width="764">Propegate Account Address info into New Contact</td>
-    </tr>
-    <tr>
-      <td width="56">47</td>
-      <td width="110">681</td>
-      <td width="764">Bug in utils.php function getListViewEntries</td>
-    </tr>
-    <tr>
-      <td width="56">48</td>
-      <td width="110">754</td>
-      <td width="764">User_name instead of firstname lastname used as
-sender in emails</td>
-    </tr>
-    <tr>
-      <td width="56">49</td>
-      <td width="110">773</td>
-      <td width="764">In custom views of Tickets the Ticket id is
-missing. Its also not possible to filter by ticket id's.</td>
-    </tr>
-    <tr>
-      <td width="56">50</td>
-      <td width="110">763</td>
-      <td width="764">Misspelling in KeyMetrics</td>
-    </tr>
-  </tbody>
-</table>
-<h3>3. Code Contributions</h3>
-<table style="width: 100%; text-align: left;" border="1" cellpadding="4" cellspacing="0">
-  <tbody>
-    <tr bgcolor="#990000">
-      <td width="5%"><b><font color="#ffffff">S. No</font></b>
-      <p><b><font color="#ffffff"> </font></b></p>
-      </td>
-      <td width="52%"><b><font color="#ffffff">Forums</font></b>
-      <p>
-    </p></td>
-      <td width="43%"><b><font color="#ffffff">Description</font></b></td>
-    </tr>
-    <tr>
-      <td width="5%">1
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1954" title="http://www.vtiger.com/discussions/viewtopic.php?t=1954">http://www.vtiger.com/discussions/viewtopic.php?t=1954</a>
-      <p> </p>
-      </td>
-      <td width="43%">GUI
-      <p>rearrange fields within blocks? </p>
-      <p>Drag and drop for the fields with different blocks</p>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">2
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2750" title="http://www.vtiger.com/discussions/viewtopic.php?t=2750">http://www.vtiger.com/discussions/viewtopic.php?t=2750</a>
-      <p> </p>
-      </td>
-      <td width="43%">Appropriate
-      <p>tabindex for edit fields. </p>
-      <p>One more column is added to the fields table to get the tab</p>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">3
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2368" title="http://www.vtiger.com/discussions/viewtopic.php?t=2368">http://www.vtiger.com/discussions/viewtopic.php?t=2368</a>
-      <p> </p>
-      </td>
-      <td width="43%">Release Relations in
-Contacts and Accounts</td>
-    </tr>
-    <tr>
-      <td width="5%">4
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2852" title="http://www.vtiger.com/discussions/viewtopic.php?t=2852">http://www.vtiger.com/discussions/viewtopic.php?t=2852</a>
-      <p> </p>
-      </td>
-      <td width="43%">Change the status of
-the activities in CustomViews from Activities module</td>
-    </tr>
-    <tr>
-      <td width="5%">5
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2031" title="http://www.vtiger.com/discussions/viewtopic.php?t=2031">http://www.vtiger.com/discussions/viewtopic.php?t=2031</a>
-(PDF format)</td>
-      <td style="vertical-align: top; color: rgb(0, 0, 0);" width="43%">In
-the PDF
-      <p>report, to get the address </p>
-on the right side of the page.</td>
-    </tr>
-    <tr>
-      <td width="5%">6
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1689" title="http://www.vtiger.com/discussions/viewtopic.php?t=1689">http://www.vtiger.com/discussions/viewtopic.php?t=1689</a>
-      <p> </p>
-      </td>
-      <td width="43%">LDAP and Active
-Directory Support Patch</td>
-    </tr>
-    <tr>
-      <td width="5%">7
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2364" title="http://www.vtiger.com/discussions/viewtopic.php?t=2364">http://www.vtiger.com/discussions/viewtopic.php?t=2364</a>
-      <p> </p>
-      </td>
-      <td width="43%">Description
-      <p>visible for History and Notes in Acc/Cnts List view.</p>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">8
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2748" title="http://www.vtiger.com/discussions/viewtopic.php?t=2748">http://www.vtiger.com/discussions/viewtopic.php?t=2748</a>
-      <p> </p>
-      </td>
-      <td width="43%">Make a note before
-closing the activity in Home Page</td>
-    </tr>
-    <tr>
-      <td width="5%">9
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?p=13502#13502" title="http://forums.vtiger.com/viewtopic.php?p=13502#13502">http://forums.vtiger.com/viewtopic.php?p=13502#13502</a>
-      </td>
-      <td width="43%">Post subject: Bug
-resolved (Ticket ID 773): TicketId for dropdown lists... </td>
-    </tr>
-    <tr>
-      <td width="5%">10
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1692" title="http://www.vtiger.com/discussions/viewtopic.php?t=1692">http://www.vtiger.com/discussions/viewtopic.php?t=1692</a></td>
-      <td width="43%">Adding
-      <p>priority to Events </p>
-- Feature</td>
-    </tr>
-    <tr>
-      <td width="5%">11
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2617" title="http://www.vtiger.com/discussions/viewtopic.php?t=2617">http://www.vtiger.com/discussions/viewtopic.php?t=2617</a></td>
-      <td width="43%">PDF's output
-formatting. </td>
-    </tr>
-    <tr>
-      <td width="5%">12
-      <p> </p>
-      </td>
-      <td>
-      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=1530" title="http://www.vtiger.com/discussions/viewtopic.php?t=1530">http://www.vtiger.com/discussions/viewtopic.php?t=1530</a></p>
-      </td>
-      <td width="43%">Revised Tracker</td>
-    </tr>
-    <tr>
-      <td width="5%">13
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?p=13396#13396" title="http://forums.vtiger.com/viewtopic.php?p=13396#13396">http://forums.vtiger.com/viewtopic.php?p=13396#13396</a>
-      </td>
-      <td width="43%">New pdf from matt </td>
-    </tr>
-    <tr>
-      <td width="5%">14
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1585" title="http://www.vtiger.com/discussions/viewtopic.php?t=1585">http://www.vtiger.com/discussions/viewtopic.php?t=1585</a></td>
-      <td width="43%">Displaying the
-meeting in the calendar, Present in 4.2GA</td>
-    </tr>
-    <tr>
-      <td width="5%">15
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2029" title="http://www.vtiger.com/discussions/viewtopic.php?t=2029">http://www.vtiger.com/discussions/viewtopic.php?t=2029</a></td>
-      <td width="43%">Import and Export
-Products</td>
-    </tr>
-    <tr>
-      <td width="5%">16
-      <p> </p>
-      </td>
-      <td>
-      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2000" title="http://www.vtiger.com/discussions/viewtopic.php?t=2000">http://www.vtiger.com/discussions/viewtopic.php?t=2000</a></p>
-      </td>
-      <td width="43%"> During
-      <p>'Import', the person who is importing the CSV files
-'user_name' in is </p>
-assigned&nbsp; to 'Assigned to' field</td>
-    </tr>
-    <tr>
-      <td width="5%">17
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2139" title="http://www.vtiger.com/discussions/viewtopic.php?t=2139">http://www.vtiger.com/discussions/viewtopic.php?t=2139</a></td>
-      <td width="43%">When creating a 'New
-      <p>Product'&nbsp; there was an error in javascript. This is
-integrated in </p>
-patch1</td>
-    </tr>
-    <tr>
-      <td width="5%">18
-      <p> </p>
-      </td>
-      <td>
-      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2196" title="http://www.vtiger.com/discussions/viewtopic.php?t=2196">http://www.vtiger.com/discussions/viewtopic.php?t=2196</a></p>
-      </td>
-      <td width="43%">The world clock
-doesn't show 12pm correctly. It was showing 00pm</td>
-    </tr>
-    <tr>
-      <td width="5%">19
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2524" title="http://www.vtiger.com/discussions/viewtopic.php?t=2524">http://www.vtiger.com/discussions/viewtopic.php?t=2524</a></td>
-      <td width="43%">Scroll bars are
-added to the
-      <p>'Related List' of Account and contacts for 'Attachments &amp;
-Notes' </p>
-and 'History'</td>
-    </tr>
-    <tr>
-      <td width="5%">20
-      <p> </p>
-      </td>
-      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2431" title="http://www.vtiger.com/discussions/viewtopic.php?t=2431">http://www.vtiger.com/discussions/viewtopic.php?t=2431</a></td>
-      <td width="43%">Search ny Ticket id
-in HelpDesk</td>
-    </tr>
-    <tr>
-      <td width="5%">21
-      <p> </p>
-      </td>
-      <td>
-      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2406" title="http://www.vtiger.com/discussions/viewtopic.php?t=2406">http://www.vtiger.com/discussions/viewtopic.php?t=2406</a></p>
-      </td>
-      <td width="43%">If you write a
-      <p>long description in an activity, it takes off a lot of space
-because the text field is one column wide only. </p>
-      <p> </p>
-With this fix, the descriptions are spaned over all columns,</td>
-    </tr>
-    <tr>
-      <td width="5%">22
-      <p> </p>
-      </td>
-      <td>
-      <p> <font face="Times New Roman, Times, serif"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2324" title="http://www.vtiger.com/discussions/viewtopic.php?t=2324">http://www.vtiger.com/discussions/viewtopic.php?t=2324</a></font></p>
-      </td>
-      <td width="43%">This will move
-      <p>the vTiger logo upwards and the tabs will start from the left
-of the page. I've applied this all the themes </p>
-except 'blue' theme</td>
-    </tr>
-    <tr>
-      <td width="5%">23
-      <p> </p>
-      </td>
-      
-    <td> 
-      <p><font color="#000000"> </font> </p>
-      <p><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2025" title="http://www.vtiger.com/discussions/viewtopic.php?t=2025">ttp://www.vtiger.com/discussions/viewtopic.php?t=2025</a>
-      </p>
-      </td>
-      <td width="43%">The date
-      <p>format required is YYYY-mm-dd however the popup uses
-mm-dd-YYYY, </p>
-      <p>A diffeent format. Upon trying to submit changes, a date error
-(js </p>
-alert) pops up stating invalid month</td>
-    </tr>
-    <tr>
-      <td width="5%">24
-      <p> </p>
-      </td>
-      <td width="52%"> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2744" title="http://www.vtiger.com/discussions/viewtopic.php?t=2744">http://www.vtiger.com/discussions/viewtopic.php?t=2744</a>
-      <p> </p>
-      </td>
-      <td width="43%">All users in a
-activity can view it in Calendar</td>
-    </tr>
-    <tr>
-      <td width="5%">25
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3105" title="http://www.vtiger.com/discussions/viewtopic.php?t=3105">http://www.vtiger.com/discussions/viewtopic.php?t=3105</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Imporved Emailing
-system with easy mass mail support- given by <strong>Raju</strong>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">26
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3100" title="http://www.vtiger.com/discussions/viewtopic.php?t=3100">http://www.vtiger.com/discussions/viewtopic.php?t=3100</a>
-      <p> </p>
-      </td>
-      <td width="43%">One color by user in
-Calendar
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">27
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3149" title="http://www.vtiger.com/discussions/viewtopic.php?t=3149">http://www.vtiger.com/discussions/viewtopic.php?t=3149</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Vtiger php
-installer script multilanguage
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">28
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3143" title="http://www.vtiger.com/discussions/viewtopic.php?t=3143">http://www.vtiger.com/discussions/viewtopic.php?t=3143</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Fun with Google Maps
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">29
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3045" title="http://www.vtiger.com/discussions/viewtopic.php?t=3045">http://www.vtiger.com/discussions/viewtopic.php?t=3045</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Automatic Inventory
-Updating
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">30
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2681" title="http://www.vtiger.com/discussions/viewtopic.php?t=2681">http://www.vtiger.com/discussions/viewtopic.php?t=2681</a>
-      <p> </p>
-      </td>
-      <td width="43%">Helpdesk Navigation.
-      <p>In helpdesk, the navigation below the list view.</p>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">31
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2005" title="http://www.vtiger.com/discussions/viewtopic.php?t=2005">http://www.vtiger.com/discussions/viewtopic.php?t=2005</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Patches- activity
-rows on Home tab, custom activity view fix
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">32
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1770" title="http://www.vtiger.com/discussions/viewtopic.php?t=1770">http://www.vtiger.com/discussions/viewtopic.php?t=1770</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Make
-QuickActivityRegister have enddate(duedate)
-      <p>To have an end date,when creating an activity from the
-calendar </p>
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">33
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?p=13390#13390" title="http://forums.vtiger.com/viewtopic.php?p=13390#13390">http://forums.vtiger.com/viewtopic.php?p=13390#13390</a>
-      </td>
-      <td width="43%">UI improvement:
-Tabbed details and related lists </td>
-    </tr>
-    <tr>
-      <td width="5%">34
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3251" title="http://forums.vtiger.com/viewtopic.php?t=3251">http://forums.vtiger.com/viewtopic.php?t=3251</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Improved pagination
-in List View
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">35
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3359" title="http://forums.vtiger.com/viewtopic.php?t=3359">http://forums.vtiger.com/viewtopic.php?t=3359</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Tickets sorted by
-ticket id desc
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">36
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=2482" title="http://forums.vtiger.com/viewtopic.php?t=2482">http://forums.vtiger.com/viewtopic.php?t=2482</a>
-      <p> </p>
-      </td>
-      <td width="43%"> First release of
-Communications and Mass Mailing
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">37
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3105" title="http://forums.vtiger.com/viewtopic.php?t=3105">http://forums.vtiger.com/viewtopic.php?t=3105</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Imporved Emailing
-system with easy mass mail support
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">38
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3226" title="http://forums.vtiger.com/viewtopic.php?t=3226">http://forums.vtiger.com/viewtopic.php?t=3226</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Full Telephony
-Integration
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">39
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3342" title="http://forums.vtiger.com/viewtopic.php?t=3342">http://forums.vtiger.com/viewtopic.php?t=3342</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Report Filters in
-PDF And Excel exports
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">40
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3079" title="http://forums.vtiger.com/viewtopic.php?t=3079">http://forums.vtiger.com/viewtopic.php?t=3079</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Export Activities
-to Palm
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">41
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3376" title="http://forums.vtiger.com/viewtopic.php?t=3376">http://forums.vtiger.com/viewtopic.php?t=3376</a>
-      <p> </p>
-      </td>
-      <td width="43%"> custom invoice view
-using custom fields fix (4.2 Patch 2)
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">42
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3367" title="http://forums.vtiger.com/viewtopic.php?t=3367">http://forums.vtiger.com/viewtopic.php?t=3367</a>
-      <p> </p>
-      </td>
-      <td width="43%">contactserialize.php
-fixes (4.2 Patch 2)
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">43
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=1954" title="http://forums.vtiger.com/viewtopic.php?t=1954">http://forums.vtiger.com/viewtopic.php?t=1954</a>
-      <p> </p>
-      </td>
-      <td width="43%"> GUI rearrange
-fields within blocks
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">44
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3390" title="http://forums.vtiger.com/viewtopic.php?t=3390">http://forums.vtiger.com/viewtopic.php?t=3390</a>
-      <p> </p>
-      </td>
-      <td width="43%"> Hierarchical rights
-      <p> </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">45
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3143" title="http://forums.vtiger.com/viewtopic.php?t=3143">http://forums.vtiger.com/viewtopic.php?t=3143</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Fun with Google Maps </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">46
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3247" title="http://forums.vtiger.com/viewtopic.php?t=3247">http://forums.vtiger.com/viewtopic.php?t=3247</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Simple Drupal Integration </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">47
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3290" title="http://forums.vtiger.com/viewtopic.php?t=3290">http://forums.vtiger.com/viewtopic.php?t=3290</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Expenses Module Integration </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">48
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3548" title="http://forums.vtiger.com/viewtopic.php?t=3548">http://forums.vtiger.com/viewtopic.php?t=3548</a>
-      <p> </p>
-      </td>
-      <td width="43%">Activities and Notes
-fixes for 4.2 patch 2 </td>
-    </tr>
-    <tr>
-      <td width="5%">49
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3545" title="http://forums.vtiger.com/viewtopic.php?t=3545">http://forums.vtiger.com/viewtopic.php?t=3545</a>
-      <p> </p>
-      </td>
-      <td width="43%">Invoice &amp; Quotes
-layout fixes </td>
-    </tr>
-    <tr>
-      <td width="5%">50
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=2597" title="http://forums.vtiger.com/viewtopic.php?t=2597">http://forums.vtiger.com/viewtopic.php?t=2597</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Postgres Support </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">51
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://sourceforge.net/mailarchive/forum.php?thread_id=8380546&amp;forum_id=44763" title="http://sourceforge.net/mailarchive/forum.php?thread_id=8380546&amp;forum_id=44763">http://sourceforge.net/mailarchive/forum.php?thread_id=8380546&amp;forum_id=44763</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Patch for customer Portal- Michael </p>
-      <p>fixed some typos </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">52
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763" title="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763">http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Patch for Install - Michael </p>
-* fixed some typos and invalid html
-      <p>* additional permissions check - prevent </p>
-      <p>'My Pipeline' showing a permissions error on new install </p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">53
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763" title="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763">http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763</a>
-      <p> </p>
-      </td>
-      <td width="43%">
-      <p>Patch for vtigercrm nusoap - Michael </p>
-The following patch upgrades the version of
-      <p>nusoap library from 0.67 to </p>
-      <p> 0.69.</p>
-      <p></p>
-      </td>
-    </tr>
-    <tr>
-      <td width="5%">54
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3053&amp;highlight=stema" title="http://forums.vtiger.com/viewtopic.php?t=3053&amp;highlight=stema">http://forums.vtiger.com/viewtopic.php?t=3053&amp;highlight=stema</a>
-      <p> </p>
-      </td>
-      <td width="43%">Arrange emails by
-sent date </td>
-    </tr>
-    <tr>
-      <td width="5%">55
-      <p> </p>
-      </td>
-      <td width="52%">
-      <p> </p>
-      <br>
-      </td>
-      <td width="43%">Enchanced PDF in
-Quotes </td>
-    </tr>
-    <tr>
-      <td width="5%">56
-      <p> </p>
-      </td>
-      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3509&amp;highlight=vip" title="http://forums.vtiger.com/viewtopic.php?t=3509&amp;highlight=vip">http://forums.vtiger.com/viewtopic.php?t=3509&amp;highlight=vip</a>
-      <p> </p>
-      </td>
-      <td width="43%">Change Home Page
-Order </td>
-    </tr>
-    <tr>
-      <td width="5%">57
-      <p> </p>
-      </td>
-      <td width="52%">Overlapping of
-company logo and product name while exporting in Invoice
-      <p> </p>
-      </td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">58</td>
-      <td width="52%">overlapping of
-company logo and product name while exporting in Invoice </td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">59</td>
-      <td width="52%">Description visible
-for History and Notes in Acc/Cnts List view.</td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">60</td>
-      <td width="52%">Change the status of
-the activities in CustomViews from Activities module</td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">61</td>
-      <td width="52%">Invoice &amp; Quotes
-layout fixes</td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">62</td>
-      <td width="52%">Arranging the home
-page contributed by Mike has been integrated (Bug ID: 291)</td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">63</td>
-      <td width="52%">Imporved Emailing
-system with easy mass mail support(Raju) (Bug ID: 500)</td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">64</td>
-      <td width="52%">Displaying Emails by
-Sent date order(Rcleeve)(Bug ID: 687 )</td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-    <tr>
-      <td width="5%">65</td>
-      <td width="52%">Arranging the blocks
-in settings page(comes under a code contribution) (Bug ID: 648 ) </td>
-      <td width="43%">&nbsp;</td>
-    </tr>
-  </tbody>
-</table>
-<h3>Known Issues</h3>
-<p>1) While creating a new user, by default 'Organisation' will be
-set&nbsp; as 'Role' to the user. Kindly change it to&nbsp; your
-specified role before saving, if 'Organisation' is set as role the
-user, the will not be able to login to the application.</p>
-<p>2) When sending mass mail form
-Leads/Contact/Accounts, validation is not done in 'To' field.</p>
-<p></p>
-<p>3) In Block Re-arrangement Feature,
-If is a field is moved to a unused/new block, the field will not be
-displayed.</p>
-<p></p>
-<p>4) In Email Listview, if mail is
-sent to mutiple recipients the entries will be displayed twice.</p>
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang="en"><head><title>vtiger CRM 5.0.2 : Release Notes</title>
+  
+  <style>
+p {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
+td{  font-family: Arial, Helvetica, sans-serif; font-size: 10pt}
+li{  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; margin-top: 12pt}
+h1{  font-family: Arial, Helvetica, sans-serif; font-size: 16pt}
+h2{  font-family: Arial, Helvetica, sans-serif; font-size: 14pt}
+h3{  font-family: Arial, Helvetica, sans-serif; font-size: 12pt}
+.background{
+background-image: url(themes/images/vtiger-paw.jpg);
+background-repeat: no-repeat;
+background-position: bottom center;
+background-attachment: fixed;
+}
+  .style1 {
+	color: #FF0000;
+	font-weight: bold;
+}
+  .style2 {
+	color: #0000FF;
+	font-weight: bold;
+}
+  </style>
+</head>
+
+<body class="background">
+<p><img src="vtiger.jpg" width="112" height="48"></p>
+<p>&nbsp;</p>
+<h1>vtiger CRM 5.0.2: Release Notes</h1>
+<p><b>Date: October 31, 2006</b></p>
+<p>Hi All,</p>
+<p>Welcome to vtiger CRM!</p>
+<p>We are happy to announce the release of vtiger CRM 5.0.2. In this release, 
+  we have focused mainly on the bug fixes and minor enhancements so that our end-user 
+  community will have better experience with our product.</p>
+<p><b><a name="TOC4" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5">Summary</a></li>
+  <li><a href="#feature">Enhancements</a></li>
+  <li><a href="#bugfix5">Bug Fixes</a></li>
+  <li><a href="#ki">Known Issues </a></li>
+  <li><a href="#patch">How to update the patch</a></li>
+</ol>
+<h3><a name="summary5"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody> 
+  <tr bgcolor="#ccccff"> 
+    <td width="5%"><b><font color="#990000">S. No</font></b></td>
+    <td width="40%"><b><font color="#990000">Item</font></b></td>
+    <td width="55%"><b><font color="#990000">Status</font></b></td>
+  </tr>
+  <tr> 
+    <td width="5%">1 </td>
+    <td width="40%">Features</td>
+    <td width="55%">&nbsp; </td>
+  </tr>
+  <tr> 
+    <td width="5%">2</td>
+    <td width="40%">Product Size</td>
+    <td width="55%"><b>Platform Independent - 6.1 MB<br>
+      Windows (EXE) - 26 MB<br>
+      Linux (BIN) - 43 MB</b></td>
+  </tr>
+  <tr> 
+    <td width="5%">3</td>
+    <td width="40%">Database Migration</td>
+    <td width="55%"><span class="style2">Available for migrating data from 4.2Patch2/4.2.3/4.2.4/5.0.0 to 5.0.2</span></td>
+  </tr>
+  <tr> 
+    <td>4</td>
+    <td>Product Download </td>
+    <td><a href="http://www.vtiger.com/index.php?option=com_content&task=view&id=30&Itemid=57" target="_blank">Click 
+      Here</a></td>
+  </tr>
+  <tr> 
+    <td width="5%">5</td>
+    <td width="40%">vtiger CRM - PHP Documentation</td>
+    <td width="55%"> URL: <a href="http://api.vtiger.com/index.php" target="_blank">Click 
+      Here</a></td>
+  </tr>
+  <tr> 
+    <td width="5%">6</td>
+    <td width="40%">Product Documentation</td>
+    <td width="55%"> 
+      <p>Available at the <a href="http://wiki.vtiger.com/index.php" target="_blank">Wiki</a></p>
+    </td>
+  </tr>
+  </tbody> 
+</table>
+<h3><a name="feature"></a>2. Enhancements</h3>
+<ul>
+	<li>Viewing  quantity in stock in the product list view</li>
+  <li>Display of Event date in the Activity history</li>
+  <li>Facility to add tags within the Tag cloud box.</li>
+  <li>Today's and All views are enabled in the Home page under Upcoming and Pending Activities sections<br>
+  </li>
+</ul>
+<p>&nbsp;</p>
+<h3><a name="bugfix5"></a>3. Bug Fixes</h3>
+<ul>
+  <li>Editing a calender entry resets the start and end time (Ticket 2271 )</li>
+  <li>Error in custom list view when a custom field related to that view is deleted 
+    has been handled (Ticket 2432)</li>
+  <li>Display of currency rate in campaign page (Ticket 2333 )</li>
+  <li>Formating issues in HTML editor.(Ticket 2290 )</li>
+  <li>Using the $contacts-salutationtype$ from Contacts in an email template, 
+    the email client does not send the email-this issue has been fixed. (Ticket 
+    2273)</li>
+  <li>PHP Version check during installation (Ticket 2329 )</li>
+  <li>Issue in removing contacts from Events and To dos (Ticket 2048 )</li>
+  <li>Product stock reduced twice - SO and Invoice -quantity (Ticket 1497 )</li>
+</ul>
+<p> For more information, please refer our <strong><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&group=owner&milestone=5.0.2&order=priority" target="_blank">vtiger CRM Bug Tracker.</a></strong></p>
+<h3><a name="ki"></a>4. Known Issues</h3>
+<p>We have about 125 issues to be fixed. You can refer our <a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&status=assigned&status=reopened&milestone=5.0.3&milestone=5.1.0&type=defect&order=priority"><b>vtiger CRM Bug Tracker</b></a> for the details of these issues.<strong> </strong></p>
+<p>
+<b><a name="patch"></a>5.How to update the patch</b>
+<p></p>
+<p>To upgrade from the version 5.0.0 or 5.0.1 to the latest version 5.0.2
+<ol>
+	<li> Login as admin user
+	<li> Click on the Settings tab 
+	<li> Go to Migration Wizard. 
+	<li> Use the link 'Click here to apply the 5.0.2 Database changes from 5.0.0/5.0.1'
+</ol>
+</p>
+<p>&nbsp;</p>
+<hr />
+
+<p>&nbsp;</p>
+<h1>vtiger CRM 5.0.1: Release Notes</h1>
+<p><b>Date: Octoer 10, 2006</b></p>
+<p>Hi All,</p>
+<p>We are happy to bring out yet another release of vtiger CRM, with much more 
+  capabilities, interesting code contributions and whole lot of Bug fixes..</p>
+<p>&nbsp;</p>
+<p><b><a name="TOC4" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5">Summary</a></li>
+  <li><a href="#feature">Features</a></li>
+  <li><a href="#bugfix5">Bug Fixes</a></li>
+  <li><a href="#ki">Known Issues </a></li>
+</ol>
+<h3><a name="summary5"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody> 
+  <tr bgcolor="#ccccff"> 
+    <td width="5%"><b><font color="#990000">S. No</font></b></td>
+    <td width="40%"><b><font color="#990000">Item</font></b></td>
+    <td width="55%"><b><font color="#990000">Status</font></b></td>
+  </tr>
+  <tr> 
+    <td width="5%">1 </td>
+    <td width="40%">Features</td>
+    <td width="55%">&nbsp; </td>
+  </tr>
+  <tr> 
+    <td width="5%">2</td>
+    <td width="40%">Product Size</td>
+    <td width="55%"><b>Platform Independent - 6.1 MB<br>
+      Windows (EXE) - 26 MB<br>
+      Linux (BIN) - 43 MB</b></td>
+  </tr>
+  <tr> 
+    <td width="5%">3</td>
+    <td width="40%">Database Migration</td>
+    <td width="55%"><span class="style2">Available for migrating data from 4.2.3 
+		    , 4.2.4, or 5.0 RC to v5.0.1. No database changes from 5.0.0 to 5.0.1</span></td>
+  </tr>
+  <tr> 
+    <td>4</td>
+    <td>Product Download </td>
+    <td><a href="http://www.vtiger.com/index.php?option=com_content&task=view&id=30&Itemid=57" target="_blank">Click 
+      Here</a></td>
+  </tr>
+  <tr> 
+    <td width="5%">5</td>
+    <td width="40%">vtiger CRM - PHP Documentation</td>
+    <td width="55%"> URL: <a href="http://api.vtiger.com/index.php" target="_blank">Click 
+      Here</a></td>
+  </tr>
+  <tr> 
+    <td width="5%">6</td>
+    <td width="40%">Product Documentation</td>
+    <td width="55%">
+      <p>Available at the <a href="http://wiki.vtiger.com/index.php" target="_blank">Wiki</a></p>
+    </td>
+  </tr>
+  </tbody> 
+</table>
+<h3><a name="feature"></a>2. Features</h3>
+<ul>
+  <li>UTF-8 Support</li>
+</ul>
+<h3><a name="bugfix5"></a>3. Bug Fixes</h3>
+<p>We have fixed about 71 issues after v5.0 Release and intergrated code contributions 
+  from the community. Please refer our <strong><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&group=owner&milestone=5.0.1&order=priority" target="_blank">vtiger 
+  CRM Bug Tracker.</a></strong></p>
+<h3><a name="ki"></a>4. Known Issues</h3>
+<p>We have about 121 issues to be fixed. You can refer our<a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&status=assigned&status=reopened&milestone=5.0.1&milestone=5.0.2&milestone=5.1.0&type=defect&order=priority"> 
+  <b>vtiger CRM Bug Tracker </b></a>for the details of these issues.<strong> </strong></p>
+<p>&nbsp;</p>
+<h3>&nbsp;</h3>
+<hr />
+<h1>&nbsp;</h1>
+<h1>vtiger CRM 5.0.0: Release Notes</h1>
+<p><b>Date: Sep 14, 2006</b></p>
+<p>Welcome to vtiger CRM!</p>
+<p>vtiger CRM is an enterprise-ready open source CRM solution for managing sales, marketing, customer support and order management functions effectively. Before version 5 release, vtiger CRM has passed through more than 10 development cycles. </p>
+<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5-v5">Summary</a></li>
+  <li><a href="#features5">Features</a></li>
+  <li><a href="#v5_Bug_Fixes-v5">Bug Fixes</a></li>
+  <li><a href="#ki">Known Issues </a></li>
+</ol>
+<h3><a name="Summary5-v5" id="Summary5-v5"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="40%"><b><font color="#990000">Item</font></b></td>
+      <td width="55%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1 </td>
+      <td width="40%">Features</td>
+      <td width="55%">&nbsp;
+        </td>
+    </tr>
+    <tr>
+	    <td width="5%">2</td>
+      <td width="40%">Product Size</td>
+      <td width="55%">Platform Independent - <b>6.1 MB<br />
+        </b>Windows (EXE) - <b>26 MB</b><br />
+        Linux (BIN) - <b>40 MB</b></td>
+    </tr>
+    <tr>
+	    <td width="5%">3</td>
+      <td width="40%">Database Migration</td>
+      <td width="55%"><span class="style2">Available for migrating data from 4.2.3 , 4.2.4, or 5.0 RC to v5.0</span></td>
+    </tr>
+    <tr>
+	    <td>4</td>
+      <td>Product Download </td>
+      <td><a href="http://www.vtiger.com/index.php?option=com_content&task=view&id=30&Itemid=57" target="_blank">Click Here</a></td>
+    </tr>
+    <tr>
+	    <td width="5%">5</td>
+      <td width="40%">vtiger CRM - PHP Documentation</td>
+      <td width="55%"> URL: <a href="http://api.vtiger.com/index.php" target="_blank">Click Here</a></td>
+    </tr>
+    <tr>
+	    <td width="5%">6</td>
+      <td width="40%">Product Documentation</td>
+      <td width="55%"><p>Available at the <a href="http://wiki.vtiger.com/index.php" target="_blank">Wiki</a></p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5-v5" id="Features5-v5"></a>2. Features</h3>
+<ul>
+  <li>AJAX based User Interface</li>
+  <li>Color Schemes</li>
+  <li> Enterprise-grade Security Management</li>
+  <li>Calendaring</li>
+  <li>Email Client</li>
+  <li> Customization</li>
+  <li>Reports &amp; Dashboard </li>
+  <li>Order Management </li>
+  <li> Marketing Automation </li>
+</ul>
+<p>For more details refer to: <a href="http://www.vtiger.com/products/crm/vtigercrm-5-release-notes.pdf">http://www.vtiger.com/products/crm/v5-release-notes.pdf</a></p>
+<h3><a name="v5_Bug_Fixes-v5" id="v5_Bug_Fixes-v5"></a>3. Bug Fixes</h3>
+<p>We have fixed about 200 issues after v5 RC release. For more details, kindly refer to the <strong><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&group=owner&version=5.0.0&order=priority%20" target="_blank">vtiger CRM Bug Tracker</a>.</strong></p>
+<h3><a name="KI5-v5" id="KI5-v5"></a>4. Known Issues</h3>
+<p>As on Sep 14, 2006 there are about 178 open issues. For more details, kindly refer to the<a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&status=assigned&status=reopened&milestone=5.0.1&milestone=&type=defect&order=priority" target="_blank"><strong> vtiger CRM Bug Tracker</strong></a>:</p>
+<hr />
+<h1>vtiger CRM 5.0 RC1: Release Notes</h1>
+<p><b>Date: Aug 14, 2006</b></p>
+<p> vtiger CRM 5.0 RC1, is ready for the last-round of validation before GA release!</p>
+<p>Last few days, we  have worked hard to make vtiger CRM more user friendly, bug free, and ready for real-time deployment. We thank our community members who spent their valuable time &amp; energy with us and making the RC release successful.</p>
+<p>We have few bugs remained in our basket and there are some formalities need to be completed before  announcing the public release for the real time deployments. In the meantime, kindly help us by reporting bugs that you might have encountered in RC release version. Your suggestions and feedback will definitely help us providing a smooth transition from v4.2.x to  next the generation  vtiger CRM. </p>
+<p>Major changes in the current update are new &quot;woodspice&quot; theme, calendar enhancements, fully customizable tax calculations, and re-desigend post-installation configuration wizard. We have also fixed about 350 bugs after version 5 Beta 2 release. </p>
+<p><b>IMPORTANT NOTES:</b> </p>
+<ul>
+  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 RC1 </b>for any deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
+  <li>Database migration script is provided for migrating data from v4.2.3 to v5 RC1 only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration scripts.</li>
+  <li class="style1">Database migration script is not provided for migrating data from v 5 Beta releases to v5 RC1. Hence users are strongly recommended to take a backup of the the v 5 Beta data before testing the migration script.</li>
+</ul>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
+<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 RC1,</p>
+<p><b><font size="3">Step 1:</font></b> Browse through <a href="http://en.vtiger.com"><b>Live Demo</b></a></p>
+<p><b><font size="3">Step 2:</font></b> Download product from the <a href="http://vtiger.com/index.php?option=com_content&amp;task=view&amp;id=70&amp;Itemid=109"><b>vtiger.com</b></a> and install in your favorite OS.</p>
+<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger CRM 5.x</b></a> category</p>
+<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_RC1">Summary</a></li>
+  <li><a href="#Features5_RC1">Features</a></li>
+  <li><a href="#v5_Bug_Fixes_RC1">Bug Fixes</a></li>
+  <li><a href="#KI5_RC1">Known Issues </a></li>
+</ol>
+<h3><a name="Summary5_RC1" id="Summary5_RC1"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="40%"><b><font color="#990000">Item</font></b></td>
+      <td width="55%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1 </td>
+      <td width="40%">Features</td>
+      <td width="55%">
+        <p>10</p></td>
+    </tr>
+    <tr>
+      <td width="5%">3</td>
+      <td width="40%">Product Size</td>
+      <td width="55%">Platform Independent - <b>5.6 MB<br />
+        </b>Windows (EXE) - <b>26 MB</b><br />
+        Linux (BIN) - <b>40 MB</b></td>
+    </tr>
+    <tr>
+      <td width="5%">4</td>
+      <td width="40%">Database Migration</td>
+      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 RC1) </font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">5</td>
+      <td width="40%">vtiger CRM - PHP Documentation</td>
+      <td width="55%"> URL: <a href="http://api.vtiger.com/index.php">Click Here</a></td>
+    </tr>
+    <tr>
+      <td width="5%">6</td>
+      <td width="40%">Product Documentation</td>
+      <td width="55%"><p>Available at the <a href="http://wiki.vtiger.com/index.php">Wiki</a></p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5_RC1" id="Features5_RC1"></a>2. Features</h3>
+<table border="1">
+  <tr>
+    <td><strong>S. No </strong></td>
+    <td><strong>Feature</strong></td>
+  </tr>
+  <tr>
+    <td>1</td>
+    <td>Customizable tax calculations for quotes, orders, and invoices. </td>
+  </tr>
+  <tr>
+    <td>2</td>
+    <td>Add  new values to the Status field in Inventory, Potentials, and FAQ modules
+.    </td>
+  </tr>
+  <tr>
+    <td>3</td>
+    <td>PO, SO, Invoice - Status and Quote Stage history.</td>
+  </tr>
+  <tr>
+    <td>4</td>
+    <td>Manage product wise discounts and grand discount while generating quotes, orders, and invoices.</td>
+  </tr>
+  <tr>
+    <td>5</td>
+    <td>Manage individual or group taxes.</td>
+  </tr>
+  <tr>
+    <td>6</td>
+    <td>Adding same product more than once in line items list.</td>
+  </tr>
+  <tr>
+    <td>7</td>
+    <td>Attach documents to the tickets.</td>
+  </tr>
+  <tr>
+    <td>8</td>
+    <td>Add negative adjustments in quotes, orders, and invoices . </td>
+  </tr>
+  <tr>
+    <td>9</td>
+    <td>Enhancements in Live Chat tool. </td>
+  </tr>
+  <tr>
+    <td>10</td>
+    <td>Unsubscribe form in compliance with CAN Spam act.</td>
+  </tr>
+</table>
+<p>&nbsp;</p>
+<table border="1" width="60%">
+  <tbody>
+    <tr>
+      <td>
+        <p><b>Note: </b></p>
+        <p><b>Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
+        <p>Line: 166</p>
+        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="v5_Bug_Fixes_RC1" id="v5_Bug_Fixes_RC1"></a>Bug Fixes</h3>
+<p>We have fixed about 350 issues after v5 Beta 2 release. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
+<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&amp;group=owner&amp;version=5.0.0&amp;order=priority%20">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&amp;group=owner&amp;version=5.0.0&amp;order=priority </a></p>
+<h3><a name="KI5_RC1" id="KI5_RC1"></a>4. Known Issues</h3>
+<p>As on Aug 13, 2006 there are about 100 open issues. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
+<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=owner&amp;version=5.0.0&amp;order=priority">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=owner&amp;version=5.0.0&amp;order=priority</a></p>
+<hr />
+<h1>vtiger CRM 5.0 Beta 2: Release Notes</h1>
+<p><b>Date: July 05, 2006</b></p>
+<p> vtiger CRM 5.0 Beta 2 release is ready for end-user community testing. The intent of this release is to showcase to the vtiger community, the significant changes made after v5 Beta release i.e., changes since May, 06'. The noteworthy features in v5 Beta 2 are New user interface for Settings module, Audit Trails as part of the security management, complete Web mail integration (including Outgoing and Incoming mail capability),  edit custom fields, enhanced user interface for Calendar, optimized the database queries further for List Views function in all the modules, and others.</p>
+<p><b>IMPORTANT NOTES:</b> </p>
+<ul>
+  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 Beta 2 </b>for any real-time deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
+  <li>vtiger CRM user interface can be best viewed in Mozilla/Firefox. We have some page loading page formatting issues in Internet Explorer, which will be fixed very soon. </li>
+  <li>JpGraph used for generating dashboards has been replaced by ImageGraph, a third party charting software.</li>
+  <li class="style1">Database migration script is provided for migrating data from v4.2.3 to v5 Beta 2 only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration script.</li>
+  <li class="style1">Database migration script is not provided for migrating data from v 5 Beta to v5 Beta 2. Hence users are strongly recommended to take a backup of the the v 5 Beta data before testing the migration script.</li>
+</ul>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
+<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 Beta 2,</p>
+<p><b><font size="3">Step 1:</font></b> Browse through <a href="http://www.vtiger.com/products/crm/demo_5beta/index.php"><b>Live Demo</b></a></p>
+<p><b><font size="3">Step 2:</font></b> Download product from the <a href="http://vtiger.com/index.php?option=com_content&amp;task=view&amp;id=70&amp;Itemid=109"><b>vtiger.com</b></a> and install in your favorite Operating System.</p>
+<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger CRM 5.x</b></a> category</p>
+<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Beta2">Summary</a></li>
+  <li><a href="#Features5_Beta2">Features</a></li>
+  <li><a href="#v5_Bug_Fixes_Beta2">Bug Fixes</a></li>
+  <li><a href="#KI5_Beta2">Known Issues </a></li>
+</ol>
+<h3><a name="Summary5_Beta2" id="Summary5_Beta2"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="40%"><b><font color="#990000">Item</font></b></td>
+      <td width="55%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1 </td>
+      <td width="40%">Features</td>
+      <td width="55%">
+        <p>12</p></td>
+    </tr>
+    <tr>
+      <td width="5%">3</td>
+      <td width="40%">Product Size</td>
+      <td width="55%">Platform Independent - <b>5.2 MB<br />
+        </b>Windows (EXE) - <b>26 MB</b><br />
+        Linux (BIN) - <b>40 MB</b></td>
+    </tr>
+    <tr>
+      <td width="5%">4</td>
+      <td width="40%">Database Migration</td>
+      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 Beta 2) </font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">5</td>
+      <td width="40%">vtiger CRM - PHP Documentation</td>
+      <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://api.vtiger.com/index.php">Click Here</a></td>
+    </tr>
+    <tr>
+      <td width="5%">6</td>
+      <td width="40%">Product Documentation</td>
+      <td width="55%"><p>Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5_Beta2" id="Features5_Beta2"></a>2. Features</h3>
+<table border="1">
+  <tr>
+    <td><strong>S. No </strong></td>
+    <td><strong>Feature</strong></td>
+  </tr>
+  <tr>
+    <td>1</td>
+    <td>Proxy Server configuration for accessing RSS feeds and information based on Ticker Symbol</td>
+  </tr>
+  <tr>
+    <td>2</td>
+    <td>Vertical bar chart in Home page </td>
+  </tr>
+  <tr>
+    <td>3</td>
+    <td>Security Management support for Emails module</td>
+  </tr>
+  <tr>
+    <td>4</td>
+    <td>Database table prefix support for a deploying vtiger CRM in other working databases</td>
+  </tr>
+  <tr>
+    <td>5</td>
+    <td>Audit Trial support for tracking all users system access details </td>
+  </tr>
+  <tr>
+    <td>6</td>
+    <td>Last 5 records visited</td>
+  </tr>
+  <tr>
+    <td>7</td>
+    <td>New User interface for Settings module</td>
+  </tr>
+  <tr>
+    <td>8</td>
+    <td>Print Report function</td>
+  </tr>
+  <tr>
+    <td>9</td>
+    <td>Email Detail View from Related List </td>
+  </tr>
+  <tr>
+    <td>10</td>
+    <td>Attach multiple documents to email message</td>
+  </tr>
+  <tr>
+    <td>11</td>
+    <td>Delete option for Tag cloud</td>
+  </tr>
+  <tr>
+    <td>12</td>
+    <td>AJAX based edit option for User details </td>
+  </tr>
+</table>
+<p>&nbsp;</p>
+<table border="1" width="60%">
+  <tbody>
+    <tr>
+      <td>
+        <p><b>Note: </b></p>
+        <p><b>Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
+        <p>Line: 166</p>
+        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="v5_Bug_Fixes_Beta2" id="v5_Bug_Fixes_Beta2"></a>Bug Fixes</h3>
+<p>We have fixed about 1000 issues after v5 Beta release. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
+<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&group=owner&version=5.0.0&order=priority%20">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=closed&amp;group=owner&amp;version=5.0.0&amp;order=priority </a></p>
+<h3><a name="KI5_Beta2" id="KI5_Beta2"></a>4. Known Issues</h3>
+<p>As on July 5, 2006 there are about 100 open issues. For more details, kindly refer to the vtiger CRM Bug Tracker:</p>
+<p><a href="http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&status=assigned&status=reopened&group=owner&version=5.0.0&order=priority">http://vtiger.fosslabs.com/cgi-bin/trac.cgi/query?status=new&amp;status=assigned&amp;status=reopened&amp;group=owner&amp;version=5.0.0&amp;order=priority</a></p>
+<hr />
+<h1>vtiger CRM 5.0 Beta: Release Notes</h1>
+<p><b>Date: May 31, 2006</b></p>
+<p> vtiger CRM 5.0 Beta release is ready for end-user community testing. The intent of this release is to showcase to the vtiger community, the significant changes made after v5 Alpha 5 release i.e., changes since Apr , 06' . The noteworthy features in v5 Beta are complete Web mail integration (including Outgoing and Incoming mail capability), Office Plugin, Outlook Plugin, Customer Portal, Web-Forms, Firefox Toolbar, 
+
+
+ edit custom fields,
+
+new user interface for Calendar, optimized the database queries for List Views function in all the modules, and others. In addition to this, we have&nbsp; conducted performance testing for some of the modules using a popular Web Based Testing Software (<a href="http://www.adventnet.com/products/qengine/index.html"><strong>AdventNet QEngine 6.0</strong></a>), which helped us to identify some of the bottlenecks in performance. We have also published the Performance Testing reports. We thank AdventNet for permitting us to make use of this interesting software and we gladly recommend it to everyone too, not because AdventNet allowed us to use it but because it is really good. </p>
+<p><strong>Note:</strong> </p>
+<p><b>IMPORTANT NOTES:</b> </p>
+<ul>
+  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 Beta </b>for any real-time deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
+  <li>vtiger CRM user interface can be best viewed in Mozilla/Firefox. We have some page loading page formatting issues in Internet Explorer, which will be fixed very soon. </li>
+  <li>JpGraph used for generating dashboards has been replaced by ImageGraph, a third party charting software.</li>
+  <li class="style1">Database migration script is provided for migrating data from v4.2.3 to v5 Beta only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration script.</li>
+</ul>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
+<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 Beta,</p>
+<p><b><font size="3">Step 1:</font></b> Browse through <a href="http://www.vtiger.com/products/crm/demo_5beta/index.php"><b>Live Demo</b></a></p>
+<p><b><font size="3">Step 2:</font></b> Download product from the <a href="http://vtiger.com/index.php?option=com_content&amp;task=view&amp;id=70&amp;Itemid=109"><b>vtiger.com</b></a> and install in your favorite Operating System.</p>
+<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger CRM 5.x</b></a> category</p>
+<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Beta">Summary</a></li>
+  <li><a href="#Features5_Beta">Features</a></li>
+  <li><a href="#KI5_Beta">Known Issues </a></li>
+</ol>
+<h3><a name="Summary5_Beta" id="Summary5_Beta"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="40%"><b><font color="#990000">Item</font></b></td>
+      <td width="55%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1 </td>
+      <td width="40%">Features</td>
+      <td width="55%">
+        <p>28</p></td>
+    </tr>
+    <tr>
+      <td width="5%">3</td>
+      <td width="40%">Product Size</td>
+      <td width="55%">Platform Independent - <b>5.0 MB<br />
+        </b>Windows (EXE) - <b>26 MB</b><br />
+        Linux (BIN) - <b>40 MB</b></td>
+    </tr>
+    <tr>
+      <td width="5%">4</td>
+      <td width="40%">Database Migration</td>
+      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 Beta) </font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">5</td>
+      <td width="40%">vtiger CRM - PHP Documentation</td>
+      <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://api.vtiger.com/index.php">Click Here</a></td>
+    </tr>
+    <tr>
+      <td width="5%">6</td>
+      <td width="40%">Product Documentation</td>
+      <td width="55%"><ul>
+          <li>Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></li>
+          <li> <a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_5_Test_Cases">Security Management</a> Document is bundled with the product.</li>
+      </ul></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5_Beta" id="Features5_Beta"></a>2. Features</h3>
+<table border="1" cellpadding="5" cellspacing="0" >
+  <ul>
+    <tr>
+      <td><strong>S.No</strong></td>
+      <td><strong>Feature</strong></td>
+    </tr>
+    <tr>
+      <td>1</td>
+      <td>Organization Hierarchy (Roles) can be defined using tree based structure</td>
+    </tr>
+    <tr>
+      <td>2</td>
+      <td>Recalculate sharing rules option is provided</td>
+    </tr>
+    <tr>
+      <td>3</td>
+      <td>Security Support for Campaigns module</td>
+    </tr>
+    <tr>
+      <td>4</td>
+      <td>Security Support for Ajax actions done</td>
+    </tr>
+    <tr>
+      <td>5</td>
+      <td>Role selection popup integrated.</td>
+    </tr>
+    <tr>
+      <td>6</td>
+      <td>Duplicate handling for Roles, Profiles and Groups done</td>
+    </tr>
+    <tr>
+      <td>7</td>
+      <td>Module and record-level security support for Create/Edit/Duplicate/Delete Mass Delete, Mass Change Owner, Mass Change Status functions</td>
+    </tr>
+    <tr>
+      <td>8</td>
+      <td>Security Support for Quick Create functions</td>
+    </tr>
+    <tr>
+      <td>9</td>
+      <td>Security Support for Lookup</td>
+    </tr>
+    <tr>
+      <td>10</td>
+      <td>Security Support for Settings module</td>
+    </tr>
+    <tr>
+      <td>11</td>
+      <td>Security Support for Convert Lead feature</td>
+    </tr>
+    <tr>
+      <td>12</td>
+      <td>Email Templates are fully functional with merge field value substitution for Leads, Contacts, Accounts, and Users Modules</td>
+    </tr>
+    <tr>
+      <td>13</td>
+      <td>Module and Record Level Security implemented for Mass Delete, Change Owner &amp; Change Status Buttons across product</td>
+    </tr>
+    <tr>
+      <td>14</td>
+      <td>Internationalization of the product across all modules</td>
+    </tr>
+    <tr>
+      <td>15</td>
+      <td>Smarty templates are used for My Preferences / List Mail Server</td>
+    </tr>
+    <tr>
+      <td>16</td>
+      <td>Option to create Multi select combo-box in Custom Field</td>
+    </tr>
+    <tr>
+      <td>17</td>
+      <td>Option to edit custom fields</td>
+    </tr>
+    <tr>
+      <td>18</td>
+      <td>Calendar module is completely redesigned</td>
+    </tr>
+    <tr>
+      <td>19</td>
+      <td>List View, Detail View and Edit View queries are optimized for a better performance</td>
+    </tr>
+    <tr>
+      <td>20</td>
+      <td>New user interface for Currency Configuration and Custom Field Settings</td>
+    </tr>
+    <tr>
+      <td>21</td>
+      <td>New user interface for Convert Lead function</td>
+    </tr>
+    <tr>
+      <td>22</td>
+      <td>Log entry for all functions are incorporated</td>
+    </tr>
+    <tr>
+      <td>23</td>
+      <td>AJAXified New Email functionality</td>
+    </tr>
+    <tr>
+      <td>24</td>
+      <td>New user interface for Reports</td>
+    </tr>
+    <tr>
+      <td>25</td>
+      <td>New user interface for MySites</td>
+    </tr>
+    <tr>
+      <td>26</td>
+      <td>New user interface for Attachments</td>
+    </tr>
+    <tr>
+      <td>27</td>
+      <td>New RSS reader has been integrated for a better performance</td>
+    </tr>
+    <tr>
+      <td>28</td>
+      <td>Mass Change owner option in various modules </td>
+    </tr>
+    <tr>
+      <td>29</td>
+      <td>Inventory Revamped</td>
+    </tr>
+	<tr>
+	<td>30</td>
+	<td>Advanced and Basic Search UI changed</td>
+	</tr>
+	<tr>
+	<td>31</td>
+	<td>Automatic Tax Calculator Integrated</td>
+	</tr>
+	<tr>
+	<td>32</td>
+	<td>Pagination to the related list added</td>
+	</tr>
+	<tr>
+	<td>33</td>
+	<td>Migration support from 4.2.3 to 5.0 Beta Integrated</td>
+	</tr>
+
+
+
+
+  </ul>
+</table>
+<p>&nbsp; </p>
+<table border="1" width="60%">
+  <tbody>
+    <tr>
+      <td>
+        <p><b>Note: </b></p>
+        <p><b>1. Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
+        <p>Line: 166</p>
+        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="KI5_Beta" id="KI5_Beta"></a>3. Known Issues</h3>
+<table border="1">
+  <tr>
+    <td><strong>S.No</strong></td>
+    <td><strong>Known Issue</strong></td>
+  </tr>
+  <tr>
+    <td>1</td>
+    <td>While creating a new e-mail using the e-mail template, the values for the fields will not appear in the e-mail</td>
+  </tr>
+  <tr>
+    <td>2</td>
+    <td>Web mail has been moved from ajax/js to prototype framework</td>
+  </tr>
+  <tr>
+    <td>3</td>
+    <td> Error are not handled properly in Web mail module</td>
+  </tr>
+  <tr>
+    <td>4</td>
+    <td> Attachments will not work properly in Web mail module </td>
+  </tr>
+  <tr>
+    <td>5</td>
+    <td> When deleting the groups, the ownership of the records that are owned by the group that is being deleted should be changed. This functionality is not handled in v5 Beta</td>
+  </tr>
+  <tr>
+    <td>6</td>
+    <td> When the data of a group is shared with other users/groups, the&nbsp; records owned by the sub groups users will be shared properly but the records owned by the sub-group will not be shared </td>
+  </tr>
+  <tr>
+    <td>7</td>
+    <td> PHP 5 related exception while saving a ticket or potential</td>
+  </tr>
+  <tr>
+    <td>8</td>
+    <td> Security support not done for New Emails Module</td>
+  </tr>
+  <tr>
+    <td>9</td>
+    <td>Security implementation in Custom View, Reports, Dashboards has some issues</td>
+  </tr>
+  <tr>
+    <td>10</td>
+    <td> Detail View Ajax edit has security issues</td>
+  </tr>
+  <tr>
+    <td>11</td>
+    <td> Security support for Calendar is not done</td>
+  </tr>
+  <tr>
+    <td>12</td>
+    <td> Security is not implemented in import and export queries</td>
+  </tr>
+  <tr>
+    <td>13</td>
+    <td> Home Page Security Support has issues</td>
+  </tr>
+  <tr>
+    <td>14</td>
+    <td> Form Validation for Notes non-functional</td>
+  </tr>
+  <tr>
+    <td>15</td>
+    <td> Events Scheduled after more than 1 hour gets displayed only at the start of the Hour - Calendar</td>
+  </tr>
+  <tr>
+    <td>16</td>
+    <td> Navigation missing in mini calendar</td>
+  </tr>
+  <tr>
+    <td>17</td>
+    <td> While editing the custom field, the field length and type are mismatched</td>
+  </tr>
+  <tr>
+    <td>18</td>
+    <td> custom field create Pop UI is not proper in IE browser</td>
+  </tr>
+  <tr>
+    <td>19</td>
+    <td> Send reminder will not work for To do</td>
+  </tr>
+  <tr>
+    <td>20</td>
+    <td> In campaign related list we have shown the newly created contacts and leads. but in Contact and Lead related list we are not showing the campaign relationship. i.e.., in contact and lead related list there is no table for campaigns. whether we should show this relationship or is this the expected behavior?</td>
+  </tr>
+  <tr>
+    <td>21</td>
+    <td> In the week calendar you can create event for any old day (even for year 2005). It is better to have a date validation.</td>
+  </tr>
+  <tr>
+    <td>22</td>
+    <td> From a entity detail view, if we click on edit button then the edit view page shows. now there is one more tan more information. if i click on that tab it shows the related list now if we click on Entity information it goes to detail view instead of edit view</td>
+  </tr>
+  <tr>
+    <td>23</td>
+    <td> If i add a to do it is not showing the to do list instead it is showing the Events </td>
+  </tr>
+  <tr>
+    <td>24</td>
+    <td> Not able to delete template documents if there is not more that one</td>
+  </tr>
+  <tr>
+    <td>25</td>
+    <td> All file types are allowed while uploading template documents</td>
+  </tr>
+  <tr>
+    <td>26</td>
+    <td>Multiple attachments is not supported in Emails</td>
+  </tr>
+  <tr>
+    <td>27</td>
+    <td> Export to excel is not working in PHP5 </td>
+  </tr>
+</table>
+<hr />
+<h1>vtiger CRM 5.0 Alpha 5: Release Notes</h1>
+<p><b>Date: April 07, 2006</b></p>
+<p> vtiger CRM 5.0  release is another release in v5 alpha release cycle, which is currently in active development phase. The intent of this release is to showcase to the vtiger community, the significant changes made after v5 Alpha 4 release i.e., changes since Mar 31, 06' . The noteworthy features in v5 Alpha 5 are new user interface for Company Information, Email templates, Company information, Outgoing mail server, Announcements, RSS, optimized the database queries for List Views function in all the modules, and others. In addition to this, we have&nbsp; conducted performance testing for some of the modules using a popular Web Based Testing Software (<a href="http://www.adventnet.com/products/qengine/index.html"><strong>AdventNet QEngine 6.0</strong></a>), which helped us to identify some of the bottlenecks in performance. We will publish the performance reports soon. We thank AdventNet for permitting us to make use of this interesting software and we gladly recommend it to everyone too, not because AdventNet allowed us to use it but because it is really good. </p>
+<p><b>IMPORTANT NOTES:</b> </p>
+<ul>
+  <li>We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 Alpha 5 </b>for any real-time deployments. In case you are looking for an immediate CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</li>
+  <li>JpGraph used for generating dashboards has been replaced by ImageGraph, a third party charting software.</li>
+  <li class="style1">Database migration script is provided for migrating data from v4.2.3 to v5 Alpha 5 only for testing purpose. Hence users are strongly recommended to take a backup of the the v4.2.3 data before testing the migration script.</li>
+</ul>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and real end users! </i> </b></p>
+<p>Jump-start to the vtiger Public Discussions and post your valuable suggestions &amp; comments to help us deliver a world class open source CRM for you in another few weeks time. It is very simple to start working with vtiger CRM 5 Alpha 5,</p>
+<p><b><a name="TOC3" id="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Alpha5">Summary</a></li>
+  <li><a href="#Features5_Alpha5">Features</a></li>
+  <li><a href="#v5_Bug_Fixes_alpha5">Bug Fixes</a></li>
+  <li><a href="#KI5_Alpha5">Known Issues </a></li>
+</ol>
+<h3><a name="Summary5_Alpha5" id="Summary5_Alpha5"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="73%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="40%"><b><font color="#990000">Item</font></b></td>
+      <td width="55%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1 </td>
+      <td width="40%">Features</td>
+      <td width="55%">
+        <p>15</p></td>
+    </tr>
+    <tr>
+      <td>2</td>
+      <td>Bug Fixes </td>
+      <td>2</td>
+    </tr>
+    <tr>
+      <td width="5%">3</td>
+      <td width="40%">Product Size</td>
+      <td width="55%">Platform Independent - <b>5.3 MB<br />
+        </b>Windows (EXE) - <b>26 MB</b><br />
+        Linux (BIN) - <b>40 MB</b></td>
+    </tr>
+    <tr>
+      <td width="5%">4</td>
+      <td width="40%">Database Migration</td>
+      <td width="55%"><b><font color="#ff0000">Available only for the Testing Purpose. Data (Migration script from v4.2.3 to v5 alpha 5) </font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">5</td>
+      <td width="40%">vtiger CRM - PHP Documentation</td>
+      <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://prdownloads.sourceforge.net/vtigercrm/vtiger_CRM_5_alpha4_PhpDocs.zip?download">Click Here</a></td>
+    </tr>
+    <tr>
+      <td width="5%">6</td>
+      <td width="40%">Product Documentation</td>
+      <td width="55%"><ul>
+        <li>Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></li>
+        <li>        <a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_5_Test_Cases">Security Management</a> Document is bundled with the product. </li>
+      </ul></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5_Alpha5" id="Features5_Alpha5"></a>2. Features</h3>
+<table style="width: 65%; text-align: left;" border="1" cellpadding="2"
+ cellspacing="2">
+  <tbody>
+    <tr>
+      <td  width="9%"><b>S. No</b></td>
+      <td  width="91%"><b>Feature</b></td>
+    </tr>
+    <tr>
+      <td  width="9%">1 </td>
+      <td  width="91%"> Smarty template applied to Currency Configuration Feature </td>
+    </tr>
+    <tr>
+      <td  width="9%">2 </td>
+      <td  width="91%"> List View feature database queries  are optimized for all the modules </td>
+    </tr>
+    <tr>
+      <td  width="9%">3 </td>
+      <td  width="91%">PHP API documentation for some of the major functions </td>
+    </tr>
+    <tr>
+      <td  width="9%">4</td>
+      <td  width="91%"> New module called Marketing is added. Campaigns module is now part of Marketing primary module. </td>
+    </tr>
+    <tr>
+      <td  width="9%">5</td>
+      <td  width="91%"> AJAXified Notification Schedulers</td>
+    </tr>
+    <tr>
+      <td  width="9%">6</td>
+      <td  width="91%"> AJAXified Inventory Notifications</td>
+    </tr>
+    <tr>
+      <td  width="9%">7</td>
+      <td  width="91%"> AJAXified Picklist Settings</td>
+    </tr>
+    <tr>
+      <td  width="9%">8</td>
+      <td  width="91%"> AJAXified Assign Module Owners</td>
+    </tr>
+    <tr>
+      <td>9</td>
+      <td> New UI for Integration of Mail Merge Templates</td>
+    </tr>
+    <tr>
+      <td>10</td>
+      <td> New UI for Company Information</td>
+    </tr>
+    <tr>
+      <td>11</td>
+      <td> New UI for Outgoing Mail Server</td>
+    </tr>
+    <tr>
+      <td>12</td>
+      <td> New UI for Backup Server Configuration</td>
+    </tr>
+    <tr>
+      <td>13</td>
+      <td> New UI for Terms and Conditions</td>
+    </tr>
+    <tr>
+      <td>14</td>
+      <td> New UI for Announcements</td>
+    </tr>
+    <tr>
+      <td>15</td>
+      <td> New UI for RSS module </td>
+    </tr>
+  </tbody>
+</table>
+<p>&nbsp; </p>
+<table border="1" width="60%">
+  <tbody>
+    <tr>
+      <td>
+        <p><b>Note: </b></p>
+        <p><b>1. Configuring Web services to update Publicly traded company profiles (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol is specified, company profile will be displayed on top of Edit view page. For this specify the server name, port number, user name and password has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
+        <p>Line: 166</p>
+        <p>Assign values to the given variables: $server,$port,$user,$pwd</p></td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="v5_Bug_Fixes_alpha5" id="v5_Bug_Fixes_alpha5"></a>Bug Fixes</h3>
+<table width="65%" border="1" cellpadding="2" cellspacing="2" text-align="left">
+  <tbody>
+    <tr>
+      <td  width="37"><b>SL No. </b></td>
+      <td  width="80"><b>Ticket ID </b></td>
+      <td  width="352"><b>Description</b></td>
+    </tr>
+    <tr>
+      <td  width="37">1 </td>
+      <td  width="80">-</td>
+      <td  width="352"> There seems to be two "search in emails" icons on the email page </td>
+    </tr>
+    <tr>
+      <td  width="37">2 </td>
+      <td  width="80">-</td>
+      <td  width="352"> Quick create drop down menu enabled. </td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="KI5_Alpha5" id="KI5_Alpha5"></a>3. Known Issues</h3>
+<ul>
+  <li> While creating a new e-mail using the e-mail template, the values for the  fields will not appear in the e-mail</li>
+  <li>Webmail has been moved from ajax/js to prototype framework</li>
+  <li> Error are not handled properly in Webmail module</li>
+  <li> Attachments will not work properly in Webmail module </li>
+  <li> When deleting the groups, the ownership of the records that are owned by the group that is being deleted should be changed. This functionality is  not handled in v5 Alpha 5</li>
+  <li> When the data of a group is shared with other users/groups, the&nbsp; records owned by the sub groups users will be shared properly but the records owned by the sub-group  will not be shared </li>
+  <li> PHP 5 related exception while saving a ticket or potential</li>
+</ul>
+<hr />
+<h1>vtiger CRM 5.0 Alpha 4: Release Notes</h1>
+<p><b>Date: March 31, 2006</b></p>
+<p>vtiger CRM 5.0 Alpha 4 release is currently in active development phase. The 
+  intent of this release is to showcase to the vtiger community, the significant 
+  changes made after v5 Alpha 3 release i.e., changes since Mar 21, 06' . The 
+  noteworthy features in v5 Alpha 3 are create database for vtiger CRM online 
+  through Configuration Wizard, edit custom fields,and so others. In addition, 
+  we are also supporting much awaited <b>PHP 5</b> and <b>MySQL 5.1.x</b> database. 
+  Please note, the vtiger CRM 5 Alpha 4 will not work with MySQL 4.0.x.<br>
+</p>
+<p><b>NOTE:</b> We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 
+  Alpha 4</b> for real-time deployment. In case you are looking for an immediate 
+  CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> 
+  (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</p>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and end users! </i> 
+  </b></p>
+<p>Jump-start to vtiger Public Discussions and post your valuable suggestions 
+  &amp; comments to help us deliver a world class open source CRM for you in another 
+  few weeks time. It is very simple,</p>
+<p><b><a name="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Alpha4">Summary</a></li>
+  <li><a href="#Features5_Alpha4">Features</a></li>
+</ol>
+<h3><a name="Summary5_Alpha4"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="65%">
+  <tbody> 
+  <tr bgcolor="#ccccff"> 
+    <td width="5%"><b><font color="#990000">S. No</font></b></td>
+    <td width="40%"><b><font color="#990000">Item</font></b></td>
+    <td width="55%"><b><font color="#990000">Status</font></b></td>
+  </tr>
+  <tr> 
+    <td width="5%">1 </td>
+    <td width="40%">Features</td>
+    <td width="55%"> 
+      <p>8</p>
+    </td>
+  </tr>
+  <tr> 
+    <td width="5%">2 </td>
+    <td width="40%">Product Size</td>
+    <td width="55%">Platform Independent - <b>8.3 MB<br>
+      </b>Windows (EXE) - <b>28 MB</b><br>
+      Linux (BIN) - <b>43 MB</b></td>
+  </tr>
+  <tr> 
+	  <td width="5%">3</td>
+    <td width="40%">Database Migration</td>
+    <td width="55%"><b><font color="#ff0000">Not Available</font></b></td>
+  </tr>
+  <tr> 
+	  <td width="5%">4</td>
+    <td width="40%">vtiger CRM - PHP Documentation</td>
+    <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://prdownloads.sourceforge.net/vtigercrm/vtiger_CRM_5_alpha4_PhpDocs.zip?download">Click 
+      Here</a></td>
+  </tr>
+  <tr> 
+	  <td width="5%">5 </td>
+    <td width="40%">Product Documentation</td>
+    <td width="55%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
+  </tr>
+  </tbody> 
+</table>
+<h3><a name="Features5_Alpha4"></a>2. Features</h3>
+<table style="width: 65%; text-align: left;" border="1" cellpadding="2"
+ cellspacing="2">
+  <tbody> 
+  <tr> 
+    <td  width="9%"><b>S. No</b></td>
+    <td  width="91%"><b>Feature</b></td>
+  </tr>
+  <tr> 
+    <td  width="9%">1 </td>
+    <td  width="91%">Support for PHP5</td>
+  </tr>
+  <tr> 
+    <td  width="9%">2 </td>
+    <td  width="91%"> Support for MySQL 5</td>
+  </tr>
+  <tr> 
+    <td  width="9%">3 </td>
+    <td  width="91%">Removed duplicate code base</td>
+  </tr>
+  <tr> 
+    <td  width="9%">4</td>
+    <td  width="91%"> Removed junk methods in code base</td>
+  </tr>
+  <tr> 
+    <td  width="9%">5</td>
+    <td  width="91%">Product API cleanup operation initiated</td>
+  </tr>
+  <tr> 
+    <td  width="9%">6</td>
+    <td  width="91%">Optimized the product performance a bit by restricting the 
+      database queries, used flat files to store commonly used data instead of 
+      repeated database queries. </td>
+  </tr>
+  <tr> 
+    <td  width="9%">7</td>
+    <td  width="91%">Create database for vtiger CRM online through Configuration 
+      Wizard</td>
+  </tr>
+  <tr> 
+    <td  width="9%">8</td>
+    <td  width="91%">Modify custom fields</td>
+  </tr>
+  </tbody> 
+</table>
+<p>&nbsp; </p>
+<table border="1" width="60%">
+  <tbody> 
+  <tr> 
+    <td> 
+      <p><b><a name="Refer_Note"></a>Note: </b></p>
+      <p><b>1. Configuring Web services to update Publicly traded company profiles 
+        (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol 
+        is specified, company profile will be displayed on top of Edit view page. 
+        For this specify the server name, port number, user name and password 
+        has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
+      <p>Line: 166</p>
+      <p>Assign values to the given variables: $server,$port,$user,$pwd</p>
+      </td>
+  </tr>
+  </tbody> 
+</table>
+<h3><a name="KI5_Alpha4"></a>3. Known Issues</h3>
+<ul>
+  <li>Dashboards feature will not function in Alpha 4 because of PHP 5 support. 
+    We are working with an alternative graphs package, which will be available 
+    during next update.</li>
+</ul>
+<hr>
+<h1>vtiger CRM 5.0 Alpha 3: Release Notes</h1>
+<p><b>Date: March 21, 2006</b></p>
+<p>vtiger CRM 5.0 Alpha 3 release is currently in active development phase. The 
+  intent of this release is to showcase to the vtiger community, the significant 
+  changes made after v5 Alpha 2 release i.e., changes since Feb 28, 06' . The 
+  noteworthy features in v5 Alpha 3 are enhanced user interface for Home page, 
+  security scope for reports and dashboards, integration of AJAX based Chat application, 
+  new user interface for System Administration, global search function for all 
+  the modules, tag based grouping of the records, and so forth. In addition, we 
+  are also supporting much awaited <b>MySQL 5.0.19</b> and <b>MySQL 4.1.x</b> 
+  database systems. Please note, the vtiger CRM 5 Alpha 3 will not work with MySQL 
+  4.0.x.<br>
+</p>
+<p><b>NOTE:</b> We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 
+  Alpha 3</b> for real-time deployment. In case you are looking for an immediate 
+  CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> 
+  (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</p>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and end users! </i> 
+  </b></p>
+<p>Jump-start to vtiger Public Discussions and post your valuable suggestions 
+  &amp; comments to help us deliver a world class open source CRM for you in another 
+  few weeks time. It is very simple,</p>
+<p><b><a name="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Alpha3">Summary</a></li>
+  <li><a href="#Features5_Alpha3">Features</a></li>
+</ol>
+<h3><a name="Summary5_Alpha3"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="65%">
+  <tbody> 
+  <tr bgcolor="#ccccff"> 
+    <td width="5%"><b><font color="#990000">S. No</font></b></td>
+    <td width="40%"><b><font color="#990000">Item</font></b></td>
+    <td width="55%"><b><font color="#990000">Status</font></b></td>
+  </tr>
+  <tr> 
+    <td width="5%">1 </td>
+    <td width="40%">Features</td>
+    <td width="55%"> 
+      <p>23</p>
+    </td>
+  </tr>
+  <tr> 
+    <td width="5%">2 </td>
+    <td width="40%">Product Size</td>
+    <td width="55%">Platform Independent - <b>9.3 MB<br>
+      </b>Windows (EXE) - <b>26 MB</b><br>
+      Linux (BIN) - <b>39 MB</b></td>
+  </tr>
+  <tr> 
+    <td width="5%">4 </td>
+    <td width="40%">Database Migration</td>
+    <td width="55%"><b><font color="#ff0000">Not Available/Will Not be Available</font></b></td>
+  </tr>
+  <tr> 
+    <td width="5%">5 </td>
+    <td width="40%">vtiger CRM - PHP Documentation</td>
+    <td width="55%">Download from vtigercrm project in SF.net. URL: <a href="http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha3_PhpDocs.zip?download">Click 
+      Here</a></td>
+  </tr>
+  <tr> 
+    <td width="5%">6 </td>
+    <td width="40%">Product Documentation</td>
+    <td width="55%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
+  </tr>
+  <tr> 
+    <td width="5%">8 </td>
+    <td width="40%">Source Code Label</td>
+    <td width="55%">VTIGERCRM_5_ALPHA3</td>
+  </tr>
+  </tbody> 
+</table>
+<h3><a name="Features5_Alpha3"></a>2. Features</h3>
+<table style="width: 65%; text-align: left;" border="1" cellpadding="2"
+ cellspacing="2">
+  <tbody> 
+  <tr> 
+    <td  width="9%"><b>S. No</b></td>
+    <td  width="91%"><b>Feature</b></td>
+  </tr>
+  <tr> 
+    <td  width="9%">1 </td>
+    <td  width="91%">Sleek Home page user interface</td>
+  </tr>
+  <tr> 
+    <td  width="9%">2 </td>
+    <td  width="91%">Demo data populated across the 
+      modules</td>
+  </tr>
+  <tr> 
+    <td  width="9%">3 </td>
+    <td  width="91%">Manage RSS feeds completely</td>
+  </tr>
+  <tr> 
+    <td  width="9%">4</td>
+    <td  width="91%"> Manage frequently visited sites 
+      in mySites module</td>
+  </tr>
+  <tr> 
+    <td  width="9%">5</td>
+    <td  width="91%">Prototype, a third-party package 
+      bundled with the product </td>
+  </tr>
+  <tr> 
+    <td  width="9%">6</td>
+    <td  width="91%">Email Templates module redesigned 
+    </td>
+  </tr>
+  <tr> 
+    <td  width="9%">7</td>
+    <td  width="91%">Custom Views in all the modules 
+      are redesigned using Smarty templates</td>
+  </tr>
+  <tr> 
+    <td  width="9%">9</td>
+    <td  width="91%">Shared/Group Calendar with multiple 
+      users</td>
+  </tr>
+  <tr> 
+    <td  width="9%">10</td>
+    <td  width="91%">Slide show of the users' photos 
+      in Users List View</td>
+  </tr>
+  <tr> 
+    <td  width="9%">11</td>
+    <td  width="91%">Search records easily by tagging 
+      a set of records</td>
+  </tr>
+  <tr> 
+    <td  width="9%">12</td>
+    <td  width="91%">Newly designed Calculator and 
+      Clock are integrated</td>
+  </tr>
+  <tr> 
+    <td  width="9%">13</td>
+    <td  width="91%">Fade effect while accessing different 
+      sub-tabs in User Detail View</td>
+  </tr>
+  <tr> 
+    <td  width="9%">14</td>
+    <td  width="91%">Integrated AJAX based third-party 
+      Chat application.</td>
+  </tr>
+  <tr> 
+    <td  width="9%">15</td>
+    <td  width="91%">AJAXified Mass Delete function 
+      in all the modules</td>
+  </tr>
+  <tr> 
+    <td  width="9%">16</td>
+    <td  width="91%">AJAXified Custom View for all 
+      modules</td>
+  </tr>
+  <tr> 
+    <td  width="9%">17</td>
+    <td  width="91%"> AJAXified Change Owner and Change 
+      Status functions in Leads module</td>
+  </tr>
+  <tr> 
+    <td  width="9%">18</td>
+    <td  width="91%">Security Management User Interface 
+      is completely redesigned </td>
+  </tr>
+  <tr> 
+    <td  width="9%">19</td>
+    <td  width="91%">Advance search functions integrated 
+      only for Leads module</td>
+  </tr>
+  <tr> 
+    <td  width="9%">20</td>
+    <td  width="91%">Security feature enabled for 
+      Reports and Dashbords Home Page</td>
+  </tr>
+  <tr> 
+    <td  width="9%">21</td>
+    <td  width="91%">Global search for all the modules</td>
+  </tr>
+  <tr> 
+    <td  width="9%">22</td>
+    <td  width="91%">MySQL 5.0.19 database support</td>
+  </tr>
+  <tr> 
+    <td  width="9%">23</td>
+    <td  width="91%">Delete handling in security module</td>
+  </tr>
+  </tbody> 
+</table>
+<p>&nbsp; </p>
+<table border="1" width="60%">
+  <tbody>
+  <tr> 
+    <td> 
+      <p><b><a name="Refer_Note"></a>Note: </b></p>
+      <p><b>1. Configuring Web services to update Publicly traded company profiles 
+        (With Ticker symbol in Accounts)</b> In Account module, if ticker symbol 
+        is specified, company profile will be displayed on top of Edit view page. 
+        For this specify the server name, port number, user name and password 
+        has in class_http/class_http.php under &lt;vtiger CRM Home&gt; directory.</p>
+      <p>Line: 166</p>
+      <p>Assign values to the given variables: $server,$port,$user,$pwd</p>
+      <p>2. Shoutbox feature has been phased out.</p>
+    </td>
+  </tr>
+  </tbody>
+</table>
+<hr>
+<h1>vtiger CRM 5.0 Alpha 2: Release Notes</h1>
+<p><b>Date: February 28, 2006</b></p>
+<p>vtiger CRM 5.0 Alpha 2 release is currently in active development phase. The 
+  intent of this release is to showcase to the vtiger community, the
+significant changes made after v5 Alpha release ie changes since Jan
+16, 06' . The noteworthy features in v5 Alpha 2 are Campaign management
+for marketing folks, enhanced predefined dashboards, AJAXified myPortal
+module, intuitive System Administration, integration of Web services to
+update all your public listed customer/company profiles, view
+multidimensional models for product catalog, latest news on company
+updates, redesigned Customer Self-service portal,etc. In addition, we
+are also supporting much awaited <b>MySQL 4.1.x</b> database system. Please note, the Alpha2 will not work with MySQL 4.0.x<br>
+</p>
+<p><b>NOTE:</b> We strongly recommend CRM community NOT to USE <b>vtiger CRM 5 
+  Alpha 2</b> for real-time deployment. In case you are looking for an immediate 
+  CRM solution for your business, please consider using the <b>vtiger CRM 4.2.3</b> 
+  (latest stable version), which can be downloaded from <a href="http://www.vtiger.com"><b>vtiger.com</b></a>.</p>
+<p><b><i>Appeal to Developers, Testers, Analysts, Writers, and end users! </i> 
+  </b></p>
+<p>Jump-start to vtiger Public Discussions and post your valuable suggestions 
+  &amp; comments to help us deliver a world class open source CRM for you in another 
+  few weeks time. It is very simple,</p>
+<p><b><font size="3">Step 1:</font></b> Browse through Live Demo: <a href="http://vtiger.com/demo/alpha2">http://vtiger.com/demo/alpha2</a></p>
+<p><b><font size="3">Step 2:</font></b> Ready with LAMP/WAMP, Download product 
+  from: </p>
+<p><b><font size="3">Step 3:</font></b> Post your suggestions &amp; comments at 
+  vtiger Discussions under : <a href="http://forums.vtiger.com/index.php?c=10"><b>vtiger 
+  CRM 5.x</b></a> category</p>
+<p><b><a name="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Alpha2">Summary</a></li>
+  <li><a href="#Features5_Alpha2">Features</a></li>
+  <li><a href="#BugFixes5_Alpha2">Bug Fixes</a></li>
+  <li><a href="#KI5_Alpha2">Known Issues</a></li>
+</ol>
+<h3><a name="Summary5_Alpha2"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="65%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      
+    <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      
+    <td width="40%"><b><font color="#990000">Item</font></b></td>
+      
+    <td width="55%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      
+    <td width="5%">1
+      </td>
+      
+    <td width="40%">Features</td>
+      
+    <td width="55%"> 
+      <p>27</p>
+      </td>
+    </tr>
+    <tr>
+      
+    <td width="5%">2
+      </td>
+      
+    <td width="40%">Product Size</td>
+      
+    <td width="55%">Source - <b>9.3 MB</b></td>
+    </tr>
+    <tr>
+      
+    <td width="5%">3
+      </td>
+      
+    <td width="40%">Bug Fixes</td>
+      
+    <td width="55%">18</td>
+    </tr>
+    <tr>
+      
+    <td width="5%">4
+      </td>
+      
+    <td width="40%">Database Migration</td>
+    <td width="55%"><b><font color="#ff0000">Not Available/Will Not be Available</font></b></td>
+    </tr>
+    <tr>
+      
+    <td width="5%">5
+      </td>
+      
+    <td width="40%">vtiger CRM - PHP Documentation</td>
+      
+    <td width="55%">Download from vtigercrm project in SF.net. 
+      URL: <a href="http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha2_PhpDocs.zip?download">Click 
+      Here</a></td>
+    </tr>
+    <tr>
+      
+    <td width="5%">6
+      </td>
+      
+    <td width="40%">Product Documentation</td>
+      
+    <td width="55%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
+    </tr>
+    <tr>
+      
+    <td  width="5%">7
+      </td>
+      
+    <td  width="40%">List of files modified between 
+      alpha and alpha 2
+      </td>
+      
+    <td  width="55%">&nbsp;</td>
+    </tr>
+    <tr>
+      
+    <td width="5%">8
+      </td>
+      
+    <td width="40%">Source Code Label</td>
+      
+    <td width="55%">VTIGERCRM_5_ALPHA2</td>
+    </tr>
+    <tr>
+      
+    <td width="5%">9
+      </td>
+      
+    <td width="40%">Known Issues</td>
+      
+    <td width="55%">11</td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5_Alpha2"></a>2. Features</h3>
+<table style="text-align: left; width: 646px; height: 224px;" border="1" cellpadding="2" cellspacing="2">
+  <tbody> 
+  <tr> 
+    <td style="width: 64px; vertical-align: top;" width="69"><b>Sl No.
+      </b></td>
+    <td  width="57"><b>Ticket ID</b></td>
+    <td  width="492"><b>Description</b></td>
+  </tr>
+  <tr> 
+    <td  width="69">1</td>
+    <td  width="57">-</td>
+    <td  width="492">Enhanced Dashboards with more 
+      than 20 charts</td>
+  </tr>
+  <tr> 
+    <td  width="69">2
+    </td>
+    <td  width="57">-</td>
+    <td  width="492">Multiple currency support and 
+      currency conversion through Web service integration</td>
+  </tr>
+  <tr> 
+    <td  width="69">3</td>
+    <td  width="57">-</td>
+    <td  width="492">Campaign Management module for 
+      Marketing automation</td>
+  </tr>
+  <tr> 
+    <td  width="69">4
+    </td>
+    <td  width="57">-</td>
+    <td  width="492">Update some of your publicly 
+      traded accounts details online using Web services integration. Input only 
+      the Ticker Symbol in Account page and update the other real-time data. (<a href="#Refer_Note"><b>Refer 
+      to Note</b></a>)</td>
+  </tr>
+  <tr> 
+    <td  width="69">5
+    </td>
+    <td  width="57">-</td>
+    <td  width="492">Stay-in-touch with your customers' 
+      by uploading their photos.</td>
+  </tr>
+  <tr> 
+    <td  width="69">6
+    </td>
+    <td  width="57">&nbsp;
+    </td>
+    <td  width="492">Analyze your customers business 
+      performance based on their Web traffic.</td>
+  </tr>
+  <tr> 
+    <td  width="69">7
+    </td>
+    <td  width="57">779
+    </td>
+    <td  width="492">Show/Hide HTML Editor (FCKEditior).</td>
+  </tr>
+  <tr> 
+    <td  width="69">8
+    </td>
+    <td  width="57">1000</td>
+    <td  width="492">Send E-mail notification to assigned 
+      users when potential is updated.</td>
+  </tr>
+  <tr> 
+    <td  width="69">9
+    </td>
+    <td  width="57">1006 </td>
+    <td  width="492">Send E-mail notification to other 
+      users.</td>
+  </tr>
+  <tr> 
+    <td  width="69">10
+    </td>
+    <td  width="57">736</td>
+    <td  width="492">Show latest/new leads on a Home 
+      page.</td>
+  </tr>
+  <tr> 
+    <td  width="69">11</td>
+    <td  width="57">-</td>
+    <td  width="492"> Ajax-based multidimensional 
+      product images upload.</td>
+  </tr>
+  <tr> 
+    <td  width="69">12
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Contact Images Scrolling in Contact 
+      ListView</td>
+  </tr>
+  <tr> 
+    <td  width="69">13
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Ajax-based <b>my Portal</b> module 
+      under Tools tab.</td>
+  </tr>
+  <tr> 
+    <td  width="69">14</td>
+    <td  width="57">-</td>
+    <td  width="492">In Home page, display the status 
+      of modified records since last logout for users.</td>
+  </tr>
+  <tr> 
+    <td  width="69">15
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Tag&nbsp;Cloud - Integration 
+      (http://tagcloud.com)</td>
+  </tr>
+  <tr> 
+    <td  width="69">16
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Company-wide Announcements configuration 
+      from Settings.</td>
+  </tr>
+  <tr> 
+    <td  width="69">17
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Thumbnail view on Mouseover for 
+      Contact images in List View.</td>
+  </tr>
+  <tr> 
+    <td  height="21" width="69">18
+    </td>
+    <td  height="21" width="57">-
+    </td>
+    <td  height="21" width="492"><font color="#FF0000">Upload vtiger CRM 
+    Users' photos.(Not Working)</font></td>
+  </tr>
+  <tr> 
+    <td  width="69">19
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492"><font color="#FF0000">Resize the users photos and create 
+    thumbnails.(Not Working)</font></td>
+  </tr>
+  <tr> 
+    <td  width="69">20
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Attach multiple files in single 
+      step.</td>
+  </tr>
+  <tr> 
+    <td  width="69">21
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">FCK editor upgraded to the latest 
+      version (v2.2).</td>
+  </tr>
+  <tr> 
+    <td  width="69">22
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Shout Box integration with vtiger 
+      CRM Home page for vtiger users to chat online.</td>
+  </tr>
+  <tr> 
+    <td  width="69">23
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Tabbed approach of Detail View 
+      information. Sections are spited to <b class="moz-txt-star"><span class="moz-txt-tag"></span>Basic<span class="moz-txt-tag"></span></b> &amp; <b class="moz-txt-star"><span class="moz-txt-tag"></span>More<span class="moz-txt-tag"></span></b> for Leads, 
+      Accounts, Contacts, Potentials &amp; Product modules.</td>
+  </tr>
+  <tr> 
+    <td  height="21" width="69">24
+    </td>
+    <td  height="21" width="57">445
+    </td>
+    <td  height="21" width="492">Addition of multiple 
+      <b>Contacts</b> in Activities, Emails, Potentials, Vendors related lists.</td>
+  </tr>
+  <tr> 
+    <td  width="69">25
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Add New E-mail in Related List 
+      of Leads &amp; Contacts.</td>
+  </tr>
+  <tr> 
+    <td  width="69">26
+    </td>
+    <td  width="57">502</td>
+    <td  width="492"> Address Inheritance for Contacts.</td>
+  </tr>
+  <tr> 
+    <td  width="69">27
+    </td>
+    <td  width="57">-
+    </td>
+    <td  width="492">Ajaxified detail view for all 
+      modules.</td>
+  </tr>
+  <tr> 
+    <td  width="69">28</td>
+    <td  width="57">-</td>
+    <td  width="492">Separate Log Messages for Security 
+      Management.</td>
+  </tr>
+  </tbody> 
+</table>
+<p>&nbsp; </p>
+<table border="1" width="60%">
+  <tbody><tr>
+    <td> 
+      <p><b><a name="Refer_Note"></a>Note: Configuring Web services to update 
+        Publicly traded company profiles (With Ticker symbol in Accounts)</b>
+        
+        In Account module, if ticker symbol is specified, company profile will 
+        be displayed on top of Edit view page. For this specify the server name, 
+        port number, user name and password has in class_http/class_http.php under 
+        &lt;vtiger CRM Home&gt; directory.</p>
+      <p>Line: 166</p>
+      <p>Assign values to the given variables: $server,$port,$user,$pwd</p>
+      <p>&nbsp; </p>
+</td>
+  </tr>
+</tbody></table>
+<h3><a name="Bugs5_Alpha2"></a>3. Bug Fixes</h3>
+<table style="text-align: left; width: 650px; height: 224px;" border="1" cellpadding="2" cellspacing="2">
+  <tbody> 
+  <tr> 
+    <td  width="45"><b>SL No.
+      </b></td>
+    <td  width="62"><b>Ticket ID
+      </b></td>
+    <td  width="515"><b>Description</b></td>
+  </tr>
+  <tr> 
+    <td  width="45">1
+    </td>
+    <td  width="62">1058</td>
+    <td  width="515">While creating customview for 
+      salesorder return action is not redirected to Salesorder Listview.</td>
+  </tr>
+  <tr> 
+    <td  width="45">2
+    </td>
+    <td  width="62">1070</td>
+    <td  width="515">In activity related list,when 
+      I click on "Activity Information" link,activity detailview is not displayed 
+    </td>
+  </tr>
+  <tr> 
+    <td  height="19" width="45">3
+    </td>
+    <td  height="19" width="62">1067</td>
+    <td  height="19" width="515">minute combo box 
+      of duration field is not displaying proper values </td>
+  </tr>
+  <tr> 
+    <td  width="45">4
+    </td>
+    <td  width="62">-</td>
+    <td  width="515">In Popup SalesOrder and PurchaseOrder 
+      "Hacking attempt" exception is thrown.</td>
+  </tr>
+  <tr> 
+    <td  width="45">5
+    </td>
+    <td  width="62">-
+    </td>
+    <td  width="515">Adding New Event in Potential 
+      Relatedlist will not be working</td>
+  </tr>
+  <tr> 
+    <td  width="45">6
+    </td>
+    <td  width="62">-
+    </td>
+    <td  width="515">In Listview when a set of accounts 
+      are selected and 'sendmail' button is clicked, finally in email editview 
+      the addresses are populated both in To and cc field</td>
+  </tr>
+  <tr> 
+    <td  width="45">7
+    </td>
+    <td  width="62">866</td>
+    <td  width="515">Problem with ticket creation</td>
+  </tr>
+  <tr> 
+    <td  width="45">8
+    </td>
+    <td  width="62">898 </td>
+    <td  width="515">Attachment Error Message not 
+      proper</td>
+  </tr>
+  <tr> 
+    <td  width="45">9
+    </td>
+    <td  width="62">913 </td>
+    <td  width="515">parent email id is not selected 
+      when select a single contact or lead from listview-send mail</td>
+  </tr>
+  <tr> 
+    <td  width="45">10
+    </td>
+    <td  width="62">1011</td>
+    <td  width="515">Customer portal issue</td>
+  </tr>
+  <tr> 
+    <td  width="45">11
+    </td>
+    <td  width="62">1034 </td>
+    <td  width="515"> export of accounts</td>
+  </tr>
+  <tr> 
+    <td  width="45">12
+    </td>
+    <td  width="62">1077</td>
+    <td  width="515">can not add email id in 'To' 
+      field of email</td>
+  </tr>
+  <tr> 
+    <td  width="45">13
+    </td>
+    <td  width="62">1088</td>
+    <td  width="515">Ticket notification with wrong 
+      signature</td>
+  </tr>
+  <tr> 
+    <td  width="45">14
+    </td>
+    <td  width="62">-
+    </td>
+    <td  width="515">Create New User, Edit &amp; Detail 
+      View of the My Preference/Settings Smartified
+    </td>
+  </tr>
+  <tr> 
+    <td  width="45">15
+    </td>
+    <td  width="62">-
+    </td>
+    <td  width="515">In create customview 'Choose 
+      columns' the 'Event information' and 'Event Description' does'nt list</td>
+  </tr>
+  <tr> 
+    <td  width="45">16
+    </td>
+    <td  width="62">-
+    </td>
+    <td  width="515">Security Support for Reports
+    </td>
+  </tr>
+  <tr> 
+    <td  width="45">17
+    </td>
+    <td  width="62">-
+    </td>
+    <td  width="515">Activity Reminder Notification 
+      email<span style="font-weight: bold;"> </span></td>
+  </tr>
+  <tr> 
+    <td  width="45">18
+    </td>
+    <td  width="62">964
+    </td>
+    <td  width="515">Activities are not in start date 
+      order and not configurable</td>
+  </tr>
+  </tbody> 
+</table>
+<h3><a name="KI5_Alpha2"></a>4. Known Issues</h3>
+<ul>
+  <li>Added the Product Details Block in the Inventory module of SalesOrder, PurchaseOrder, 
+    Invoice &amp; Quotes. But the functionality of the same is to be worked upon.. 
+    This has to be done for create, edit &amp; detail view.</li>
+  <li>Event created from calendar will not be displayed in the calendar</li>
+  <li>Some of the features in the Inventory management related modules will not 
+    function properly. The Smarty templates are not applied fully.</li>
+  <li>In this release only one theme (blue) is supported. You cannot use the other 
+    bundled themes.</li>
+  <li>Some of the Related List View functions may not work properly.</li>
+  <li>In the Basic search, Search by Alphabets, and some of the field Search like 
+    Quote ID, Notes, Related To will not work.</li>
+  <li>Advance Search will not work in all the modules.</li>
+  <li>Calendar functionality is not functional, we are providing only the UI.</li>
+  <li>In home page pipeline and calendar will not be displayed.</li>
+  <li>Reports are not fully functional. You may experience some errors while working 
+    with reports.</li>
+  <li>Quick create and global search are not supported.</li>
+</ul>
+<h3><a name="v5atov5a2"></a>5. List of Files Changed from V 5 alpha to V 5 alpha 
+  2</h3>
+<ul>
+  <li>List of Changed files</li>
+  <li>Files Moved to Attic&nbsp; </li>
+</ul>
+<hr>
+<h1>vtiger CRM 5.0 Alpha 1: Release Notes</h1>
+<p><b>Date: January 16, 2006</b></p>
+<p>vtiger CRM 5.0 Alpha release is only for the testing purpose. The
+complete front-end architecture has been redesigned using the Smarty
+Template Engine (<a href="http://smarty.php.net/download.php" target="_blank">http://www.smarty.php.net/download.php</a> ) and some
+of the features and bugs fixed in earlier versions may not work. Please
+feel free to report bugs at:</p>
+<p><a href="http://bugs.vtiger.com"><b>http://bugs.vtiger.com</b></a></p>
+<p><b><a name="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary5_Alpha2">Summary</a></li>
+  <li><a href="#Features5_Alpha2">Features</a></li>
+  <li><a href="#BugFixes5_Alpha2">Bug Fixes</a></li>
+  <li><a href="#KI5_Alpha2">Known Issues</a></li>
+</ol>
+<h3><a name="Summary5_Alpha"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="65%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="31%"><b><font color="#990000">Item</font></b></td>
+      <td width="64%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1
+      </td>
+      <td width="31%">Features</td>
+      <td width="64%">
+      <p>3
+      </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">2
+      </td>
+      <td width="31%">Product Size</td>
+      <td width="64%">Windows - <b>27.5 MB</b>
+Linux - <b>39 MB</b>
+Source - <b>9.8 MB</b></td>
+    </tr>
+    <tr>
+      <td width="5%">3
+      </td>
+      <td width="31%">Bug Fixes</td>
+      <td width="64%">103</td>
+    </tr>
+    <tr>
+      <td width="5%">4
+      </td>
+      <td width="31%">Code Contributions</td>
+      <td width="64%"><a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions">http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions</a>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">5
+      </td>
+      <td width="31%">Database Migration
+      </td>
+      <td width="64%"><b>Not Available</b></td>
+    </tr>
+    <tr>
+      <td width="5%">6
+      </td>
+      <td width="31%">vtiger CRM - PHP Documentation</td>
+      <td width="64%">Download from vtigercrm project in SF.net. 
+URL: <a href="http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha_PhpDocs.zip?download">http://prdownloads.sourceforge.net/vtigercrmvtiger_CRM_5_Alpha_PhpDocs.zip?download</a></td>
+    </tr>
+    <tr>
+      <td width="5%">7</td>
+      <td width="31%">Product Documentation</td>
+      <td width="64%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
+    </tr>
+    <tr>
+      <td width="5%">8</td>
+      <td width="31%">Source Code Label</td>
+      <td width="64%">VTIGERCRM_5_ALPHA</td>
+    </tr>
+    <tr>
+      <td width="5%">9
+      </td>
+      <td width="31%">Known Issues</td>
+      <td width="64%">10</td>
+    </tr>
+  </tbody>
+</table>
+<h3><a name="Features5_Alpha"></a>2. Features</h3>
+<ul>
+  <li>UI interface has been redesigned based on Smarty template engine.</li>
+  <li>Bug fixes based on the Operation Consolidation list.</li>
+  <li>Security Management enhancements. For more detail refer to <a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_5_Test_Cases">vtigercrm5_alpha_Security.html</a></li>
+</ul>
+<h3><a name="Bugs5_Alpha"></a>3. Bug Fixes</h3>
+<p>Refer to the following links:</p>
+<ul>
+  <li><a href="#Bugs3">v.4.5 Dev 3 Bug Fixes</a></li>
+  <li><a href="#Bugs2">v4.5 Dev 2 Bug FIxes</a></li>
+  <li><a href="#Bugs1">v4.5 Dev 1Bug Fixes</a></li>
+</ul>
+<h3><a name="KI5_Alpha"></a>4. Known Issues</h3>
+<ul>
+  <li>Some of the features in the Inventory management related modules
+will not function properly. The Smarty templates are not applied fully.</li>
+  <li>In this release only one theme (blue) is supported. You cannot
+use the other bundled themes.</li>
+  <li>Some of the Related List View functions may not work properly.</li>
+  <li>In the Basic search, Search by Alphabets, and some of the field
+Search like Quote ID, Notes, Related To will not work.</li>
+  <li>Advance Search will not work in all the modules.</li>
+  <li>Calendar functionality is not functional, we are providing only
+the UI.</li>
+  <li>In home page pipeline and calendar will not be displayed.</li>
+  <li>Reports are not fully functional. You may experience some errors
+while working with reports.</li>
+  <li>Some of the Popup window may not function properly.</li>
+  <li>Quick create and global search are not supported.</li>
+  <li>Problem in Search UI with IE browser</li>
+</ul>
+<hr>
+<h1>vtiger CRM 4.5 : Development Version 3 - Release Notes</h1>
+<p><b>Date: November 23, 2005</b></p>
+<p><b><a name="TOC3"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary3">Summary</a></li>
+  <li><a href="#Features3">Features</a></li>
+  <li><a href="#Bugs3">Bug Fixes</a></li>
+  <li><a href="#KI3">Known Issues</a></li>
+</ol>
+<h3><a name="Summary5_Alpha"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="65%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="5%"><b><font color="#990000">S. No</font></b></td>
+      <td width="31%"><b><font color="#990000">Item</font></b></td>
+      <td width="64%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1
+      </td>
+      <td width="31%">Features</td>
+      <td width="64%">
+      <p> </p>
+8
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">2
+      </td>
+      <td width="31%">Product Size</td>
+      <td width="64%">Windows - 30MB
+Linux - 42MB</td>
+    </tr>
+    <tr>
+      <td width="5%">3
+      </td>
+      <td width="31%">Bug Fixes</td>
+      <td width="64%">29</td>
+    </tr>
+    <tr>
+      <td width="5%">4
+      </td>
+      <td width="31%">Code Contributions</td>
+      <td width="64%"><a href="http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions">http://www.vtiger.com/wiki/index.php/Vtiger_CRM_Code_Contributions</a>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">5
+      </td>
+      <td width="31%">Database Migration
+      </td>
+      <td width="64%">Not Available.&nbsp; </td>
+    </tr>
+    <tr>
+      <td width="5%">6
+      </td>
+      <td width="31%">vtiger CRM - PHP Documentation</td>
+      <td width="64%">Bundled with the Product (&lt;vtiger CRM
+Home&gt;/vtigerCRM_docs directory)</td>
+    </tr>
+    <tr>
+      <td width="5%">7</td>
+      <td width="31%">Product Documentation</td>
+      <td width="64%">Available at the <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
+    </tr>
+    <tr>
+      <td width="5%">8</td>
+      <td width="31%">Source Code Label</td>
+      <td width="64%">VTIGERCRM_4_5_M3</td>
+    </tr>
+    <tr>
+      <td width="5%">9
+      </td>
+      <td width="31%">Known Issues</td>
+      <td width="64%">4</td>
+    </tr>
+    <tr>
+      <td width="5%">10
+      </td>
+      <td width="31%">List of Files Changed from V 4.5 Development 2 to
+V 4.5 Development 3</td>
+      <td width="64%">110</td>
+    </tr>
+    <tr>
+      <td width="5%">11</td>
+      <td width="31%">List of Files Changed from V 4.2 Development 1 to
+V 4.5 Development 3</td>
+      <td width="64%">277</td>
+    </tr>
+    <tr>
+      <td width="5%">12</td>
+      <td width="31%">List of Files Changed from V 4.2 Patch 2 to V 4.5
+Development 3</td>
+      <td width="64%">190</td>
+    </tr>
+  </tbody>
+</table>
+<p align="right"><b><a href="#TOC3">Back
+to Top</a></b></p>
+<h3><a name="Features3"></a>2. Features</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="80%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="56"><b><font color="#990000">S. No </font></b></td>
+      <td ><b><font color="#990000">Ticket
+ID
+      </font></b></td>
+      <td width="764"><b><font color="#990000">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td >
+      <br>
+</td>
+      <td>
+      <p> Progress bar display during the vtiger CRM database creation
+in Installation wizard. </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td >
+      <br>
+</td>
+      <td>Default Organization Sharing in Security is modified
+according to the new Security Schema. Migration support is also
+provided for this feature.</td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td >588
+      </td>
+      <td>Suppress sending mail to account when a ticket is submitted.</td>
+    </tr>
+    <tr>
+      <td width="56">4</td>
+      <td >
+      <br>
+</td>
+      <td>Product quantity in stock is automatically updated when
+the&nbsp; goods specified in the Purchase Order are received.
+      
+      <b>Note:</b> To update the product quantity in stock, users have
+to change the Status drop-down list value to 'Received Shipment'
+immediately after receiving the shipment.</td>
+    </tr>
+    <tr>
+      <td width="56">5</td>
+      <td ><br>
+      </td>
+      <td>In Office Plug-in, fields from multiple modules (Accounts,
+Contacts, Leads, HelpDesk, and Users) can be merged while creating mail
+merge templates.</td>
+    </tr>
+    <tr>
+      <td width="56">6</td>
+      <td ><br>
+      </td>
+      <td>In vtiger CRM create mail merge documents by merging fields
+from multiple modules (Accounts,Contacts, Users)</td>
+    </tr>
+    <tr>
+      <td width="56">7</td>
+      <td ><br>
+      </td>
+      <td>Provided support for User field in mail merge documents</td>
+    </tr>
+    <tr>
+      <td width="56">8</td>
+      <td ><br>
+      </td>
+      <td>Mail merge all the records from a module by selecting "Select
+All" checkbox in ListView of Accounts, Contacts, Leads, and HelpDesk
+modules.</td>
+    </tr>
+  </tbody>
+</table>
+<div align="right">
+<p><b><a href="#TOC">Back to Top</a></b> </p>
+</div>
+<h3><a name="Size3"></a>3. Product Size</h3>
+<table style="text-align: left; width: 80%;" border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td><b><font color="#990000">Distribution</font></b></td>
+      <td><font color="#990000"><b>Version 4.2 Build Size </b></font></td>
+      <td><b><font color="#990000">Version 4.5 Milestone 3 Build Size</font></b></td>
+    </tr>
+    <tr>
+      <td>Windows (EXE)</td>
+      <td>42 MB
+      <p> </p>
+      </td>
+      <td><b>30 MB</b></td>
+    </tr>
+    <tr>
+      <td>Linux (BIN)</td>
+      <td>39 MB
+      <p> </p>
+      </td>
+      <td><b>42 MB</b></td>
+    </tr>
+  </tbody>
+</table>
+<div align="right">
+<p><b><a href="#TOC3">Back to Top</a></b> </p>
+</div>
+<h3><a name="Bugs3"></a>4. Bug Fixes</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="80%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="56"><b><font color="#990000">S. No </font></b></td>
+      <td width="110"><b><font color="#990000">Bug ID</font></b></td>
+      <td width="764"><b><font color="#990000">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td>539</td>
+      <td>In the Potential related list view the currency value should
+be aligned right, and the currency symbol should be shown in the title
+instead of in front of every value. </td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td>640</td>
+      <td>&nbsp;Issue in Pop-up New link</td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td>665 <br>
+      </td>
+      <td>&nbsp;Check-all checkbox checks wrong checkboxes</td>
+    </tr>
+    <tr>
+      <td width="56">4</td>
+      <td>761</td>
+      <td>&nbsp;Added dash after Potential Name when converting from
+Lead</td>
+    </tr>
+    <tr>
+      <td width="56">5</td>
+      <td>644</td>
+      <td>&nbsp;Start/End date options in Custom View</td>
+    </tr>
+    <tr>
+      <td width="56">6</td>
+      <td>643</td>
+      <td>Issue in Group Activities display in Home page</td>
+    </tr>
+    <tr>
+      <td width="56">7</td>
+      <td>689</td>
+      <td>utils.php call time pass reference error </td>
+    </tr>
+    <tr>
+      <td width="56">8</td>
+      <td>770</td>
+      <td>Checkbox fields are saved with null instead of 0 value.</td>
+    </tr>
+    <tr>
+      <td width="56">9</td>
+      <td>570</td>
+      <td>Missing information when converting Lead to Contact</td>
+    </tr>
+    <tr>
+      <td width="56">10</td>
+      <td>754</td>
+      <td>Date Format on Quotes, Invoices and Orders</td>
+    </tr>
+    <tr>
+      <td width="56">11</td>
+      <td>511</td>
+      <td>Custom view-&nbsp; if lastname is selected the first
+name and the last name are displayed</td>
+    </tr>
+    <tr>
+      <td width="56">12</td>
+      <td>645</td>
+      <td>Html tags are not shown properly in activity description</td>
+    </tr>
+    <tr>
+      <td width="56">13</td>
+      <td>463</td>
+      <td>Don't show "My group allocation" section if no group is
+defined</td>
+    </tr>
+    <tr>
+      <td width="56">14</td>
+      <td>849</td>
+      <td>user belonging to more than 2 group .issue</td>
+    </tr>
+    <tr>
+      <td width="56">15</td>
+      <td>820</td>
+      <td>Product image editing error</td>
+    </tr>
+    <tr>
+      <td width="56">16</td>
+      <td>831</td>
+      <td>custom view error</td>
+    </tr>
+    <tr>
+      <td width="56">17</td>
+      <td>695</td>
+      <td>call time pass reference is corrected</td>
+    </tr>
+    <tr>
+      <td width="56">18</td>
+      <td>484</td>
+      <td>Tickets assigned to a group error </td>
+    </tr>
+    <tr>
+      <td width="56">19</td>
+      <td>851</td>
+      <td>Wrong picklist value in edit view</td>
+    </tr>
+    <tr>
+      <td width="56">20</td>
+      <td>&nbsp;</td>
+      <td>Access to vtigercrm.log files restricted -
+vulnerability fix.</td>
+    </tr>
+    <tr>
+      <td >21<br>
+      </td>
+      <td >833<br>
+      </td>
+      <td >test mail can be sent to test
+the e-mail function on configuring the mail server </td>
+    </tr>
+    <tr>
+      <td >22<br>
+      </td>
+      <td >718<br>
+      </td>
+      <td >Signatures are double-spaced in
+e-mails </td>
+    </tr>
+    <tr>
+      <td >23<br>
+      </td>
+      <td >453<br>
+      </td>
+      <td >issue in vendor search </td>
+    </tr>
+    <tr>
+      <td >24<br>
+      </td>
+      <td >564<br>
+      </td>
+      <td >Tickets assigned to Groups </td>
+    </tr>
+    <tr>
+      <td >25<br>
+      </td>
+      <td >195<br>
+      </td>
+      <td >Email - admin mail is empty,
+then cc in email is not going </td>
+    </tr>
+    <tr>
+      <td >26<br>
+      </td>
+      <td >710<br>
+      </td>
+      <td >activity notifications -&gt;
+display further information </td>
+    </tr>
+    <tr>
+      <td >27<br>
+      </td>
+      <td >504 </td>
+      <td >New Contact -Account addressNew
+Contact -Account address</td>
+    </tr>
+    <tr>
+      <td >28</td>
+      <td >259</td>
+      <td >Office Integration account name
+in address block</td>
+    </tr>
+    <tr>
+      <td >29</td>
+      <td >378</td>
+      <td >Office Plugin field selection</td>
+    </tr>
+  </tbody>
+</table>
+<div align="right">
+<p><b><a href="#TOC3">Back to Top</a></b><br>
+</p>
+</div>
+<h3>6. Known Issues</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="80%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="56"><b><font color="#990000">S. No </font></b></td>
+      <td width="764"><b><font color="#990000">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td>
+      <p>In user creation page, by default the <b>Organization</b> is
+displayed in <b>Role</b> drop-down list field but there is no action
+associated with the <b>Organization</b> value. Kindly select roles
+other than <b>Organization</b> in the drop-down list.</p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td width="764">
+      <p>While sending mass e-mail from Leads/Contact/Accounts,
+validation check will not be performed for the <b>To</b> field.</p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td width="764"> In Block rearrangement feature, If a field is
+moved to an unused or new block, the field will not be displayed.</td>
+    </tr>
+    <tr>
+      <td width="56">4</td>
+      <td width="764"> In E-mail ListView, if mail is sent to multiple
+recipients the entries will be displayed twice.</td>
+    </tr>
+  </tbody>
+</table>
+<p>&nbsp;</p>
+<hr>
+<br>
+<h1>vtiger CRM 4.5 : Development Version 2 - Release Notes</h1>
+<p><b>Date: November 16, 2005</b></p>
+<p><b><a name="TOC"></a>Table of Contents</b></p>
+<ol>
+  <li><a href="#Summary2">Summary</a></li>
+  <li><a href="#Features2">Features</a></li>
+  <li><a href="#Size">Product Size</a></li>
+  <li><a href="#Bugs2">Bug Fixes</a></li>
+  <li><a href="#DBMigration2">Database Migration</a></li>
+  <li><a href="#KI2">Known Issues</a></li>
+  <li><a href="#v451tov452">List of Files Changed from V 4.5
+Development 1 to V 4.5 Development 2</a></li>
+  <li><a href="#v42p2tov452">List of Files Changed from V 4.2 Patch 2
+to V 4.5 Development 2</a></li>
+</ol>
+<h3><a name="Summary2"></a>1. Summary</h3>
+<table border="1" cellpadding="5" cellspacing="0" width="50%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="10%"><b><font color="#990000">S. No</font></b></td>
+      <td width="53%"><b><font color="#990000">Item</font></b></td>
+      <td width="18%"><b><font color="#990000">Status</font></b></td>
+    </tr>
+    <tr>
+      <td width="10%">1</td>
+      <td width="53%">Features</td>
+      <td width="18%">3
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="10%">2</td>
+      <td width="53%">Product Size</td>
+      <td width="18%">Windows - 31MB<br>
+Linux - 41MB</td>
+    </tr>
+    <tr>
+      <td width="10%">3</td>
+      <td width="53%">Bug Fixes</td>
+      <td width="18%">24</td>
+    </tr>
+    <tr>
+      <td width="10%">4</td>
+      <td width="53%">Code Contributions</td>
+      <td width="18%">Nil</td>
+    </tr>
+    <tr>
+      <td width="10%">5</td>
+      <td width="53%">vtiger CRM - PHP Documentation</td>
+      <td width="18%">Bundled with Product</td>
+    </tr>
+    <tr>
+      <td width="10%">6</td>
+      <td width="53%">Product Documentation</td>
+      <td width="18%">Available at <a href="http://www.vtiger.com/wiki/index.php/Main_Page">Wiki</a></td>
+    </tr>
+    <tr>
+      <td width="10%">7</td>
+      <td width="53%">Source Code Label</td>
+      <td width="18%">VTIGERCRM_4_5_M2</td>
+    </tr>
+    <tr>
+      <td width="10%">8</td>
+      <td width="53%">List of Files Changed from V 4.5 Development 1 to
+V 4.5 Development 2</td>
+      <td width="18%">137</td>
+    </tr>
+    <tr>
+      <td width="10%">9</td>
+      <td width="53%">List of Files Changed from V 4.2 Patch 2 to V 4.5
+Development 2</td>
+      <td width="18%">279</td>
+    </tr>
+  </tbody>
+</table>
+<p align="right"><b><a href="#TOC">Back to Top</a></b></p>
+<h3><a name="Features2"></a>2. Features</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="80%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="56"><b><font color="#990000">S. No </font></b></td>
+      <td width="764"><b><font color="#990000">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td>
+      <p>Profile management module is revamped completely</p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td width="764">
+      <p>Display all the records that are assigned to users dynamically
+in a scrollable format. </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td width="764">Documentation for vtiger CRM - PHP libraries is
+bundled with the product. (Present under vtigerCRM_docs directory)</td>
+    </tr>
+  </tbody>
+</table>
+<div align="right">
+<p><b><a href="#TOC">Back to Top</a></b>
+</p>
+</div>
+<h3><a name="Size"></a>3. Product Size</h3>
+<table style="text-align: left; width: 80%;" border="1" cellpadding="2" cellspacing="2">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td><b><font color="#990000">Distribution</font></b></td>
+      <td><font color="#990000"><b>Version 4.2 Build Size </b></font></td>
+      <td><b><font color="#990000">Version 4.5 Milestone 2 Build Size</font></b></td>
+    </tr>
+    <tr>
+      <td>Windows (EXE)</td>
+      <td>42 MB
+      <p> </p>
+      </td>
+      <td><b>31 MB</b>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td>Linux (BIN)</td>
+      <td>39 MB
+      <p> </p>
+      </td>
+      <td><b>41 MB</b></td>
+    </tr>
+  </tbody>
+</table>
+<div align="right">
+<p><b><a href="#TOC">Back to Top</a></b>
+</p>
+</div>
+<h3><a name="Bugs2"></a>4. Bug Fixes</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="80%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="56"><b><font color="#990000">S. No </font></b></td>
+      <td width="110"><b><font color="#990000">Bug ID</font></b></td>
+      <td width="764"><b><font color="#990000">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td>810</td>
+      <td>
+      <p>The close link in activities custom view returns to the
+default view</p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">
+      <p>E-mail functions are restructured in the following mailing
+functions:</p>
+      <ul>
+        <li>Send E-mail to assigned to user, Lead, Contact and Account
+in Emails module</li>
+        <li>Send notification to the assigned to user in Activities
+module</li>
+        <li>Send Ticket details to the assigned to user and Parent in
+HelpDesk</li>
+        <li>Send customer portal login details to the customer in
+Contact module</li>
+        <li>Send mail about the portal ticket creation to the module
+owner and the customer itself in Customer Portal</li>
+      </ul>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td width="110">768</td>
+      <td width="764">Lead Street text box restricted to 30 chars</td>
+    </tr>
+    <tr>
+      <td width="56">4</td>
+      <td width="110">486</td>
+      <td width="764">Not Held Meetings shown in Activities instead of
+History</td>
+    </tr>
+    <tr>
+      <td width="56">5</td>
+      <td width="110">771</td>
+      <td width="764">Events with status "Not Held" appear still in
+Activities instead of the history table</td>
+    </tr>
+    <tr>
+      <td width="56">6</td>
+      <td width="110">682</td>
+      <td width="764">Creating an event with status planned for past
+time</td>
+    </tr>
+    <tr>
+      <td width="56">7</td>
+      <td width="110">629</td>
+      <td width="764">Select End date as today's date</td>
+    </tr>
+    <tr>
+      <td width="56">8</td>
+      <td width="110">635</td>
+      <td width="764">End date need not be mandatory if there start
+date is mandatory</td>
+    </tr>
+    <tr>
+      <td width="56">9</td>
+      <td width="110">411</td>
+      <td width="764">New Event Creation</td>
+    </tr>
+    <tr>
+      <td width="56">10</td>
+      <td width="110">809</td>
+      <td width="764">Designation Should be converted into Title field
+of Contact</td>
+    </tr>
+    <tr>
+      <td width="56">11</td>
+      <td width="110">725</td>
+      <td width="764">Field "Designation" does not seem to get carried
+across to either the Account, Potential nor Contact entries.</td>
+    </tr>
+    <tr>
+      <td width="56">12</td>
+      <td width="110">777</td>
+      <td width="764">Converting a lead does not allow two decimal
+places</td>
+    </tr>
+    <tr>
+      <td width="56">13</td>
+      <td width="110">700</td>
+      <td width="764">Events-&gt;Status is not displayed</td>
+    </tr>
+    <tr>
+      <td width="56">14</td>
+      <td width="110">446</td>
+      <td width="764">displaying product id instead of product name in
+ticket list view</td>
+    </tr>
+    <tr>
+      <td width="56">15</td>
+      <td width="110">112</td>
+      <td width="764">Generated Reports topic change</td>
+    </tr>
+    <tr>
+      <td width="56">16</td>
+      <td width="110">359</td>
+      <td width="764">Spelling Error in Reports</td>
+    </tr>
+    <tr>
+      <td width="56">17</td>
+      <td width="110">369</td>
+      <td width="764">'Translation issue'</td>
+    </tr>
+    <tr>
+      <td width="56">18</td>
+      <td width="110">398</td>
+      <td width="764">quotation custom view</td>
+    </tr>
+    <tr>
+      <td width="56">19</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">Issue - Columns to Total in Reports</td>
+    </tr>
+    <tr>
+      <td width="56">20</td>
+      <td width="110">817</td>
+      <td width="764">table names PortalInfo and CustomerDetails should
+be changed in lower case</td>
+    </tr>
+    <tr>
+      <td width="56">21</td>
+      <td width="110">818</td>
+      <td width="764">Added module in portal and the tickets should be
+assigned to the owner of the module</td>
+    </tr>
+    <tr>
+      <td width="56">22</td>
+      <td width="110">819</td>
+      <td width="764">after saving the ticket control goes to list of
+tickets instead of new ticket's detail view(in customerportal)</td>
+    </tr>
+    <tr>
+      <td width="56">23</td>
+      <td width="110">824</td>
+      <td width="764">E-mail title is missing in E-mail DetailView</td>
+    </tr>
+    <tr>
+      <td>24
+      <p> </p>
+      </td>
+      <td>
+      <p> </p>
+      <br>
+      </td>
+      <td>nusoap version upgraded to 0.7.1
+      <p> </p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div align="right">
+<p>&nbsp;
+</p>
+</div>
+<div align="right">
+<p><b><a href="#TOC">Back to Top</a></b>
+</p>
+</div>
+<h3><a name="DBMigration2"></a>5. Database Migration</h3>
+<p>Database migration support is provided for the following versions:
+</p>
+<p></p>
+<ul>
+  <li>From vtigerCRM 4.2 Patch2 to vtigerCRM Developer Version 2</li>
+  <li> From vtigerCRM Developer Version 1 to vtigerCRM Developer
+Version 2</li>
+</ul>
+<p><b>Database Migration Procedure:</b></p>
+<ol>
+  <li>Download the attached Migration zip and extract to the
+&lt;vtigerCRM home&gt; directory (Migration42p2_to_45dev2.zip)</li>
+  <li> Access the <b>dev_index.php</b> file through the browser.</li>
+  <li> Select the versions to migrate.<br>
+  </li>
+</ol>
+<div align="right">
+<p><b><a href="#TOC">Back to Top</a></b>
+</p>
+</div>
+<h3><a name="KI2"></a>6. Known Issues</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="80%">
+  <tbody>
+    <tr bgcolor="#ccccff">
+      <td width="56"><b><font color="#990000">S. No </font></b></td>
+      <td width="764"><b><font color="#990000">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td>
+      <p>In user creation page, by default the <b>Organization</b> is
+displayed in <b>Role</b> drop-down list field but there is no action
+associated with the <b>Organization</b> value. Kindly select roles
+other than <b>Organization</b> in the drop-down list.</p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td width="764">
+      <p>While sending mass e-mail from Leads/Contact/Accounts,
+validation check will not be performed for the <b>To</b> field.</p>
+      </td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td width="764"> In Block rearrangement feature, If a field is
+moved to an unused or new block, the field will not be displayed.</td>
+    </tr>
+    <tr>
+      <td width="56">4</td>
+      <td width="764"> In E-mail ListView, if mail is sent to multiple
+recipients the entries will be displayed twice.</td>
+    </tr>
+  </tbody>
+</table>
+<hr>
+<h1>vtiger CRM 4.5 - Development Version 1 Release Notes
+<p>Date: November 9, 2005</p>
+</h1>
+<p><b>Summary:</b></p>
+<table border="1" cellpadding="5" cellspacing="0" width="50%">
+  <tbody>
+    <tr>
+      <td width="20%"><b>S. No</b></td>
+      <td width="29%"><b>Item</b></td>
+      <td width="11%"><b>Total</b></td>
+      <td width="20%"><b>Remarks</b></td>
+    </tr>
+    <tr>
+      <td width="20%">1</td>
+      <td width="29%">Features</td>
+      <td width="11%">1</td>
+      <td width="20%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="20%">2</td>
+      <td width="29%">Bug Fixes</td>
+      <td width="11%">50</td>
+      <td width="20%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="20%">3</td>
+      <td width="29%">Code Contributions</td>
+      <td width="11%">64</td>
+      <td width="20%">&nbsp;</td>
+    </tr>
+  </tbody>
+</table>
+<p>Henceforth the Emails Send/Saved will be treated like mails in Send
+items, of our regular mail client, if such emails, need to be resent,
+the recipients to be selected again.</p>
+<h3>1. Features</h3>
+<p>Added BCC field in Emails</p>
+<h3><a name="Bugs1"></a>2. Bug Fixes</h3>
+<table border="1" cellpadding="4" cellspacing="0" width="100%">
+  <tbody>
+    <tr bgcolor="#990000">
+      <td width="56"><b><font color="#ffffff">S. No </font></b></td>
+      <td width="110"><b><font color="#ffffff">Bug ID</font></b></td>
+      <td width="764"><b><font color="#ffffff">Subject</font></b></td>
+    </tr>
+    <tr>
+      <td width="56">1</td>
+      <td width="110">638</td>
+      <td width="764">Priority for Events</td>
+    </tr>
+    <tr>
+      <td width="56">2</td>
+      <td width="110">157</td>
+      <td width="764">Inventory Mgmt Related List Show All Details</td>
+    </tr>
+    <tr>
+      <td width="56">3</td>
+      <td width="110">433</td>
+      <td width="764">Search option missing in Popup Purchase order</td>
+    </tr>
+    <tr>
+      <td width="56">4</td>
+      <td width="110">454</td>
+      <td width="764">Issue in creating new note from product detail
+view</td>
+    </tr>
+    <tr>
+      <td width="56">5</td>
+      <td width="110">384</td>
+      <td width="764">Activities not saving?</td>
+    </tr>
+    <tr>
+      <td width="56">6</td>
+      <td width="110">233</td>
+      <td width="764">Bug in invoice</td>
+    </tr>
+    <tr>
+      <td width="56">7</td>
+      <td width="110">220</td>
+      <td width="764">Some Bug in Vtiger 4.2 - Invoice</td>
+    </tr>
+    <tr>
+      <td width="56">8</td>
+      <td width="110">373</td>
+      <td width="764">No Title for description</td>
+    </tr>
+    <tr>
+      <td width="56">9</td>
+      <td width="110">256</td>
+      <td width="764">name in account's address information</td>
+    </tr>
+    <tr>
+      <td width="56">10</td>
+      <td width="110">693</td>
+      <td width="764">Select Contact option Not Available</td>
+    </tr>
+    <tr>
+      <td width="56">11</td>
+      <td width="110">205</td>
+      <td width="764">spelling error and There doesn't seem to be a way
+to add a first nam</td>
+    </tr>
+    <tr>
+      <td width="56">12</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">Thunderbird plugin dialog has to be closed twice </td>
+    </tr>
+    <tr>
+      <td width="56">13</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">ThunderBird - window problem </td>
+    </tr>
+    <tr>
+      <td width="56">14</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">print option should open new page </td>
+    </tr>
+    <tr>
+      <td width="56">15</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">email,phone fields are not validated in contacts </td>
+    </tr>
+    <tr>
+      <td width="56">16</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">Problems with Thunderbird plugin </td>
+    </tr>
+    <tr>
+      <td width="56">17</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">Thunderbird Plugin: Error importing Contacts </td>
+    </tr>
+    <tr>
+      <td width="56">18</td>
+      <td width="110">&nbsp;</td>
+      <td width="764"> Thunderbird Extn count doesn't match </td>
+    </tr>
+    <tr>
+      <td width="56">19</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">Custom view - Mandatory check </td>
+    </tr>
+    <tr>
+      <td width="56">20</td>
+      <td width="110">&nbsp;</td>
+      <td width="764">Product Custom view</td>
+    </tr>
+    <tr>
+      <td width="56">21</td>
+      <td width="110">744</td>
+      <td width="764">Terms &amp; Conditions in Company Details as well
+as in Edit View</td>
+    </tr>
+    <tr>
+      <td width="56">22</td>
+      <td width="110">692</td>
+      <td width="764">While exporting SalesOrder i got New column after
+Quote Name.</td>
+    </tr>
+    <tr>
+      <td width="56">23</td>
+      <td width="110">688</td>
+      <td width="764">while generating reports if we select reports an
+error message is displayed this issue has been fixed</td>
+    </tr>
+    <tr>
+      <td width="56">24</td>
+      <td width="110">686</td>
+      <td width="764">after integrating the code contributed by raju
+the lead names are not displayed in the popup in email module</td>
+    </tr>
+    <tr>
+      <td width="56">25</td>
+      <td width="110">&nbsp;</td>
+      <td width="764"> Having status for events in Customview of
+Activities-Customer request</td>
+    </tr>
+    <tr>
+      <td width="56">26</td>
+      <td width="110">284</td>
+      <td width="764">In populating the Demo data of leads,giving the
+companyname</td>
+    </tr>
+    <tr>
+      <td width="56">27</td>
+      <td width="110">289</td>
+      <td width="764">In populating Demo data, giving the value for
+assigned to</td>
+    </tr>
+    <tr>
+      <td width="56">28</td>
+      <td width="110">151</td>
+      <td width="764">Attachment contains footer of vitgerCRM and
+javascript (I attached license_agreement.txt of vtigercrm, but i got in
+other name and not in .txt&nbsp;format and content is mixed with
+vtigerCRM Footer)</td>
+    </tr>
+    <tr>
+      <td width="56">29</td>
+      <td width="110">194</td>
+      <td width="764">Email Email,Webmail Tab is comming for all pages
+in Email Module (While Editing email,still the listview tab
+(Emails,Webmails) is&nbsp;comming. It should be like Email : ""Subject"")</td>
+    </tr>
+    <tr>
+      <td width="56">30</td>
+      <td width="110">440</td>
+      <td width="764">issue while creating new contact&amp;account
+through add business card</td>
+    </tr>
+    <tr>
+      <td width="56">31</td>
+      <td width="110">690</td>
+      <td width="764">Problem in Close Date and Last modified of the
+list of Sales Stage History of the Potentials</td>
+    </tr>
+    <tr>
+      <td width="56">32</td>
+      <td width="110">694</td>
+      <td width="764">Date showing is incorrect in add business card
+(when add new business card, there is date for appoinment where the
+showing date is not in&nbsp;current user date format</td>
+    </tr>
+    <tr>
+      <td width="56">33</td>
+      <td width="110">158</td>
+      <td width="764">Pick list Custom field issue</td>
+    </tr>
+    <tr>
+      <td width="56">34</td>
+      <td width="110">370</td>
+      <td width="764">duplicate entry in list view</td>
+    </tr>
+    <tr>
+      <td width="56">35</td>
+      <td width="110">288</td>
+      <td width="764">Issue in Inventory Popups</td>
+    </tr>
+    <tr>
+      <td width="56">36</td>
+      <td width="110">347</td>
+      <td width="764">Error Message</td>
+    </tr>
+    <tr>
+      <td width="56">37</td>
+      <td width="110">358</td>
+      <td width="764">Filtering by Headers in Leads</td>
+    </tr>
+    <tr>
+      <td width="56">38</td>
+      <td width="110">342</td>
+      <td width="764">New users can'&acute;t login</td>
+    </tr>
+    <tr>
+      <td width="56">39</td>
+      <td width="110">360</td>
+      <td width="764">System Configuration</td>
+    </tr>
+    <tr>
+      <td width="56">40</td>
+      <td width="110">145</td>
+      <td width="764">related module is empty</td>
+    </tr>
+    <tr>
+      <td width="56">41</td>
+      <td width="110">179</td>
+      <td width="764">Potential-activities</td>
+    </tr>
+    <tr>
+      <td width="56">42</td>
+      <td width="110">203</td>
+      <td width="764">Inventory RL</td>
+    </tr>
+    <tr>
+      <td width="56">43</td>
+      <td width="110">211</td>
+      <td width="764">There is no option to create a Potential for a
+contact</td>
+    </tr>
+    <tr>
+      <td width="56">44</td>
+      <td width="110">212</td>
+      <td width="764">Create Quote from Contact</td>
+    </tr>
+    <tr>
+      <td width="56">45</td>
+      <td width="110">354</td>
+      <td width="764">Critical security vulnerability in multi-instance
+installations / multiple instance login problem</td>
+    </tr>
+    <tr>
+      <td width="56">46</td>
+      <td width="110">670</td>
+      <td width="764">Propegate Account Address info into New Contact</td>
+    </tr>
+    <tr>
+      <td width="56">47</td>
+      <td width="110">681</td>
+      <td width="764">Bug in utils.php function getListViewEntries</td>
+    </tr>
+    <tr>
+      <td width="56">48</td>
+      <td width="110">754</td>
+      <td width="764">User_name instead of firstname lastname used as
+sender in emails</td>
+    </tr>
+    <tr>
+      <td width="56">49</td>
+      <td width="110">773</td>
+      <td width="764">In custom views of Tickets the Ticket id is
+missing. Its also not possible to filter by ticket id's.</td>
+    </tr>
+    <tr>
+      <td width="56">50</td>
+      <td width="110">763</td>
+      <td width="764">Misspelling in KeyMetrics</td>
+    </tr>
+  </tbody>
+</table>
+<h3>3. Code Contributions</h3>
+<table style="width: 100%; text-align: left;" border="1" cellpadding="4" cellspacing="0">
+  <tbody>
+    <tr bgcolor="#990000">
+      <td width="5%"><b><font color="#ffffff">S. No</font></b>
+      <p><b><font color="#ffffff"> </font></b></p>
+      </td>
+      <td width="52%"><b><font color="#ffffff">Forums</font></b>
+      <p>
+    </p></td>
+      <td width="43%"><b><font color="#ffffff">Description</font></b></td>
+    </tr>
+    <tr>
+      <td width="5%">1
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1954" title="http://www.vtiger.com/discussions/viewtopic.php?t=1954">http://www.vtiger.com/discussions/viewtopic.php?t=1954</a>
+      <p> </p>
+      </td>
+      <td width="43%">GUI
+      <p>rearrange fields within blocks? </p>
+      <p>Drag and drop for the fields with different blocks</p>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">2
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2750" title="http://www.vtiger.com/discussions/viewtopic.php?t=2750">http://www.vtiger.com/discussions/viewtopic.php?t=2750</a>
+      <p> </p>
+      </td>
+      <td width="43%">Appropriate
+      <p>tabindex for edit fields. </p>
+      <p>One more column is added to the fields table to get the tab</p>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">3
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2368" title="http://www.vtiger.com/discussions/viewtopic.php?t=2368">http://www.vtiger.com/discussions/viewtopic.php?t=2368</a>
+      <p> </p>
+      </td>
+      <td width="43%">Release Relations in
+Contacts and Accounts</td>
+    </tr>
+    <tr>
+      <td width="5%">4
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2852" title="http://www.vtiger.com/discussions/viewtopic.php?t=2852">http://www.vtiger.com/discussions/viewtopic.php?t=2852</a>
+      <p> </p>
+      </td>
+      <td width="43%">Change the status of
+the activities in CustomViews from Activities module</td>
+    </tr>
+    <tr>
+      <td width="5%">5
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2031" title="http://www.vtiger.com/discussions/viewtopic.php?t=2031">http://www.vtiger.com/discussions/viewtopic.php?t=2031</a>
+(PDF format)</td>
+      <td style="vertical-align: top; color: rgb(0, 0, 0);" width="43%">In
+the PDF
+      <p>report, to get the address </p>
+on the right side of the page.</td>
+    </tr>
+    <tr>
+      <td width="5%">6
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1689" title="http://www.vtiger.com/discussions/viewtopic.php?t=1689">http://www.vtiger.com/discussions/viewtopic.php?t=1689</a>
+      <p> </p>
+      </td>
+      <td width="43%">LDAP and Active
+Directory Support Patch</td>
+    </tr>
+    <tr>
+      <td width="5%">7
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2364" title="http://www.vtiger.com/discussions/viewtopic.php?t=2364">http://www.vtiger.com/discussions/viewtopic.php?t=2364</a>
+      <p> </p>
+      </td>
+      <td width="43%">Description
+      <p>visible for History and Notes in Acc/Cnts List view.</p>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">8
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2748" title="http://www.vtiger.com/discussions/viewtopic.php?t=2748">http://www.vtiger.com/discussions/viewtopic.php?t=2748</a>
+      <p> </p>
+      </td>
+      <td width="43%">Make a note before
+closing the activity in Home Page</td>
+    </tr>
+    <tr>
+      <td width="5%">9
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?p=13502#13502" title="http://forums.vtiger.com/viewtopic.php?p=13502#13502">http://forums.vtiger.com/viewtopic.php?p=13502#13502</a>
+      </td>
+      <td width="43%">Post subject: Bug
+resolved (Ticket ID 773): TicketId for dropdown lists... </td>
+    </tr>
+    <tr>
+      <td width="5%">10
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1692" title="http://www.vtiger.com/discussions/viewtopic.php?t=1692">http://www.vtiger.com/discussions/viewtopic.php?t=1692</a></td>
+      <td width="43%">Adding
+      <p>priority to Events </p>
+- Feature</td>
+    </tr>
+    <tr>
+      <td width="5%">11
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2617" title="http://www.vtiger.com/discussions/viewtopic.php?t=2617">http://www.vtiger.com/discussions/viewtopic.php?t=2617</a></td>
+      <td width="43%">PDF's output
+formatting. </td>
+    </tr>
+    <tr>
+      <td width="5%">12
+      <p> </p>
+      </td>
+      <td>
+      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=1530" title="http://www.vtiger.com/discussions/viewtopic.php?t=1530">http://www.vtiger.com/discussions/viewtopic.php?t=1530</a></p>
+      </td>
+      <td width="43%">Revised Tracker</td>
+    </tr>
+    <tr>
+      <td width="5%">13
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?p=13396#13396" title="http://forums.vtiger.com/viewtopic.php?p=13396#13396">http://forums.vtiger.com/viewtopic.php?p=13396#13396</a>
+      </td>
+      <td width="43%">New pdf from matt </td>
+    </tr>
+    <tr>
+      <td width="5%">14
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1585" title="http://www.vtiger.com/discussions/viewtopic.php?t=1585">http://www.vtiger.com/discussions/viewtopic.php?t=1585</a></td>
+      <td width="43%">Displaying the
+meeting in the calendar, Present in 4.2GA</td>
+    </tr>
+    <tr>
+      <td width="5%">15
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2029" title="http://www.vtiger.com/discussions/viewtopic.php?t=2029">http://www.vtiger.com/discussions/viewtopic.php?t=2029</a></td>
+      <td width="43%">Import and Export
+Products</td>
+    </tr>
+    <tr>
+      <td width="5%">16
+      <p> </p>
+      </td>
+      <td>
+      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2000" title="http://www.vtiger.com/discussions/viewtopic.php?t=2000">http://www.vtiger.com/discussions/viewtopic.php?t=2000</a></p>
+      </td>
+      <td width="43%"> During
+      <p>'Import', the person who is importing the CSV files
+'user_name' in is </p>
+assigned&nbsp; to 'Assigned to' field</td>
+    </tr>
+    <tr>
+      <td width="5%">17
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2139" title="http://www.vtiger.com/discussions/viewtopic.php?t=2139">http://www.vtiger.com/discussions/viewtopic.php?t=2139</a></td>
+      <td width="43%">When creating a 'New
+      <p>Product'&nbsp; there was an error in javascript. This is
+integrated in </p>
+patch1</td>
+    </tr>
+    <tr>
+      <td width="5%">18
+      <p> </p>
+      </td>
+      <td>
+      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2196" title="http://www.vtiger.com/discussions/viewtopic.php?t=2196">http://www.vtiger.com/discussions/viewtopic.php?t=2196</a></p>
+      </td>
+      <td width="43%">The world clock
+doesn't show 12pm correctly. It was showing 00pm</td>
+    </tr>
+    <tr>
+      <td width="5%">19
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2524" title="http://www.vtiger.com/discussions/viewtopic.php?t=2524">http://www.vtiger.com/discussions/viewtopic.php?t=2524</a></td>
+      <td width="43%">Scroll bars are
+added to the
+      <p>'Related List' of Account and contacts for 'Attachments &amp;
+Notes' </p>
+and 'History'</td>
+    </tr>
+    <tr>
+      <td width="5%">20
+      <p> </p>
+      </td>
+      <td><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2431" title="http://www.vtiger.com/discussions/viewtopic.php?t=2431">http://www.vtiger.com/discussions/viewtopic.php?t=2431</a></td>
+      <td width="43%">Search ny Ticket id
+in HelpDesk</td>
+    </tr>
+    <tr>
+      <td width="5%">21
+      <p> </p>
+      </td>
+      <td>
+      <p> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2406" title="http://www.vtiger.com/discussions/viewtopic.php?t=2406">http://www.vtiger.com/discussions/viewtopic.php?t=2406</a></p>
+      </td>
+      <td width="43%">If you write a
+      <p>long description in an activity, it takes off a lot of space
+because the text field is one column wide only. </p>
+      <p> </p>
+With this fix, the descriptions are spaned over all columns,</td>
+    </tr>
+    <tr>
+      <td width="5%">22
+      <p> </p>
+      </td>
+      <td>
+      <p> <font face="Times New Roman, Times, serif"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2324" title="http://www.vtiger.com/discussions/viewtopic.php?t=2324">http://www.vtiger.com/discussions/viewtopic.php?t=2324</a></font></p>
+      </td>
+      <td width="43%">This will move
+      <p>the vTiger logo upwards and the tabs will start from the left
+of the page. I've applied this all the themes </p>
+except 'blue' theme</td>
+    </tr>
+    <tr>
+      <td width="5%">23
+      <p> </p>
+      </td>
+      
+    <td> 
+      <p><font color="#000000"> </font> </p>
+      <p><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2025" title="http://www.vtiger.com/discussions/viewtopic.php?t=2025">ttp://www.vtiger.com/discussions/viewtopic.php?t=2025</a>
+      </p>
+      </td>
+      <td width="43%">The date
+      <p>format required is YYYY-mm-dd however the popup uses
+mm-dd-YYYY, </p>
+      <p>A diffeent format. Upon trying to submit changes, a date error
+(js </p>
+alert) pops up stating invalid month</td>
+    </tr>
+    <tr>
+      <td width="5%">24
+      <p> </p>
+      </td>
+      <td width="52%"> <a href="http://www.vtiger.com/discussions/viewtopic.php?t=2744" title="http://www.vtiger.com/discussions/viewtopic.php?t=2744">http://www.vtiger.com/discussions/viewtopic.php?t=2744</a>
+      <p> </p>
+      </td>
+      <td width="43%">All users in a
+activity can view it in Calendar</td>
+    </tr>
+    <tr>
+      <td width="5%">25
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3105" title="http://www.vtiger.com/discussions/viewtopic.php?t=3105">http://www.vtiger.com/discussions/viewtopic.php?t=3105</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Imporved Emailing
+system with easy mass mail support- given by <strong>Raju</strong>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">26
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3100" title="http://www.vtiger.com/discussions/viewtopic.php?t=3100">http://www.vtiger.com/discussions/viewtopic.php?t=3100</a>
+      <p> </p>
+      </td>
+      <td width="43%">One color by user in
+Calendar
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">27
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3149" title="http://www.vtiger.com/discussions/viewtopic.php?t=3149">http://www.vtiger.com/discussions/viewtopic.php?t=3149</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Vtiger php
+installer script multilanguage
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">28
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3143" title="http://www.vtiger.com/discussions/viewtopic.php?t=3143">http://www.vtiger.com/discussions/viewtopic.php?t=3143</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Fun with Google Maps
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">29
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=3045" title="http://www.vtiger.com/discussions/viewtopic.php?t=3045">http://www.vtiger.com/discussions/viewtopic.php?t=3045</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Automatic Inventory
+Updating
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">30
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2681" title="http://www.vtiger.com/discussions/viewtopic.php?t=2681">http://www.vtiger.com/discussions/viewtopic.php?t=2681</a>
+      <p> </p>
+      </td>
+      <td width="43%">Helpdesk Navigation.
+      <p>In helpdesk, the navigation below the list view.</p>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">31
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=2005" title="http://www.vtiger.com/discussions/viewtopic.php?t=2005">http://www.vtiger.com/discussions/viewtopic.php?t=2005</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Patches- activity
+rows on Home tab, custom activity view fix
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">32
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://www.vtiger.com/discussions/viewtopic.php?t=1770" title="http://www.vtiger.com/discussions/viewtopic.php?t=1770">http://www.vtiger.com/discussions/viewtopic.php?t=1770</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Make
+QuickActivityRegister have enddate(duedate)
+      <p>To have an end date,when creating an activity from the
+calendar </p>
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">33
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?p=13390#13390" title="http://forums.vtiger.com/viewtopic.php?p=13390#13390">http://forums.vtiger.com/viewtopic.php?p=13390#13390</a>
+      </td>
+      <td width="43%">UI improvement:
+Tabbed details and related lists </td>
+    </tr>
+    <tr>
+      <td width="5%">34
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3251" title="http://forums.vtiger.com/viewtopic.php?t=3251">http://forums.vtiger.com/viewtopic.php?t=3251</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Improved pagination
+in List View
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">35
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3359" title="http://forums.vtiger.com/viewtopic.php?t=3359">http://forums.vtiger.com/viewtopic.php?t=3359</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Tickets sorted by
+ticket id desc
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">36
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=2482" title="http://forums.vtiger.com/viewtopic.php?t=2482">http://forums.vtiger.com/viewtopic.php?t=2482</a>
+      <p> </p>
+      </td>
+      <td width="43%"> First release of
+Communications and Mass Mailing
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">37
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3105" title="http://forums.vtiger.com/viewtopic.php?t=3105">http://forums.vtiger.com/viewtopic.php?t=3105</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Imporved Emailing
+system with easy mass mail support
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">38
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3226" title="http://forums.vtiger.com/viewtopic.php?t=3226">http://forums.vtiger.com/viewtopic.php?t=3226</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Full Telephony
+Integration
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">39
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3342" title="http://forums.vtiger.com/viewtopic.php?t=3342">http://forums.vtiger.com/viewtopic.php?t=3342</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Report Filters in
+PDF And Excel exports
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">40
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3079" title="http://forums.vtiger.com/viewtopic.php?t=3079">http://forums.vtiger.com/viewtopic.php?t=3079</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Export Activities
+to Palm
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">41
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3376" title="http://forums.vtiger.com/viewtopic.php?t=3376">http://forums.vtiger.com/viewtopic.php?t=3376</a>
+      <p> </p>
+      </td>
+      <td width="43%"> custom invoice view
+using custom fields fix (4.2 Patch 2)
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">42
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3367" title="http://forums.vtiger.com/viewtopic.php?t=3367">http://forums.vtiger.com/viewtopic.php?t=3367</a>
+      <p> </p>
+      </td>
+      <td width="43%">contactserialize.php
+fixes (4.2 Patch 2)
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">43
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=1954" title="http://forums.vtiger.com/viewtopic.php?t=1954">http://forums.vtiger.com/viewtopic.php?t=1954</a>
+      <p> </p>
+      </td>
+      <td width="43%"> GUI rearrange
+fields within blocks
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">44
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3390" title="http://forums.vtiger.com/viewtopic.php?t=3390">http://forums.vtiger.com/viewtopic.php?t=3390</a>
+      <p> </p>
+      </td>
+      <td width="43%"> Hierarchical rights
+      <p> </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">45
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3143" title="http://forums.vtiger.com/viewtopic.php?t=3143">http://forums.vtiger.com/viewtopic.php?t=3143</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Fun with Google Maps </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">46
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3247" title="http://forums.vtiger.com/viewtopic.php?t=3247">http://forums.vtiger.com/viewtopic.php?t=3247</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Simple Drupal Integration </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">47
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3290" title="http://forums.vtiger.com/viewtopic.php?t=3290">http://forums.vtiger.com/viewtopic.php?t=3290</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Expenses Module Integration </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">48
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3548" title="http://forums.vtiger.com/viewtopic.php?t=3548">http://forums.vtiger.com/viewtopic.php?t=3548</a>
+      <p> </p>
+      </td>
+      <td width="43%">Activities and Notes
+fixes for 4.2 patch 2 </td>
+    </tr>
+    <tr>
+      <td width="5%">49
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3545" title="http://forums.vtiger.com/viewtopic.php?t=3545">http://forums.vtiger.com/viewtopic.php?t=3545</a>
+      <p> </p>
+      </td>
+      <td width="43%">Invoice &amp; Quotes
+layout fixes </td>
+    </tr>
+    <tr>
+      <td width="5%">50
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=2597" title="http://forums.vtiger.com/viewtopic.php?t=2597">http://forums.vtiger.com/viewtopic.php?t=2597</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Postgres Support </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">51
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://sourceforge.net/mailarchive/forum.php?thread_id=8380546&amp;forum_id=44763" title="http://sourceforge.net/mailarchive/forum.php?thread_id=8380546&amp;forum_id=44763">http://sourceforge.net/mailarchive/forum.php?thread_id=8380546&amp;forum_id=44763</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Patch for customer Portal- Michael </p>
+      <p>fixed some typos </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">52
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763" title="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763">http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Patch for Install - Michael </p>
+* fixed some typos and invalid html
+      <p>* additional permissions check - prevent </p>
+      <p>'My Pipeline' showing a permissions error on new install </p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">53
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763" title="http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763">http://sourceforge.net/mailarchive/forum.php?thread_id=8365518&amp;forum_id=44763</a>
+      <p> </p>
+      </td>
+      <td width="43%">
+      <p>Patch for vtigercrm nusoap - Michael </p>
+The following patch upgrades the version of
+      <p>nusoap library from 0.67 to </p>
+      <p> 0.69.</p>
+      <p></p>
+      </td>
+    </tr>
+    <tr>
+      <td width="5%">54
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3053&amp;highlight=stema" title="http://forums.vtiger.com/viewtopic.php?t=3053&amp;highlight=stema">http://forums.vtiger.com/viewtopic.php?t=3053&amp;highlight=stema</a>
+      <p> </p>
+      </td>
+      <td width="43%">Arrange emails by
+sent date </td>
+    </tr>
+    <tr>
+      <td width="5%">55
+      <p> </p>
+      </td>
+      <td width="52%">
+      <p> </p>
+      <br>
+      </td>
+      <td width="43%">Enchanced PDF in
+Quotes </td>
+    </tr>
+    <tr>
+      <td width="5%">56
+      <p> </p>
+      </td>
+      <td width="52%"><a href="http://forums.vtiger.com/viewtopic.php?t=3509&amp;highlight=vip" title="http://forums.vtiger.com/viewtopic.php?t=3509&amp;highlight=vip">http://forums.vtiger.com/viewtopic.php?t=3509&amp;highlight=vip</a>
+      <p> </p>
+      </td>
+      <td width="43%">Change Home Page
+Order </td>
+    </tr>
+    <tr>
+      <td width="5%">57
+      <p> </p>
+      </td>
+      <td width="52%">Overlapping of
+company logo and product name while exporting in Invoice
+      <p> </p>
+      </td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">58</td>
+      <td width="52%">overlapping of
+company logo and product name while exporting in Invoice </td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">59</td>
+      <td width="52%">Description visible
+for History and Notes in Acc/Cnts List view.</td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">60</td>
+      <td width="52%">Change the status of
+the activities in CustomViews from Activities module</td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">61</td>
+      <td width="52%">Invoice &amp; Quotes
+layout fixes</td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">62</td>
+      <td width="52%">Arranging the home
+page contributed by Mike has been integrated (Bug ID: 291)</td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">63</td>
+      <td width="52%">Imporved Emailing
+system with easy mass mail support(Raju) (Bug ID: 500)</td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">64</td>
+      <td width="52%">Displaying Emails by
+Sent date order(Rcleeve)(Bug ID: 687 )</td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+    <tr>
+      <td width="5%">65</td>
+      <td width="52%">Arranging the blocks
+in settings page(comes under a code contribution) (Bug ID: 648 ) </td>
+      <td width="43%">&nbsp;</td>
+    </tr>
+  </tbody>
+</table>
+<h3>Known Issues</h3>
+<p>1) While creating a new user, by default 'Organisation' will be
+set&nbsp; as 'Role' to the user. Kindly change it to&nbsp; your
+specified role before saving, if 'Organisation' is set as role the
+user, the will not be able to login to the application.</p>
+<p>2) When sending mass mail form
+Leads/Contact/Accounts, validation is not done in 'To' field.</p>
+<p></p>
+<p>3) In Block Re-arrangement Feature,
+If is a field is moved to a unused/new block, the field will not be
+displayed.</p>
+<p></p>
+<p>4) In Email Listview, if mail is
+sent to mutiple recipients the entries will be displayed twice.</p>
+</body>
+</html>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ActivityDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ActivityDetailView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ActivityDetailView.tpl Tue Nov 14 03:16:10 2006
@@ -1,491 +1,486 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-<script type="text/javascript" src="modules/{$MODULE}/Activity.js"></script>
-<script type="text/javascript" src="include/js/reflection.js"></script>
-<script src="include/scriptaculous/prototype.js" type="text/javascript"></script>
-<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
-<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
-   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
-</span>
-
-<script>
-function tagvalidate()
-{ldelim}
-	if(document.getElementById('txtbox_tagfields').value != '')
-		SaveTag('txtbox_tagfields','{$ID}','{$MODULE}');	
-	else
-	{ldelim}
-		alert("Please enter a tag");
-		return false;
-	{rdelim}
-{rdelim}
-function DeleteTag(id)
-{ldelim}
-	$("vtbusy_info").style.display="inline";
-	Effect.Fade('tag_'+id);
-	new Ajax.Request(
-		'index.php',
-                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                        method: 'post',
-                        postBody: "file=TagCloud&module={$MODULE}&action={$MODULE}Ajax&ajxaction=DELETETAG&tagid=" +id,
-                        onComplete: function(response) {ldelim}
-						getTagCloud();
-						$("vtbusy_info").style.display="none";
-                        {rdelim}
-                {rdelim}
-        );
-{rdelim}
-</script>
-<table width="100%" cellpadding="2" cellspacing="0" border="0">
-<form action="index.php" method="post" name="DetailView" id="form">
-<tr><td>&nbsp;</td>
-	<td>
-                <table cellpadding="0" cellspacing="5" border="0">
-			{include file='DetailViewHidden.tpl'}
-		</table>	
-
-<!-- Contents -->
-<table  border="0" cellpadding="5" cellspacing="0" width="100%" >
-<tr>
-	<td class="lvtHeaderText" style="border-bottom:1px dotted #cccccc">
-	
-		<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
-			<tr><td>		
-				 <span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$SINGLE_MOD} {$APP.LBL_INFORMATION}</span>&nbsp;&nbsp;<span id="vtbusy_info" style="display:none;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span><span id="vtbusy_info" style="visibility:hidden;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span></td><td>&nbsp;
-			</td></tr>
-			 <tr height=20><td class=small>{$UPDATEINFO}</td></tr>
-		 </table>
-	</td>
-</tr>
-<tr><td>
-<table border="0" cellpadding="0" cellspacing="0" width="100%">
-	<tr>
-		<td valign=top align=left >
-                           <table border=0 cellspacing=0 cellpadding=3 width=100%>
-				<tr>
-					<td align=left>
-					<!-- content cache -->
-					
-					<table border=0 cellspacing=0 cellpadding=0 width=100%>
-			                  <tr>
-					     <td style="padding:3px">
-						     <!-- General details -->
-				                     <table border=0 cellspacing=0 cellpadding=0 width=100%>
-						     <tr nowrap>
-							<td  colspan=4 style="padding:5px">
-								{if $EDIT_DUPLICATE eq 'permitted'}
-                                                                <input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="&nbsp;{$APP.LBL_EDIT_BUTTON_LABEL}&nbsp;">&nbsp;
-								{/if}
-							</td>
-							<td width=50% align=right>
-							{if $EDIT_DUPLICATE eq 'permitted'}
-                                                                <input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
-                                                        {/if}
-							{if $DELETE eq 'permitted'}
-                                                                <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; {if $VIEWTYPE eq 'calendar'} this.form.return_action.value='index'; {else} this.form.return_action.value='ListView'; {/if}  this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
-                                                         {/if}
-
-							</td>
-						     </tr>
-						     </table>
-						     {foreach key=header item=detail from=$BLOCKS}
-						     <table border=0 cellspacing=0 cellpadding=5 width=100% class="small">
-						     	<tr>{strip}
-						     		<td colspan=4 class="tableHeading">
-									<b>{$header}</b>
-								</td>{/strip}
-					             	</tr>
-						     </table>
-						     {/foreach}
-						     {if $ACTIVITYDATA.activitytype neq 'Task'}	
-							 <!-- display of fields starts -->
-						     <table border=0 cellspacing=0 cellpadding=5 width=100% >
-               						 <tr>
-								{if $LABEL.activitytype neq ''}
-								<td class="cellLabel" width="20%" align="right"><b>{$MOD.LBL_EVENTTYPE}</b></td>
-								<td class="cellInfo" width="30%"align="left">{$ACTIVITYDATA.activitytype}</td>
-								{/if}
-								{if $LABEL.visibility neq ''}
-								<td class="cellLabel" width="20%" align="right"><b>{$LABEL.visibility}</b></td>
-                                                                <td class="cellInfo" width="30%" align="left" >{$ACTIVITYDATA.visibility}</td>
-								{/if}
-							 </tr>
-							 <tr>
-                        					<td class="cellLabel" align="right"><b>{$MOD.LBL_EVENTNAME}</b></td>
-					                        <td class="cellInfo" colspan=3 align="left" >{$ACTIVITYDATA.subject}</td>
-             						 </tr>
-							 {if $LABEL.description neq ''}
-							 <tr>
-								<td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.description}</b></td>
-								<td class="cellInfo" valign="top" align="left" colspan="3" height="60px">{$ACTIVITYDATA.description}</td>
-							 </tr>
-							{/if}
-							 <tr>
-								{if $LABEL.eventstatus neq ''}
-								<td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.eventstatus}</b></td>
-								<td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.eventstatus}</td>
-								{/if}
-								{if $LABEL.assigned_user_id neq ''}
-								<td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.assigned_user_id}</b></td>
-								<td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.assigned_user_id}</td>
-								{/if}
-                                                         </tr>
-							 <tr>
-								{if $LABEL.taskpriority neq ''}
-                                                                <td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.taskpriority}</b></td>
-                                                                <td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.taskpriority}</td>
-								{/if}
-								{if $LABEL.sendnotification neq ''}
-                                                                <td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.sendnotification}</b></td>
-                                                                <td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.sendnotification}</td>
-								{/if}
-                                                         </tr>
-                                                         <tr>
-                                                                <td class="cellLabel" align="right" nowrap valign="top"align="right">{if $LABEL.createdtime neq ''}<b>{$LABEL.createdtime}</b>{/if}</td>
-                                                                <td class="cellInfo" align="left" nowrap valign="top">{if $LABEL.createdtime neq ''}{$ACTIVITYDATA.createdtime}{/if}</td>
-                                                                <td class="cellLabel" align="right" nowrap valign="top"align="right">{if $LABEL.modifiedtime neq ''}<b>{$LABEL.modifiedtime}</b>{/if}</td>
-                                                                <td class="cellInfo" align="left" nowrap valign="top">{if $LABEL.modifiedtime neq ''}{$ACTIVITYDATA.modifiedtime}{/if}</td>
-                                                         </tr>
-						     </table>
-						     <table border=0 cellspacing=1 cellpadding=0 width=100%>
-							<tr><td width=50% valign=top >
-								<table border=0 cellspacing=0 cellpadding=2 width=100%>
-                                                                        <tr><td class="mailSubHeader"><b>{$MOD.LBL_EVENTSTAT}</b></td></tr>
-                                                                        <tr><td class=small>{$ACTIVITYDATA.starthr}:{$ACTIVITYDATA.startmin}{$ACTIVITYDATA.startfmt}</td></tr>
-                                                                        <tr><td class=small>{$ACTIVITYDATA.date_start}</td></tr>
-                                                                </table></td>
-							<td width=50% valign=top >
-                                                                <table border=0 cellspacing=0 cellpadding=2 width=100%>
-                                                                        <tr><td  class="mailSubHeader"><b>{$MOD.LBL_EVENTEDAT}</b></td></tr>
-                                                                        <tr><td class=small>{$ACTIVITYDATA.endhr}:{$ACTIVITYDATA.endmin}{$ACTIVITYDATA.endfmt}</td></tr>
-                                                                        <tr><td class=small>{$ACTIVITYDATA.due_date}</td></tr>
-                                                                </table>
-                                                        </td></tr>
-                                                     </table>
-						     <br>
-					             <table border=0 cellspacing=0 cellpadding=0 width=100% align=center>
-                					 <tr>
-                        					<td>
-                         				        	<table border=0 cellspacing=0 cellpadding=3 width=100%>
-                             						<tr>
-                                        					<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
-					                                        <td id="cellTabInvite" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');dispLayer('addEventInviteUI');ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_INVITE}</a></td>
-										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-										<td id="cellTabAlarm" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','on');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');dispLayer('addEventAlarmUI');ghide('addEventInviteUI');ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_REMINDER}</a></td>
-										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-										<td id="cellTabRepeat" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','on');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');ghide('addEventInviteUI');dispLayer('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_REPEAT}</a></td>
-										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-										<td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','on');ghide('addEventAlarmUI');ghide('addEventInviteUI');dispLayer('addEventRelatedtoUI');ghide('addEventRepeatUI');">{$MOD.LBL_LIST_RELATED_TO}</a></td>
-										<td class="dvtTabCache" style="width:100%">&nbsp;</td>
-									</tr>
-									</table>
-								</td>
-							 </tr>
-							
-							 <tr>
-								<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
-									<!-- Invite UI -->
-									<DIV id="addEventInviteUI" style="display:block;width:100%">
-									<table width="100%" cellpadding="5" cellspacing="0" border="0">
-										<tr>
-                                                                                        <td width="30%" valign="top" align=right><b>{$MOD.LBL_USERS}</b></td>
-                                                                                        <td width="70%" align=left valign="top" >
-												{foreach item=username key=userid from=$INVITEDUSERS}
-                                                                                        	        {$username.3}<br>
-                                                                                                {/foreach}
-											</td>
-                                                                                </tr>
-									</table>
-									</DIV>
-									<!-- Reminder UI -->
-					                                <DIV id="addEventAlarmUI" style="display:none;width:100%">
-									{if $LABEL.reminder_time != ''}
-									<table width="100%" cellpadding="5" cellspacing="0" border="0">
-                                                                                <tr>
-                                                                                        <td width="30%" align=right><b>{$MOD.LBL_SENDREMINDER}</b></td>
-                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.set_reminder}</td>
-                                                                                </tr>
-										{if $ACTIVITYDATA.set_reminder != 'No'}
-										<tr>
-                                                                                        <td width="30%" align=right><b>{$MOD.LBL_RMD_ON}</b></td>
-											<td width="70%" align=left>{$ACTIVITYDATA.reminder_str}</td>
-										</tr>
-										{/if}
-                                                                        </table>
-									{/if}
-									</DIV>
-									<!-- Repeat UI -->
-                                					<div id="addEventRepeatUI" style="display:none;width:100%">
-									{if $LABEL.recurringtype neq ''}
-									<table width="100%" cellpadding="5" cellspacing="0" border="0">
-										<tr>
-                                                                                        <td width="30%" align=right><b>{$MOD.LBL_ENABLE_REPEAT}</b></td>
-                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.recurringcheck}</td>
-                                                                                </tr>
-										{if $ACTIVITYDATA.recurringcheck != 'No'}
-										<tr>
-											<td width="30%" align=right>&nbsp;</td>
-											<td>{$MOD.LBL_REPEATEVENT}&nbsp;{$ACTIVITYDATA.repeat_frequency}&nbsp;{$MOD[$ACTIVITYDATA.recurringtype]}</td>
-										</tr>
-										<tr>
-                                                                                        <td width="30%" align=right>&nbsp;</td>
-                                                                                        <td>{$ACTIVITYDATA.repeat_str}</td>
-                                                                                </tr>
-										{/if}
-									</table>
-									{/if}
-									</div>
-									<!-- Relatedto UI -->
-									<div id="addEventRelatedtoUI" style="display:none;width:100%">
-									<table width="100%" cellpadding="5" cellspacing="0" border="0">
-										{if $LABEL.parent_id neq ''}
-										<tr>
-											<td width="30%" align=right valign="top"><b>{$LABEL.parent_id}</b></td>
-											<td width="70%" align=left valign="top">{$ACTIVITYDATA.parent_name}</td>
-										</tr>
-										{/if}
-										<tr>
-											<td width="30%" valign="top" align=right><b>{$MOD.LBL_CONTACT_NAME}</b></td>	
-											<td width="70%" valign="top" align=left>
-											{foreach item=contactname key=cntid from=$CONTACTS}
-	                                                                                {$contactname.0}&nbsp;{$contactname.1}<br>
-                                                                                        {/foreach}
-										</tr>
-									</table>
-									</div>
-								</td>
-                					 </tr>
-						     </table>
-						    {else}
-							<!-- detailed view of a ToDo -->
-					 	     <table border="0" cellpadding="5" cellspacing="0" width="100%">
-							<tr>
-								<td class="cellLabel" width="20%" align="right"><b>{$MOD.LBL_TODO}</b></td>
-								<td class="cellInfo" width="80%" align="left">{$ACTIVITYDATA.subject}</td>
-							</tr>
-							{if $LABEL.description neq ''}
-							<tr>
-								<td class="cellLabel" align="right" valign="top"><b>{$LABEL.description}</b></td>
-                                                                <td class="cellInfo" align="left" colspan="3" valign="top" height="60px">{$ACTIVITYDATA.description}</td>
-                					</tr>
-							{/if}
-							<tr>
-                        					<td colspan="2" align="center" style="padding:0px">
-                                				<table border="0" cellpadding="5" cellspacing="1" width="100%" >
-                                       					<tr>
-                                                				<td class="cellLabel" width=33% align="left">{if $LABEL.taskstatus neq ''}<b>{$LABEL.taskstatus}</b>{/if}</td>
-										<td class="cellLabel" width=33% align="left">{if $LABEL.taskpriority neq ''}<b>{$LABEL.taskpriority}</b>{/if}</td>
-										<td class="cellLabel" width=34% align="left">{if $LABEL.assigned_user_id neq ''}<b>{$LABEL.assigned_user_id}</b>{/if}</td>
-									</tr>
-									<tr>
-                                                				<td class="cellInfo" align="left" valign="top">{if $LABEL.taskstatus neq ''}{$ACTIVITYDATA.taskstatus}{/if}</td>
-										<td class="cellInfo" align="left" valign="top">{if $LABEL.taskpriority neq ''}{$ACTIVITYDATA.taskpriority}{/if}</td>
-										<td class="cellInfo" align="left" valign="top">{if $LABEL.taskpriority neq ''}{$ACTIVITYDATA.assigned_user_id}{/if}</td>
-									</tr>
-								</table>
-								</td>
-							</tr>
-						     </table>
-						     <table border="0" cellpadding="0" cellspacing="0" width="100%" align=center>
-	                                                <tr><td width=50% valign=top >
-								<table border=0 cellspacing=0 cellpadding=2 width=100% align=center>
-									<tr><td class="mailSubHeader" align=left ><b>{$MOD.LBL_TIMEDATE}</b></td></tr>
-									<tr><td class="small" >{$ACTIVITYDATA.starthr}:{$ACTIVITYDATA.startmin}{$ACTIVITYDATA.startfmt}</td></tr>
-									<tr><td class="cellInfo" style="padding-left:0px">{$ACTIVITYDATA.date_start}</td></tr>
-								</table>
-							</td>
-							<td width=50% valign="top">
-								<table border=0 cellspacing=0 cellpadding=2 width=100% align=center>
-									<tr><td class="mailSubHeader"><b>{$LABEL.due_date}</b></td></tr>
-									<tr><td class="small">{$ACTIVITYDATA.due_date}</td></tr>
-									<tr><td class="cellInfo">&nbsp;</td></tr>
-								</table>
-							</td>
-						     </table>
-						     <table border=0 cellspacing=0 cellpadding=5 width=100% >
-							<tr>
-								<td class="cellLabel" align=right nowrap width=20%>{if $LABEL.createdtime neq ''}<b>{$LABEL.createdtime}</b>{/if}</td>
-                                                                <td class="cellInfo" align=left nowrap width=30%>{if $LABEL.createdtime neq ''}{$ACTIVITYDATA.createdtime}{/if}</td>
-                                                                <td class="cellLabel" align=right nowrap width=20%>{if $LABEL.modifiedtime neq ''}<b>{$LABEL.modifiedtime}</b>{/if}</td>
-                                                                <td class="cellInfo" align=left  nowrap width=30%>{if $LABEL.modifiedtime neq ''}{$ACTIVITYDATA.modifiedtime}{/if}</td>
-                                                        </tr>
-                                                     </table>
-						     <br>
-						     <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
-							<tr>
-								<td>
-									<table border="0" cellpadding="3" cellspacing="0" width="100%">
-									<tr>
-										<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
-                                                                                <td id="cellTabInvite" class="dvtSelectedCell" align="center" nowrap="nowrap"><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabRelatedto','off');dispLayer('addTaskAlarmUI');ghide('addTaskRelatedtoUI');">{$MOD.LBL_NOTIFICATION}</td></a>
-										<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;
-                                                                                <td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabRelatedto','on');dispLayer('addTaskRelatedtoUI');ghide('addTaskAlarmUI');">{$MOD.LBL_RELATEDTO}</a></td>
-
-                                                                                <td class="dvtTabCache" style="width: 100%;">&nbsp;</td>
-									</tr>
-									</table>
-								</td>
-							</tr>
-							<tr>
-								<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
-                                                                <!-- Notification UI -->
-                                                                        <DIV id="addTaskAlarmUI" style="display:block;width:100%">
-									{if $LABEL.sendnotification neq ''}
-                                                                        <table width="100%" cellpadding="5" cellspacing="0" border="0">
-                                                                                <tr>
-                                                                                        <td width="30%" align=right><b>{$MOD.LBL_SENDNOTIFICATION}</b></td>
-                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.sendnotification}</td>
-                                                                                </tr>
-                                                                        </table>
-									{/if}
-                                                                        </DIV>
-									<div id="addTaskRelatedtoUI" style="display:none;width:100%">
-									{if $LABEL.parent_id neq ''}
-                                                                        <table width="100%" cellpadding="5" cellspacing="0" border="0">
-                                                                                <tr>
-                                                                                        <td width="30%" align=right><b>{$LABEL.parent_id}</b></td>
-                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.parent_name}</td>
-                                                                                </tr>
-                                                                                <tr>
-                                                                                        <td align=right><b>{$MOD.LBL_CONTACT_NAME}</b></td>
-                                                                                        <td align=left>{$ACTIVITYDATA.contact_id}</td>
-                                                                                </tr>
-                                                                        </table>
-									{/if}
-                                                                        </div>
-								</td>
-							</tr>
-						     </table>
-						     {/if}
-
-                     	                      </td>
-					   </tr>
-                </tr>
-		<tr>
-			<td style="padding:10px">
-		           <table border=0 cellspacing=0 cellpadding=0 width=100%>
-				     {strip}<tr nowrap>
-							<td  colspan=4 style="padding:5px">
-								{if $EDIT_DUPLICATE eq 'permitted'}
-                                                                <input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="&nbsp;{$APP.LBL_EDIT_BUTTON_LABEL}&nbsp;">&nbsp;
-								{/if}
-							</td>
-							<td align=right>
-								{if $EDIT_DUPLICATE eq 'permitted'}
-                                                                <input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
-                                                                {/if}
-								{if $DELETE eq 'permitted'}
-                                                                <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
-                                                                {/if}
-
-							</td>
-					</tr>{/strip}
-			   </table>
-			</td>
-		</tr>
-	</table>
-	</td>
-	<td width=22% valign=top style="border-left:2px dashed #cccccc;padding:13px">
-						<!-- right side relevant info -->
-
-		<!-- Add Tag link added just above the tag cloud image -->
-		<table border=0 cellspacing=0 cellpadding=5 width=100% >
-		<tr>
-			<td align="left" class="genHeaderSmall"  nowrap><div id="addtagdiv"><a href="javascript:;" onClick="show('tagdiv'),fnhide('addtagdiv'),document.getElementById('txtbox_tagfields').focus()"><b>{$APP.LBL_ADD_TAG}</b></a></div><div id="tagdiv" style="display:none;"><input class="textbox"  type="text" id="txtbox_tagfields" name="textbox_First Name" value=""></input>&nbsp;&nbsp;<input name="button_tagfileds" type="button" class="crmbutton small save" value="{$APP.LBL_TAG_IT}" onclick="return tagvalidate()"/><input name="close" type="button" class="crmbutton small cancel" value="{$APP.LBL_CLOSE}" onClick="fnhide('tagdiv'),show('addtagdiv')"></div></td>
-		</tr>
-		</table>
-		<br>
-		<!-- Eng Add Tag Link -->
-		<!-- Tag cloud display -->
-		<table border=0 cellspacing=0 cellpadding=0 width=100% class="tagCloud">
-		<tr>
-			<td class="tagCloudTopBg"><img src="{$IMAGE_PATH}tagCloudName.gif" border=0></td>
-		</tr>
-		<tr>
-			<td class="tagCloudDisplay" valign=top> <span id="tagfields">{$ALL_TAG}</span></td>
-		</tr>
-		</table>
-		<!-- End Tag cloud display -->
-			<!-- Mail Merge-->
-				<br>
-				{if $MERGEBUTTON eq 'permitted'}
-  				<table border=0 cellspacing=0 cellpadding=0 width=100% class="rightMailMerge">
-      				<tr>
-      					   <td class="rightMailMergeHeader"><b>{$WORDTEMPLATEOPTIONS}</b></td>
-      				</tr>
-      				<tr style="height:25px">
-      						<td class="rightMailMergeContent">
-          						<select name="mergefile">{foreach key=templid item=tempflname from=$TOPTIONS}<option value="{$templid}">{$tempflname}</option>{/foreach}</select>
-          						<input class="crmbutton small create" value="{$APP.LBL_MERGE_BUTTON_LABEL}" onclick="this.form.action.value='Merge';" type="submit"></input>
-      					  </td>
-      				</tr>
-  				</table>
-				{/if}
-			</td>
-		</tr>
-		</table>
-		
-			
-			
-		
-		</div>
-		<!-- PUBLIC CONTENTS STOPS-->
-	</td>
-</tr>
-</table>
-
-{if $MODULE eq 'Products'}
-<script language="JavaScript" type="text/javascript" src="modules/Products/Productsslide.js"></script>
-<script language="JavaScript" type="text/javascript">Carousel();</script>
-{/if}
-
-<script>
-function getTagCloud()
-{ldelim}
-new Ajax.Request(
-        'index.php',
-        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-        method: 'post',
-        postBody: 'module={$MODULE}&action={$MODULE}Ajax&file=TagCloud&ajxaction=GETTAGCLOUD&recordid={$ID}',
-        onComplete: function(response) {ldelim}
-                                $("tagfields").innerHTML=response.responseText;
-                                $("txtbox_tagfields").value ='';
-                        {rdelim}
-        {rdelim}
-);
-{rdelim}
-getTagCloud();
-</script>
-<!-- added for validation -->
-<script language="javascript">
-  var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
-  var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
-  var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
-</script>
-</td>
-
-</tr></table></form>
-</td></tr></table>
-</td></tr></table>
-</td></tr></table>
-        </td></tr></table>
-        </td></tr></table>
-        </div>
-        </td>
-        <td valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-        </tr>
-        </table>
-
-
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+<script type="text/javascript" src="modules/{$MODULE}/Activity.js"></script>
+<script type="text/javascript" src="include/js/reflection.js"></script>
+<script src="include/scriptaculous/prototype.js" type="text/javascript"></script>
+<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
+<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
+   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
+</span>
+
+<script>
+function tagvalidate()
+{ldelim}
+	if(document.getElementById('txtbox_tagfields').value != '')
+		SaveTag('txtbox_tagfields','{$ID}','{$MODULE}');	
+	else
+	{ldelim}
+		alert("Please enter a tag");
+		return false;
+	{rdelim}
+{rdelim}
+function DeleteTag(id)
+{ldelim}
+	$("vtbusy_info").style.display="inline";
+	Effect.Fade('tag_'+id);
+	new Ajax.Request(
+		'index.php',
+                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                        method: 'post',
+                        postBody: "file=TagCloud&module={$MODULE}&action={$MODULE}Ajax&ajxaction=DELETETAG&tagid=" +id,
+                        onComplete: function(response) {ldelim}
+						getTagCloud();
+						$("vtbusy_info").style.display="none";
+                        {rdelim}
+                {rdelim}
+        );
+{rdelim}
+</script>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+<form action="index.php" method="post" name="DetailView" id="form">
+<tr><td>&nbsp;</td>
+	<td>
+                <table cellpadding="0" cellspacing="5" border="0">
+			{include file='DetailViewHidden.tpl'}
+		</table>	
+
+<!-- Contents -->
+<table  border="0" cellpadding="5" cellspacing="0" width="100%" >
+<tr>
+	<td class="lvtHeaderText" style="border-bottom:1px dotted #cccccc">
+	
+		<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
+			<tr><td>		
+				 <span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$SINGLE_MOD} {$APP.LBL_INFORMATION}</span>&nbsp;&nbsp;<span id="vtbusy_info" style="display:none;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span><span id="vtbusy_info" style="visibility:hidden;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span></td><td>&nbsp;
+			</td></tr>
+			 <tr height=20><td class=small>{$UPDATEINFO}</td></tr>
+		 </table>
+	</td>
+</tr>
+<tr><td>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+	<tr>
+		<td valign=top align=left >
+                           <table border=0 cellspacing=0 cellpadding=3 width=100%>
+				<tr>
+					<td align=left>
+					<!-- content cache -->
+					
+					<table border=0 cellspacing=0 cellpadding=0 width=100%>
+			                  <tr>
+					     <td style="padding:3px">
+						     <!-- General details -->
+				                     <table border=0 cellspacing=0 cellpadding=0 width=100%>
+						     <tr nowrap>
+							<td  colspan=4 style="padding:5px">
+								{if $EDIT_DUPLICATE eq 'permitted'}
+                                                                <input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="&nbsp;{$APP.LBL_EDIT_BUTTON_LABEL}&nbsp;">&nbsp;
+								{/if}
+							</td>
+							<td width=50% align=right>
+							{if $EDIT_DUPLICATE eq 'permitted'}
+                                                                <input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
+                                                        {/if}
+							{if $DELETE eq 'permitted'}
+                                                                <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; {if $VIEWTYPE eq 'calendar'} this.form.return_action.value='index'; {else} this.form.return_action.value='ListView'; {/if}  this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
+                                                         {/if}
+
+							</td>
+						     </tr>
+						     </table>
+						     {foreach key=header item=detail from=$BLOCKS}
+						     <table border=0 cellspacing=0 cellpadding=5 width=100% class="small">
+						     	<tr>{strip}
+						     		<td colspan=4 class="tableHeading">
+									<b>{$header}</b>
+								</td>{/strip}
+					             	</tr>
+						     </table>
+						     {/foreach}
+						     {if $ACTIVITYDATA.activitytype neq 'Task'}	
+							 <!-- display of fields starts -->
+						     <table border=0 cellspacing=0 cellpadding=5 width=100% >
+               						 <tr>
+								{if $LABEL.activitytype neq ''}
+								<td class="cellLabel" width="20%" align="right"><b>{$MOD.LBL_EVENTTYPE}</b></td>
+								<td class="cellInfo" width="30%"align="left">{$ACTIVITYDATA.activitytype}</td>
+								{/if}
+								{if $LABEL.visibility neq ''}
+								<td class="cellLabel" width="20%" align="right"><b>{$LABEL.visibility}</b></td>
+                                                                <td class="cellInfo" width="30%" align="left" >{$ACTIVITYDATA.visibility}</td>
+								{/if}
+							 </tr>
+							 <tr>
+                        					<td class="cellLabel" align="right"><b>{$MOD.LBL_EVENTNAME}</b></td>
+					                        <td class="cellInfo" colspan=3 align="left" >{$ACTIVITYDATA.subject}</td>
+             						 </tr>
+							 {if $LABEL.description neq ''}
+							 <tr>
+								<td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.description}</b></td>
+								<td class="cellInfo" valign="top" align="left" colspan="3" height="60px">{$ACTIVITYDATA.description}</td>
+							 </tr>
+							{/if}
+							 <tr>
+								{if $LABEL.eventstatus neq ''}
+								<td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.eventstatus}</b></td>
+								<td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.eventstatus}</td>
+								{/if}
+								{if $LABEL.assigned_user_id neq ''}
+								<td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.assigned_user_id}</b></td>
+								<td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.assigned_user_id}</td>
+								{/if}
+                                                         </tr>
+							 <tr>
+								{if $LABEL.taskpriority neq ''}
+                                                                <td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.taskpriority}</b></td>
+                                                                <td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.taskpriority}</td>
+								{/if}
+								{if $LABEL.sendnotification neq ''}
+                                                                <td class="cellLabel" align="right" nowrap valign="top"><b>{$LABEL.sendnotification}</b></td>
+                                                                <td class="cellInfo" align="left" nowrap valign="top">{$ACTIVITYDATA.sendnotification}</td>
+								{/if}
+                                                         </tr>
+                                                         <tr>
+                                                                <td class="cellLabel" align="right" nowrap valign="top"align="right">{if $LABEL.createdtime neq ''}<b>{$LABEL.createdtime}</b>{/if}</td>
+                                                                <td class="cellInfo" align="left" nowrap valign="top">{if $LABEL.createdtime neq ''}{$ACTIVITYDATA.createdtime}{/if}</td>
+                                                                <td class="cellLabel" align="right" nowrap valign="top"align="right">{if $LABEL.modifiedtime neq ''}<b>{$LABEL.modifiedtime}</b>{/if}</td>
+                                                                <td class="cellInfo" align="left" nowrap valign="top">{if $LABEL.modifiedtime neq ''}{$ACTIVITYDATA.modifiedtime}{/if}</td>
+                                                         </tr>
+						     </table>
+						     <table border=0 cellspacing=1 cellpadding=0 width=100%>
+							<tr><td width=50% valign=top >
+								<table border=0 cellspacing=0 cellpadding=2 width=100%>
+                                                                        <tr><td class="mailSubHeader"><b>{$MOD.LBL_EVENTSTAT}</b></td></tr>
+                                                                        <tr><td class=small>{$ACTIVITYDATA.starthr}:{$ACTIVITYDATA.startmin}{$ACTIVITYDATA.startfmt}</td></tr>
+                                                                        <tr><td class=small>{$ACTIVITYDATA.date_start}</td></tr>
+                                                                </table></td>
+							<td width=50% valign=top >
+                                                                <table border=0 cellspacing=0 cellpadding=2 width=100%>
+                                                                        <tr><td  class="mailSubHeader"><b>{$MOD.LBL_EVENTEDAT}</b></td></tr>
+                                                                        <tr><td class=small>{$ACTIVITYDATA.endhr}:{$ACTIVITYDATA.endmin}{$ACTIVITYDATA.endfmt}</td></tr>
+                                                                        <tr><td class=small>{$ACTIVITYDATA.due_date}</td></tr>
+                                                                </table>
+                                                        </td></tr>
+                                                     </table>
+						     <br>
+					             <table border=0 cellspacing=0 cellpadding=0 width=100% align=center>
+                					 <tr>
+                        					<td>
+                         				        	<table border=0 cellspacing=0 cellpadding=3 width=100%>
+                             						<tr>
+                                        					<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+					                                        <td id="cellTabInvite" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');dispLayer('addEventInviteUI');ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_INVITE}</a></td>
+										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+										<td id="cellTabAlarm" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','on');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');dispLayer('addEventAlarmUI');ghide('addEventInviteUI');ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_REMINDER}</a></td>
+										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+										<td id="cellTabRepeat" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','on');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');ghide('addEventInviteUI');dispLayer('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_REPEAT}</a></td>
+										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+										<td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','on');ghide('addEventAlarmUI');ghide('addEventInviteUI');dispLayer('addEventRelatedtoUI');ghide('addEventRepeatUI');">{$MOD.LBL_LIST_RELATED_TO}</a></td>
+										<td class="dvtTabCache" style="width:100%">&nbsp;</td>
+									</tr>
+									</table>
+								</td>
+							 </tr>
+							
+							 <tr>
+								<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
+									<!-- Invite UI -->
+									<DIV id="addEventInviteUI" style="display:block;width:100%">
+									<table width="100%" cellpadding="5" cellspacing="0" border="0">
+										<tr>
+                                                                                        <td width="30%" valign="top" align=right><b>{$MOD.LBL_USERS}</b></td>
+                                                                                        <td width="70%" align=left valign="top" >
+												{foreach item=username key=userid from=$INVITEDUSERS}
+                                                                                        	        {$username.3}<br>
+                                                                                                {/foreach}
+											</td>
+                                                                                </tr>
+									</table>
+									</DIV>
+									<!-- Reminder UI -->
+					                                <DIV id="addEventAlarmUI" style="display:none;width:100%">
+									{if $LABEL.reminder_time != ''}
+									<table width="100%" cellpadding="5" cellspacing="0" border="0">
+                                                                                <tr>
+                                                                                        <td width="30%" align=right><b>{$MOD.LBL_SENDREMINDER}</b></td>
+                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.set_reminder}</td>
+                                                                                </tr>
+										{if $ACTIVITYDATA.set_reminder != 'No'}
+										<tr>
+                                                                                        <td width="30%" align=right><b>{$MOD.LBL_RMD_ON}</b></td>
+											<td width="70%" align=left>{$ACTIVITYDATA.reminder_str}</td>
+										</tr>
+										{/if}
+                                                                        </table>
+									{/if}
+									</DIV>
+									<!-- Repeat UI -->
+                                					<div id="addEventRepeatUI" style="display:none;width:100%">
+									{if $LABEL.recurringtype neq ''}
+									<table width="100%" cellpadding="5" cellspacing="0" border="0">
+										<tr>
+                                                                                        <td width="30%" align=right><b>{$MOD.LBL_ENABLE_REPEAT}</b></td>
+                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.recurringcheck}</td>
+                                                                                </tr>
+										{if $ACTIVITYDATA.recurringcheck != 'No'}
+										<tr>
+											<td width="30%" align=right>&nbsp;</td>
+											<td>{$MOD.LBL_REPEATEVENT}&nbsp;{$ACTIVITYDATA.repeat_frequency}&nbsp;{$MOD[$ACTIVITYDATA.recurringtype]}</td>
+										</tr>
+										<tr>
+                                                                                        <td width="30%" align=right>&nbsp;</td>
+                                                                                        <td>{$ACTIVITYDATA.repeat_str}</td>
+                                                                                </tr>
+										{/if}
+									</table>
+									{/if}
+									</div>
+									<!-- Relatedto UI -->
+									<div id="addEventRelatedtoUI" style="display:none;width:100%">
+									<table width="100%" cellpadding="5" cellspacing="0" border="0">
+										{if $LABEL.parent_id neq ''}
+										<tr>
+											<td width="30%" align=right valign="top"><b>{$LABEL.parent_id}</b></td>
+											<td width="70%" align=left valign="top">{$ACTIVITYDATA.parent_name}</td>
+										</tr>
+										{/if}
+										<tr>
+											<td width="30%" valign="top" align=right><b>{$MOD.LBL_CONTACT_NAME}</b></td>	
+											<td width="70%" valign="top" align=left>
+											{foreach item=contactname key=cntid from=$CONTACTS}
+	                                                                                {$contactname.0}&nbsp;{$contactname.1}<br>
+                                                                                        {/foreach}
+										</tr>
+									</table>
+									</div>
+								</td>
+                					 </tr>
+						     </table>
+						    {else}
+							<!-- detailed view of a ToDo -->
+					 	     <table border="0" cellpadding="5" cellspacing="0" width="100%">
+							<tr>
+								<td class="cellLabel" width="20%" align="right"><b>{$MOD.LBL_TODO}</b></td>
+								<td class="cellInfo" width="80%" align="left">{$ACTIVITYDATA.subject}</td>
+							</tr>
+							{if $LABEL.description neq ''}
+							<tr>
+								<td class="cellLabel" align="right" valign="top"><b>{$LABEL.description}</b></td>
+                                                                <td class="cellInfo" align="left" colspan="3" valign="top" height="60px">{$ACTIVITYDATA.description}</td>
+                					</tr>
+							{/if}
+							<tr>
+                        					<td colspan="2" align="center" style="padding:0px">
+                                				<table border="0" cellpadding="5" cellspacing="1" width="100%" >
+                                       					<tr>
+                                                				<td class="cellLabel" width=33% align="left">{if $LABEL.taskstatus neq ''}<b>{$LABEL.taskstatus}</b>{/if}</td>
+										<td class="cellLabel" width=33% align="left">{if $LABEL.taskpriority neq ''}<b>{$LABEL.taskpriority}</b>{/if}</td>
+										<td class="cellLabel" width=34% align="left">{if $LABEL.assigned_user_id neq ''}<b>{$LABEL.assigned_user_id}</b>{/if}</td>
+									</tr>
+									<tr>
+                                                				<td class="cellInfo" align="left" valign="top">{if $LABEL.taskstatus neq ''}{$ACTIVITYDATA.taskstatus}{/if}</td>
+										<td class="cellInfo" align="left" valign="top">{if $LABEL.taskpriority neq ''}{$ACTIVITYDATA.taskpriority}{/if}</td>
+										<td class="cellInfo" align="left" valign="top">{if $LABEL.taskpriority neq ''}{$ACTIVITYDATA.assigned_user_id}{/if}</td>
+									</tr>
+								</table>
+								</td>
+							</tr>
+						     </table>
+						     <table border="0" cellpadding="0" cellspacing="0" width="100%" align=center>
+	                                                <tr><td width=50% valign=top >
+								<table border=0 cellspacing=0 cellpadding=2 width=100% align=center>
+									<tr><td class="mailSubHeader" align=left ><b>{$MOD.LBL_TIMEDATE}</b></td></tr>
+									<tr><td class="small" >{$ACTIVITYDATA.starthr}:{$ACTIVITYDATA.startmin}{$ACTIVITYDATA.startfmt}</td></tr>
+									<tr><td class="cellInfo" style="padding-left:0px">{$ACTIVITYDATA.date_start}</td></tr>
+								</table>
+							</td>
+							<td width=50% valign="top">
+								<table border=0 cellspacing=0 cellpadding=2 width=100% align=center>
+									<tr><td class="mailSubHeader"><b>{$LABEL.due_date}</b></td></tr>
+									<tr><td class="small">{$ACTIVITYDATA.due_date}</td></tr>
+									<tr><td class="cellInfo">&nbsp;</td></tr>
+								</table>
+							</td>
+						     </table>
+						     <table border=0 cellspacing=0 cellpadding=5 width=100% >
+							<tr>
+								<td class="cellLabel" align=right nowrap width=20%>{if $LABEL.createdtime neq ''}<b>{$LABEL.createdtime}</b>{/if}</td>
+                                                                <td class="cellInfo" align=left nowrap width=30%>{if $LABEL.createdtime neq ''}{$ACTIVITYDATA.createdtime}{/if}</td>
+                                                                <td class="cellLabel" align=right nowrap width=20%>{if $LABEL.modifiedtime neq ''}<b>{$LABEL.modifiedtime}</b>{/if}</td>
+                                                                <td class="cellInfo" align=left  nowrap width=30%>{if $LABEL.modifiedtime neq ''}{$ACTIVITYDATA.modifiedtime}{/if}</td>
+                                                        </tr>
+                                                     </table>
+						     <br>
+						     <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
+							<tr>
+								<td>
+									<table border="0" cellpadding="3" cellspacing="0" width="100%">
+									<tr>
+										<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
+                                                                                <td id="cellTabInvite" class="dvtSelectedCell" align="center" nowrap="nowrap"><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabRelatedto','off');dispLayer('addTaskAlarmUI');ghide('addTaskRelatedtoUI');">{$MOD.LBL_NOTIFICATION}</td></a>
+										<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;
+                                                                                <td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabRelatedto','on');dispLayer('addTaskRelatedtoUI');ghide('addTaskAlarmUI');">{$MOD.LBL_RELATEDTO}</a></td>
+
+                                                                                <td class="dvtTabCache" style="width: 100%;">&nbsp;</td>
+									</tr>
+									</table>
+								</td>
+							</tr>
+							<tr>
+								<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
+                                                                <!-- Notification UI -->
+                                                                        <DIV id="addTaskAlarmUI" style="display:block;width:100%">
+									{if $LABEL.sendnotification neq ''}
+                                                                        <table width="100%" cellpadding="5" cellspacing="0" border="0">
+                                                                                <tr>
+                                                                                        <td width="30%" align=right><b>{$MOD.LBL_SENDNOTIFICATION}</b></td>
+                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.sendnotification}</td>
+                                                                                </tr>
+                                                                        </table>
+									{/if}
+                                                                        </DIV>
+									<div id="addTaskRelatedtoUI" style="display:none;width:100%">
+									{if $LABEL.parent_id neq ''}
+                                                                        <table width="100%" cellpadding="5" cellspacing="0" border="0">
+                                                                                <tr>
+                                                                                        <td width="30%" align=right><b>{$LABEL.parent_id}</b></td>
+                                                                                        <td width="70%" align=left>{$ACTIVITYDATA.parent_name}</td>
+                                                                                </tr>
+                                                                                <tr>
+                                                                                        <td align=right><b>{$MOD.LBL_CONTACT_NAME}</b></td>
+                                                                                        <td align=left>{$ACTIVITYDATA.contact_id}</td>
+                                                                                </tr>
+                                                                        </table>
+									{/if}
+                                                                        </div>
+								</td>
+							</tr>
+						     </table>
+						     {/if}
+
+                     	                      </td>
+					   </tr>
+                </tr>
+		<tr>
+			<td style="padding:10px">
+		           <table border=0 cellspacing=0 cellpadding=0 width=100%>
+				     {strip}<tr nowrap>
+							<td  colspan=4 style="padding:5px">
+								{if $EDIT_DUPLICATE eq 'permitted'}
+                                                                <input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="&nbsp;{$APP.LBL_EDIT_BUTTON_LABEL}&nbsp;">&nbsp;
+								{/if}
+							</td>
+							<td align=right>
+								{if $EDIT_DUPLICATE eq 'permitted'}
+                                                                <input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
+                                                                {/if}
+								{if $DELETE eq 'permitted'}
+                                                                <input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
+                                                                {/if}
+
+							</td>
+					</tr>{/strip}
+			   </table>
+			</td>
+		</tr>
+	</table>
+	</td>
+	<td width=22% valign=top style="border-left:2px dashed #cccccc;padding:13px">
+						<!-- right side relevant info -->
+
+		<!-- Tag cloud display -->
+		<table border=0 cellspacing=0 cellpadding=0 width=100% class="tagCloud">
+		<tr>
+			<td class="tagCloudTopBg"><img src="{$IMAGE_PATH}tagCloudName.gif" border=0></td>
+		</tr>
+		<tr>
+                      	<td><div id="tagdiv" style="display:visible;"><input class="textbox"  type="text" id="txtbox_tagfields" name="textbox_First Name" value="" style="width:100px;margin-left:5px;"></input>&nbsp;&nbsp;<input name="button_tagfileds" type="button" class="crmbutton small save" value="{$APP.LBL_TAG_IT}" onclick="return tagvalidate()"/></div></td>
+                </tr>
+		<tr>
+			<td class="tagCloudDisplay" valign=top> <span id="tagfields">{$ALL_TAG}</span></td>
+		</tr>
+		</table>
+		<!-- End Tag cloud display -->
+			<!-- Mail Merge-->
+				<br>
+				{if $MERGEBUTTON eq 'permitted'}
+  				<table border=0 cellspacing=0 cellpadding=0 width=100% class="rightMailMerge">
+      				<tr>
+      					   <td class="rightMailMergeHeader"><b>{$WORDTEMPLATEOPTIONS}</b></td>
+      				</tr>
+      				<tr style="height:25px">
+      						<td class="rightMailMergeContent">
+          						<select name="mergefile">{foreach key=templid item=tempflname from=$TOPTIONS}<option value="{$templid}">{$tempflname}</option>{/foreach}</select>
+          						<input class="crmbutton small create" value="{$APP.LBL_MERGE_BUTTON_LABEL}" onclick="this.form.action.value='Merge';" type="submit"></input>
+      					  </td>
+      				</tr>
+  				</table>
+				{/if}
+			</td>
+		</tr>
+		</table>
+		
+			
+			
+		
+		</div>
+		<!-- PUBLIC CONTENTS STOPS-->
+	</td>
+</tr>
+</table>
+
+{if $MODULE eq 'Products'}
+<script language="JavaScript" type="text/javascript" src="modules/Products/Productsslide.js"></script>
+<script language="JavaScript" type="text/javascript">Carousel();</script>
+{/if}
+
+<script>
+function getTagCloud()
+{ldelim}
+new Ajax.Request(
+        'index.php',
+        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+        method: 'post',
+        postBody: 'module={$MODULE}&action={$MODULE}Ajax&file=TagCloud&ajxaction=GETTAGCLOUD&recordid={$ID}',
+        onComplete: function(response) {ldelim}
+                                $("tagfields").innerHTML=response.responseText;
+                                $("txtbox_tagfields").value ='';
+                        {rdelim}
+        {rdelim}
+);
+{rdelim}
+getTagCloud();
+</script>
+<!-- added for validation -->
+<script language="javascript">
+  var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
+  var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
+  var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
+</script>
+</td>
+
+</tr></table></form>
+</td></tr></table>
+</td></tr></table>
+</td></tr></table>
+        </td></tr></table>
+        </td></tr></table>
+        </div>
+        </td>
+        <td valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+        </tr>
+        </table>
+
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ActivityEditView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ActivityEditView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ActivityEditView.tpl Tue Nov 14 03:16:10 2006
@@ -1,868 +1,868 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-{*<!-- module header -->*}
-
-<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
-<script type="text/javascript" src="jscalendar/calendar.js"></script>
-<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
-<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
-<script type="text/javascript" src="modules/{$MODULE}/Activity.js"></script>
-<script type="text/javascript">
-</script>
-
-{*<!-- Contents -->*}
-<table width="100%" cellpadding="2" cellspacing="0" border="0">
-<form name="EditView" method="POST" action="index.php">
-<input type="hidden" name="time_start" id="time_start">
-<tr>
-        <td>
-                <table cellpadding="0" cellspacing="5" border="0">
-			{include file='EditViewHidden.tpl'}
-                </table>
-<table  border="0" cellpadding="5" cellspacing="0" width="100%" >
-<tr>
-        <td class="lvtHeaderText" style="border-bottom:1px dotted #cccccc">
-
-                <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
-                        <tr><td>
-		
-				{if $OP_MODE eq 'edit_view'}   
-					<span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} - {$APP.LBL_EDITING} {$SINGLE_MOD} {$APP.LBL_INFORMATION}</span> <br>
-					<span class="small">{$UPDATEINFO}	 </span> 
-				{/if}
-				{if $OP_MODE eq 'create_view'}
-					<span class="lvtHeaderText">{$APP.LBL_CREATING} {$SINGLE_MOD}</span> <br>
-				{/if}
-			</td></tr>
-		</table>
-        </td>
-</tr>
-
-<tr><td>
-<table border="0" cellpadding="5" cellspacing="0" width="100%">
-        <tr>
-                <td valign=top align=left >
-                           <table border=0 cellspacing=0 cellpadding=0 width=100%>
-                                <tr>
-					<td align=left>
-					<!-- content cache -->
-
-					<table border=0 cellspacing=0 cellpadding=0 width=100%>
-					  <tr>
-					     <td style="padding:10px">
-						     <!-- General details -->
-						     <table border=0 cellspacing=0 cellpadding=0 width=100% >
-						     <tr>
-							<td  colspan=4 style="padding:5px">
-								<div align="center">
-								<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" {if $ACTIVITY_MODE neq 'Task'} onclick="this.form.action.value='Save';  displaydeleted();return maincheck_form();"{else} onclick="this.form.action.value='Save';  displaydeleted(); maintask_check_form();return formValidate();" {/if} type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-								<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-								</div>
-							</td>
-						     </tr>
-						     </table>
-						     <!-- included to handle the edit fields based on ui types -->
-						     {foreach key=header item=data from=$BLOCKS}
-						     <table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
-						     <tr>
-							<td colspan=4 class="tableHeading">
-								<b>{$header}</b>
-							</td>
-						     </tr>
-						     </table>
-						     {/foreach}
-						     {if $ACTIVITY_MODE neq 'Task'}
-							<input type="hidden" name="time_end" id="time_end">
-							<input type=hidden name="inviteesid" id="inviteesid" value="">
-							<input type="hidden" name="duration_hours" value="0">
-							<input type="hidden" name="duration_minutes" value="0">
-						     <table border=0 cellspacing=0 cellpadding=5 width=100% >
-							{if $LABEL.activitytype neq ''}
-							<tr>
-								<td class="cellLabel" nowrap  width=20% align="right"><b>{$MOD.LBL_EVENTTYPE}</b></td>
-								<td class="cellInfo" width=80% align="left">
-									<table>
-										<tr>
-										{foreach key=tyeparrkey item=typearr from=$ACTIVITYDATA.activitytype}
-                                                                                {foreach key=sel_value item=value from=$typearr}
-                                                                                {if $value eq 'selected' && $sel_value eq 'Meeting'}
-                                                                                        {assign var='meetcheck' value='checked'}
-                                                                                        {assign var='callcheck' value=''}
-                                                                                {else}
-                                                                                        {assign var='meetcheck' value=''}
-                                                                                        {assign var='callcheck' value='checked'}
-                                                                                {/if}
-                                                                                {/foreach}
-                                                                                {/foreach}
-											<td><input type="radio" name='activitytype' value='Call' style='vertical-align: middle;' {$callcheck}></td><td>{$APP.Call}</td><td style="width:10px">
-											<td><input type="radio" name='activitytype' value='Meeting' style='vertical-align: middle;' {$meetcheck}></td><td>{$APP.Meeting}</td><td style="width:20px">
-										</tr>
-									</table>
-								</td>
-							</tr>
-							{/if}
-							<tr>
-								<td class="cellLabel" nowrap align="right"><b>{$MOD.LBL_EVENTNAME}</b></td>
-								<td class="cellInfo" align="left"><input name="subject" type="text" class="textbox" value="{$ACTIVITYDATA.subject}" style="width:50%">&nbsp;&nbsp;&nbsp;
-								{if $LABEL.visibility neq ''}
-								{foreach key=key_one item=arr from=$ACTIVITYDATA.visibility}
-                                                                        {foreach key=sel_value item=value from=$arr}
-                                                                        {if $value eq 'selected' && $sel_value eq 'Public'}
-                                                                                {assign var="visiblecheck" value="checked"}
-                                                                        {else}
-                                                                                {assign var="visiblecheck" value=""}
-                                                                        {/if}
-                                                                        {/foreach}
-                                                                        {/foreach}
-                                                                        <input name="visibility" value="Public" type="checkbox" {$visiblecheck}>{$MOD.LBL_PUBLIC}
-								{/if}
-								</td>
-							</tr>
-							{if $LABEL.description neq ''}
-							<tr>
-                        					<td class="cellLabel" valign="top" nowrap align="right"><b>{$LABEL.description}</b></td>
-								<td class="cellInfo" align="left"><textarea style="width:100%; height : 60px;" name="description">{$ACTIVITYDATA.description}</textarea></td>
-                					</tr>
-							{/if}
-							<tr>
-								<td colspan=2 width=80% align="center">
-								<table border=0 cellspacing=0 cellpadding=3 width=80%>
-									<tr>
-										<td >{if $LABEL.eventstatus neq ''}<b>{$LABEL.eventstatus}</b>{/if}</td>
-                                                                                <td >{if $LABEL.assigned_user_id != ''}<b>
-											{$LABEL.assigned_user_id}</b>
-											{/if}</td>
-									</tr>
-									<tr>
-										<td valign=top>
-										{if $LABEL.eventstatus neq ''}
-                                                                                <select name="eventstatus" id="eventstatus" class=small>
-                                                                                        {foreach item=arr from=$ACTIVITYDATA.eventstatus}
-                                                                                        {foreach key=sel_value item=value from=$arr}
-                                                                                        <option value="{$sel_value}" {$value}>
-                                                                                                {if $APP[$sel_value] neq ''}
-                                                                                                {$APP[$sel_value]}
-                                                                                                {else}
-                                                                                                        {$sel_value}
-                                                                                                {/if}
-                                                                                        </option>
-                                                                                        {/foreach}
-                                                                                        {/foreach}
-                                                                                </select>
-										{/if}
-                                                                        	</td>
-										<td valign=top rowspan=2>
-											{if $ACTIVITYDATA.assigned_user_id != ''}
-											{assign var=check value=1}
-                                        						{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
-                                                					{foreach key=sel_value item=value from=$arr}
-                                                        					{if $value ne ''}
-                                                                					{assign var=check value=$check*0}
-                                                        					{else}
-                                                                					{assign var=check value=$check*1}
-                                                        					{/if}
-                                                					{/foreach}
-                                        						{/foreach}
-
-                                        						{if $check eq 0}
-                                                						{assign var=select_user value='checked'}
-                                                						{assign var=style_user value='display:block'}
-                                                						{assign var=style_group value='display:none'}
-                                        						{else}
-                                                						{assign var=select_group value='checked'}
-                                                						{assign var=style_user value='display:none'}
-                                                						{assign var=style_group value='display:block'}
-                                        						{/if}
-                                        						<input type="radio" name="assigntype" {$select_user} value="U" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_USER}
-                                        						{if $secondvalue.assigned_user_id neq ''}
-                                                					<input type="radio" name="assigntype" {$select_group} value="T" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_GROUP}
-                                        						{/if}
-											<span id="assign_user" style="{$style_user}">
-                                     				           			<select name="assigned_user_id">
-                                                        					{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
-                                                                				{foreach key=sel_value item=value from=$arr}
-                                                                        				<option value="{$key_one}" {$value}>{$sel_value}</option>
-                                                                				{/foreach}
-                                                        					{/foreach}
-                                                			   			</select>
-                                        			       			</span>
-
-                                        						{if $secondvalue.assigned_user_id neq ''}
-                                                					<span id="assign_team" style="{$style_group}">
-                                                        					<select name="assigned_group_name" >';
-                                                                				{foreach key=key_one item=arr from=$secondvalue.assigned_user_id}
-                                                                        			{foreach key=sel_value item=value from=$arr}
-                                                                                			<option value="{$sel_value}" {$value}>{$sel_value}</option>
-                                                                        			{/foreach}
-                                                                				{/foreach}
-                                                        					</select>
-                                                					</span>
-                                        						{/if}
-											{else}
-											<input name="assigned_user_id" value="{$CURRENTUSERID}" type="hidden">
-											{/if}
-											<br>{if $LABEL.sendnotification neq ''}<input type="checkbox" name="sendnotification" >&nbsp;{$LABEL.sendnotification}{/if}
-										</td>
-									</tr>
-									{if $LABEL.taskpriority neq ''}
-									<tr>
-										<td valign=top><b>{$LABEL.taskpriority}</b>
-										<br>
-										<select name="taskpriority" id="taskpriority">
-                                                                                        {foreach item=arr from=$ACTIVITYDATA.taskpriority}
-                                                                                        {foreach key=sel_value item=value from=$arr}
-                                                                                        <option value="{$sel_value}" {$value}>
-                                                                                                {if $APP[$sel_value] neq ''}
-                                                                                                {$APP[$sel_value]}
-                                                                                                {else}
-                                                                                                        {$sel_value}
-                                                                                                {/if}
-                                                                                        </option>
-                                                                                        {/foreach}
-                                                                                        {/foreach}
-                                                                                </select>
-										</td> 
-										
-									</tr>
-									{/if}
-								</table>
-							</td></tr>
-						     </table>
-						     <hr noshade size=1>
-						     <table border=0 cellspacing=0 cellpadding=5 width=90% align=center bgcolor="#FFFFFF">
-							<tr>
-								<td >
-									<table border=0 cellspacing=0 cellpadding=2 width=100% align=center>
-									<tr><td width=50% valign=top style="border-right:1px solid #dddddd">
-										<table border=0 cellspacing=0 cellpadding=2 width=90% align=center>
-											<tr><td colspan=3 ><b>{$MOD.LBL_EVENTSTAT}</b></td></tr>
-											<tr><td colspan=3>{$STARTHOUR}</td></tr>
-											<tr><td>
-												{foreach key=date_value item=time_value from=$ACTIVITYDATA.date_start}
-                                                                                                        {assign var=date_val value="$date_value"}
-                                                                                                        {assign var=time_val value="$time_value"}
-	                                                                                        {/foreach}
-                                                                                                <input type="text" name="date_start" id="jscal_field_date_start" class="textbox" style="width:90px" value="{$date_val}"></td><td width=100%><img border=0 src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
-													{foreach key=date_fmt item=date_str from=$secondvalue.date_start}
-													{assign var=date_vl value="$date_fmt"}
-													{/foreach}
-													<script type="text/javascript">
-														Calendar.setup ({ldelim}
-														inputField : "jscal_field_date_start", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
-														{rdelim})
-													</script>
-											</td></tr>
-										</table></td>
-										<td width=50% valign=top >
-											<table border=0 cellspacing=0 cellpadding=2 width=90% align=center>
-												<tr><td colspan=3><b>{$MOD.LBL_EVENTEDAT}</b></td></tr>
-												<tr><td colspan=3>{$ENDHOUR}
-												</td></tr>
-												<tr><td>
-													{foreach key=date_value item=time_value from=$ACTIVITYDATA.due_date}
-													{assign var=date_val value="$date_value"}
-													{assign var=time_val value="$time_value"}
-													{/foreach}
-													<input type="text" name="due_date" id="jscal_field_due_date" class="textbox" style="width:90px" value="{$date_val}"></td><td width=100%><img border=0 src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
-													{foreach key=date_fmt item=date_str from=$secondvalue.due_date}
-													{assign var=date_vl value="$date_fmt"}
-                                                                                                        {/foreach}
-													<script type="text/javascript">
-														Calendar.setup ({ldelim}
-														inputField : "jscal_field_due_date", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
-														{rdelim})
-													</script>
-												</td></tr>
-											</table>
-										</td>
-									</tr>
-								</table></td>
-							</tr>
-						     </table>
-						     <br>
-						     <table border=0 cellspacing=0 cellpadding=0 width=100% align=center>
-							<tr><td>
-								<table border=0 cellspacing=0 cellpadding=3 width=100%>
-									<tr>
-										<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
-										<td id="cellTabInvite" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');gshow('addEventInviteUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_INVITE}</a></td>
-										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-										<td id="cellTabAlarm" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','on');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');gshow('addEventAlarmUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventInviteUI');ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_REMINDER}</a></td>
-										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-										<td id="cellTabRepeat" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','on');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');ghide('addEventInviteUI');gshow('addEventRepeatUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventRelatedtoUI');">{$MOD.LBL_REPEAT}</a></td>
-										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-										<td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','on');ghide('addEventAlarmUI');ghide('addEventInviteUI');gshow('addEventRelatedtoUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventRepeatUI');">{$MOD.LBL_RELATEDTO}</a></td>
-										<td class="dvtTabCache" style="width:100%">&nbsp;</td>
-									</tr>
-								</table>
-							</td></tr>
-							<tr>
-								<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
-								<!-- Invite UI -->
-									<DIV id="addEventInviteUI" style="display:block;width:100%">
-									<table border=0 cellspacing=0 cellpadding=2 width=100%>
-										<tr>
-											<td valign=top> 
-												<table border=0 cellspacing=0 cellpadding=2 width=100%>
-													<tr><td colspan=3>
-														<ul style="padding-left:20px">
-														<li>{$MOD.LBL_INVITE_INST1}
-														<li>{$MOD.LBL_INVITE_INST2}
-														</ul>
-													</td></tr>
-													<tr>
-														<td><b>{$MOD.LBL_AVL_USERS}</b></td>
-														<td>&nbsp;</td>
-														<td><b>{$MOD.LBL_SEL_USERS}</b></td>
-													</tr>
-													<tr>
-														<td width=40% align=center valign=top>
-														<select name="availableusers" id="availableusers" class=small size=5 multiple style="height:70px;width:100%">
-														{foreach item=username key=userid from=$USERSLIST}
-														{if $userid != ''}
-														<option value="{$userid}">{$username}</option>
-														{/if}
-														{/foreach}
-														</select>
-														</td>
-														<td width=20% align=center valign=top>
-														<input type=button value="{$MOD.LBL_ADD_BUTTON} >>" class="crm button small save" style="width:100%" onClick="addColumn()"><br>
-														<input type=button value="<< {$MOD.LBL_RMV_BUTTON} " class="crm button small cancel" style="width:100%" onClick="delColumn()">
-														</td>
-														<td width=40% align=center valign=top>
-														<select name="selectedusers" id="selectedusers" class=small size=5 multiple style="height:70px;width:100%">
-														{foreach item=username key=userid from=$INVITEDUSERS}
-														{if $userid != ''}
-														<option value="{$userid}">{$username}</option>
-                                                                                                                {/if}
-                                                                                                                {/foreach}
-														</select>
-														<div align=left> {$MOD.LBL_SELUSR_INFO}
-														</div>
-														</td>
-													</tr>
-												</table>
-											</td>
-										</tr>
-									</table>
-									</DIV>
-									<!-- Reminder UI -->	
-									<DIV id="addEventAlarmUI" style="display:none;width:100%">
-									{if $LABEL.reminder_time neq ''}
-										<table>
-											{assign var=secondval value=$secondvalue.reminder_time}
-											{assign var=check value=$secondval[0]}
-											{assign var=yes_val value=$secondval[1]}
-											{assign var=no_val value=$secondval[2]}
-											
-											<tr><td>{$LABEL.reminder_time}</td><td>
-											<input type="radio" name="set_reminder" value="Yes" {$check} onClick="showBlock('reminderOptions')">&nbsp;{$yes_val}&nbsp;
-											<input type="radio" name="set_reminder" value="No" onClick="fnhide('reminderOptions')">&nbsp;{$no_val}&nbsp;
-											</td></tr>
-										</table>
-									{if $check eq 'CHECKED'}
-										{assign var=reminstyle value='style="display:block;width:100%"'}
-									{else}
-										{assign var=reminstyle value='style="display:none;width:100%"'}
-									{/if}
-									<DIV id="reminderOptions" {$reminstyle}>
-										<table border=0 cellspacing=0 cellpadding=2  width=100%>
-											<tr>
-												<td nowrap align=right width=20% valign=top><b>{$MOD.LBL_RMD_ON} : </b></td>
-												<td width=80%>
-													<table border=0>
-													<tr>
-														<td colspan=2>
-														{foreach item=val_arr from=$ACTIVITYDATA.reminder_time}
-														{assign var=start value="$val_arr[0]"}
-														{assign var=end value="$val_arr[1]"}
-														{assign var=sendname value="$val_arr[2]"}
-														{assign var=disp_text value="$val_arr[3]"}
-														{assign var=sel_val value="$val_arr[4]"}
-														<select name="{$sendname}">
-														{section name=reminder start=$start max=$end loop=$end step=1 }
-														{if $smarty.section.reminder.index eq $sel_val}
-														{assign var=sel_value value="SELECTED"}
-														{else}
-														{assign var=sel_value value=""}
-														{/if}
-														<OPTION VALUE="{$smarty.section.reminder.index}" "{$sel_value}">{$smarty.section.reminder.index}</OPTION>
-														{/section}
-														</select>
-														&nbsp;{$disp_text}
-														{/foreach}
-														</td>
-													</tr>
-													</table>
-												</td>
-											</tr>
-											<tr>
-												<td nowrap align=right>
-													{$MOD.LBL_SDRMD}
-												</td>
-												<td >
-													<input type=text name="toemail" readonly="readonly" class=textbox style="width:90%" value="{$USEREMAILID}">
-												</td>
-											</tr>
-										</table>
-									{/if}
-									</DIV>
-									</DIV>
-									<!-- Repeat UI -->
-									<div id="addEventRepeatUI" style="display:none;width:100%">
-									{if $LABEL.recurringtype neq ''}
-									<table border=0 cellspacing=0 cellpadding=2  width=100%>
-										<tr>
-											<td nowrap align=right width=20% valign=top>
-												<strong>{$MOD.LBL_REPEAT}</strong>
-											</td>
-											<td nowrap width=80% valign=top>
-												<table border=0 cellspacing=0 cellpadding=0>
-												<tr>
-							
-													<td width=20>
-													{if $ACTIVITYDATA.recurringcheck eq 'Yes'}
-														{assign var=rptstyle value='style="display:block"'}
-														{if $ACTIVITYDATA.eventrecurringtype eq 'Daily'}
-															{assign var=rptmonthstyle value='style="display:none"'}
-															{assign var=rptweekstyle value='style="display:none"'}
-														{elseif $ACTIVITYDATA.eventrecurringtype eq 'Weekly'}
-															{assign var=rptmonthstyle value='style="display:none"'}
-															{assign var=rptweekstyle value='style="display:block"'}
-														{elseif $ACTIVITYDATA.eventrecurringtype eq 'Monthly'}
-															{assign var=rptmonthstyle value='style="display:block"'}
-															{assign var=rptweekstyle value='style="display:none"'}
-														{elseif $ACTIVITYDATA.eventrecurringtype eq 'Yearly'}
-															{assign var=rptmonthstyle value='style="display:none"'}
-															{assign var=rptweekstyle value='style="display:none"'}
-														{/if}
-													<input type="checkbox" name="recurringcheck" onClick="showhide('repeatOptions')" checked>
-													{else}
-														{assign var=rptstyle value='style="display:none"'}
-														{assign var=rptmonthstyle value='style="display:none"'}
-														{assign var=rptweekstyle value='style="display:none"'}
-													<input type="checkbox" name="recurringcheck" onClick="showhide('repeatOptions')">
-													{/if}
-													</td>
-													<td colspan=2>Enable Repeat</td>
-												</tr>
-												<tr>
-													<td colspan=2>
-													<div id="repeatOptions" {$rptstyle}>
-													<table border=0 cellspacing=0 cellpadding=2>
-													<tr>
-													<td>Repeat once in every</td>
-													<td><input type="text" name="repeat_frequency" class="textbox" style="width:20px" value="{$ACTIVITYDATA.repeat_frequency}" ></td>
-													<td><select name="recurringtype">
-													<option value="Daily" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Daily'} selected {/if}>{$MOD.LBL_DAYS}</option>
-													<option value="Weekly" onClick="gshow('repeatWeekUI'); ghide('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Weekly'} selected {/if}>{$MOD.LBL_WEEKS}</option>
-												<option value="Monthly" onClick="ghide('repeatWeekUI'); gshow('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Monthly'} selected {/if}>{$MOD.LBL_MONTHS}</option>
-													<option value="Yearly" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');"; {if $ACTIVITYDATA.eventrecurringtype eq 'Yearly'} selected {/if}>{$MOD.LBL_YEAR}</option>
-													</select>
-													</td>
-												</tr>
-												</table>
-												<div id="repeatWeekUI" {$rptweekstyle}>
-												<table border=0 cellspacing=0 cellpadding=2>
-												<tr>
-													<td><input name="sun_flag" value="sunday" {$ACTIVITYDATA.week0} type="checkbox"></td><td>Sun</td>
-													<td><input name="mon_flag" value="monday" {$ACTIVITYDATA.week1} type="checkbox"></td><td>Mon</td>
-													<td><input name="tue_flag" value="tuesday" {$ACTIVITYDATA.week2} type="checkbox"></td><td>Tue</td>
-													<td><input name="wed_flag" value="wednesday" {$ACTIVITYDATA.week3} type="checkbox"></td><td>Wed</td>
-													<td><input name="thu_flag" value="thursday" {$ACTIVITYDATA.week4} type="checkbox"></td><td>Thu</td>
-													<td><input name="fri_flag" value="friday" {$ACTIVITYDATA.week5} type="checkbox"></td><td>Fri</td>
-													<td><input name="sat_flag" value="saturday" {$ACTIVITYDATA.week6} type="checkbox"></td><td>Sat</td>
-												</tr>
-												</table>
-												</div>
-	
-												<div id="repeatMonthUI" {$rptmonthstyle}>
-												<table border=0 cellspacing=0 cellpadding=2>
-												<tr>
-													<td>
-														<table border=0 cellspacing=0 cellpadding=2>
-														<tr>
-														<td><input type="radio" checked name="repeatMonth" {if $ACTIVITYDATA.repeatMonth eq 'date'} checked {/if} value="date"></td><td>on</td><td><input type="text" class=textbox style="width:20px" value="{$ACTIVITYDATA.repeatMonth_date}" name="repeatMonth_date" ></td><td>day of the month</td>
-														</tr>
-														</table>
-													</td>
-												</tr>
-												<tr>
-													<td>
-														<table border=0 cellspacing=0 cellpadding=2>
-														<tr><td>
-														<input type="radio" name="repeatMonth" {if $ACTIVITYDATA.repeatMonth eq 'day'} checked {/if} value="day"></td>
-														<td>on</td>
-														<td>
-														<select name="repeatMonth_daytype">
-															<option value="first" {if $ACTIVITYDATA.repeatMonth_daytype eq 'first'} selected {/if}>First</option>
-															<option value="last" {if $ACTIVITYDATA.repeatMonth_daytype eq 'last'} selected {/if}>Last</option>
-														</select>
-														</td>
-														<td>
-														<select name="repeatMonth_day">
-															<option value=1 {if $ACTIVITYDATA.repeatMonth_day eq 1} selected {/if}>{$MOD.LBL_DAY1}</option>
-															<option value=2 {if $ACTIVITYDATA.repeatMonth_day eq 2} selected {/if}>{$MOD.LBL_DAY2}</option>
-															<option value=3 {if $ACTIVITYDATA.repeatMonth_day eq 3} selected {/if}>{$MOD.LBL_DAY3}</option>
-															<option value=4 {if $ACTIVITYDATA.repeatMonth_day eq 4} selected {/if}>{$MOD.LBL_DAY4}</option>
-															<option value=5 {if $ACTIVITYDATA.repeatMonth_day eq 5} selected {/if}>{$MOD.LBL_DAY5}</option>
-															<option value=6 {if $ACTIVITYDATA.repeatMonth_day eq 6} selected {/if}>{$MOD.LBL_DAY6}</option>
-														</select>
-														</td>
-														</tr>
-														</table>
-													</td>
-												</tr>
-												</table>
-												</div>
-								
-											</div>
-										</td>
-										</tr>
-									</table>
-								</td>
-							</tr>
-						</table>
-						{/if}
-						</div>
-						<div id="addEventRelatedtoUI" style="display:none;width:100%">
-						<table width="100%" cellpadding="5" cellspacing="0" border="0">
-							{if $LABEL.parent_id neq ''}	
-							<tr>
-								<td><b>{$MOD.LBL_RELATEDTO}</b></td>
-								<td>
-									<input name="parent_id" type="hidden" value="{$secondvalue.parent_id}">
-									<select name="parent_type" class="small" id="parent_type" onChange="document.EditView.parent_name.value='';document.EditView.parent_id.value=''">
-									{section name=combo loop=$LABEL.parent_id}
-										<option value="{$fldlabel_combo.parent_id[combo]}" {$fldlabel_sel.parent_id[combo]}>{$LABEL.parent_id[combo]}</option>
-									{/section}
-                                             				</select>
-								</td>
-								<td>
-									<div id="eventrelatedto" align="left">
-										<input name="parent_name" readonly type="text" class="calTxt small" value="{$ACTIVITYDATA.parent_id}">
-										<input type="button" name="selectparent" class="crmButton small edit" value="Select" onclick="return window.open('index.php?module='+document.EditView.parent_type.value+'&action=Popup','test','width=640,height=602,resizable=0,scrollbars=0,top=150,left=200');">
-									</div>
-								</td>
-							</tr>
-							{/if}
-							<tr>
-								<td><b>{$APP.Contacts}</b></td>
-								<td colspan="2">
-									<input name="contactidlist" id="contactidlist" value="{$CONTACTSID}" type="hidden">
-									<textarea rows="5" name="contactlist" readonly="readonly" class="calTxt">
-									{$CONTACTSNAME}
-									</textarea>&nbsp;
-									<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&return_module=Calendar&popuptype=detailview&select=enable&form=EditView&form_submit=false','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="Select Contacts">
-								</td>
-							</tr>
-						</table>
-					</div>
-			</td>
-		</tr>
-		</table>
-		<!-- Alarm, Repeat, Invite stops-->
-		{else}
-		<table border="0" cellpadding="5" cellspacing="0" width="100%">
-			<tr>
-                        	<td class="cellLabel" width="20%" align="right"><b>{$MOD.LBL_TODO}</b></td>
-                        	<td class="cellInfo" width="80%" align="left"><input name="subject" value="{$ACTIVITYDATA.subject}" class="textbox" style="width: 70%;" type="text"></td>
-           		</tr>
-			
-			<tr>
-				{if $LABEL.description != ''}
-				<td class="cellLabel" align="right"><b>{$LABEL.description}</b></td>
-				<td class="cellInfo" align="left"><textarea style="width: 90%; height: 60px;" name="description">{$ACTIVITYDATA.description}</textarea>
-				{/if}
-				
-			</tr>
-			<tr>
-		    		<td colspan="2" align="center" width="100%" style="padding:0px">
-					<table border="0" cellpadding="5" cellspacing="1" width="100%">
-            					<tr>
-							{if $LABEL.taskstatus != ''}
-							<td class="cellLabel" width=33% align="left"><b>{$LABEL.taskstatus}</b></td>
-							{/if}
-							{if $LABEL.taskpriority != ''}
-              						<td class="cellLabel" width=33% align="left"><b>{$LABEL.taskpriority}</b></td>
-							{/if}
-              						{if $LABEL.assigned_user_id != ''}
-							<td class="cellLabel" width=34% align="left"><b>{$LABEL.assigned_user_id}</b></td>
-							{/if}
-						</tr>
-						<tr>
-							{if $LABEL.taskstatus != ''}
-							<td align="left" valign="top">
-								<select name="taskstatus" id="taskstatus" class=small>
-                                        			{foreach item=arr from=$ACTIVITYDATA.taskstatus}
-                                        			{foreach key=sel_value item=value from=$arr}
-                                                			<option value="{$sel_value}" {$value}>
-                                                        		{if $APP[$sel_value] neq ''}
-                                                                		{$APP[$sel_value]}
-                                                        		{else}
-                                                                		{$sel_value}
-                                                        		{/if}
-                                                			</option>
-                                        			{/foreach}
-                                        			{/foreach}
-                                				</select>
-							</td>
-							{/if}
-							{if $LABEL.taskpriority != ''}
-							<td align="left" valign="top">
-								<select name="taskpriority" id="taskpriority" class=small>
-        			                                {foreach item=arr from=$ACTIVITYDATA.taskpriority}
-                                			        {foreach key=sel_value item=value from=$arr}
-			                                                <option value="{$sel_value}" {$value}>
-                        		                                {if $APP[$sel_value] neq ''}
-                                        		                        {$APP[$sel_value]}
-                                                       			{else}
-                                                                		{$sel_value}
-                                                        		{/if}
-                                                			</option>
-                                        			{/foreach}
-                                        			{/foreach}
-                                				</select>
-							</td>
-							{/if}
-							{if $LABEL.assigned_user_id != ''}
-							<td align="left" valign="top">
-								{assign var=check value=1}
-                                        			{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
-			                                        {foreach key=sel_value item=value from=$arr}
-                        		                              	{if $value ne ''}
-                                        		                      	{assign var=check value=$check*0}
-                                                        		{else}
-                                                                		{assign var=check value=$check*1}
-                                                        		{/if}
-                                                		{/foreach}
-                                        			{/foreach}
-								{if $check eq 0}
-                                             				{assign var=select_user value='checked'}
-                                                			{assign var=style_user value='display:block'}
-                                                			{assign var=style_group value='display:none'}
-                                        			{else}
-                                                			{assign var=select_group value='checked'}
-                                                			{assign var=style_user value='display:none'}
-                                                			{assign var=style_group value='display:block'}
-                                        			{/if}
-				                                <input type="radio" name="assigntype" {$select_user} value="U" onclick="toggleAssignType(this.value)">&nbsp;User
-				                                {if $secondvalue.assigned_user_id neq ''}
-                                			        <input type="radio" name="assigntype" {$select_group} value="T" onclick="toggleAssignType(this.value)">&nbsp;Group
-                                        			{/if}
-                                        			<span id="assign_user" style="{$style_user}">
-                                                		<select name="assigned_user_id" class=small>
-                                                        	{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
-				                                {foreach key=sel_value item=value from=$arr}
-                                		                	<option value="{$key_one}" {$value}>{$sel_value}</option>
-								{/foreach}
-                                                        	{/foreach}
-                                                		</select>
-								</span>
-								{if $secondvalue.assigned_user_id neq ''}
-                                                		<span id="assign_team" style="{$style_group}">
-                                                        		<select name="assigned_group_name" class=small>';
-                                                                		{foreach key=key_one item=arr from=$secondvalue.assigned_user_id}
-                                                                       		{foreach key=sel_value item=value from=$arr}
-                                                                               		<option value="{$sel_value}" {$value}>{$sel_value}</option>
-                                                                       		{/foreach}
-                                                                		{/foreach}
-                                                        		</select>
-				                                </span>
-                                				{/if}	
-							</td>
-							{else}
-								<input name="assigned_user_id" value="{$CURRENTUSERID}" type="hidden">
-							{/if}
-						</tr>
-					</table>
-				</td>
-			</tr>
-			</table>
-			<table border="0" cellpadding="0" cellspacing="1" width="100%" align=center>
-			<tr><td width=50% valign=top>
-				<table border=0 cellspacing=0 cellpadding=2 width=100% align=center >
-					<tr><td colspan=3  class="mailSubHeader"><b>{$MOD.LBL_TODODATETIME}</b></td></tr>
-					<tr><td colspan=3>{$STARTHOUR}</td></tr>
-					<tr><td>
-							{foreach key=date_value item=time_value from=$ACTIVITYDATA.date_start}
-	                                        		{assign var=date_val value="$date_value"}
-								{assign var=time_val value="$time_value"}
-                                        		{/foreach}
-							<input name="date_start" id="date_start" class="textbox" style="width: 90px;" value="{$date_val}" type="text"></td><td width=100%><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start" align="middle" border="0">
-							{foreach key=date_fmt item=date_str from=$secondvalue.date_start}
-								{assign var=date_vl value="$date_fmt"}
-							{/foreach}				
-							<script type="text/javascript">
-								Calendar.setup ({ldelim}
-	        	                                	inputField : "date_start", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
-							{rdelim})
-							</script>
-						</td></tr>
-					</table></td>
-					<td width=50% valign="top">
-                                                <table border="0" cellpadding="2" cellspacing="0" width="100%" align=center>
-							<tr><td class="mailSubHeader" colspan=3><b>{$LABEL.due_date}</b></td></tr>
-							<tr><td>
-								{foreach key=date_value item=time_value from=$ACTIVITYDATA.due_date}
-									{assign var=date_val value="$date_value"}
-									{assign var=time_val value="$time_value"}
-								{/foreach}
-								<input name="due_date" id="due_date" class="textbox" style="width: 90px;" value="{$date_val}" type="text"></td><td width=100%><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date" border="0">
-								{foreach key=date_fmt item=date_str from=$secondvalue.due_date}
-                                                			{assign var=date_vl value="$date_fmt"}
-                                        			{/foreach}
-				      				<script type="text/javascript">
-								Calendar.setup ({ldelim}
-	                                        			inputField : "due_date", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
-					   			{rdelim})
-								</script>
-        						</td></tr>
-						</table></td>
-					</tr>
-				</table>
-				<br><br>
-		<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%" bgcolor="#FFFFFF">
-			<tr>
-				<td>
-					<table border="0" cellpadding="3" cellspacing="0" width="100%">
-						<tr>
-							<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
-							<td id="cellTabInvite" class="dvtSelectedCell" align="center" nowrap="nowrap"><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabRelatedto','off');Taskshow('addTaskAlarmUI','todo',document.EditView.date_start.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value);ghide('addTaskRelatedtoUI');">{$MOD.LBL_NOTIFICATION}</a></td>
-							<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;
-                                                        <td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabRelatedto','on');Taskshow('addTaskRelatedtoUI','todo',document.EditView.date_start.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value);ghide('addTaskAlarmUI');">{$MOD.LBL_RELATEDTO}</a></td>
-                                                        <td class="dvtTabCache" style="width:100%">
-						</tr>
-
-					</table>
-				</td>
-			</tr>
-			<tr>
-				<td class="dvtContentSpace" style="padding: 10px; height: 120px;" align="left" valign="top" width="100%">
-			<!-- Reminder UI -->
-			<div id="addTaskAlarmUI" style="display: block; width: 100%;">
-			{if $LABEL.sendnotification != ''}
-                	<table>
-				<tr><td>{$LABEL.sendnotification}</td>
-					{if $ACTIVITYDATA.sendnotification eq 1}
-                                        <td>
-                                                <input name="sendnotification" type="checkbox" checked>
-                                        </td>
-                                	{else}
-                                        <td>
-                                                <input name="sendnotification" type="checkbox">
-                                        </td>
-                                	{/if}
-				</tr>
-			</table>
-			{/if}
-			</div>
-			<div id="addTaskRelatedtoUI" style="display:none;width:100%">
-           		     <table width="100%" cellpadding="5" cellspacing="0" border="0">
-			     {if $LABEL.parent_id neq ''}
-                	     <tr>
-                        	     <td><b>{$MOD.LBL_RELATEDTO}</b></td>
-                                     <td>
-					<input name="parent_id" type="hidden" value="{$secondvalue.parent_id}">
-                                             <select name="parent_type" class="small" id="parent_type" onChange="document.EditView.parent_name.value='';document.EditView.parent_id.value=''">
-							{section name=combo loop=$LABEL.parent_id}
-								<option value="{$fldlabel_combo.parent_id[combo]}" {$fldlabel_sel.parent_id[combo]}>{$LABEL.parent_id[combo]}</option>
-							{/section}
-					     </select>
-                                     </td>
-                                     <td>
-                              	        <div id="taskrelatedto" align="left">
-						<input name="parent_name" readonly type="text" class="calTxt small" value="{$ACTIVITYDATA.parent_id}">
-						<input type="button" name="selectparent" class="crmButton small edit" value="Select" onclick="return window.open('index.php?module='+document.EditView.parent_type.value+'&action=Popup','test','width=640,height=602,resizable=0,scrollbars=0,top=150,left=200');">
-					 </div>
-                                     </td>
-			     </tr>
-			     {/if}
-			     {if $LABEL.contact_id neq ''}	
-			     <tr>
-                                     <td><b>{$LABEL.contact_id}</b></td>
-				     <td colspan="2">
-						<input name="contact_name" readonly type="text" class="calTxt" value="{$ACTIVITYDATA.contact_id}"><input name="contact_id" type="hidden" value="{$secondvalue.contact_id}">&nbsp;
-						<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="Select Contact">
-				     </td>
-                             </tr>
-			     {/if}
-		</table>
-              	</div>
-                </td></tr></table>
-
-		{/if}
-			</td></tr>
-			<tr>
-				<td  colspan=4 style="padding:5px">
-					<div align="center">
-                        	        	<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" {if $ACTIVITY_MODE neq 'Task'} onclick="this.form.action.value='Save';  displaydeleted();return maincheck_form();"{else} onclick="this.form.action.value='Save';  displaydeleted(); maintask_check_form();return formValidate();" {/if} type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-						<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-					</div>
-				</td>
-			</tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-</td></tr>
-</form></table>
-</td></tr></table>
-</td></tr></table>
-</td></tr></table>
-        </td></tr></table>
-        </td></tr></table>
-        </div>
-        </td>
-        <td valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-        </tr>
-        </table>
-<script>
-{if $ACTIVITY_MODE eq 'Task'}
-	var fieldname = new Array('subject','date_start','time_start','taskstatus');
-	var fieldlabel = new Array('Subject','Date','Time','Status');
-	var fielddatatype = new Array('V~M','D~M~time_start','T~O','V~O');
-{else}
-	var fieldname = new Array('subject','date_start','due_date','taskpriority','sendnotification','parent_id','contact_id','reminder_time','recurringtype');
-	var fieldlabel = new Array('Subject','Start Date','Due Date','Priority','Send Notification','Related To','Contact Name','Send Reminder','Recurrence');
-	var fielddatatype = new Array('V~M','D~M','D~M~OTH~GE~date_start~Start Date','V~O','C~O','I~O','I~O','I~O','O~O');
-{/if}
-</script>
-<script>	
-	var ProductImages=new Array();
-	var count=0;
-
-	function delRowEmt(imagename)
-	{ldelim}
-		ProductImages[count++]=imagename;
-	{rdelim}
-
-	function displaydeleted()
-	{ldelim}
-		var imagelists='';
-		for(var x = 0; x < ProductImages.length; x++)
-		{ldelim}
-			imagelists+=ProductImages[x]+'###';
-		{rdelim}
-
-		if(imagelists != '')
-			document.EditView.imagelist.value=imagelists
-	{rdelim}
-
-</script>
-<script language="JavaScript" type="text/JavaScript">
-	setObjects();
-</script>
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+{*<!-- module header -->*}
+
+<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
+<script type="text/javascript" src="jscalendar/calendar.js"></script>
+<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
+<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
+<script type="text/javascript" src="modules/{$MODULE}/Activity.js"></script>
+<script type="text/javascript">
+</script>
+
+{*<!-- Contents -->*}
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+<form name="EditView" method="POST" action="index.php">
+<input type="hidden" name="time_start" id="time_start">
+<tr>
+        <td>
+                <table cellpadding="0" cellspacing="5" border="0">
+			{include file='EditViewHidden.tpl'}
+                </table>
+<table  border="0" cellpadding="5" cellspacing="0" width="100%" >
+<tr>
+        <td class="lvtHeaderText" style="border-bottom:1px dotted #cccccc">
+
+                <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
+                        <tr><td>
+		
+				{if $OP_MODE eq 'edit_view'}   
+					<span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} - {$APP.LBL_EDITING} {$SINGLE_MOD} {$APP.LBL_INFORMATION}</span> <br>
+					<span class="small">{$UPDATEINFO}	 </span> 
+				{/if}
+				{if $OP_MODE eq 'create_view'}
+					<span class="lvtHeaderText">{$APP.LBL_CREATING} {$SINGLE_MOD}</span> <br>
+				{/if}
+			</td></tr>
+		</table>
+        </td>
+</tr>
+
+<tr><td>
+<table border="0" cellpadding="5" cellspacing="0" width="100%">
+        <tr>
+                <td valign=top align=left >
+                           <table border=0 cellspacing=0 cellpadding=0 width=100%>
+                                <tr>
+					<td align=left>
+					<!-- content cache -->
+
+					<table border=0 cellspacing=0 cellpadding=0 width=100%>
+					  <tr>
+					     <td style="padding:10px">
+						     <!-- General details -->
+						     <table border=0 cellspacing=0 cellpadding=0 width=100% >
+						     <tr>
+							<td  colspan=4 style="padding:5px">
+								<div align="center">
+								<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" {if $ACTIVITY_MODE neq 'Task'} onclick="this.form.action.value='Save';  displaydeleted();return maincheck_form();"{else} onclick="this.form.action.value='Save';  displaydeleted(); maintask_check_form();return formValidate();" {/if} type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+								<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+								</div>
+							</td>
+						     </tr>
+						     </table>
+						     <!-- included to handle the edit fields based on ui types -->
+						     {foreach key=header item=data from=$BLOCKS}
+						     <table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
+						     <tr>
+							<td colspan=4 class="tableHeading">
+								<b>{$header}</b>
+							</td>
+						     </tr>
+						     </table>
+						     {/foreach}
+						     {if $ACTIVITY_MODE neq 'Task'}
+							<input type="hidden" name="time_end" id="time_end">
+							<input type=hidden name="inviteesid" id="inviteesid" value="">
+							<input type="hidden" name="duration_hours" value="0">
+							<input type="hidden" name="duration_minutes" value="0">
+						     <table border=0 cellspacing=0 cellpadding=5 width=100% >
+							{if $LABEL.activitytype neq ''}
+							<tr>
+								<td class="cellLabel" nowrap  width=20% align="right"><b>{$MOD.LBL_EVENTTYPE}</b></td>
+								<td class="cellInfo" width=80% align="left">
+									<table>
+										<tr>
+										{foreach key=tyeparrkey item=typearr from=$ACTIVITYDATA.activitytype}
+                                                                                {foreach key=sel_value item=value from=$typearr}
+                                                                                {if $value eq 'selected' && $sel_value eq 'Meeting'}
+                                                                                        {assign var='meetcheck' value='checked'}
+                                                                                        {assign var='callcheck' value=''}
+                                                                                {else}
+                                                                                        {assign var='meetcheck' value=''}
+                                                                                        {assign var='callcheck' value='checked'}
+                                                                                {/if}
+                                                                                {/foreach}
+                                                                                {/foreach}
+											<td><input type="radio" name='activitytype' value='Call' style='vertical-align: middle;' {$callcheck}></td><td>{$APP.Call}</td><td style="width:10px">
+											<td><input type="radio" name='activitytype' value='Meeting' style='vertical-align: middle;' {$meetcheck}></td><td>{$APP.Meeting}</td><td style="width:20px">
+										</tr>
+									</table>
+								</td>
+							</tr>
+							{/if}
+							<tr>
+								<td class="cellLabel" nowrap align="right"><b>{$MOD.LBL_EVENTNAME}</b></td>
+								<td class="cellInfo" align="left"><input name="subject" type="text" class="textbox" value="{$ACTIVITYDATA.subject}" style="width:50%">&nbsp;&nbsp;&nbsp;
+								{if $LABEL.visibility neq ''}
+								{foreach key=key_one item=arr from=$ACTIVITYDATA.visibility}
+                                                                        {foreach key=sel_value item=value from=$arr}
+                                                                        {if $value eq 'selected' && $sel_value eq 'Public'}
+                                                                                {assign var="visiblecheck" value="checked"}
+                                                                        {else}
+                                                                                {assign var="visiblecheck" value=""}
+                                                                        {/if}
+                                                                        {/foreach}
+                                                                        {/foreach}
+                                                                        <input name="visibility" value="Public" type="checkbox" {$visiblecheck}>{$MOD.LBL_PUBLIC}
+								{/if}
+								</td>
+							</tr>
+							{if $LABEL.description neq ''}
+							<tr>
+                        					<td class="cellLabel" valign="top" nowrap align="right"><b>{$LABEL.description}</b></td>
+								<td class="cellInfo" align="left"><textarea style="width:100%; height : 60px;" name="description">{$ACTIVITYDATA.description}</textarea></td>
+                					</tr>
+							{/if}
+							<tr>
+								<td colspan=2 width=80% align="center">
+								<table border=0 cellspacing=0 cellpadding=3 width=80%>
+									<tr>
+										<td >{if $LABEL.eventstatus neq ''}<b>{$LABEL.eventstatus}</b>{/if}</td>
+                                                                                <td >{if $LABEL.assigned_user_id != ''}<b>
+											{$LABEL.assigned_user_id}</b>
+											{/if}</td>
+									</tr>
+									<tr>
+										<td valign=top>
+										{if $LABEL.eventstatus neq ''}
+                                                                                <select name="eventstatus" id="eventstatus" class=small>
+                                                                                        {foreach item=arr from=$ACTIVITYDATA.eventstatus}
+                                                                                        {foreach key=sel_value item=value from=$arr}
+                                                                                        <option value="{$sel_value}" {$value}>
+                                                                                                {if $MOD.$sel_value neq ''}
+                                                                                                {$MOD.$sel_value}
+                                                                                                {else}
+                                                                                                        {$sel_value}
+                                                                                                {/if}
+                                                                                        </option>
+                                                                                        {/foreach}
+                                                                                        {/foreach}
+                                                                                </select>
+										{/if}
+                                                                        	</td>
+										<td valign=top rowspan=2>
+											{if $ACTIVITYDATA.assigned_user_id != ''}
+											{assign var=check value=1}
+                                        						{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
+                                                					{foreach key=sel_value item=value from=$arr}
+                                                        					{if $value ne ''}
+                                                                					{assign var=check value=$check*0}
+                                                        					{else}
+                                                                					{assign var=check value=$check*1}
+                                                        					{/if}
+                                                					{/foreach}
+                                        						{/foreach}
+
+                                        						{if $check eq 0}
+                                                						{assign var=select_user value='checked'}
+                                                						{assign var=style_user value='display:block'}
+                                                						{assign var=style_group value='display:none'}
+                                        						{else}
+                                                						{assign var=select_group value='checked'}
+                                                						{assign var=style_user value='display:none'}
+                                                						{assign var=style_group value='display:block'}
+                                        						{/if}
+                                        						<input type="radio" name="assigntype" {$select_user} value="U" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_USER}
+                                        						{if $secondvalue.assigned_user_id neq ''}
+                                                					<input type="radio" name="assigntype" {$select_group} value="T" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_GROUP}
+                                        						{/if}
+											<span id="assign_user" style="{$style_user}">
+                                     				           			<select name="assigned_user_id">
+                                                        					{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
+                                                                				{foreach key=sel_value item=value from=$arr}
+                                                                        				<option value="{$key_one}" {$value}>{$sel_value}</option>
+                                                                				{/foreach}
+                                                        					{/foreach}
+                                                			   			</select>
+                                        			       			</span>
+
+                                        						{if $secondvalue.assigned_user_id neq ''}
+                                                					<span id="assign_team" style="{$style_group}">
+                                                        					<select name="assigned_group_name" >';
+                                                                				{foreach key=key_one item=arr from=$secondvalue.assigned_user_id}
+                                                                        			{foreach key=sel_value item=value from=$arr}
+                                                                                			<option value="{$sel_value}" {$value}>{$sel_value}</option>
+                                                                        			{/foreach}
+                                                                				{/foreach}
+                                                        					</select>
+                                                					</span>
+                                        						{/if}
+											{else}
+											<input name="assigned_user_id" value="{$CURRENTUSERID}" type="hidden">
+											{/if}
+											<br>{if $LABEL.sendnotification neq ''}<input type="checkbox" name="sendnotification" >&nbsp;{$LABEL.sendnotification}{/if}
+										</td>
+									</tr>
+									{if $LABEL.taskpriority neq ''}
+									<tr>
+										<td valign=top><b>{$LABEL.taskpriority}</b>
+										<br>
+										<select name="taskpriority" id="taskpriority">
+                                                                                        {foreach item=arr from=$ACTIVITYDATA.taskpriority}
+                                                                                        {foreach key=sel_value item=value from=$arr}
+                                                                                        <option value="{$sel_value}" {$value}>
+                                                                                                {if $MOD.$sel_value neq ''}
+                                                                                                {$MOD.$sel_value}
+                                                                                                {else}
+                                                                                                        {$sel_value}
+                                                                                                {/if}
+                                                                                        </option>
+                                                                                        {/foreach}
+                                                                                        {/foreach}
+                                                                                </select>
+										</td> 
+										
+									</tr>
+									{/if}
+								</table>
+							</td></tr>
+						     </table>
+						     <hr noshade size=1>
+						     <table border=0 cellspacing=0 cellpadding=5 width=90% align=center bgcolor="#FFFFFF">
+							<tr>
+								<td >
+									<table border=0 cellspacing=0 cellpadding=2 width=100% align=center>
+									<tr><td width=50% valign=top style="border-right:1px solid #dddddd">
+										<table border=0 cellspacing=0 cellpadding=2 width=90% align=center>
+											<tr><td colspan=3 ><b>{$MOD.LBL_EVENTSTAT}</b></td></tr>
+											<tr><td colspan=3>{$STARTHOUR}</td></tr>
+											<tr><td>
+												{foreach key=date_value item=time_value from=$ACTIVITYDATA.date_start}
+                                                                                                        {assign var=date_val value="$date_value"}
+                                                                                                        {assign var=time_val value="$time_value"}
+	                                                                                        {/foreach}
+                                                                                                <input type="text" name="date_start" id="jscal_field_date_start" class="textbox" style="width:90px" value="{$date_val}"></td><td width=100%><img border=0 src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
+													{foreach key=date_fmt item=date_str from=$secondvalue.date_start}
+													{assign var=date_vl value="$date_fmt"}
+													{/foreach}
+													<script type="text/javascript">
+														Calendar.setup ({ldelim}
+														inputField : "jscal_field_date_start", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
+														{rdelim})
+													</script>
+											</td></tr>
+										</table></td>
+										<td width=50% valign=top >
+											<table border=0 cellspacing=0 cellpadding=2 width=90% align=center>
+												<tr><td colspan=3><b>{$MOD.LBL_EVENTEDAT}</b></td></tr>
+												<tr><td colspan=3>{$ENDHOUR}
+												</td></tr>
+												<tr><td>
+													{foreach key=date_value item=time_value from=$ACTIVITYDATA.due_date}
+													{assign var=date_val value="$date_value"}
+													{assign var=time_val value="$time_value"}
+													{/foreach}
+													<input type="text" name="due_date" id="jscal_field_due_date" class="textbox" style="width:90px" value="{$date_val}"></td><td width=100%><img border=0 src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
+													{foreach key=date_fmt item=date_str from=$secondvalue.due_date}
+													{assign var=date_vl value="$date_fmt"}
+                                                                                                        {/foreach}
+													<script type="text/javascript">
+														Calendar.setup ({ldelim}
+														inputField : "jscal_field_due_date", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
+														{rdelim})
+													</script>
+												</td></tr>
+											</table>
+										</td>
+									</tr>
+								</table></td>
+							</tr>
+						     </table>
+						     <br>
+						     <table border=0 cellspacing=0 cellpadding=0 width=100% align=center>
+							<tr><td>
+								<table border=0 cellspacing=0 cellpadding=3 width=100%>
+									<tr>
+										<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+										<td id="cellTabInvite" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');gshow('addEventInviteUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_INVITE}</a></td>
+										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+										<td id="cellTabAlarm" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','on');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','off');gshow('addEventAlarmUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventInviteUI');ghide('addEventRepeatUI');ghide('addEventRelatedtoUI');">{$MOD.LBL_REMINDER}</a></td>
+										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+										<td id="cellTabRepeat" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','on');switchClass('cellTabRelatedto','off');ghide('addEventAlarmUI');ghide('addEventInviteUI');gshow('addEventRepeatUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventRelatedtoUI');">{$MOD.LBL_REPEAT}</a></td>
+										<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+										<td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabAlarm','off');switchClass('cellTabRepeat','off');switchClass('cellTabRelatedto','on');ghide('addEventAlarmUI');ghide('addEventInviteUI');gshow('addEventRelatedtoUI','',document.EditView.date_start.value,document.EditView.due_date.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value,document.EditView.endhr.value,document.EditView.endmin.value,document.EditView.endfmt.value);ghide('addEventRepeatUI');">{$MOD.LBL_RELATEDTO}</a></td>
+										<td class="dvtTabCache" style="width:100%">&nbsp;</td>
+									</tr>
+								</table>
+							</td></tr>
+							<tr>
+								<td width=100% valign=top align=left class="dvtContentSpace" style="padding:10px;height:120px">
+								<!-- Invite UI -->
+									<DIV id="addEventInviteUI" style="display:block;width:100%">
+									<table border=0 cellspacing=0 cellpadding=2 width=100%>
+										<tr>
+											<td valign=top> 
+												<table border=0 cellspacing=0 cellpadding=2 width=100%>
+													<tr><td colspan=3>
+														<ul style="padding-left:20px">
+														<li>{$MOD.LBL_INVITE_INST1}
+														<li>{$MOD.LBL_INVITE_INST2}
+														</ul>
+													</td></tr>
+													<tr>
+														<td><b>{$MOD.LBL_AVL_USERS}</b></td>
+														<td>&nbsp;</td>
+														<td><b>{$MOD.LBL_SEL_USERS}</b></td>
+													</tr>
+													<tr>
+														<td width=40% align=center valign=top>
+														<select name="availableusers" id="availableusers" class=small size=5 multiple style="height:70px;width:100%">
+														{foreach item=username key=userid from=$USERSLIST}
+														{if $userid != ''}
+														<option value="{$userid}">{$username}</option>
+														{/if}
+														{/foreach}
+														</select>
+														</td>
+														<td width=20% align=center valign=top>
+														<input type=button value="{$MOD.LBL_ADD_BUTTON} >>" class="crm button small save" style="width:100%" onClick="addColumn()"><br>
+														<input type=button value="<< {$MOD.LBL_RMV_BUTTON} " class="crm button small cancel" style="width:100%" onClick="delColumn()">
+														</td>
+														<td width=40% align=center valign=top>
+														<select name="selectedusers" id="selectedusers" class=small size=5 multiple style="height:70px;width:100%">
+														{foreach item=username key=userid from=$INVITEDUSERS}
+														{if $userid != ''}
+														<option value="{$userid}">{$username}</option>
+                                                                                                                {/if}
+                                                                                                                {/foreach}
+														</select>
+														<div align=left> {$MOD.LBL_SELUSR_INFO}
+														</div>
+														</td>
+													</tr>
+												</table>
+											</td>
+										</tr>
+									</table>
+									</DIV>
+									<!-- Reminder UI -->	
+									<DIV id="addEventAlarmUI" style="display:none;width:100%">
+									{if $LABEL.reminder_time neq ''}
+										<table>
+											{assign var=secondval value=$secondvalue.reminder_time}
+											{assign var=check value=$secondval[0]}
+											{assign var=yes_val value=$secondval[1]}
+											{assign var=no_val value=$secondval[2]}
+											
+											<tr><td>{$LABEL.reminder_time}</td><td>
+											<input type="radio" name="set_reminder" value="Yes" {$check} onClick="showBlock('reminderOptions')">&nbsp;{$yes_val}&nbsp;
+											<input type="radio" name="set_reminder" value="No" onClick="fnhide('reminderOptions')">&nbsp;{$no_val}&nbsp;
+											</td></tr>
+										</table>
+									{if $check eq 'CHECKED'}
+										{assign var=reminstyle value='style="display:block;width:100%"'}
+									{else}
+										{assign var=reminstyle value='style="display:none;width:100%"'}
+									{/if}
+									<DIV id="reminderOptions" {$reminstyle}>
+										<table border=0 cellspacing=0 cellpadding=2  width=100%>
+											<tr>
+												<td nowrap align=right width=20% valign=top><b>{$MOD.LBL_RMD_ON} : </b></td>
+												<td width=80%>
+													<table border=0>
+													<tr>
+														<td colspan=2>
+														{foreach item=val_arr from=$ACTIVITYDATA.reminder_time}
+														{assign var=start value="$val_arr[0]"}
+														{assign var=end value="$val_arr[1]"}
+														{assign var=sendname value="$val_arr[2]"}
+														{assign var=disp_text value="$val_arr[3]"}
+														{assign var=sel_val value="$val_arr[4]"}
+														<select name="{$sendname}">
+														{section name=reminder start=$start max=$end loop=$end step=1 }
+														{if $smarty.section.reminder.index eq $sel_val}
+														{assign var=sel_value value="SELECTED"}
+														{else}
+														{assign var=sel_value value=""}
+														{/if}
+														<OPTION VALUE="{$smarty.section.reminder.index}" "{$sel_value}">{$smarty.section.reminder.index}</OPTION>
+														{/section}
+														</select>
+														&nbsp;{$disp_text}
+														{/foreach}
+														</td>
+													</tr>
+													</table>
+												</td>
+											</tr>
+											<tr>
+												<td nowrap align=right>
+													{$MOD.LBL_SDRMD}
+												</td>
+												<td >
+													<input type=text name="toemail" readonly="readonly" class=textbox style="width:90%" value="{$USEREMAILID}">
+												</td>
+											</tr>
+										</table>
+									{/if}
+									</DIV>
+									</DIV>
+									<!-- Repeat UI -->
+									<div id="addEventRepeatUI" style="display:none;width:100%">
+									{if $LABEL.recurringtype neq ''}
+									<table border=0 cellspacing=0 cellpadding=2  width=100%>
+										<tr>
+											<td nowrap align=right width=20% valign=top>
+												<strong>{$MOD.LBL_REPEAT}</strong>
+											</td>
+											<td nowrap width=80% valign=top>
+												<table border=0 cellspacing=0 cellpadding=0>
+												<tr>
+							
+													<td width=20>
+													{if $ACTIVITYDATA.recurringcheck eq 'Yes'}
+														{assign var=rptstyle value='style="display:block"'}
+														{if $ACTIVITYDATA.eventrecurringtype eq 'Daily'}
+															{assign var=rptmonthstyle value='style="display:none"'}
+															{assign var=rptweekstyle value='style="display:none"'}
+														{elseif $ACTIVITYDATA.eventrecurringtype eq 'Weekly'}
+															{assign var=rptmonthstyle value='style="display:none"'}
+															{assign var=rptweekstyle value='style="display:block"'}
+														{elseif $ACTIVITYDATA.eventrecurringtype eq 'Monthly'}
+															{assign var=rptmonthstyle value='style="display:block"'}
+															{assign var=rptweekstyle value='style="display:none"'}
+														{elseif $ACTIVITYDATA.eventrecurringtype eq 'Yearly'}
+															{assign var=rptmonthstyle value='style="display:none"'}
+															{assign var=rptweekstyle value='style="display:none"'}
+														{/if}
+													<input type="checkbox" name="recurringcheck" onClick="showhide('repeatOptions')" checked>
+													{else}
+														{assign var=rptstyle value='style="display:none"'}
+														{assign var=rptmonthstyle value='style="display:none"'}
+														{assign var=rptweekstyle value='style="display:none"'}
+													<input type="checkbox" name="recurringcheck" onClick="showhide('repeatOptions')">
+													{/if}
+													</td>
+													<td colspan=2>{$MOD.LBL_ENABLE_REPEAT}<td>
+												</tr>
+												<tr>
+													<td colspan=2>
+													<div id="repeatOptions" {$rptstyle}>
+													<table border=0 cellspacing=0 cellpadding=2>
+													<tr>
+													<td>Repeat once in every</td>
+													<td><input type="text" name="repeat_frequency" class="textbox" style="width:20px" value="{$ACTIVITYDATA.repeat_frequency}" ></td>
+													<td><select name="recurringtype">
+													<option value="Daily" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Daily'} selected {/if}>{$MOD.LBL_DAYS}</option>
+													<option value="Weekly" onClick="gshow('repeatWeekUI'); ghide('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Weekly'} selected {/if}>{$MOD.LBL_WEEKS}</option>
+												<option value="Monthly" onClick="ghide('repeatWeekUI'); gshow('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Monthly'} selected {/if}>{$MOD.LBL_MONTHS}</option>
+													<option value="Yearly" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');"; {if $ACTIVITYDATA.eventrecurringtype eq 'Yearly'} selected {/if}>{$MOD.LBL_YEAR}</option>
+													</select>
+													</td>
+												</tr>
+												</table>
+												<div id="repeatWeekUI" {$rptweekstyle}>
+												<table border=0 cellspacing=0 cellpadding=2>
+												<tr>
+													<td><input name="sun_flag" value="sunday" {$ACTIVITYDATA.week0} type="checkbox"></td><td>Sun</td>
+													<td><input name="mon_flag" value="monday" {$ACTIVITYDATA.week1} type="checkbox"></td><td>Mon</td>
+													<td><input name="tue_flag" value="tuesday" {$ACTIVITYDATA.week2} type="checkbox"></td><td>Tue</td>
+													<td><input name="wed_flag" value="wednesday" {$ACTIVITYDATA.week3} type="checkbox"></td><td>Wed</td>
+													<td><input name="thu_flag" value="thursday" {$ACTIVITYDATA.week4} type="checkbox"></td><td>Thu</td>
+													<td><input name="fri_flag" value="friday" {$ACTIVITYDATA.week5} type="checkbox"></td><td>Fri</td>
+													<td><input name="sat_flag" value="saturday" {$ACTIVITYDATA.week6} type="checkbox"></td><td>Sat</td>
+												</tr>
+												</table>
+												</div>
+	
+												<div id="repeatMonthUI" {$rptmonthstyle}>
+												<table border=0 cellspacing=0 cellpadding=2>
+												<tr>
+													<td>
+														<table border=0 cellspacing=0 cellpadding=2>
+														<tr>
+														<td><input type="radio" checked name="repeatMonth" {if $ACTIVITYDATA.repeatMonth eq 'date'} checked {/if} value="date"></td><td>on</td><td><input type="text" class=textbox style="width:20px" value="{$ACTIVITYDATA.repeatMonth_date}" name="repeatMonth_date" ></td><td>day of the month</td>
+														</tr>
+														</table>
+													</td>
+												</tr>
+												<tr>
+													<td>
+														<table border=0 cellspacing=0 cellpadding=2>
+														<tr><td>
+														<input type="radio" name="repeatMonth" {if $ACTIVITYDATA.repeatMonth eq 'day'} checked {/if} value="day"></td>
+														<td>on</td>
+														<td>
+														<select name="repeatMonth_daytype">
+															<option value="first" {if $ACTIVITYDATA.repeatMonth_daytype eq 'first'} selected {/if}>First</option>
+															<option value="last" {if $ACTIVITYDATA.repeatMonth_daytype eq 'last'} selected {/if}>Last</option>
+														</select>
+														</td>
+														<td>
+														<select name="repeatMonth_day">
+															<option value=1 {if $ACTIVITYDATA.repeatMonth_day eq 1} selected {/if}>{$MOD.LBL_DAY1}</option>
+															<option value=2 {if $ACTIVITYDATA.repeatMonth_day eq 2} selected {/if}>{$MOD.LBL_DAY2}</option>
+															<option value=3 {if $ACTIVITYDATA.repeatMonth_day eq 3} selected {/if}>{$MOD.LBL_DAY3}</option>
+															<option value=4 {if $ACTIVITYDATA.repeatMonth_day eq 4} selected {/if}>{$MOD.LBL_DAY4}</option>
+															<option value=5 {if $ACTIVITYDATA.repeatMonth_day eq 5} selected {/if}>{$MOD.LBL_DAY5}</option>
+															<option value=6 {if $ACTIVITYDATA.repeatMonth_day eq 6} selected {/if}>{$MOD.LBL_DAY6}</option>
+														</select>
+														</td>
+														</tr>
+														</table>
+													</td>
+												</tr>
+												</table>
+												</div>
+								
+											</div>
+										</td>
+										</tr>
+									</table>
+								</td>
+							</tr>
+						</table>
+						{/if}
+						</div>
+						<div id="addEventRelatedtoUI" style="display:none;width:100%">
+						<table width="100%" cellpadding="5" cellspacing="0" border="0">
+							{if $LABEL.parent_id neq ''}	
+							<tr>
+								<td><b>{$MOD.LBL_RELATEDTO}</b></td>
+								<td>
+									<input name="parent_id" type="hidden" value="{$secondvalue.parent_id}">
+									<select name="parent_type" class="small" id="parent_type" onChange="document.EditView.parent_name.value='';document.EditView.parent_id.value=''">
+									{section name=combo loop=$LABEL.parent_id}
+										<option value="{$fldlabel_combo.parent_id[combo]}" {$fldlabel_sel.parent_id[combo]}>{$LABEL.parent_id[combo]}</option>
+									{/section}
+                                             				</select>
+								</td>
+								<td>
+									<div id="eventrelatedto" align="left">
+										<input name="parent_name" readonly type="text" class="calTxt small" value="{$ACTIVITYDATA.parent_id}">
+										<input type="button" name="selectparent" class="crmButton small edit" value="Select" onclick="return window.open('index.php?module='+document.EditView.parent_type.value+'&action=Popup','test','width=640,height=602,resizable=0,scrollbars=0,top=150,left=200');">
+									</div>
+								</td>
+							</tr>
+							{/if}
+							<tr>
+								<td><b>{$APP.Contacts}</b></td>
+								<td colspan="2">
+									<input name="contactidlist" id="contactidlist" value="{$CONTACTSID}" type="hidden">
+									<textarea rows="5" name="contactlist" readonly="readonly" class="calTxt">
+									{$CONTACTSNAME}
+									</textarea>&nbsp;
+									<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&return_module=Calendar&popuptype=detailview&select=enable&form=EditView&form_submit=false','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="Select Contacts">
+								</td>
+							</tr>
+						</table>
+					</div>
+			</td>
+		</tr>
+		</table>
+		<!-- Alarm, Repeat, Invite stops-->
+		{else}
+		<table border="0" cellpadding="5" cellspacing="0" width="100%">
+			<tr>
+                        	<td class="cellLabel" width="20%" align="right"><b>{$MOD.LBL_TODO}</b></td>
+                        	<td class="cellInfo" width="80%" align="left"><input name="subject" value="{$ACTIVITYDATA.subject}" class="textbox" style="width: 70%;" type="text"></td>
+           		</tr>
+			
+			<tr>
+				{if $LABEL.description != ''}
+				<td class="cellLabel" align="right"><b>{$LABEL.description}</b></td>
+				<td class="cellInfo" align="left"><textarea style="width: 90%; height: 60px;" name="description">{$ACTIVITYDATA.description}</textarea>
+				{/if}
+				
+			</tr>
+			<tr>
+		    		<td colspan="2" align="center" width="100%" style="padding:0px">
+					<table border="0" cellpadding="5" cellspacing="1" width="100%">
+            					<tr>
+							{if $LABEL.taskstatus != ''}
+							<td class="cellLabel" width=33% align="left"><b>{$LABEL.taskstatus}</b></td>
+							{/if}
+							{if $LABEL.taskpriority != ''}
+              						<td class="cellLabel" width=33% align="left"><b>{$LABEL.taskpriority}</b></td>
+							{/if}
+              						{if $LABEL.assigned_user_id != ''}
+							<td class="cellLabel" width=34% align="left"><b>{$LABEL.assigned_user_id}</b></td>
+							{/if}
+						</tr>
+						<tr>
+							{if $LABEL.taskstatus != ''}
+							<td align="left" valign="top">
+								<select name="taskstatus" id="taskstatus" class=small>
+                                        			{foreach item=arr from=$ACTIVITYDATA.taskstatus}
+                                        			{foreach key=sel_value item=value from=$arr}
+                                                			<option value="{$sel_value}" {$value}>
+                                                        		{if $MOD.$sel_value neq ''}
+                                                                		{$MOD.$sel_value}
+                                                        		{else}
+                                                                		{$sel_value}
+                                                        		{/if}
+                                                			</option>
+                                        			{/foreach}
+                                        			{/foreach}
+                                				</select>
+							</td>
+							{/if}
+							{if $LABEL.taskpriority != ''}
+							<td align="left" valign="top">
+								<select name="taskpriority" id="taskpriority" class=small>
+        			                                {foreach item=arr from=$ACTIVITYDATA.taskpriority}
+                                			        {foreach key=sel_value item=value from=$arr}
+			                                                <option value="{$sel_value}" {$value}>
+                        		                                {if $MOD.$sel_value neq ''}
+                                        		                        {$MOD.$sel_value}
+                                                       			{else}
+                                                                		{$sel_value}
+                                                        		{/if}
+                                                			</option>
+                                        			{/foreach}
+                                        			{/foreach}
+                                				</select>
+							</td>
+							{/if}
+							{if $LABEL.assigned_user_id != ''}
+							<td align="left" valign="top">
+								{assign var=check value=1}
+                                        			{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
+			                                        {foreach key=sel_value item=value from=$arr}
+                        		                              	{if $value ne ''}
+                                        		                      	{assign var=check value=$check*0}
+                                                        		{else}
+                                                                		{assign var=check value=$check*1}
+                                                        		{/if}
+                                                		{/foreach}
+                                        			{/foreach}
+								{if $check eq 0}
+                                             				{assign var=select_user value='checked'}
+                                                			{assign var=style_user value='display:block'}
+                                                			{assign var=style_group value='display:none'}
+                                        			{else}
+                                                			{assign var=select_group value='checked'}
+                                                			{assign var=style_user value='display:none'}
+                                                			{assign var=style_group value='display:block'}
+                                        			{/if}
+				                                <input type="radio" name="assigntype" {$select_user} value="U" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_USER}
+				                                {if $secondvalue.assigned_user_id neq ''}
+                                			        <input type="radio" name="assigntype" {$select_group} value="T" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_GROUP}
+                                        			{/if}
+                                        			<span id="assign_user" style="{$style_user}">
+                                                		<select name="assigned_user_id" class=small>
+                                                        	{foreach key=key_one item=arr from=$ACTIVITYDATA.assigned_user_id}
+				                                {foreach key=sel_value item=value from=$arr}
+                                		                	<option value="{$key_one}" {$value}>{$sel_value}</option>
+								{/foreach}
+                                                        	{/foreach}
+                                                		</select>
+								</span>
+								{if $secondvalue.assigned_user_id neq ''}
+                                                		<span id="assign_team" style="{$style_group}">
+                                                        		<select name="assigned_group_name" class=small>';
+                                                                		{foreach key=key_one item=arr from=$secondvalue.assigned_user_id}
+                                                                       		{foreach key=sel_value item=value from=$arr}
+                                                                               		<option value="{$sel_value}" {$value}>{$sel_value}</option>
+                                                                       		{/foreach}
+                                                                		{/foreach}
+                                                        		</select>
+				                                </span>
+                                				{/if}	
+							</td>
+							{else}
+								<input name="assigned_user_id" value="{$CURRENTUSERID}" type="hidden">
+							{/if}
+						</tr>
+					</table>
+				</td>
+			</tr>
+			</table>
+			<table border="0" cellpadding="0" cellspacing="1" width="100%" align=center>
+			<tr><td width=50% valign=top>
+				<table border=0 cellspacing=0 cellpadding=2 width=100% align=center >
+					<tr><td colspan=3  class="mailSubHeader"><b>{$MOD.LBL_TODODATETIME}</b></td></tr>
+					<tr><td colspan=3>{$STARTHOUR}</td></tr>
+					<tr><td>
+							{foreach key=date_value item=time_value from=$ACTIVITYDATA.date_start}
+	                                        		{assign var=date_val value="$date_value"}
+								{assign var=time_val value="$time_value"}
+                                        		{/foreach}
+							<input name="date_start" id="date_start" class="textbox" style="width: 90px;" value="{$date_val}" type="text"></td><td width=100%><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start" align="middle" border="0">
+							{foreach key=date_fmt item=date_str from=$secondvalue.date_start}
+								{assign var=date_vl value="$date_fmt"}
+							{/foreach}				
+							<script type="text/javascript">
+								Calendar.setup ({ldelim}
+	        	                                	inputField : "date_start", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
+							{rdelim})
+							</script>
+						</td></tr>
+					</table></td>
+					<td width=50% valign="top">
+                                                <table border="0" cellpadding="2" cellspacing="0" width="100%" align=center>
+							<tr><td class="mailSubHeader" colspan=3><b>{$LABEL.due_date}</b></td></tr>
+							<tr><td>
+								{foreach key=date_value item=time_value from=$ACTIVITYDATA.due_date}
+									{assign var=date_val value="$date_value"}
+									{assign var=time_val value="$time_value"}
+								{/foreach}
+								<input name="due_date" id="due_date" class="textbox" style="width: 90px;" value="{$date_val}" type="text"></td><td width=100%><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date" border="0">
+								{foreach key=date_fmt item=date_str from=$secondvalue.due_date}
+                                                			{assign var=date_vl value="$date_fmt"}
+                                        			{/foreach}
+				      				<script type="text/javascript">
+								Calendar.setup ({ldelim}
+	                                        			inputField : "due_date", ifFormat : "{$date_vl}", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
+					   			{rdelim})
+								</script>
+        						</td></tr>
+						</table></td>
+					</tr>
+				</table>
+				<br><br>
+		<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%" bgcolor="#FFFFFF">
+			<tr>
+				<td>
+					<table border="0" cellpadding="3" cellspacing="0" width="100%">
+						<tr>
+							<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
+							<td id="cellTabInvite" class="dvtSelectedCell" align="center" nowrap="nowrap"><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','on');switchClass('cellTabRelatedto','off');Taskshow('addTaskAlarmUI','todo',document.EditView.date_start.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value);ghide('addTaskRelatedtoUI');">{$MOD.LBL_NOTIFICATION}</a></td>
+							<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
+                                                        <td id="cellTabRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabInvite','off');switchClass('cellTabRelatedto','on');Taskshow('addTaskRelatedtoUI','todo',document.EditView.date_start.value,document.EditView.starthr.value,document.EditView.startmin.value,document.EditView.startfmt.value);ghide('addTaskAlarmUI');">{$MOD.LBL_RELATEDTO}</a></td>
+                                                        <td class="dvtTabCache" style="width:100%">&nbsp;</td>
+						</tr>
+
+					</table>
+				</td>
+			</tr>
+			<tr>
+				<td class="dvtContentSpace" style="padding: 10px; height: 120px;" align="left" valign="top" width="100%">
+			<!-- Reminder UI -->
+			<div id="addTaskAlarmUI" style="display: block; width: 100%;">
+			{if $LABEL.sendnotification != ''}
+                	<table>
+				<tr><td>{$LABEL.sendnotification}</td>
+					{if $ACTIVITYDATA.sendnotification eq 1}
+                                        <td>
+                                                <input name="sendnotification" type="checkbox" checked>
+                                        </td>
+                                	{else}
+                                        <td>
+                                                <input name="sendnotification" type="checkbox">
+                                        </td>
+                                	{/if}
+				</tr>
+			</table>
+			{/if}
+			</div>
+			<div id="addTaskRelatedtoUI" style="display:none;width:100%">
+           		     <table width="100%" cellpadding="5" cellspacing="0" border="0">
+			     {if $LABEL.parent_id neq ''}
+                	     <tr>
+                        	     <td><b>{$MOD.LBL_RELATEDTO}</b></td>
+                                     <td>
+					<input name="parent_id" type="hidden" value="{$secondvalue.parent_id}">
+                                             <select name="parent_type" class="small" id="parent_type" onChange="document.EditView.parent_name.value='';document.EditView.parent_id.value=''">
+							{section name=combo loop=$LABEL.parent_id}
+								<option value="{$fldlabel_combo.parent_id[combo]}" {$fldlabel_sel.parent_id[combo]}>{$LABEL.parent_id[combo]}</option>
+							{/section}
+					     </select>
+                                     </td>
+                                     <td>
+                              	        <div id="taskrelatedto" align="left">
+						<input name="parent_name" readonly type="text" class="calTxt small" value="{$ACTIVITYDATA.parent_id}">
+						<input type="button" name="selectparent" class="crmButton small edit" value="Select" onclick="return window.open('index.php?module='+document.EditView.parent_type.value+'&action=Popup','test','width=640,height=602,resizable=0,scrollbars=0,top=150,left=200');">
+					 </div>
+                                     </td>
+			     </tr>
+			     {/if}
+			     {if $LABEL.contact_id neq ''}	
+			     <tr>
+                                     <td><b>{$LABEL.contact_id}</b></td>
+				     <td colspan="2">
+						<input name="contact_name" readonly type="text" class="calTxt" value="{$ACTIVITYDATA.contact_id}"><input name="contact_id" type="hidden" value="{$secondvalue.contact_id}">&nbsp;
+						<input type="button" onclick="return window.open('index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView','test','width=640,height=602,resizable=0,scrollbars=0');" class="crmButton small edit" name="selectcnt" value="Select Contact">
+				     </td>
+                             </tr>
+			     {/if}
+		</table>
+              	</div>
+                </td></tr></table>
+
+		{/if}
+			</td></tr>
+			<tr>
+				<td  colspan=4 style="padding:5px">
+					<div align="center">
+                        	        	<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" {if $ACTIVITY_MODE neq 'Task'} onclick="this.form.action.value='Save';  displaydeleted();return maincheck_form();"{else} onclick="this.form.action.value='Save';  displaydeleted(); maintask_check_form();return formValidate();" {/if} type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+						<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+					</div>
+				</td>
+			</tr></table>
+		</td></tr></table>
+		</td></tr></table>
+		</td></tr></table>
+		</td></tr></table>
+		</td></tr></table>
+</td></tr>
+</form></table>
+</td></tr></table>
+</td></tr></table>
+</td></tr></table>
+        </td></tr></table>
+        </td></tr></table>
+        </div>
+        </td>
+        <td valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+        </tr>
+        </table>
+<script>
+{if $ACTIVITY_MODE eq 'Task'}
+	var fieldname = new Array('subject','date_start','time_start','taskstatus');
+	var fieldlabel = new Array('Subject','Date','Time','Status');
+	var fielddatatype = new Array('V~M','D~M~time_start','T~O','V~O');
+{else}
+	var fieldname = new Array('subject','date_start','due_date','taskpriority','sendnotification','parent_id','contact_id','reminder_time','recurringtype');
+	var fieldlabel = new Array('Subject','Start Date','Due Date','Priority','Send Notification','Related To','Contact Name','Send Reminder','Recurrence');
+	var fielddatatype = new Array('V~M','D~M','D~M~OTH~GE~date_start~Start Date','V~O','C~O','I~O','I~O','I~O','O~O');
+{/if}
+</script>
+<script>	
+	var ProductImages=new Array();
+	var count=0;
+
+	function delRowEmt(imagename)
+	{ldelim}
+		ProductImages[count++]=imagename;
+	{rdelim}
+
+	function displaydeleted()
+	{ldelim}
+		var imagelists='';
+		for(var x = 0; x < ProductImages.length; x++)
+		{ldelim}
+			imagelists+=ProductImages[x]+'###';
+		{rdelim}
+
+		if(imagelists != '')
+			document.EditView.imagelist.value=imagelists
+	{rdelim}
+
+</script>
+<script language="JavaScript" type="text/JavaScript">
+	setObjects();
+</script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ActivityListView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ActivityListView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ActivityListView.tpl Tue Nov 14 03:16:10 2006
@@ -1,486 +1,518 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-{*<!-- module header -->*}
-<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/ListView.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/search.js"></script>
-<script language="JavaScript" type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<script language="javascript">
-
-function callSearch(searchtype)
-{ldelim}
-	for(i=1;i<=26;i++)
-    	{ldelim}
-        	var data_td_id = 'alpha_'+ eval(i);
-        	getObj(data_td_id).className = 'searchAlph';
-    	{rdelim}
-   	gPopupAlphaSearchUrl = '';
-
-	search_fld_val= document.basicSearch.search_field[document.basicSearch.search_field.selectedIndex].value;
-        search_txt_val=document.basicSearch.search_text.value;
-        var urlstring = '';
-        if(searchtype == 'Basic')
-        {ldelim}
-                urlstring = 'search_field='+search_fld_val+'&searchtype=BasicSearch&search_text='+search_txt_val+'&';
-        {rdelim}
-        else if(searchtype == 'Advanced')
-        {ldelim}
-                var no_rows = document.basicSearch.search_cnt.value;
-                for(jj = 0 ; jj < no_rows; jj++)
-                {ldelim}
-                        var sfld_name = getObj("Fields"+jj);
-                        var scndn_name= getObj("Condition"+jj);
-                        var srchvalue_name = getObj("Srch_value"+jj);
-                        urlstring = urlstring+'Fields'+jj+'='+sfld_name[sfld_name.selectedIndex].value+'&';
-                        urlstring = urlstring+'Condition'+jj+'='+scndn_name[scndn_name.selectedIndex].value+'&';
-                        urlstring = urlstring+'Srch_value'+jj+'='+srchvalue_name.value+'&';
-                {rdelim}
-                for (i=0;i<getObj("matchtype").length;i++){ldelim}
-                        if (getObj("matchtype")[i].checked==true)
-                                urlstring += 'matchtype='+getObj("matchtype")[i].value+'&';
-                {rdelim}
-                urlstring += 'search_cnt='+no_rows+'&';
-                urlstring += 'searchtype=advance&'
-        {rdelim}
-	new Ajax.Request(
-		'index.php',
-		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-			method: 'post',
-			postBody:urlstring +'query=true&file=ListView&module={$MODULE}&action={$MODULE}Ajax&ajax=true',
-			onComplete: function(response) {ldelim}
-				$("status").style.display="none";
-                                result = response.responseText.split('&#&#&#');
-                                $("ListViewContents").innerHTML= result[2];
-                                if(result[1] != '')
-                                        alert(result[1]);
-			{rdelim}
-	       {rdelim}
-        );
-
-{rdelim}
-function alphabetic(module,url,dataid)
-{ldelim}
-        for(i=1;i<=26;i++)
-        {ldelim}
-                var data_td_id = 'alpha_'+ eval(i);
-                getObj(data_td_id).className = 'searchAlph';
-
-        {rdelim}
-        getObj(dataid).className = 'searchAlphselected';
-	$("status").style.display="inline";
-	new Ajax.Request(
-		'index.php',
-		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-			method: 'post',
-			postBody: 'module='+module+'&action='+module+'Ajax&file=ListView&ajax=true&'+url,
-			onComplete: function(response) {ldelim}
-				$("status").style.display="none";
-				result = response.responseText.split('&#&#&#');
-				$("ListViewContents").innerHTML= result[2];
-				if(result[1] != '')
-			                alert(result[1]);
-			{rdelim}
-		{rdelim}
-	);
-{rdelim}
-
-</script>
-
-		{include file='Buttons_List.tpl'}
-                                <div id="searchingUI" style="display:none;">
-                                        <table border=0 cellspacing=0 cellpadding=0 width=100%>
-                                        <tr>
-                                                <td align=center>
-                                                <img src="images/searching.gif" alt="Searching... please wait"  title="Searching... please wait">
-                                                </td>
-                                        </tr>
-                                        </table>
-
-                                </div>
-                        </td>
-                </tr>
-                </table>
-        </td>
-</tr>
-</table>
-
-{*<!-- Contents -->*}
-<form name="basicSearch" action="index.php" onsubmit="return false;">
-<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
-     <tr>
-        <td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-
-	<td class="showPanelBg" valign="top" width=100% style="padding:10px;">
-	 <!-- SIMPLE SEARCH -->
-<div id="searchAcc" style="z-index:1;display:none;position:relative;">
-<table width="80%" cellpadding="5" cellspacing="0"  class="searchUIBasic small" align="center" border=0>
-	<tr>
-		<td class="searchUIName small" nowrap align="left">
-		<span class="moduleName">Search</span><br><span class="small"><a href="#" onClick="fnhide('searchAcc');show('advSearch');document.basicSearch.searchtype.value='advance';">{$APP.LBL_GO_TO} {$APP.LNK_ADVANCED_SEARCH}</a></span>
-		<!-- <img src="{$IMAGE_PATH}basicSearchLens.gif" align="absmiddle" alt="{$APP.LNK_BASIC_SEARCH}" title="{$APP.LNK_BASIC_SEARCH}" border=0>&nbsp;&nbsp;-->
-		</td>
-		<td class="small" nowrap align=right><b>{$APP.LBL_SEARCH_FOR}</b></td>
-		<td class="small"><input type="text"  class="txtBox" style="width:120px" name="search_text"></td>
-		<td class="small" nowrap><b>{$APP.LBL_IN}</b>&nbsp;
-			<select name ="search_field" class="txtBox" style="width:150px">
-			 {html_options  options=$SEARCHLISTHEADER }
-			</select>
-                        <input type="hidden" name="searchtype" value="BasicSearch">
-                        <input type="hidden" name="module" value="{$MODULE}">
-                        <input type="hidden" name="parenttab" value="{$CATEGORY}">
-			<input type="hidden" name="action" value="index">
-                        <input type="hidden" name="query" value="true">
-			<input type="hidden" name="search_cnt">
-		</td>
-		<td class="small" nowrap width=40% >
-			  <input name="submit" type="button" class="crmbutton small create" onClick="callSearch('Basic');" value=" {$APP.LBL_SEARCH_NOW_BUTTON} ">&nbsp;
-			  
-		</td>
-		<td class="small" valign="top" onMouseOver="this.style.cursor='pointer';" onclick="moveMe('searchAcc');searchshowhide('searchAcc','advSearch')">[x]</td>
-	</tr>
-	<tr>
-		<td colspan="6" align="center" class="small">
-			<table border=0 cellspacing=0 cellpadding=0 width=100%>
-				<tr>
-                                                {$ALPHABETICAL}
-                                </tr>
-                        </table>
-		</td>
-	</tr>
-</table>
-</div>
-<!-- ADVANCED SEARCH -->
-<div id="advSearch" style="display:none;">
-		<table  cellspacing=0 cellpadding=5 width=80% class="searchUIAdv1 small" align="center" border=0>
-			<tr>
-					<td class="searchUIName small" nowrap align="left"><span class="moduleName">Search</span><br><span class="small"><a href="#" onClick="show('searchAcc');fnhide('advSearch')">{$APP.LBL_GO_TO} {$APP.LNK_BASIC_SEARCH}</a></span></td>
-					<td nowrap class="small"><b><input name="matchtype" type="radio" value="all">&nbsp;{$APP.LBL_ADV_SEARCH_MSG_ALL}</b></td>
-					<td nowrap width=60% class="small" ><b><input name="matchtype" type="radio" value="any" checked>&nbsp;{$APP.LBL_ADV_SEARCH_MSG_ANY}</b></td>
-					<td class="small" valign="top" onMouseOver="this.style.cursor='pointer';" onclick="moveMe('searchAcc');searchshowhide('searchAcc','advSearch')">[x]</td>
-			</tr>
-		</table>
-		<table cellpadding="2" cellspacing="0" width="80%" align="center" class="searchUIAdv2 small" border=0>
-			<tr>
-				<td align="center" class="small" width=90%>
-				<div id="fixed" style="position:relative;width:95%;height:80px;padding:0px; overflow:auto;border:1px solid #CCCCCC;background-color:#ffffff" class="small">
-					<table border=0 width=95%>
-					<tr>
-					<td align=left>
-						<table width="100%"  border="0" cellpadding="2" cellspacing="0" id="adSrc" align="left">
-						<tr  >
-							<td width="31%"><select name="Fields0" class="detailedViewTextBox">
-							{$FIELDNAMES}
-							</select>
-							</td>
-							<td width="32%"><select name="Condition0" class="detailedViewTextBox">
-								{$CRITERIA}
-							</select>
-							</td>
-							<td width="32%"><input type="text" name="Srch_value0" class="detailedViewTextBox"></td>
-						</tr>
-						</table>
-					</td>
-					</tr>
-				</table>
-				</div>	
-				</td>
-			</tr>
-		</table>
-			
-		<table border=0 cellspacing=0 cellpadding=5 width=80% class="searchUIAdv3 small" align="center">
-		<tr>
-			<td align=left width=40%>
-						<input type="button" name="more" value=" {$APP.LBL_MORE} " onClick="fnAddSrch('{$FIELDNAMES}','{$CRITERIA}')" class="crmbuttom small edit" >
-						<input name="button" type="button" value=" {$APP.LBL_FEWER_BUTTON} " onclick="delRow()" class="crmbuttom small edit" >
-			</td>
-			<td align=left class="small"><input type="button" class="crmbutton small create" value=" {$APP.LBL_SEARCH_NOW_BUTTON} " onClick="totalnoofrows();callSearch('Advanced');">
-			</td>
-		</tr>
-	</table>
-</div>		
-</form>
-{*<!-- Searching UI -->*}
-
-
-<div class="small" style="padding: 10px;">
-	<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
-		<tr>
-			<td>
-				<table class="small" border="0" cellpadding="3" cellspacing="0" width="100%">
-				<tr>
-					<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
-					<td class="dvtUnSelectedCell" align="center" nowrap="nowrap"><a href="index.php?action=index&module=Calendar&parenttab={$CATEGORY}">{$APP.Calendar}</a></td>
-					<td class="dvtTabCache" style="width: 10px;">&nbsp;</td>
-					<td class="dvtSelectedCell" align="center" nowrap="nowrap">{$MOD.LBL_ALL_EVENTS_TODOS}</td>
-					<td class="dvtTabCache" style="width: 100%;">&nbsp;</td>
-				</tr>
-                                </table>
-                        </td>
-                </tr>
-		<tr>
-			<td align="left" valign="top">
-				<table class="dvtContentSpace" border="0" cellpadding="3" cellspacing="0" width="100%">
-					<tr>
-						<td align="left">
-							<!-- content cache -->
-							<table border="0" cellpadding="0" cellspacing="0" width="100%">
-								<tr>
-									<td style="padding: 10px;">
-
-	   <!-- PUBLIC CONTENTS STARTS-->
-	   <div id="ListViewContents" class="small" style="width:100%;position:relative;">
-     <form name="massdelete" method="POST">
-     <input name='search_url' id="search_url" type='hidden' value='{$SEARCH_URL}'>
-     <input name="idlist" id="idlist" type="hidden">
-     <input name="change_owner" type="hidden">
-     <input name="change_status" type="hidden">
-     <input name="allids" type="hidden" value="{$ALLIDS}">
-               <table border=0 cellspacing=1 cellpadding=0 width=100% class="lvtBg">
-	            <tr >
-		      <td>
-		         <table border=0 cellspacing=0 cellpadding=2 width=100% class="small">
-			      <tr>
-				 <td style="padding-right:20px" nowrap>
-                                 {foreach key=button_check item=button_label from=$BUTTONS}
-                                        {if $button_check eq 'del'}
-                                             <input class="crmbutton small delete" type="button" value="{$button_label}" onclick="return massDelete('{$MODULE}')"/>
-                                        {elseif $button_check eq 's_mail'}
-                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return eMail('{$MODULE}',this);"/>
-                                        {elseif $button_check eq 's_cmail'}
-                                             <input class="crmbutton small edit" type="submit" value="{$button_label}" onclick="return massMail('{$MODULE}')"/>
-                                        {elseif $button_check eq 'c_status'}
-                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changestatus')"/>
-					{elseif $button_check eq 'c_owner'}
-						{if $MODULE neq 'Notes' && $MODULE neq 'Products' && $MODULE neq 'Faq' && $MODULE neq 'Vendors' && $MODULE neq 'PriceBooks'}
-						     <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changeowner')"/>
-                                                {/if}
-                                        {/if}
-
-                                 {/foreach}
-                    </td>
-				 <td style="padding-right:20px" class="small" nowrap>{$RECORD_COUNTS}</td>
-		        	 <td nowrap >
-					<table border=0 cellspacing=0 cellpadding=0 class="small">
-					     <tr>{$NAVIGATION}</tr>
-					</table>
-                    </td>
-				 <td width=100% align="right">
-				   <table border=0 cellspacing=0 cellpadding=0 class="small">
-					<tr>
-						<td>{$APP.LBL_VIEW}</td>
-						<td style="padding-left:5px;padding-right:5px">
-                                                    <SELECT NAME="viewname" id="viewname" class="small" onchange="showDefaultCustomView(this,'{$MODULE}')">{$CUSTOMVIEW_OPTION}</SELECT></td>
-                                                    {if $ALL eq 'All'}
-							<td><a href="index.php?module={$MODULE}&action=CustomView&parenttab={$CATEGORY}">{$APP.LNK_CV_CREATEVIEW}</a>
-							<span class="small">|</span>
-							<span class="small" disabled>{$APP.LNK_CV_EDIT}</span>
-							<span class="small">|</span>
-                                                        <span class="small" disabled>{$APP.LNK_CV_DELETE}</span></td>
-						    {else}
-							<td><a href="index.php?module={$MODULE}&action=CustomView&parenttab={$CATEGORY}">{$APP.LNK_CV_CREATEVIEW}</a>
-							<span class="small">|</span>
-                                                        <a href="index.php?module={$MODULE}&action=CustomView&record={$VIEWID}&parenttab={$CATEGORY}">{$APP.LNK_CV_EDIT}</a>
-                                                        <span class="small">|</span>
-							<a href="index.php?module=CustomView&action=Delete&dmodule={$MODULE}&record={$VIEWID}&parenttab={$CATEGORY}">{$APP.LNK_CV_DELETE}</a></td>
-						    {/if}
-					</tr>
-				   </table>
-				 </td>	
-       		       </tr>
-			 </table>
-                         <div  class="calDIV" style="overflow:auto;">
-			 <table border=0 cellspacing=1 cellpadding=3 width=100% class="calListTable" class="small">
-			      <tr>
-             			 <td class="lvtCol"><input type="checkbox"  name="selectall" onClick=toggleSelect(this.checked,"selected_id")></td>
-				 {foreach name="listviewforeach" item=header from=$LISTHEADER}
-        			 <td class="lvtCol">{$header}</td>
-			         {/foreach}
-			      </tr>
-			      {foreach item=entity key=entity_id from=$LISTENTITY}
-			      <tr bgcolor=white onMouseOver="this.className='lvtColDataHover'" onMouseOut="this.className='lvtColData'" id="row_{$entity_id}">
-				 <td width="2%"><input type="checkbox" NAME="selected_id" value= '{$entity_id}' onClick=toggleSelectAll(this.name,"selectall")></td>
-				 {foreach item=data from=$entity}	
-				 <td>{$data}</td>
-	                         {/foreach}
-			      </tr>
-			      {foreachelse}
-				<tr><td style="background-color:#efefef;height:340px" align="center" colspan="{$smarty.foreach.listviewforeach.iteration+1}">
-						<div style="border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 45%; position: relative; z-index: 10000000;">
-							{assign var=vowel_conf value='LBL_A'}
-							{assign var=MODULE_CREATE value=$SINGLE_MOD}
-
-							{if $CHECK.EditView eq 'yes' && $MODULE neq 'Emails' && $MODULE neq 'Webmails'}
-							
-							<table border="0" cellpadding="5" cellspacing="0" width="98%">
-							<tr>
-								<td rowspan="2" width="25%"><img src="{$IMAGE_PATH}empty.jpg" height="60" width="61"></td>
-								<td style="border-bottom: 1px solid rgb(204, 204, 204);" nowrap="nowrap" width="75%"><span class="genHeaderSmall">{$APP.LBL_NO} {$APP.$MODULE_CREATE}s {$APP.LBL_FOUND} !</span></td>
-							</tr>
-							<tr>
-							<td class="small" align="left" nowrap="nowrap">{$APP.LBL_YOU_CAN_CREATE} {$APP.$vowel_conf} {$APP.$MODULE_CREATE} {$APP.LBL_NOW}. {$APP.LBL_CLICK_THE_LINK}:<br>
-								   {if $MODULE neq 'Calendar'}	
-						  			&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.$vowel_conf} {$APP.$MODULE_CREATE}</a><br>
-								   {else}
-									&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&amp;action=EditView&amp;return_module=Calendar&amp;activity_mode=Events&amp;return_action=DetailView&amp;activitytype=Meeting&amp;parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.LBL_A} {$APP.Meeting}</a><br>
-									&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&amp;action=EditView&amp;return_module=Calendar&amp;activity_mode=Events&amp;return_action=DetailView&amp;activitytype=Call&amp;parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.LBL_A} {$APP.Call}</a><br>
-									&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&amp;action=EditView&amp;return_module=Calendar&amp;activity_mode=Task&amp;return_action=DetailView&amp;parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.LBL_A} {$APP.Todo}</a>
-								   {/if}
-								</td>
-							</tr>
-							</table> 
-							{else}
-							<table border="0" cellpadding="5" cellspacing="0" width="98%">
-							<tr>
-								<td rowspan="2" width="25%"><img src="{$IMAGE_PATH}empty.jpg" height="60" width="61"></td>
-								<td style="border-bottom: 1px solid rgb(204, 204, 204);" nowrap="nowrap" width="75%"><span class="genHeaderSmall">{$APP.LBL_NO} {$APP.$MODULE_CREATE}s {$APP.LBL_FOUND} !</span></td>
-							</tr>
-							<tr>
-								<td class="small" align="left" nowrap="nowrap">{$APP.LBL_YOU_ARE_NOT_ALLOWED_TO_CREATE} {$APP.$vowel_conf} {$APP.$MODULE_CREATE}<br>
-								</td>
-							</tr>
-							</table>
-							{/if}
-						</div>					
-				</td></tr>	
-			      {/foreach}
-			 </table>
-			 </div>
-			 <table border=0 cellspacing=0 cellpadding=2 width=100%>
-			      <tr>
-				 <td style="padding-right:20px" nowrap>
-                                 {foreach key=button_check item=button_label from=$BUTTONS}
-                                        {if $button_check eq 'del'}
-                                            <input class="crmbutton small delete" type="button" value="{$button_label}" onclick="return massDelete('{$MODULE}')"/>
-                                        {elseif $button_check eq 's_mail'}
-                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return eMail('{$MODULE}',this)"/>
-                                        {elseif $button_check eq 's_cmail'}
-                                             <input class="crmbutton small edit" type="submit" value="{$button_label}" onclick="return massMail('{$MODULE}')"/>
-                                        {elseif $button_check eq 'c_status'}
-                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changestatus')"/>
-					{elseif $button_check eq 'c_owner'}
-				                {if $MODULE neq 'Notes' && $MODULE neq 'Products' && $MODULE neq 'Faq' && $MODULE neq 'Vendors' && $MODULE neq 'PriceBooks'}
-                                                     <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changeowner')"/>
-                                                {/if}
-                                        {/if}
-
-                                 {/foreach}
-                    </td>
-				 <td style="padding-right:20px" class="small" nowrap>{$RECORD_COUNTS}</td>
-				 <td nowrap >
-				    <table border=0 cellspacing=0 cellpadding=0 class="small">
-				         <tr>{$NAVIGATION}</tr>
-				     </table>
-				 </td>
-				 <td align="right" width=100%>
-				   <table border=0 cellspacing=0 cellpadding=0 class="small">
-					<tr>
-                                           {$WORDTEMPLATEOPTIONS}{$MERGEBUTTON}
-					</tr>
-				   </table>
-				 </td>
-			      </tr>
-       		    </table>
-		       </td>
-		   </tr>
-	    </table>
-
-   </form>	
-{$SELECT_SCRIPT}
-	</div>
-	 </td></tr></table>
-	 </td></tr></table>
-         </td></tr></table>
-        </div>
-
-     </td>
-        <td valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</table>
-
-
-<div id="changeowner" class="statechange">
-<table width="100%" border="0" cellpadding="3" cellspacing="0">
-<tr>
-	<td class="genHeaderSmall" align="left" style="border-bottom:1px solid #CCCCCC;" width="60%">{$APP.LBL_CHANGE_OWNER}</td>
-	<td style="border-bottom: 1px solid rgb(204, 204, 204);">&nbsp;</td>
-	<td align="right" style="border-bottom:1px solid #CCCCCC;" width="40%"><a href="javascript:fninvsh('changeowner')">{$APP.LBL_CLOSE}</a></td>
-</tr>
-<tr>
-	<td colspan="3">&nbsp;</td>
-</tr>
-<tr>
-	<td width="50%"><b>{$APP.LBL_TRANSFER_OWNERSHIP}</b></td>
-	<td width="2%"><b>:</b></td>
-	<td width="48%">
-	<select name="lead_owner" id="lead_owner" class="detailedViewTextBox">
-	{$CHANGE_OWNER}
-	</select>
-	</td>
-</tr>
-<tr><td colspan="3" style="border-bottom:1px dashed #CCCCCC;">&nbsp;</td></tr>
-<tr>
-	<td colspan="3" align="center">
-	&nbsp;&nbsp;
-	<input type="button" name="button" class="crmbutton small edit" value="{$APP.LBL_UPDATE_OWNER}" onClick="ajaxChangeStatus('owner')">
-	<input type="button" name="button" class="crmbutton small cancel" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" onClick="fninvsh('changeowner')">
-</td>
-</tr>
-</table>
-</div>
-
-
-<script>
-{literal}
-
-function ajaxChangeStatus(statusname)
-{
-	$("status").style.display="inline";
-	var viewid = document.massdelete.viewname.value;
-	var idstring = document.getElementById('idlist').value;
-	if(statusname == 'status')
-	{
-		fninvsh('changestatus');
-		var url='&leadval='+document.getElementById('lead_status').options[document.getElementById('lead_status').options.selectedIndex].value;
-		var urlstring ="module=Users&action=updateLeadDBStatus&return_module=Leads"+url+"&viewname="+viewid+"&idlist="+idstring;
-	}
-	else if(statusname == 'owner')
-	{
-		fninvsh('changeowner');
-		var url='&user_id='+document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
-		
-{/literal}
-		var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
-{literal}
-
-	}
-	new Ajax.Request(
-                'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: urlstring,
-                        onComplete: function(response) {
-                                $("status").style.display="none";
-                                result = response.responseText.split('&#&#&#');
-                                $("ListViewContents").innerHTML= result[2];
-                                if(result[1] != '')
-                                        alert(result[1]);
-                        }
-                }
-        );
-	
-}
-</script>
-{/literal}
-
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+{*<!-- module header -->*}
+<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/ListView.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/search.js"></script>
+<script language="JavaScript" type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<script language="javascript">
+function checkgroup()
+{ldelim}
+
+  if(document.change_ownerform_name.user_lead_owner[1].checked)
+  {ldelim}
+          document.change_ownerform_name.lead_group_owner.style.display = "block";
+          document.change_ownerform_name.lead_owner.style.display = "none";
+  {rdelim}
+  else
+  {ldelim}
+          document.change_ownerform_name.lead_owner.style.display = "block";
+          document.change_ownerform_name.lead_group_owner.style.display = "none";
+  {rdelim}    
+  
+{rdelim}
+function callSearch(searchtype)
+{ldelim}
+	for(i=1;i<=26;i++)
+    	{ldelim}
+        	var data_td_id = 'alpha_'+ eval(i);
+        	getObj(data_td_id).className = 'searchAlph';
+    	{rdelim}
+   	gPopupAlphaSearchUrl = '';
+
+	search_fld_val= document.basicSearch.search_field[document.basicSearch.search_field.selectedIndex].value;
+        search_txt_val=document.basicSearch.search_text.value;
+        var urlstring = '';
+        if(searchtype == 'Basic')
+        {ldelim}
+                urlstring = 'search_field='+search_fld_val+'&searchtype=BasicSearch&search_text='+search_txt_val+'&';
+        {rdelim}
+        else if(searchtype == 'Advanced')
+        {ldelim}
+                var no_rows = document.basicSearch.search_cnt.value;
+                for(jj = 0 ; jj < no_rows; jj++)
+                {ldelim}
+                        var sfld_name = getObj("Fields"+jj);
+                        var scndn_name= getObj("Condition"+jj);
+                        var srchvalue_name = getObj("Srch_value"+jj);
+                        urlstring = urlstring+'Fields'+jj+'='+sfld_name[sfld_name.selectedIndex].value+'&';
+                        urlstring = urlstring+'Condition'+jj+'='+scndn_name[scndn_name.selectedIndex].value+'&';
+                        urlstring = urlstring+'Srch_value'+jj+'='+srchvalue_name.value+'&';
+                {rdelim}
+                for (i=0;i<getObj("matchtype").length;i++){ldelim}
+                        if (getObj("matchtype")[i].checked==true)
+                                urlstring += 'matchtype='+getObj("matchtype")[i].value+'&';
+                {rdelim}
+                urlstring += 'search_cnt='+no_rows+'&';
+                urlstring += 'searchtype=advance&'
+        {rdelim}
+	new Ajax.Request(
+		'index.php',
+		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+			method: 'post',
+			postBody:urlstring +'query=true&file=ListView&module={$MODULE}&action={$MODULE}Ajax&ajax=true',
+			onComplete: function(response) {ldelim}
+				$("status").style.display="none";
+                                result = response.responseText.split('&#&#&#');
+                                $("ListViewContents").innerHTML= result[2];
+                                if(result[1] != '')
+                                        alert(result[1]);
+			{rdelim}
+	       {rdelim}
+        );
+
+{rdelim}
+function alphabetic(module,url,dataid)
+{ldelim}
+        for(i=1;i<=26;i++)
+        {ldelim}
+                var data_td_id = 'alpha_'+ eval(i);
+                getObj(data_td_id).className = 'searchAlph';
+
+        {rdelim}
+        getObj(dataid).className = 'searchAlphselected';
+	$("status").style.display="inline";
+	new Ajax.Request(
+		'index.php',
+		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+			method: 'post',
+			postBody: 'module='+module+'&action='+module+'Ajax&file=ListView&ajax=true&'+url,
+			onComplete: function(response) {ldelim}
+				$("status").style.display="none";
+				result = response.responseText.split('&#&#&#');
+				$("ListViewContents").innerHTML= result[2];
+				if(result[1] != '')
+			                alert(result[1]);
+			{rdelim}
+		{rdelim}
+	);
+{rdelim}
+
+</script>
+
+		{include file='Buttons_List.tpl'}
+                                <div id="searchingUI" style="display:none;">
+                                        <table border=0 cellspacing=0 cellpadding=0 width=100%>
+                                        <tr>
+                                                <td align=center>
+                                                <img src="images/searching.gif" alt="Searching... please wait"  title="Searching... please wait">
+                                                </td>
+                                        </tr>
+                                        </table>
+
+                                </div>
+                        </td>
+                </tr>
+                </table>
+        </td>
+</tr>
+</table>
+
+{*<!-- Contents -->*}
+<form name="basicSearch" action="index.php" onsubmit="return false;">
+<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
+     <tr>
+        <td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+
+	<td class="showPanelBg" valign="top" width=100% style="padding:10px;">
+	 <!-- SIMPLE SEARCH -->
+<div id="searchAcc" style="z-index:1;display:none;position:relative;">
+<table width="80%" cellpadding="5" cellspacing="0"  class="searchUIBasic small" align="center" border=0>
+	<tr>
+		<td class="searchUIName small" nowrap align="left">
+		<span class="moduleName">Search</span><br><span class="small"><a href="#" onClick="fnhide('searchAcc');show('advSearch');document.basicSearch.searchtype.value='advance';">{$APP.LBL_GO_TO} {$APP.LNK_ADVANCED_SEARCH}</a></span>
+		<!-- <img src="{$IMAGE_PATH}basicSearchLens.gif" align="absmiddle" alt="{$APP.LNK_BASIC_SEARCH}" title="{$APP.LNK_BASIC_SEARCH}" border=0>&nbsp;&nbsp;-->
+		</td>
+		<td class="small" nowrap align=right><b>{$APP.LBL_SEARCH_FOR}</b></td>
+		<td class="small"><input type="text"  class="txtBox" style="width:120px" name="search_text"></td>
+		<td class="small" nowrap><b>{$APP.LBL_IN}</b>&nbsp;
+			<select name ="search_field" class="txtBox" style="width:150px">
+			 {html_options  options=$SEARCHLISTHEADER }
+			</select>
+                        <input type="hidden" name="searchtype" value="BasicSearch">
+                        <input type="hidden" name="module" value="{$MODULE}">
+                        <input type="hidden" name="parenttab" value="{$CATEGORY}">
+			<input type="hidden" name="action" value="index">
+                        <input type="hidden" name="query" value="true">
+			<input type="hidden" name="search_cnt">
+		</td>
+		<td class="small" nowrap width=40% >
+			  <input name="submit" type="button" class="crmbutton small create" onClick="callSearch('Basic');" value=" {$APP.LBL_SEARCH_NOW_BUTTON} ">&nbsp;
+			  
+		</td>
+		<td class="small" valign="top" onMouseOver="this.style.cursor='pointer';" onclick="moveMe('searchAcc');searchshowhide('searchAcc','advSearch')">[x]</td>
+	</tr>
+	<tr>
+		<td colspan="6" align="center" class="small">
+			<table border=0 cellspacing=0 cellpadding=0 width=100%>
+				<tr>
+                                                {$ALPHABETICAL}
+                                </tr>
+                        </table>
+		</td>
+	</tr>
+</table>
+</div>
+<!-- ADVANCED SEARCH -->
+<div id="advSearch" style="display:none;">
+		<table  cellspacing=0 cellpadding=5 width=80% class="searchUIAdv1 small" align="center" border=0>
+			<tr>
+					<td class="searchUIName small" nowrap align="left"><span class="moduleName">Search</span><br><span class="small"><a href="#" onClick="show('searchAcc');fnhide('advSearch')">{$APP.LBL_GO_TO} {$APP.LNK_BASIC_SEARCH}</a></span></td>
+					<td nowrap class="small"><b><input name="matchtype" type="radio" value="all">&nbsp;{$APP.LBL_ADV_SEARCH_MSG_ALL}</b></td>
+					<td nowrap width=60% class="small" ><b><input name="matchtype" type="radio" value="any" checked>&nbsp;{$APP.LBL_ADV_SEARCH_MSG_ANY}</b></td>
+					<td class="small" valign="top" onMouseOver="this.style.cursor='pointer';" onclick="moveMe('searchAcc');searchshowhide('searchAcc','advSearch')">[x]</td>
+			</tr>
+		</table>
+		<table cellpadding="2" cellspacing="0" width="80%" align="center" class="searchUIAdv2 small" border=0>
+			<tr>
+				<td align="center" class="small" width=90%>
+				<div id="fixed" style="position:relative;width:95%;height:80px;padding:0px; overflow:auto;border:1px solid #CCCCCC;background-color:#ffffff" class="small">
+					<table border=0 width=95%>
+					<tr>
+					<td align=left>
+						<table width="100%"  border="0" cellpadding="2" cellspacing="0" id="adSrc" align="left">
+						<tr  >
+							<td width="31%"><select name="Fields0" class="detailedViewTextBox">
+							{$FIELDNAMES}
+							</select>
+							</td>
+							<td width="32%"><select name="Condition0" class="detailedViewTextBox">
+								{$CRITERIA}
+							</select>
+							</td>
+							<td width="32%"><input type="text" name="Srch_value0" class="detailedViewTextBox"></td>
+						</tr>
+						</table>
+					</td>
+					</tr>
+				</table>
+				</div>	
+				</td>
+			</tr>
+		</table>
+			
+		<table border=0 cellspacing=0 cellpadding=5 width=80% class="searchUIAdv3 small" align="center">
+		<tr>
+			<td align=left width=40%>
+						<input type="button" name="more" value=" {$APP.LBL_MORE} " onClick="fnAddSrch('{$FIELDNAMES}','{$CRITERIA}')" class="crmbuttom small edit" >
+						<input name="button" type="button" value=" {$APP.LBL_FEWER_BUTTON} " onclick="delRow()" class="crmbuttom small edit" >
+			</td>
+			<td align=left class="small"><input type="button" class="crmbutton small create" value=" {$APP.LBL_SEARCH_NOW_BUTTON} " onClick="totalnoofrows();callSearch('Advanced');">
+			</td>
+		</tr>
+	</table>
+</div>		
+</form>
+{*<!-- Searching UI -->*}
+
+
+<div class="small" style="padding: 10px;">
+	<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
+		<tr>
+			<td>
+				<table class="small" border="0" cellpadding="3" cellspacing="0" width="100%">
+				<tr>
+					<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
+					<td class="dvtUnSelectedCell" align="center" nowrap="nowrap"><a href="index.php?action=index&module=Calendar&parenttab={$CATEGORY}">{$APP.Calendar}</a></td>
+					<td class="dvtTabCache" style="width: 10px;">&nbsp;</td>
+					<td class="dvtSelectedCell" align="center" nowrap="nowrap">{$MOD.LBL_ALL_EVENTS_TODOS}</td>
+					<td class="dvtTabCache" style="width: 100%;">&nbsp;</td>
+				</tr>
+                                </table>
+                        </td>
+                </tr>
+		<tr>
+			<td align="left" valign="top">
+				<table class="dvtContentSpace" border="0" cellpadding="3" cellspacing="0" width="100%">
+					<tr>
+						<td align="left">
+							<!-- content cache -->
+							<table border="0" cellpadding="0" cellspacing="0" width="100%">
+								<tr>
+									<td style="padding: 10px;">
+
+	   <!-- PUBLIC CONTENTS STARTS-->
+	   <div id="ListViewContents" class="small" style="width:100%;position:relative;">
+     <form name="massdelete" method="POST">
+     <input name='search_url' id="search_url" type='hidden' value='{$SEARCH_URL}'>
+     <input name="idlist" id="idlist" type="hidden">
+     <input name="change_owner" type="hidden">
+     <input name="change_status" type="hidden">
+     <input name="allids" type="hidden" value="{$ALLIDS}">
+               <table border=0 cellspacing=1 cellpadding=0 width=100% class="lvtBg">
+	            <tr >
+		      <td>
+		         <table border=0 cellspacing=0 cellpadding=2 width=100% class="small">
+			      <tr>
+				 <td style="padding-right:20px" nowrap>
+                                 {foreach key=button_check item=button_label from=$BUTTONS}
+                                        {if $button_check eq 'del'}
+                                             <input class="crmbutton small delete" type="button" value="{$button_label}" onclick="return massDelete('{$MODULE}')"/>
+                                        {elseif $button_check eq 's_mail'}
+                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return eMail('{$MODULE}',this);"/>
+                                        {elseif $button_check eq 's_cmail'}
+                                             <input class="crmbutton small edit" type="submit" value="{$button_label}" onclick="return massMail('{$MODULE}')"/>
+                                        {elseif $button_check eq 'c_status'}
+                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changestatus')"/>
+					{elseif $button_check eq 'c_owner'}
+						{if $MODULE neq 'Notes' && $MODULE neq 'Products' && $MODULE neq 'Faq' && $MODULE neq 'Vendors' && $MODULE neq 'PriceBooks'}
+						     <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changeowner')"/>
+                                                {/if}
+                                        {/if}
+
+                                 {/foreach}
+                    </td>
+				 <td style="padding-right:20px" class="small" nowrap>{$RECORD_COUNTS}</td>
+		        	 <td nowrap >
+					<table border=0 cellspacing=0 cellpadding=0 class="small">
+					     <tr>{$NAVIGATION}</tr>
+					</table>
+                    </td>
+				 <td width=100% align="right">
+				   <table border=0 cellspacing=0 cellpadding=0 class="small">
+					<tr>
+						<td>{$APP.LBL_VIEW}</td>
+						<td style="padding-left:5px;padding-right:5px">
+                                                    <SELECT NAME="viewname" id="viewname" class="small" onchange="showDefaultCustomView(this,'{$MODULE}')">{$CUSTOMVIEW_OPTION}</SELECT></td>
+                                                    {if $ALL eq 'All'}
+							<td><a href="index.php?module={$MODULE}&action=CustomView&parenttab={$CATEGORY}">{$APP.LNK_CV_CREATEVIEW}</a>
+							<span class="small">|</span>
+							<span class="small" disabled>{$APP.LNK_CV_EDIT}</span>
+							<span class="small">|</span>
+                                                        <span class="small" disabled>{$APP.LNK_CV_DELETE}</span></td>
+						    {else}
+							<td><a href="index.php?module={$MODULE}&action=CustomView&parenttab={$CATEGORY}">{$APP.LNK_CV_CREATEVIEW}</a>
+							<span class="small">|</span>
+                                                        <a href="index.php?module={$MODULE}&action=CustomView&record={$VIEWID}&parenttab={$CATEGORY}">{$APP.LNK_CV_EDIT}</a>
+                                                        <span class="small">|</span>
+							<a href="index.php?module=CustomView&action=Delete&dmodule={$MODULE}&record={$VIEWID}&parenttab={$CATEGORY}">{$APP.LNK_CV_DELETE}</a></td>
+						    {/if}
+					</tr>
+				   </table>
+				 </td>	
+       		       </tr>
+			 </table>
+                         <div  class="calDIV" style="overflow:auto;">
+			 <table border=0 cellspacing=1 cellpadding=3 width=100% class="calListTable" class="small">
+			      <tr>
+             			 <td class="lvtCol"><input type="checkbox"  name="selectall" onClick=toggleSelect(this.checked,"selected_id")></td>
+				 {foreach name="listviewforeach" item=header from=$LISTHEADER}
+        			 <td class="lvtCol">{$header}</td>
+			         {/foreach}
+			      </tr>
+			      {foreach item=entity key=entity_id from=$LISTENTITY}
+			      <tr bgcolor=white onMouseOver="this.className='lvtColDataHover'" onMouseOut="this.className='lvtColData'" id="row_{$entity_id}">
+				 <td width="2%"><input type="checkbox" NAME="selected_id" value= '{$entity_id}' onClick=toggleSelectAll(this.name,"selectall")></td>
+				 {foreach item=data from=$entity}	
+				 <td>{$data}</td>
+	                         {/foreach}
+			      </tr>
+			      {foreachelse}
+				<tr><td style="background-color:#efefef;height:340px" align="center" colspan="{$smarty.foreach.listviewforeach.iteration+1}">
+						<div style="border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 45%; position: relative; z-index: 10000000;">
+							{assign var=vowel_conf value='LBL_A'}
+							{assign var=MODULE_CREATE value=$SINGLE_MOD}
+
+							{if $CHECK.EditView eq 'yes' && $MODULE neq 'Emails' && $MODULE neq 'Webmails'}
+							
+							<table border="0" cellpadding="5" cellspacing="0" width="98%">
+							<tr>
+								<td rowspan="2" width="25%"><img src="{$IMAGE_PATH}empty.jpg" height="60" width="61"></td>
+								<td style="border-bottom: 1px solid rgb(204, 204, 204);" nowrap="nowrap" width="75%"><span class="genHeaderSmall">{$APP.LBL_NO} {$APP.$MODULE_CREATE}s {$APP.LBL_FOUND} !</span></td>
+							</tr>
+							<tr>
+							<td class="small" align="left" nowrap="nowrap">{$APP.LBL_YOU_CAN_CREATE} {$APP.$vowel_conf} {$APP.$MODULE_CREATE} {$APP.LBL_NOW}. {$APP.LBL_CLICK_THE_LINK}:<br>
+								   {if $MODULE neq 'Calendar'}	
+						  			&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.$vowel_conf} {$APP.$MODULE_CREATE}</a><br>
+								   {else}
+									&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&amp;action=EditView&amp;return_module=Calendar&amp;activity_mode=Events&amp;return_action=DetailView&amp;activitytype=Meeting&amp;parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.LBL_A} {$APP.Meeting}</a><br>
+									&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&amp;action=EditView&amp;return_module=Calendar&amp;activity_mode=Events&amp;return_action=DetailView&amp;activitytype=Call&amp;parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.LBL_A} {$APP.Call}</a><br>
+									&nbsp;&nbsp;-<a href="index.php?module={$MODULE}&amp;action=EditView&amp;return_module=Calendar&amp;activity_mode=Task&amp;return_action=DetailView&amp;parenttab={$CATEGORY}">{$APP.LBL_CREATE} {$APP.LBL_A} {$APP.Todo}</a>
+								   {/if}
+								</td>
+							</tr>
+							</table> 
+							{else}
+							<table border="0" cellpadding="5" cellspacing="0" width="98%">
+							<tr>
+								<td rowspan="2" width="25%"><img src="{$IMAGE_PATH}empty.jpg" height="60" width="61"></td>
+								<td style="border-bottom: 1px solid rgb(204, 204, 204);" nowrap="nowrap" width="75%"><span class="genHeaderSmall">{$APP.LBL_NO} {$APP.$MODULE_CREATE}s {$APP.LBL_FOUND} !</span></td>
+							</tr>
+							<tr>
+								<td class="small" align="left" nowrap="nowrap">{$APP.LBL_YOU_ARE_NOT_ALLOWED_TO_CREATE} {$APP.$vowel_conf} {$APP.$MODULE_CREATE}<br>
+								</td>
+							</tr>
+							</table>
+							{/if}
+						</div>					
+				</td></tr>	
+			      {/foreach}
+			 </table>
+			 </div>
+			 <table border=0 cellspacing=0 cellpadding=2 width=100%>
+			      <tr>
+				 <td style="padding-right:20px" nowrap>
+                                 {foreach key=button_check item=button_label from=$BUTTONS}
+                                        {if $button_check eq 'del'}
+                                            <input class="crmbutton small delete" type="button" value="{$button_label}" onclick="return massDelete('{$MODULE}')"/>
+                                        {elseif $button_check eq 's_mail'}
+                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return eMail('{$MODULE}',this)"/>
+                                        {elseif $button_check eq 's_cmail'}
+                                             <input class="crmbutton small edit" type="submit" value="{$button_label}" onclick="return massMail('{$MODULE}')"/>
+                                        {elseif $button_check eq 'c_status'}
+                                             <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changestatus')"/>
+					{elseif $button_check eq 'c_owner'}
+				                {if $MODULE neq 'Notes' && $MODULE neq 'Products' && $MODULE neq 'Faq' && $MODULE neq 'Vendors' && $MODULE neq 'PriceBooks'}
+                                                     <input class="crmbutton small edit" type="button" value="{$button_label}" onclick="return change(this,'changeowner')"/>
+                                                {/if}
+                                        {/if}
+
+                                 {/foreach}
+                    </td>
+				 <td style="padding-right:20px" class="small" nowrap>{$RECORD_COUNTS}</td>
+				 <td nowrap >
+				    <table border=0 cellspacing=0 cellpadding=0 class="small">
+				         <tr>{$NAVIGATION}</tr>
+				     </table>
+				 </td>
+				 <td align="right" width=100%>
+				   <table border=0 cellspacing=0 cellpadding=0 class="small">
+					<tr>
+                                           {$WORDTEMPLATEOPTIONS}{$MERGEBUTTON}
+					</tr>
+				   </table>
+				 </td>
+			      </tr>
+       		    </table>
+		       </td>
+		   </tr>
+	    </table>
+
+   </form>	
+{$SELECT_SCRIPT}
+	</div>
+	 </td></tr></table>
+	 </td></tr></table>
+         </td></tr></table>
+        </div>
+
+     </td>
+        <td valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</table>
+
+
+<div id="changeowner" class="statechange">
+<table width="100%" border="0" cellpadding="3" cellspacing="0">
+<tr>
+	<td class="genHeaderSmall" align="left" style="border-bottom:1px solid #CCCCCC;" width="60%">{$APP.LBL_CHANGE_OWNER}</td>
+	<td style="border-bottom: 1px solid rgb(204, 204, 204);">&nbsp;</td>
+	<td align="right" style="border-bottom:1px solid #CCCCCC;" width="40%"><a href="javascript:fninvsh('changeowner')">{$APP.LBL_CLOSE}</a></td>
+</tr>
+<tr>
+	<td colspan="3">&nbsp;</td>
+</tr>
+<tr>
+	<td width="50%"><b>{$APP.LBL_TRANSFER_OWNERSHIP}</b></td>
+	<td width="2%"><b>:</b></td>
+	<td width="48%">
+	         <form name="change_ownerform_name">
+	        <input type = "radio" name = "user_lead_owner"  onclick=checkgroup();  checked>{$APP.LBL_USER}&nbsp;
+					<input type = "radio" name = "user_lead_owner" onclick=checkgroup(); >{$APP.LBL_GROUP}<br>
+					<select name="lead_owner" id="lead_owner" class="detailedViewTextBox">
+					{$CHANGE_OWNER}
+					</select>
+					<select name="lead_group_owner" id="lead_group_owner" class="detailedViewTextBox" style="display:none;">
+					{$CHANGE_GROUP_OWNER}
+					</select>
+					</form>
+	</td>
+</tr>
+<tr><td colspan="3" style="border-bottom:1px dashed #CCCCCC;">&nbsp;</td></tr>
+<tr>
+	<td colspan="3" align="center">
+	&nbsp;&nbsp;
+	<input type="button" name="button" class="crmbutton small edit" value="{$APP.LBL_UPDATE_OWNER}" onClick="ajaxChangeStatus('owner')">
+	<input type="button" name="button" class="crmbutton small cancel" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" onClick="fninvsh('changeowner')">
+</td>
+</tr>
+</table>
+</div>
+
+
+<script>
+{literal}
+
+function ajaxChangeStatus(statusname)
+{
+	$("status").style.display="inline";
+	var viewid = document.massdelete.viewname.value;
+	var idstring = document.getElementById('idlist').value;
+	if(statusname == 'status')
+	{
+		fninvsh('changestatus');
+		var url='&leadval='+document.getElementById('lead_status').options[document.getElementById('lead_status').options.selectedIndex].value;
+		var urlstring ="module=Users&action=updateLeadDBStatus&return_module=Leads"+url+"&viewname="+viewid+"&idlist="+idstring;
+	}
+	else if(statusname == 'owner')
+	{
+		
+	   if(document.change_ownerform_name.user_lead_owner[0].checked)
+	   {
+		    fninvsh('changeowner');
+		    var url='&user_id='+document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
+		    {/literal}
+		        var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
+		    {literal}
+     }
+    else
+    {
+        fninvsh('changeowner');
+		    var url='&group_id='+document.getElementById('lead_group_owner').options[document.getElementById('lead_group_owner').options.selectedIndex].value;
+	       {/literal}
+		        var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
+		    {literal}
+    }
+
+	}
+	new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: urlstring,
+                        onComplete: function(response) {
+                                $("status").style.display="none";
+                                result = response.responseText.split('&#&#&#');
+                                $("ListViewContents").innerHTML= result[2];
+                                if(result[1] != '')
+                                        alert(result[1]);
+                        }
+                }
+        );
+	
+}
+</script>
+{/literal}
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/AddMailAccount.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/AddMailAccount.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/AddMailAccount.tpl Tue Nov 14 03:16:10 2006
@@ -1,168 +1,168 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-
-<tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" valign="top" width="100%">
-                <div class="small" style="padding: 10px;">
-                        <span class="lvtHeaderText">{$MOD.LBL_MY_MAIL_SERVER_DET}</span> <br>
-                        <hr noshade="noshade" size="1"><br>
-
-  		<form action="index.php" method="post" name="EditView" id="form">
-			<input type="hidden" name="module" value="Settings">
-		  	<input type="hidden" name="action">
-  			<input type="hidden" name="server_type" value="email">
-			<input type="hidden" name="record" value="{$ID}">
-		        <input type="hidden" name="edit" value="{$EDIT}">
-			<input type="hidden" name="return_module" value="Settings">
-			<input type="hidden" name="return_action" value="index">
-	</tr>	
-		
-		<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
-                  <tr>
-
-                        <td>
-                            <table class="small" border="0" cellpadding="3" cellspacing="0" width="100%">
-                                <tr>
-                                    <td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
-                                    <td class="dvtSelectedCell" style="width: 100px;" align="center" nowrap="nowrap"><b>{$MOD.LBL_MY_MAIL_SERVER_DET} </b></td>
-		                    <td class="dvtTabCache" nowrap="nowrap">&nbsp;</td>
-                                </tr>
-
-                            </table>
-                        </td>
-                </tr>
-                <tr>
-                        <td align="left" valign="top">
-
-<!-- General Contents for Mail Server Starts Here -->
-
-<table class="dvtContentSpace" border="0" cellpadding="3" cellspacing="0" width="100%">
-<tr>
-   <td align="left">
-     <table border="0" cellpadding="0" cellspacing="0" width="100%">
-       <tr>
-          <td style="padding: 10px;"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
-       <tr>
-           <td colspan="3" class="detailedViewHeader"><b>{$MOD.LBL_EMAIL_ID}</b></td>
-       </tr>
-       <tr>
-          <td class="dvtCellLabel" align="right" width="33%">{$MOD.LBL_DISPLAY_NAME}</td>
-          <td class="dvtCellInfo" width="33%"><input type="text" name="displayname" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'" value="{$DISPLAYNAME}"/></td>
-          <td class="dvtCellInfo" width="34%">{$MOD.LBL_NAME_EXAMPLE}</td>
-       </tr>
-       <tr>
-          <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT> {$MOD.LBL_EMAIL_ADDRESS} </td>
-          <td class="dvtCellInfo"><input type="text" name="email" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'" value="{$EMAIL}"/></td>
-          <td class="dvtCellInfo">{$MOD.LBL_EMAIL_EXAMPLE}</td>
-       </tr>
-       <tr><td colspan="3" >&nbsp;</td></tr>
-       <tr>
-          <td colspan="3"  class="detailedViewHeader"><b>{$MOD.LBL_MAIL_SERVER_SETTINGS}</b></td>
-       </tr>
-       <tr>
-          <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT>{$MOD.LBL_MAIL_SERVER_NAME}</td>
-          <td class="dvtCellInfo"><input type="text" name="mail_servername" value="{$SERVERNAME}"  class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
-          <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT>{$APP.LBL_LIST_USER_NAME}</td>
-           <td class="dvtCellInfo"><input type="text" name="server_username" value="{$SERVERUSERNAME}"  class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
-           <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT>{$MOD.LBL_LIST_PASSWORD}</td>
-           <td class="dvtCellInfo"><input type="password" name="server_password" value="{$SERVERPASSWORD}"  class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
-           <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td colspan="3" class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right">{$MOD.LBL_MAIL_PROTOCOL}</td>
-           <td class="dvtCellInfo">
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+
+<tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" valign="top" width="100%">
+                <div class="small" style="padding: 10px;">
+                        <span class="lvtHeaderText">{$MOD.LBL_MY_MAIL_SERVER_DET}</span> <br>
+                        <hr noshade="noshade" size="1"><br>
+
+  		<form action="index.php" method="post" name="EditView" id="form">
+			<input type="hidden" name="module" value="Settings">
+		  	<input type="hidden" name="action">
+  			<input type="hidden" name="server_type" value="email">
+			<input type="hidden" name="record" value="{$ID}">
+		        <input type="hidden" name="edit" value="{$EDIT}">
+			<input type="hidden" name="return_module" value="Settings">
+			<input type="hidden" name="return_action" value="index">
+	</tr>	
+		
+		<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
+                  <tr>
+
+                        <td>
+                            <table class="small" border="0" cellpadding="3" cellspacing="0" width="100%">
+                                <tr>
+                                    <td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
+                                    <td class="dvtSelectedCell" style="width: 100px;" align="center" nowrap="nowrap"><b>{$MOD.LBL_MY_MAIL_SERVER_DET} </b></td>
+		                    <td class="dvtTabCache" nowrap="nowrap">&nbsp;</td>
+                                </tr>
+
+                            </table>
+                        </td>
+                </tr>
+                <tr>
+                        <td align="left" valign="top">
+
+<!-- General Contents for Mail Server Starts Here -->
+
+<table class="dvtContentSpace" border="0" cellpadding="3" cellspacing="0" width="100%">
+<tr>
+   <td align="left">
+     <table border="0" cellpadding="0" cellspacing="0" width="100%">
+       <tr>
+          <td style="padding: 10px;"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
+       <tr>
+           <td colspan="3" class="detailedViewHeader"><b>{$MOD.LBL_EMAIL_ID}</b></td>
+       </tr>
+       <tr>
+          <td class="dvtCellLabel" align="right" width="33%">{$MOD.LBL_DISPLAY_NAME}</td>
+          <td class="dvtCellInfo" width="33%"><input type="text" name="displayname" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'" value="{$DISPLAYNAME}"/></td>
+          <td class="dvtCellInfo" width="34%">{$MOD.LBL_NAME_EXAMPLE}</td>
+       </tr>
+       <tr>
+          <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT> {$MOD.LBL_EMAIL_ADDRESS} </td>
+          <td class="dvtCellInfo"><input type="text" name="email" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'" value="{$EMAIL}"/></td>
+          <td class="dvtCellInfo">{$MOD.LBL_EMAIL_EXAMPLE}</td>
+       </tr>
+       <tr><td colspan="3" >&nbsp;</td></tr>
+       <tr>
+          <td colspan="3"  class="detailedViewHeader"><b>{$MOD.LBL_INCOME_SERVER_SETTINGS}</b></td>
+       </tr>
+       <tr>
+          <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT>{$MOD.LBL_MAIL_SERVER_NAME}</td>
+          <td class="dvtCellInfo"><input type="text" name="mail_servername" value="{$SERVERNAME}"  class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
+          <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT>{$APP.LBL_LIST_USER_NAME}</td>
+           <td class="dvtCellInfo"><input type="text" name="server_username" value="{$SERVERUSERNAME}"  class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
+           <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right"><FONT class="required" color="red">{$APP.LBL_REQUIRED_SYMBOL}</FONT>{$MOD.LBL_LIST_PASSWORD}</td>
+           <td class="dvtCellInfo"><input type="password" name="server_password" value="{$SERVERPASSWORD}"  class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
+           <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td colspan="3" class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right">{$MOD.LBL_MAIL_PROTOCOL}</td>
+           <td class="dvtCellInfo">
 		<!-- <input type="radio" name="mailprotocol" value="pop3" {$POP3}/>&nbsp;{$MOD.LBL_POP} <font color="red">* *</font>&nbsp;
 		<input type="radio" name="mailprotocol" value="imap" {$IMAP}/>&nbsp;{$MOD.LBL_IMAP} <font color="red">* *</font>&nbsp; -->
-		<input type="radio" name="mailprotocol" value="imap2" {$IMAP2}/>&nbsp;{$MOD.LBL_IMAP2}
-		<input type="radio" name="mailprotocol" value="IMAP4" {$IMAP4}/>&nbsp;{$MOD.LBL_IMAP4}
-	   </td>	
-           <td class="dvtCellInfo">&nbsp;</td>
-        </tr>
-        <tr>
-           <td class="dvtCellLabel" align="right">{$MOD.LBL_SSL_OPTIONS}</td>
-           <td class="dvtCellInfo">
-		<input type="radio" name="ssltype" value="notls" {$NOTLS} />&nbsp;{$MOD.LBL_NO_TLS}
-		<input type="radio" name="ssltype" value="tls" {$TLS} />&nbsp; {$MOD.LBL_TLS} </td>
-           <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right">{$MOD.LBL_CERT_VAL}</td>
-           <td class="dvtCellInfo">
-		<input type="radio" name="sslmeth" value="validate-cert" {$VALIDATECERT} />&nbsp;{$MOD.LBL_VAL_SSL_CERT}
-		<input type="radio" name="sslmeth" value="novalidate-cert" {$NOVALIDATECERT} />&nbsp;{$MOD.LBL_DONOT_VAL_SSL_CERT}
-	   </td>	
-           <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right">{$MOD.LBL_INT_MAILER}</td>
-           <td class="dvtCellInfo">
-		<input type="radio" name="int_mailer" value="1" {$INT_MAILER_USE} />&nbsp;{$MOD.LBL_INT_MAILER_USE}
-		<input type="radio" name="int_mailer" value="0" {$INT_MAILER_NOUSE} />&nbsp;{$MOD.LBL_INT_MAILER_NOUSE}
-	   </td>	
-           <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right">{$MOD.LBL_REFRESH_TIMEOUT}</td>
-           <td class="dvtCellInfo">
-		<select value="{$BOX_REFRESH}" name="box_refresh">
-			<option value="60000">{$MOD.LBL_1_MIN}</option>
-			<option value="120000">{$MOD.LBL_2_MIN}</option>
-			<option value="240000">{$MOD.LBL_3_MIN}</option>
-			<option value="360000">{$MOD.LBL_4_MIN}</option>
-			<option value="480000">{$MOD.LBL_5_MIN}</option>
-		</select>
-	   </td>
-           <td class="dvtCellInfo">&nbsp;</td>
-       </tr>
-       <tr>
-           <td class="dvtCellLabel" align="right">{$MOD.LBL_EMAILS_PER_PAGE}</td>
-           <td class="dvtCellInfo"><input type="text" name="mails_per_page" value="{$MAILS_PER_PAGE}" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
-           <td class="dvtCellInfo">&nbsp;</td>
-	</tr><tr>
-	<td colspan='3' align='center'>{$MOD.LBL_MAIL_DISCLAIM}</td>
-       </tr>
-       <tr><td colspan="3" style="border-bottom:1px dashed #CCCCCC;">&nbsp;</td></tr>
-       <tr>
-           <td colspan="3" align="center">
-		<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='SaveMailAccount'; return verify_data(EditView)" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " >
-			&nbsp;&nbsp;
-	        <input title="{$APP.LBL_CANCEL_BUTTON_LABEL}>" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"></td>
-           </td>
-       </tr>
-       <tr><td colspan="3" style="border-top:1px dashed #CCCCCC;">&nbsp;</td></tr>
-       </table>
-	   </td>
-            </tr>
-
-     </table></td>
-     </tr>
-</table>
-</td></tr>
-</table>
-</form>
-</td></tr>
-</table>
-
-{$JAVASCRIPT}
+		<input type="radio" name="mailprotocol" value="imap2" {$IMAP2}/>&nbsp;{$MOD.LBL_IMAP2}
+		<input type="radio" name="mailprotocol" value="IMAP4" {$IMAP4}/>&nbsp;{$MOD.LBL_IMAP4}
+	   </td>	
+           <td class="dvtCellInfo">&nbsp;</td>
+        </tr>
+        <tr>
+           <td class="dvtCellLabel" align="right">{$MOD.LBL_SSL_OPTIONS}</td>
+           <td class="dvtCellInfo">
+		<input type="radio" name="ssltype" value="notls" {$NOTLS} />&nbsp;{$MOD.LBL_NO_TLS}
+		<input type="radio" name="ssltype" value="tls" {$TLS} />&nbsp; {$MOD.LBL_TLS} </td>
+           <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right">{$MOD.LBL_CERT_VAL}</td>
+           <td class="dvtCellInfo">
+		<input type="radio" name="sslmeth" value="validate-cert" {$VALIDATECERT} />&nbsp;{$MOD.LBL_VAL_SSL_CERT}
+		<input type="radio" name="sslmeth" value="novalidate-cert" {$NOVALIDATECERT} />&nbsp;{$MOD.LBL_DONOT_VAL_SSL_CERT}
+	   </td>	
+           <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right">{$MOD.LBL_INT_MAILER}</td>
+           <td class="dvtCellInfo">
+		<input type="radio" name="int_mailer" value="1" {$INT_MAILER_USE} />&nbsp;{$MOD.LBL_INT_MAILER_USE}
+		<input type="radio" name="int_mailer" value="0" {$INT_MAILER_NOUSE} />&nbsp;{$MOD.LBL_INT_MAILER_NOUSE}
+	   </td>	
+           <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right">{$MOD.LBL_REFRESH_TIMEOUT}</td>
+           <td class="dvtCellInfo">
+		<select value="{$BOX_REFRESH}" name="box_refresh">
+			<option value="60000">{$MOD.LBL_1_MIN}</option>
+			<option value="120000">{$MOD.LBL_2_MIN}</option>
+			<option value="240000">{$MOD.LBL_3_MIN}</option>
+			<option value="360000">{$MOD.LBL_4_MIN}</option>
+			<option value="480000">{$MOD.LBL_5_MIN}</option>
+		</select>
+	   </td>
+           <td class="dvtCellInfo">&nbsp;</td>
+       </tr>
+       <tr>
+           <td class="dvtCellLabel" align="right">{$MOD.LBL_EMAILS_PER_PAGE}</td>
+           <td class="dvtCellInfo"><input type="text" name="mails_per_page" value="{$MAILS_PER_PAGE}" class="detailedViewTextBox" onfocus="this.className='detailedViewTextBoxOn'" onblur="this.className='detailedViewTextBox'"/></td>
+           <td class="dvtCellInfo">&nbsp;</td>
+	</tr><tr>
+	<td colspan='3' align='center'>{$MOD.LBL_MAIL_DISCLAIM}</td>
+       </tr>
+       <tr><td colspan="3" style="border-bottom:1px dashed #CCCCCC;">&nbsp;</td></tr>
+       <tr>
+           <td colspan="3" align="center">
+		<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='SaveMailAccount'; return verify_data(EditView)" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " >
+			&nbsp;&nbsp;
+	        <input title="{$APP.LBL_CANCEL_BUTTON_LABEL}>" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"></td>
+           </td>
+       </tr>
+       <tr><td colspan="3" style="border-top:1px dashed #CCCCCC;">&nbsp;</td></tr>
+       </table>
+	   </td>
+            </tr>
+
+     </table></td>
+     </tr>
+</table>
+</td></tr>
+</table>
+</form>
+</td></tr>
+</table>
+
+{$JAVASCRIPT}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/AddProductToPriceBooks.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/AddProductToPriceBooks.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/AddProductToPriceBooks.tpl Tue Nov 14 03:16:10 2006
@@ -1,157 +1,164 @@
-<!--*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
--->
-{literal}
-<script language="javascript">
-function addtopricebook()
-{
-	x = document.addToPB.selected_id.length;
-	prod_array = new Array(x);
-	idstring = "";
-	if ( x == undefined)
-	{
-		if (document.addToPB.selected_id.checked)
-		{
-			yy = document.addToPB.selected_id.value+"_listprice";
-			document.addToPB.idlist.value=document.addToPB.selected_id.value;
-			var elem = document.addToPB.elements;
-			var ele_len =elem.length;
-			var i=0,j=0;
-	
-			for(i=0; i<ele_len; i++)
-			{	
-				if(elem[i].name == yy)
-				{
-					if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) 
-					{
-						alert("List Price cannot be empty");
-			               		return false;	
-					}	
-					else if(isNaN(elem[i].value))
-                                        {
-                                                alert("Invalid List Price");
-                                                return false;
-                                        }
-
-				}
-			}	
-			
-		}
-		else 
-		{
-			alert("Please select at least one entity");
-			return false;
-		}
-	}
-	else
-	{
-		xx = 0;
-		for(i = 0; i < x ; i++)
-		{
-			if(document.addToPB.selected_id[i].checked)
-			{
-				idstring = document.addToPB.selected_id[i].value +";"+idstring;
-				 prod_array[xx] = document.addToPB.selected_id[i].value;
-				
-				xx++;	
-			}
-		}
-		if (xx != 0)
-		{
-			document.addToPB.idlist.value=idstring;
-			var elem = document.addToPB.elements;
-                        var ele_len =elem.length;
-                        var i=0,j=0;
-
-                        for(i=0; i<ele_len; i++)
-                        {
-                                for(j=0; j < xx; j++)
-                                {
-                                        var xy= prod_array[j]+"_listprice";
-                                        if(elem[i].name == xy)
-                                        {
-						if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) 
-						{
-							alert("List Price cannot be empty");
-			                		return false;	
-						}
-						else if(isNaN(elem[i].value))
-                	                        {
-        	                                        alert("Invalid List Price");
-                                                	return false;
-                                        	}
-	
-                                        }
-                                }
-                        }
-
-		}
-		else
-		{
-			alert("Please select at least one entity");
-			return false;
-		}
-	}
-{/literal}
-document.addToPB.action="index.php?module=Products&action=addPbProductRelToDB&return_module=Products&return_action=DetailView&return_id={$RETURN_ID}"
-{rdelim}
-
-
-function updateAllListPrice(unitprice)
-{ldelim}
-        var fieldname_array = new Array({$FIELD_NAME_ARRAY});
-        var unitprice,fieldname;
-
-        for(j=0; j<fieldname_array.length; j++)
-        {ldelim}
-                fieldname=fieldname_array[j];
-                updateListPrice(unitprice,fieldname);
-        {rdelim}
-{rdelim}
-
-</script>
-<script language="javascript" src="modules/Products/Product.js"></script>
-<table width="95%" border="0" cellpadding="0" cellspacing="0">
-<tr><td colspan="3">&nbsp;</td></tr>
-<tr>
-		<td>&nbsp;</td>
-		<td class="showPanelBg">
-{$PRICEBOOKLISTHEADER}
-<table border="0" cellpadding="0" cellspacing="0"  width="100%">
-  <tr height="20"> 
-    <td  class="listFormHeaderLinks">
-	 <table border="0" cellpadding="0" cellspacing="0" width="100%">
-		<tr>
-			<td>&nbsp;{$RECORD_COUNTS}</td>
-			   {$NAVIGATION}
-		</tr>
-	 </table>
-    </td>
-   </tr>
-   <tr>
-   			<td>
-					<table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="3" cellspacing="1" width="90%" align="center">
-							 {$LISTHEADER}
-							 {$LISTENTITY}
-					</table>
-			</td>
-   </tr>   
-   <tr><td>&nbsp;</td></tr>
-   </form>
-</table>
-
-</form>
-</table>
-</td>
-<td>&nbsp;</td>
-</tr>
-</table>
-
-
+<!--*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+-->
+{literal}
+<script language="javascript">
+function addtopricebook()
+{
+	x = document.addToPB.selected_id.length;
+	prod_array = new Array(x);
+	idstring = "";
+	if ( x == undefined)
+	{
+		if (document.addToPB.selected_id.checked)
+		{
+			yy = document.addToPB.selected_id.value+"_listprice";
+			document.addToPB.idlist.value=document.addToPB.selected_id.value;
+			var elem = document.addToPB.elements;
+			var ele_len =elem.length;
+			var i=0,j=0;
+	
+			for(i=0; i<ele_len; i++)
+			{	
+				if(elem[i].name == yy)
+				{
+					if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) 
+					{
+						alert("List Price cannot be empty");
+			               		return false;	
+					}	
+					else if(isNaN(elem[i].value))
+                                        {
+                                                alert("Invalid List Price");
+                                                return false;
+                                        }
+
+				}
+			}	
+			
+		}
+		else 
+		{
+			alert("Please select at least one entity");
+			return false;
+		}
+	}
+	else
+	{
+		xx = 0;
+		for(i = 0; i < x ; i++)
+		{
+			if(document.addToPB.selected_id[i].checked)
+			{
+				idstring = document.addToPB.selected_id[i].value +";"+idstring;
+				 prod_array[xx] = document.addToPB.selected_id[i].value;
+				
+				xx++;	
+			}
+		}
+		if (xx != 0)
+		{
+			document.addToPB.idlist.value=idstring;
+			var elem = document.addToPB.elements;
+                        var ele_len =elem.length;
+                        var i=0,j=0;
+
+                        for(i=0; i<ele_len; i++)
+                        {
+                                for(j=0; j < xx; j++)
+                                {
+                                        var xy= prod_array[j]+"_listprice";
+                                        if(elem[i].name == xy)
+                                        {
+						if (elem[i].value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) 
+						{
+							alert("List Price cannot be empty");
+			                		return false;	
+						}
+						else if(isNaN(elem[i].value))
+                	                        {
+        	                                        alert("Invalid List Price");
+                                                	return false;
+                                        	}
+	
+                                        }
+                                }
+                        }
+
+		}
+		else
+		{
+			alert("Please select at least one entity");
+			return false;
+		}
+	}
+{/literal}
+document.addToPB.action="index.php?module=Products&action=addPbProductRelToDB&return_module=Products&return_action=DetailView&return_id={$RETURN_ID}"
+{rdelim}
+
+
+function updateAllListPrice(unitprice)
+{ldelim}
+        var fieldname_array = new Array({$FIELD_NAME_ARRAY});
+        var unitprice,fieldname;
+	var id;
+	var fieldinfo;
+	var checkid;
+
+        for(j=0; j<fieldname_array.length; j++)
+        {ldelim}
+		fieldinfo = fieldname_array[j].split("_");
+		id = fieldinfo[0];
+		checkid = "check_"+id;
+
+                fieldname=fieldname_array[j];
+                updateListPrice(unitprice,fieldname,document.getElementById(checkid));
+        {rdelim}
+{rdelim}
+
+</script>
+<script language="javascript" src="modules/Products/Product.js"></script>
+<table width="95%" border="0" cellpadding="0" cellspacing="0">
+<tr><td colspan="3">&nbsp;</td></tr>
+<tr>
+		<td>&nbsp;</td>
+		<td class="showPanelBg">
+{$PRICEBOOKLISTHEADER}
+<table border="0" cellpadding="0" cellspacing="0"  width="100%">
+  <tr height="20"> 
+    <td  class="listFormHeaderLinks">
+	 <table border="0" cellpadding="0" cellspacing="0" width="100%">
+		<tr>
+			<td>&nbsp;{$RECORD_COUNTS}</td>
+			   {$NAVIGATION}
+		</tr>
+	 </table>
+    </td>
+   </tr>
+   <tr>
+   			<td>
+					<table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="3" cellspacing="1" width="90%" align="center">
+							 {$LISTHEADER}
+							 {$LISTENTITY}
+					</table>
+			</td>
+   </tr>   
+   <tr><td>&nbsp;</td></tr>
+   </form>
+</table>
+
+</form>
+</table>
+</td>
+<td>&nbsp;</td>
+</tr>
+</table>
+
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/AddProductsToPriceBook.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/AddProductsToPriceBook.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/AddProductsToPriceBook.tpl Tue Nov 14 03:16:10 2006
@@ -1,57 +1,65 @@
-<!--*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
--->
-<script language="javascript">
-
-function updateAllListPrice()
-{ldelim}
-        var unitprice_array = new Array({$UNIT_PRICE_ARRAY});
-        var fieldname_array = new Array({$FIELD_NAME_ARRAY});
-
-	var n=unitprice_array.length;	
-	var unitprice,fieldname;
-	for(j=0; j<unitprice_array.length; j++)
-	{ldelim}
-		unitprice=unitprice_array[j];
-		fieldname=fieldname_array[j];	
-		updateListPrice(unitprice,fieldname);
-	{rdelim}
-{rdelim}
-
-</script>
-<script language="javascript" src="modules/PriceBooks/PriceBook.js"></script>
-<BR>
-<BR>
-{$PRODUCTLISTHEADER}
-<table border="0" cellpadding="0" cellspacing="0" class="FormBorder" width="100%">
-  <tr height="20"> 
-    <td >
-	 <table border="0" cellpadding="0" cellspacing="0" width="100%">
-		<tr>
-			<td>&nbsp;{$RECORD_COUNTS}</td>
-			   {$NAVIGATION}
-		</tr>
-	 </table>
-    </td>
-   </tr>
-   <tr><td >
-   <table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="3" cellspacing="1" width="90%" align="center">
-   {$LISTHEADER}
-   {$LISTENTITY}
-   </table>
-   </td></tr>
-   <tr><td>&nbsp;</td></tr>
-   </form>
-</table>
-
-</form>
-</table>
-
-
+<!--*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+-->
+<script language="javascript">
+
+function updateAllListPrice()
+{ldelim}
+        var unitprice_array = new Array({$UNIT_PRICE_ARRAY});
+        var fieldname_array = new Array({$FIELD_NAME_ARRAY});
+
+	var n=unitprice_array.length;	
+	var unitprice,fieldname;
+	var id;
+	var fieldinfo;
+	var checkid;
+
+	for(j=0; j<unitprice_array.length; j++)
+	{ldelim}
+		fieldinfo = fieldname_array[j].split("_");
+		id = fieldinfo[0];
+		checkid = "check_"+id;
+
+		unitprice=unitprice_array[j];
+		fieldname=fieldname_array[j];	
+		updateListPrice(unitprice,fieldname,document.getElementById(checkid));
+	{rdelim}
+{rdelim}
+
+</script>
+<script language="javascript" src="modules/PriceBooks/PriceBook.js"></script>
+<BR>
+<BR>
+{$PRODUCTLISTHEADER}
+<table border="0" cellpadding="0" cellspacing="0" class="FormBorder" width="100%">
+  <tr height="20"> 
+    <td >
+	 <table border="0" cellpadding="0" cellspacing="0" width="100%">
+		<tr>
+			<td>&nbsp;{$RECORD_COUNTS}</td>
+			   {$NAVIGATION}
+		</tr>
+	 </table>
+    </td>
+   </tr>
+   <tr><td >
+   <table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="3" cellspacing="1" width="90%" align="center">
+   {$LISTHEADER}
+   {$LISTENTITY}
+   </table>
+   </td></tr>
+   <tr><td>&nbsp;</td></tr>
+   </form>
+</table>
+
+</form>
+</table>
+
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List.tpl Tue Nov 14 03:16:10 2006
@@ -1,140 +1,140 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<!-- Activity createlink layer start  -->
-{if $MODULE eq 'Calendar'}
-<div id="reportLay" style="width: 125px; right: 159px; top: 260px; display: none; z-index:50" onmouseout="fninvsh('reportLay')" onmouseover="fnvshNrm('reportLay')">
-        <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
-                <tr>
-                        <td>
-                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Events&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_EVENT}</a>
-                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Task&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_TASK}</a>
-                        </td>
-                </tr>
-        </table>
-
-</div>
-{/if}
-<!-- Activity createlink layer end  -->
-
-
-<TABLE border=0 cellspacing=0 cellpadding=0 width=100% class=small>
-<tr><td style="height:2px"></td></tr>
-<tr>
-	<td style="padding-left:10px;padding-right:50px" class="moduleName" nowrap>{$APP.$CATEGORY} > <a class="hdrLink" href="index.php?action=ListView&module={$MODULE}&parenttab={$CATEGORY}">{$APP.$MODULE}</a></td>
-	<td width=100% nowrap>
-	
-		<table border="0" cellspacing="0" cellpadding="0" >
-		<tr>
-		<td class="sep1" style="width:1px;"></td>
-		<td class=small >
-			<!-- Add and Search -->
-			<table border=0 cellspacing=0 cellpadding=0>
-			<tr>
-			<td>
-				<table border=0 cellspacing=0 cellpadding=5>
-				<tr>
-					{if $CHECK.EditView eq 'yes' && $MODULE neq 'Emails' && $MODULE neq 'Webmails'}
-			        		{if $MODULE eq 'Calendar'}
-		                      	        	<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Add-Faded.gif" border=0></td>
-                	   			 {else}
-	                        		       	<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$APP.$MODULE}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$APP.$MODULE}..." border=0></a></td>
-			                       	{/if}
-					{else}
-						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Add-Faded.gif" border=0></td>	
-					{/if}
-									
-					{if $CHECK.index eq 'yes' && $MODULE neq 'Emails' && $MODULE neq 'Webmails'}
-						 <td style="padding-right:10px"><a href="javascript:;" onClick="moveMe('searchAcc');searchshowhide('searchAcc','advSearch')" ><img src="{$IMAGE_PATH}btnL3Search.gif" alt="{$APP.LBL_SEARCH_ALT}{$APP.$MODULE}..." title="{$APP.LBL_SEARCH_TITLE}{$APP.$MODULE}..." border=0></a></a></td>
-					{else}
-						<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Search-Faded.gif" border=0></td>
-					{/if}
-					
-				</tr>
-				</table>
-			</td>
-			</tr>
-			</table>
-		</td>
-		<td style="width:20px;">&nbsp;</td>
-		<td class="small">
-			<!-- Calendar Clock Calculator and Chat -->
-				<table border=0 cellspacing=0 cellpadding=5>
-				<tr>
-					{if $CATEGORY eq 'Settings' || $CATEGORY eq 'Tools' || $CATEGORY eq 'Analytics'}
-						{if $CHECK.Calendar eq 'yes'}
-						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab=My Home Page");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
-						{else}
-						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
-						{/if}
-					{else}
-						{if $CHECK.Calendar eq 'yes'}
-						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab={$CATEGORY}");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
-						{else}
-						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
-						{/if}
-					{/if}
-					<td style="padding-right:0px"><a href="javascript:;"><img src="{$IMAGE_PATH}btnL3Clock.gif" alt="{$APP.LBL_CLOCK_ALT}" title="{$APP.LBL_CLOCK_TITLE}" border=0 onClick="fnvshobj(this,'wclock');"></a></a></td>
-					<td style="padding-right:0px"><a href="#"><img src="{$IMAGE_PATH}btnL3Calc.gif" alt="{$APP.LBL_CALCULATOR_ALT}" title="{$APP.LBL_CALCULATOR_TITLE}" border=0 onClick="fnvshobj(this,'calculator_cont');fetch_calc();"></a></td>
-					<td style="padding-right:10px"><a href="javascript:;" onClick='return window.open("index.php?module=Contacts&action=vtchat","Chat","width=600,height=450,resizable=1,scrollbars=1");'><img src="{$IMAGE_PATH}tbarChat.gif" alt="{$APP.LBL_CHAT_ALT}" title="{$APP.LBL_CHAT_TITLE}" border=0></a>
-                    </td>	
-					<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Tracker.gif" alt="{$APP.LBL_LAST_VIEWED}" title="{$APP.LBL_LAST_VIEWED}" border=0 onClick="fnvshobj(this,'tracker');">
-                    			</td>	
-				</tr>
-				</table>
-		</td>
-		<td style="width:20px;">&nbsp;</td>
-		<td class="small">
-			<!-- Import / Export -->
-			<table border=0 cellspacing=0 cellpadding=5>
-			<tr>
-			{if $MODULE eq 'Contacts' || $MODULE eq 'Leads' || $MODULE eq 'Accounts' || $MODULE eq 'Potentials' || $MODULE eq 'Products' }
-		   		{if $CHECK.Import eq 'yes'}	
-					<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=Import&step=1&return_module={$MODULE}&return_action=index&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}tbarImport.gif" alt="{$APP.LBL_IMPORT} {$APP.$MODULE}" title="{$APP.LBL_IMPORT} {$APP.$MODULE}" border="0"></a></td>	
-				{else}	
-					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>	
-				{/if}	
-				{if $CHECK.Export eq 'yes'}	
-	    			<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
-				{else}	
-					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
-                {/if}
-			{elseif $MODULE eq 'Notes' || $MODULE eq 'Emails'}	
-				
-				{if $CHECK.Export eq 'yes'}
-					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
-					<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
-				{else}	 
-					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
-					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
-				{/if}
-			{else}
-				<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
-                <td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
-			{/if}
-			</tr>
-			</table>	
-		<td style="width:20px;">&nbsp;</td>
-		<td class="small">
-			<!-- All Menu -->
-				<table border=0 cellspacing=0 cellpadding=5>
-				<tr>
-				<td style="padding-left:10px;"><a href="javascript:;" onmouseout="fninvsh('allMenu');" onClick="fnvshobj(this,'allMenu')"><img src="{$IMAGE_PATH}btnL3AllMenu.gif" alt="{$APP.LBL_ALL_MENU_ALT}" title="{$APP.LBL_ALL_MENU_TITLE}" border="0"></a></td>
-				</tr>
-				</table>
-		</td>			
-		</tr>
-		</table>
-	</td>
-</tr>
-<tr><td style="height:2px"></td></tr>
-</TABLE>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<!-- Activity createlink layer start  -->
+{if $MODULE eq 'Calendar'}
+<div id="reportLay" style="width: 125px; right: 159px; top: 260px; display: none; z-index:50" onmouseout="fninvsh('reportLay')" onmouseover="fnvshNrm('reportLay')">
+        <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
+                <tr>
+                        <td>
+                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Events&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_EVENT}</a>
+                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Task&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_TASK}</a>
+                        </td>
+                </tr>
+        </table>
+
+</div>
+{/if}
+<!-- Activity createlink layer end  -->
+
+
+<TABLE border=0 cellspacing=0 cellpadding=0 width=100% class=small>
+<tr><td style="height:2px"></td></tr>
+<tr>
+	<td style="padding-left:10px;padding-right:50px" class="moduleName" nowrap>{$APP.$CATEGORY} > <a class="hdrLink" href="index.php?action=ListView&module={$MODULE}&parenttab={$CATEGORY}">{$APP.$MODULE}</a></td>
+	<td width=100% nowrap>
+	
+		<table border="0" cellspacing="0" cellpadding="0" >
+		<tr>
+		<td class="sep1" style="width:1px;"></td>
+		<td class=small >
+			<!-- Add and Search -->
+			<table border=0 cellspacing=0 cellpadding=0>
+			<tr>
+			<td>
+				<table border=0 cellspacing=0 cellpadding=5>
+				<tr>
+					{if $CHECK.EditView eq 'yes' && $MODULE neq 'Emails' && $MODULE neq 'Webmails'}
+			        		{if $MODULE eq 'Calendar'}
+		                      	        	<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Add-Faded.gif" border=0></td>
+                	   			 {else}
+	                        		       	<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$APP.$SINGLE_MOD}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$APP.$SINGLE_MOD}..." border=0></a></td>
+			                       	{/if}
+					{else}
+						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Add-Faded.gif" border=0></td>	
+					{/if}
+									
+					{if $CHECK.index eq 'yes' && $MODULE neq 'Emails' && $MODULE neq 'Webmails'}
+						 <td style="padding-right:10px"><a href="javascript:;" onClick="moveMe('searchAcc');searchshowhide('searchAcc','advSearch')" ><img src="{$IMAGE_PATH}btnL3Search.gif" alt="{$APP.LBL_SEARCH_ALT}{$APP.$MODULE}..." title="{$APP.LBL_SEARCH_TITLE}{$APP.$MODULE}..." border=0></a></a></td>
+					{else}
+						<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Search-Faded.gif" border=0></td>
+					{/if}
+					
+				</tr>
+				</table>
+			</td>
+			</tr>
+			</table>
+		</td>
+		<td style="width:20px;">&nbsp;</td>
+		<td class="small">
+			<!-- Calendar Clock Calculator and Chat -->
+				<table border=0 cellspacing=0 cellpadding=5>
+				<tr>
+					{if $CATEGORY eq 'Settings' || $CATEGORY eq 'Tools' || $CATEGORY eq 'Analytics'}
+						{if $CHECK.Calendar eq 'yes'}
+						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab=My Home Page");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
+						{else}
+						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
+						{/if}
+					{else}
+						{if $CHECK.Calendar eq 'yes'}
+						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab={$CATEGORY}");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
+						{else}
+						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
+						{/if}
+					{/if}
+					<td style="padding-right:0px"><a href="javascript:;"><img src="{$IMAGE_PATH}btnL3Clock.gif" alt="{$APP.LBL_CLOCK_ALT}" title="{$APP.LBL_CLOCK_TITLE}" border=0 onClick="fnvshobj(this,'wclock');"></a></a></td>
+					<td style="padding-right:0px"><a href="#"><img src="{$IMAGE_PATH}btnL3Calc.gif" alt="{$APP.LBL_CALCULATOR_ALT}" title="{$APP.LBL_CALCULATOR_TITLE}" border=0 onClick="fnvshobj(this,'calculator_cont');fetch_calc();"></a></td>
+					<td style="padding-right:10px"><a href="javascript:;" onClick='return window.open("index.php?module=Contacts&action=vtchat","Chat","width=600,height=450,resizable=1,scrollbars=1");'><img src="{$IMAGE_PATH}tbarChat.gif" alt="{$APP.LBL_CHAT_ALT}" title="{$APP.LBL_CHAT_TITLE}" border=0></a>
+                    </td>	
+					<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Tracker.gif" alt="{$APP.LBL_LAST_VIEWED}" title="{$APP.LBL_LAST_VIEWED}" border=0 onClick="fnvshobj(this,'tracker');">
+                    			</td>	
+				</tr>
+				</table>
+		</td>
+		<td style="width:20px;">&nbsp;</td>
+		<td class="small">
+			<!-- Import / Export -->
+			<table border=0 cellspacing=0 cellpadding=5>
+			<tr>
+			{if $MODULE eq 'Contacts' || $MODULE eq 'Leads' || $MODULE eq 'Accounts' || $MODULE eq 'Potentials' || $MODULE eq 'Products' }
+		   		{if $CHECK.Import eq 'yes'}	
+					<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=Import&step=1&return_module={$MODULE}&return_action=index&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}tbarImport.gif" alt="{$APP.LBL_IMPORT} {$APP.$MODULE}" title="{$APP.LBL_IMPORT} {$APP.$MODULE}" border="0"></a></td>	
+				{else}	
+					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>	
+				{/if}	
+				{if $CHECK.Export eq 'yes'}	
+	    			<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
+				{else}	
+					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
+                {/if}
+			{elseif $MODULE eq 'Notes' || $MODULE eq 'Emails'}	
+				
+				{if $CHECK.Export eq 'yes'}
+					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
+					<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
+				{else}	 
+					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
+					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
+				{/if}
+			{else}
+				<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
+                <td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
+			{/if}
+			</tr>
+			</table>	
+		<td style="width:20px;">&nbsp;</td>
+		<td class="small">
+			<!-- All Menu -->
+				<table border=0 cellspacing=0 cellpadding=5>
+				<tr>
+				<td style="padding-left:10px;"><a href="javascript:;" onmouseout="fninvsh('allMenu');" onClick="fnvshobj(this,'allMenu')"><img src="{$IMAGE_PATH}btnL3AllMenu.gif" alt="{$APP.LBL_ALL_MENU_ALT}" title="{$APP.LBL_ALL_MENU_TITLE}" border="0"></a></td>
+				</tr>
+				</table>
+		</td>			
+		</tr>
+		</table>
+	</td>
+</tr>
+<tr><td style="height:2px"></td></tr>
+</TABLE>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List1.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List1.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Buttons_List1.tpl Tue Nov 14 03:16:10 2006
@@ -1,140 +1,142 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<!-- Activity createlink layer start  -->
-{if $MODULE eq 'Calendar'}
-<div id="reportLay" style="width: 125px; right: 159px; top: 260px; display: none; z-index:50" onmouseout="fninvsh('reportLay')" onmouseover="fnvshNrm('reportLay')">
-        <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
-                <tr>
-                        <td>
-                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Events&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_EVENT}</a>
-                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Task&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_TASK}</a>
-                        </td>
-                </tr>
-        </table>
-
-</div>
-{/if}
-<!-- Activity createlink layer end  -->
-
-
-<TABLE border=0 cellspacing=0 cellpadding=0 width=100% class=small>
-<tr><td style="height:2px"></td></tr>
-<tr>
-	{if $CATEGORY eq 'Settings'}
-<!-- No List View in Settings - Action is index -->
-		<td style="padding-left:10px;padding-right:50px" class="moduleName" nowrap><a class="hdrLink" href="index.php?action=index&module={$MODULE}&parenttab={$CATEGORY}">{$APP.$MODULE}</a></td>
-	{else}
-		<td style="padding-left:10px;padding-right:50px" class="moduleName" nowrap>{$APP.$CATEGORY} > <a class="hdrLink" href="index.php?action=ListView&module={$MODULE}&parenttab={$CATEGORY}">{$APP.$MODULE}</a></td>
-	{/if}
-	<td width=100% nowrap>
-	
-		<table border="0" cellspacing="0" cellpadding="0" >
-		<tr>
-		<td class="sep1" style="width:1px;"></td>
-		<td class=small >
-			<!-- Add and Search -->
-			<table border=0 cellspacing=0 cellpadding=0>
-			<tr>
-			<td>
-				<table border=0 cellspacing=0 cellpadding=5>
-				<tr>
-					{if $CHECK.EditView eq 'yes'}
-			        		{if $MODULE eq 'Calendar'}
-		                      	        	<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" id="showSubMenu"  onMouseOver="fnvshobj(this,'reportLay');" onMouseOut="fninvsh('reportLay');"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$MODULE}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$MODULE}..." border=0></a></td>
-                	   			 {else}
-	                        		       	<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$MODULE}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$MODULE}..." border=0></a></td>
-			                       	{/if}
-					{else}
-						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Add-Faded.gif" border=0></td>	
-					{/if}
-									
-						<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Search-Faded.gif" border=0></td>
-					
-				</tr>
-				</table>
-			</td>
-			</tr>
-			</table>
-		</td>
-		<td style="width:20px;">&nbsp;</td>
-		<td class="small">
-			<!-- Calendar Clock Calculator and Chat -->
-				<table border=0 cellspacing=0 cellpadding=5>
-				<tr>
-					{if $CATEGORY eq 'Settings' || $CATEGORY eq 'Tools' || $CATEGORY eq 'Analytics'}
-						{if $CHECK.Calendar eq 'yes'}
-						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab=My Home Page");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
-						{else}
-                                                <td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
-                                                {/if}
-					{else}
-						{if $CHECK.Calendar eq 'yes'}
-						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab={$CATEGORY}");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
-						{else}
-                                                <td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
-                                                {/if}
-					{/if}
-					<td style="padding-right:0px"><a href="javascript:;"><img src="{$IMAGE_PATH}btnL3Clock.gif" alt="{$APP.LBL_CLOCK_ALT}" title="{$APP.LBL_CLOCK_TITLE}" border=0 onClick="fnvshobj(this,'wclock');"></a></a></td>
-					<td style="padding-right:0px"><a href="#"><img src="{$IMAGE_PATH}btnL3Calc.gif" alt="{$APP.LBL_CALCULATOR_ALT}" title="{$APP.LBL_CALCULATOR_TITLE}" border=0 onClick="fnvshobj(this,'calculator_cont');fetch_calc();"></a></td>
-					<td style="padding-right:0px"><a href="javascript:;" onClick='return window.open("index.php?module=Contacts&action=vtchat","Chat","width=600,height=450,resizable=1,scrollbars=1");'><img src="{$IMAGE_PATH}tbarChat.gif" alt="{$APP.LBL_CHAT_ALT}" title="{$APP.LBL_CHAT_TITLE}" border=0></a>
-                    </td>	
-					<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Tracker.gif" alt="{$APP.LBL_LAST_VIEWED}" title="{$APP.LBL_LAST_VIEWED}" border=0 onClick="fnvshobj(this,'tracker');">
-                    			</td>	
-				</tr>
-				</table>
-		</td>
-		<td style="width:20px;">&nbsp;</td>
-		<td class="small">
-			<!-- Import / Export -->
-			<table border=0 cellspacing=0 cellpadding=5>
-			<tr>
-			{if $MODULE eq 'Contacts' || $MODULE eq 'Leads' || $MODULE eq 'Accounts' || $MODULE eq 'Potentials' || $MODULE eq 'Products' }
-		   		{if $CHECK.Import eq 'yes'}	
-					<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=Import&step=1&return_module={$MODULE}&return_action=index&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}tbarImport.gif" alt="{$APP.LBL_IMPORT} {$APP.$MODULE}" title="{$APP.LBL_IMPORT} {$APP.$MODULE}" border="0"></a></td>	
-				{else}	
-					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>	
-				{/if}	
-				{if $CHECK.Export eq 'yes'}	
-	    			<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
-				{else}	
-					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
-                {/if}
-			{elseif $MODULE eq 'Notes' || $MODULE eq 'Emails'}	
-				
-				{if $CHECK.Export eq 'yes'}
-					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
-					<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
-				{else}	 
-					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
-					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
-				{/if}
-			{else}
-				<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
-                <td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
-			{/if}
-			</tr>
-			</table>	
-		<td style="width:20px;">&nbsp;</td>
-		<td class="small">
-			<!-- All Menu -->
-				<table border=0 cellspacing=0 cellpadding=5>
-				<tr>
-				<td style="padding-left:10px;"><a href="javascript:;" onmouseout="fninvsh('allMenu');" onClick="fnvshobj(this,'allMenu')"><img src="{$IMAGE_PATH}btnL3AllMenu.gif" alt="{$APP.LBL_ALL_MENU_ALT}" title="{$APP.LBL_ALL_MENU_TITLE}" border="0"></a></td>
-				</tr>
-				</table>
-		</td>			
-		</tr>
-		</table>
-	</td>
-</tr>
-</TABLE>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<!-- Activity createlink layer start  -->
+{if $MODULE eq 'Calendar'}
+<div id="reportLay" style="width: 125px; right: 159px; top: 260px; display: none; z-index:50" onmouseout="fninvsh('reportLay')" onmouseover="fnvshNrm('reportLay')">
+        <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
+                <tr>
+                        <td>
+                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Events&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_EVENT}</a>
+                                <a href="index.php?module={$MODULE}&action=EditView&return_module={$MODULE}&activity_mode=Task&return_action=DetailView&parenttab={$CATEGORY}" class="calMnu">{$NEW_TASK}</a>
+                        </td>
+                </tr>
+        </table>
+
+</div>
+{/if}
+<!-- Activity createlink layer end  -->
+
+
+<TABLE border=0 cellspacing=0 cellpadding=0 width=100% class=small>
+<tr><td style="height:2px"></td></tr>
+<tr>
+	{if $CATEGORY eq 'Settings' || $CATEGORY eq 'Organization' }
+<!-- No List View in Settings and Organizations - Action is index -->
+		<td style="padding-left:10px;padding-right:50px" class="moduleName" nowrap><a class="hdrLink" href="index.php?action=index&module={$MODULE}&parenttab={$CATEGORY}">{$APP.$MODULE}</a></td>
+	{else}
+		<td style="padding-left:10px;padding-right:50px" class="moduleName" nowrap>{$APP.$CATEGORY} > <a class="hdrLink" href="index.php?action=ListView&module={$MODULE}&parenttab={$CATEGORY}">{$APP.$MODULE}</a></td>
+	{/if}
+	<td width=100% nowrap>
+	
+		<table border="0" cellspacing="0" cellpadding="0" >
+		<tr>
+		<td class="sep1" style="width:1px;"></td>
+		<td class=small >
+			<!-- Add and Search -->
+			<table border=0 cellspacing=0 cellpadding=0>
+			<tr>
+			<td>
+				<table border=0 cellspacing=0 cellpadding=5>
+				<tr>
+					{if $CHECK.EditView eq 'yes'}
+			        		{if $MODULE eq 'Calendar'}
+		                      	        	<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" id="showSubMenu"  onMouseOver="fnvshobj(this,'reportLay');" onMouseOut="fninvsh('reportLay');"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$SINGLE_MOD}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$SINGLE_MOD}..." border=0></a></td>
+			        		{elseif $MODULE eq 'OrgUnit'}
+	                        		       	<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}&parentid={$PARENTORG}"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$MODULE}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$MODULE}..." border=0></a></td>
+                	   			{else}
+	                        		       	<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=EditView&return_action=DetailView&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}btnL3Add.gif" alt="{$APP.LBL_CREATE_BUTTON_LABEL} {$SINGLE_MOD}..." title="{$APP.LBL_CREATE_BUTTON_LABEL} {$SINGLE_MOD}..." border=0></a></td>
+			                       	{/if}
+					{else}
+						<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Add-Faded.gif" border=0></td>	
+					{/if}
+									
+						<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Search-Faded.gif" border=0></td>
+					
+				</tr>
+				</table>
+			</td>
+			</tr>
+			</table>
+		</td>
+		<td style="width:20px;">&nbsp;</td>
+		<td class="small">
+			<!-- Calendar Clock Calculator and Chat -->
+				<table border=0 cellspacing=0 cellpadding=5>
+				<tr>
+					{if $CATEGORY eq 'Settings' || $CATEGORY eq 'Tools' || $CATEGORY eq 'Analytics'}
+						{if $CHECK.Calendar eq 'yes'}
+						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab=My Home Page");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
+						{else}
+                                                <td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
+                                                {/if}
+					{else}
+						{if $CHECK.Calendar eq 'yes'}
+						<td style="padding-right:0px;padding-left:10px;"><a href="javascript:;" onClick='fnvshobj(this,"miniCal");getMiniCal("parenttab={$CATEGORY}");'><img src="{$IMAGE_PATH}btnL3Calendar.gif" alt="{$APP.LBL_CALENDAR_ALT}" title="{$APP.LBL_CALENDAR_TITLE}" border=0></a></a></td>
+						{else}
+                                                <td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}btnL3Calendar-Faded.gif"></td>
+                                                {/if}
+					{/if}
+					<td style="padding-right:0px"><a href="javascript:;"><img src="{$IMAGE_PATH}btnL3Clock.gif" alt="{$APP.LBL_CLOCK_ALT}" title="{$APP.LBL_CLOCK_TITLE}" border=0 onClick="fnvshobj(this,'wclock');"></a></a></td>
+					<td style="padding-right:0px"><a href="#"><img src="{$IMAGE_PATH}btnL3Calc.gif" alt="{$APP.LBL_CALCULATOR_ALT}" title="{$APP.LBL_CALCULATOR_TITLE}" border=0 onClick="fnvshobj(this,'calculator_cont');fetch_calc();"></a></td>
+					<td style="padding-right:0px"><a href="javascript:;" onClick='return window.open("index.php?module=Contacts&action=vtchat","Chat","width=600,height=450,resizable=1,scrollbars=1");'><img src="{$IMAGE_PATH}tbarChat.gif" alt="{$APP.LBL_CHAT_ALT}" title="{$APP.LBL_CHAT_TITLE}" border=0></a>
+                    </td>	
+					<td style="padding-right:10px"><img src="{$IMAGE_PATH}btnL3Tracker.gif" alt="{$APP.LBL_LAST_VIEWED}" title="{$APP.LBL_LAST_VIEWED}" border=0 onClick="fnvshobj(this,'tracker');">
+                    			</td>	
+				</tr>
+				</table>
+		</td>
+		<td style="width:20px;">&nbsp;</td>
+		<td class="small">
+			<!-- Import / Export -->
+			<table border=0 cellspacing=0 cellpadding=5>
+			<tr>
+			{if $MODULE eq 'Contacts' || $MODULE eq 'Leads' || $MODULE eq 'Accounts' || $MODULE eq 'Potentials' || $MODULE eq 'Products' }
+		   		{if $CHECK.Import eq 'yes'}	
+					<td style="padding-right:0px;padding-left:10px;"><a href="index.php?module={$MODULE}&action=Import&step=1&return_module={$MODULE}&return_action=index&parenttab={$CATEGORY}"><img src="{$IMAGE_PATH}tbarImport.gif" alt="{$APP.LBL_IMPORT} {$APP.$MODULE}" title="{$APP.LBL_IMPORT} {$APP.$MODULE}" border="0"></a></td>	
+				{else}	
+					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>	
+				{/if}	
+				{if $CHECK.Export eq 'yes'}	
+	    			<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
+				{else}	
+					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
+                {/if}
+			{elseif $MODULE eq 'Notes' || $MODULE eq 'Emails'}	
+				
+				{if $CHECK.Export eq 'yes'}
+					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
+					<td style="padding-right:10px"><a href="index.php?module={$MODULE}&action=Export&all=1"><img src="{$IMAGE_PATH}tbarExport.gif" alt="{$APP.LBL_EXPORT} {$APP.$MODULE}" title="{$APP.LBL_EXPORT} {$APP.$MODULE}" border="0"></a></td>
+				{else}	 
+					<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
+					<td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
+				{/if}
+			{else}
+				<td style="padding-right:0px;padding-left:10px;"><img src="{$IMAGE_PATH}tbarImport-Faded.gif" border="0"></td>
+                <td style="padding-right:10px"><img src="{$IMAGE_PATH}tbarExport-Faded.gif" border="0"></td>
+			{/if}
+			</tr>
+			</table>	
+		<td style="width:20px;">&nbsp;</td>
+		<td class="small">
+			<!-- All Menu -->
+				<table border=0 cellspacing=0 cellpadding=5>
+				<tr>
+				<td style="padding-left:10px;"><a href="javascript:;" onmouseout="fninvsh('allMenu');" onClick="fnvshobj(this,'allMenu')"><img src="{$IMAGE_PATH}btnL3AllMenu.gif" alt="{$APP.LBL_ALL_MENU_ALT}" title="{$APP.LBL_ALL_MENU_TITLE}" border="0"></a></td>
+				</tr>
+				</table>
+		</td>			
+		</tr>
+		</table>
+	</td>
+</tr>
+</TABLE>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/CreateEmailTemplate.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/CreateEmailTemplate.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/CreateEmailTemplate.tpl Tue Nov 14 03:16:10 2006
@@ -1,324 +1,324 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-
-<script language="JavaScript" type="text/javascript">
-    var allOptions = null;
-
-    function setAllOptions(inputOptions) 
-    {ldelim}
-        allOptions = inputOptions;
-    {rdelim}
-
-    function modifyMergeFieldSelect(cause, effect) 
-    {ldelim}
-        var selected = cause.options[cause.selectedIndex].value;  id="mergeFieldValue"
-        var s = allOptions[cause.selectedIndex];
-            
-        effect.length = s;
-        for (var i = 0; i < s; i++) 
-	{ldelim}
-            effect.options[i] = s[i];
-        {rdelim}
-        document.getElementById('mergeFieldValue').value = '';
-    {rdelim}
-{literal}
-    function init() 
-    {
-        var blankOption = new Option('--None--', '--None--');
-        var allOpts = new Object(0);
-        var options = null;
-            
-	    options = new Object(19);
-            options[0] = blankOption;
-            
-                
-                options[1] = new Option('Account: Account Name', '$accounts-accountname$'); 
-                options[2] = new Option('Account: Account Type', '$accounts-account_type$'); 
-                options[3] = new Option('Account: Industry', '$accounts-industry$'); 
-                options[4] = new Option('Account: Annual Revenue', '$accounts-annualrevenue$'); 
-                options[5] = new Option('Account: Phone', '$accounts-phone$'); 
-                options[6] = new Option('Account: Email', '$accounts-email1$'); 
-                options[7] = new Option('Account: Rating', '$accounts-rating$'); 
-                options[8] = new Option('Account: Website', '$accounts-website$'); 
-                options[9] = new Option('Account: Fax', '$accounts-fax$'); 
-            
-	        allOpts[1] = options;
-        
-            options = new Object(11);
-            options[0] = blankOption;
-                
-                options[1] = new Option('Contact: First Name', '$contacts-firstname$'); 
-                options[2] = new Option('Contact: Last Name', '$contacts-lastname$'); 
-                options[3] = new Option('Contact: Salutation', '$contacts-salutationtype$'); 
-                options[4] = new Option('Contact: Title', '$contacts-title$'); 
-                options[5] = new Option('Contact: Email', '$contacts-email$'); 
-                options[6] = new Option('Contact: Department', '$contacts-department$'); 
-                options[7] = new Option('Contact: Other Email','$contacts-otheremail$'); 
-                options[8] = new Option('Contact: Phone', '$contacts-phone$'); 
-                options[9] = new Option('Contact: Mobile', '$contacts-mobile$'); 
-                options[10] = new Option('Contact: Currency', '$contacts-currency$'); 
-                            
-            allOpts[2] = options;
-        
-            
-            options = new Object(19);
-            options[0] = blankOption;
-            
-                
-                options[1] = new Option('Lead: First Name', '$leads-firstname$'); 
-                options[2] = new Option('Lead: Last Name', '$leads-lastname$'); 
-                options[3] = new Option('Lead: Lead Source', '$leads-leadsource$'); 
-                options[4] = new Option('Lead: Status', '$leads-leadstatus$'); 
-                options[5] = new Option('Lead: Rating', '$leads-rating$'); 
-                options[6] = new Option('Lead: Industry', '$leads-industry$'); 
-                options[7] = new Option('Lead: Yahoo ID', '$leads-yahooid$'); 
-                options[8] = new Option('Lead: Email', '$leads-email$'); 
-                options[9] = new Option('Lead: Annual Revenue', '$leads-annualrevenue$'); 
-                options[10] = new Option('Lead: Title', '$leads-designation$'); 
-                options[11] = new Option('Lead: Salutation', '$leads-salutation$'); 
-            
-	        allOpts[3] = options;
-
-	        options = new Object(19);
-                options[0] = blankOption;
-            
-                options[1] = new Option('User: First Name', '$users-first_name$'); 
-                options[2] = new Option('User: Last Name', '$users-last_name$'); 
-		options[3] = new Option('User: Title', '$users-title$'); 
-		options[4] = new Option('User: Department', '$users-department$'); 
-		options[5] = new Option('User: HomePhone', '$users-phone_home$'); 
-		options[6] = new Option('User: Mobile', '$users-phone_mobile$'); 
-		options[7] = new Option('User: Signature', '$users-signature$'); 
-		options[8] = new Option('User: Email', '$users-email$'); 
-		options[9] = new Option('User: Street', '$users-address_street$'); 
-		options[10] = new Option('User: City', '$users-address_city$'); 
-		options[11] = new Option('User: State', '$users-address_state$'); 
-		options[11] = new Option('User: Country', '$users-address_country$'); 
-		options[11] = new Option('User: PostalCode', '$users-address_postalcode$'); 
-            
-            	allOpts[4] = options;
-	    
-        setAllOptions(allOpts);
-    }
-	
-	function cancelForm(frm)
-	{
-		frm.action.value='detailviewemailtemplate';
-		frm.parenttab.value='Settings';
-		frm.submit();
-	}
-{/literal}
-</script>
-
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-<br>
-	<div align=center>
-	
-			{include file='SetMenu.tpl'}
-				<!-- DISPLAY -->
-				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
-				<form action="index.php" method="post" name="templatecreate" onsubmit="return check4null(templatecreate);">  
-				<input type="hidden" name="action">
-				<input type="hidden" name="mode" value="{$EMODE}">
-				<input type="hidden" name="module" value="Users">
-				<input type="hidden" name="templateid" value="{$TEMPLATEID}">
-				<input type="hidden" name="parenttab" value="PARENTTAB}">
-				<tr>
-					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}ViewTemplate.gif" alt="Users" width="45" height="60" border=0 title="Users"></td>
-				{if $EMODE eq 'edit'}
-					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$UMOD.LBL_EMAIL_TEMPLATES}</a> &gt; {$MOD.LBL_EDIT} &quot;{$TEMPLATENAME}&quot; </b></td>
-				{else}
-					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$UMOD.LBL_EMAIL_TEMPLATES}</a> &gt; {$MOD.LBL_CREATE_EMAIL_TEMPLATES} </b></td>
-				{/if}
-					
-				</tr>
-				<tr>
-					<td valign=top class="small">{$UMOD.LBL_EMAIL_TEMPLATE_DESC}</td>
-				</tr>
-				</table>
-				
-				<br>
-				<table border=0 cellspacing=0 cellpadding=10 width=100% >
-				<tr>
-				<td>
-				
-					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-					<tr>
-						{if $EMODE eq 'edit'}
-						<td class="big"><strong>{$UMOD.LBL_PROPERTIES} &quot;{$TEMPLATENAME}&quot; </strong></td>
-						{else}
-						<td class="big"><strong>{$MOD.LBL_CREATE_EMAIL_TEMPLATES}</strong></td>
-						{/if}
-						<td class="small" align=right>
-							<input type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}" class="crmButton small save" onclick="this.form.action.value='saveemailtemplate'; this.form.parenttab.value='Settings'" >&nbsp;&nbsp;
-			{if $EMODE eq 'edit'}
-				<input type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="crmButton small cancel" onclick="cancelForm(this.form)" />
-			{else}
-				<input type="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="crmButton small cancel" onclick="window.history.back()" >
-			{/if}
-						</td>
-					</tr>
-					</table>
-					
-					<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr>
-						<td width=20% class="small cellLabel"><font color="red">*</font><strong>{$UMOD.LBL_NAME}</strong></td>
-						<td width=80% class="small cellText"><input name="templatename" type="text" value="{$TEMPLATENAME}" class="detailedViewTextBox" tabindex="1">&nbsp;</td>
-					  </tr>
-					<tr>
-						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_DESCRIPTION}</strong></td>
-						<td class="cellText small" valign=top><span class="small cellText">
-						  <input name="description" type="text" value="{$DESCRIPTION}" class="detailedViewTextBox" tabindex="2">
-						</span></td>
-					  </tr>
-					<tr>
-						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_FOLDER}</strong></td>
-						<td class="cellText small" valign=top>
-						{if $EMODE eq 'edit'}
-						<select name="foldername" class="small" tabindex="" style="width:100%" tabindex="3">
-                                                    {foreach item=arr from=$FOLDERNAME}
-                                                     <option value="{$FOLDERNAME}" {$arr}>{$FOLDERNAME}</option>
-                                                        {if $FOLDERNAME == 'Public'}
-                                                          <option value="Personal">{$UMOD.LBL_PERSONAL}</option>
-                                                        {else}
-                                                          <option value="Public">{$UMOD.LBL_PUBLIC}</option>
-                                                         {/if}
-                                                   {/foreach}
-                                                 </select>
-						{else}
-						<select name="foldername" class="small" tabindex="" value="{$FOLDERNAME}" style="width:100%" tabindex="3">
-                                                    <option value="Personal">{$UMOD.LBL_PERSONAL}</option>
-                                                    <option value="Public" selected>{$UMOD.LBL_PUBLIC}</option>
-        	                                </select>
-						{/if}
-					
-						</td>
-					  </tr>
-					
-					
-					<tr>
-					  <td colspan="2" valign=top class="cellText small"><table width="100%"  border="0" cellspacing="0" cellpadding="0" class="thickBorder">
-                        <tr>
-                          <td valign=top><table width="100%"  border="0" cellspacing="0" cellpadding="5" >
-                              <tr>
-                                <td colspan="3" valign="top" class="small" style="background-color:#cccccc"><strong>{$UMOD.LBL_EMAIL_TEMPLATE}</strong></td>
-                                </tr>
-                              <tr>
-                                <td width="15%" valign="top" class="cellLabel small"><font color='red'>*</font>{$UMOD.LBL_SUBJECT}</td>
-                                <td width="85%" colspan="2" class="cellText small"><span class="small cellText">
-                                  <input name="subject" type="text" value="{$SUBJECT}" class="detailedViewTextBox" tabindex="4">
-                                </span></td>
-                              </tr>
-                              <tr>
-                                <td valign="top" width=10% class="cellLabel small">{$UMOD.LBL_MESSAGE}</td>
-                                 <td valign="top" width=60% class="cellText small"><p><textarea name="body" style="width:90%;height:200px" class=small tabindex="5">{$BODY}</textarea></p>
-                                    </td>
-                                <td valign="top" width=30% class="cellText small" style="border-left:2px dotted #cccccc;"><table width="100%"  border="0" cellspacing="0" cellpadding="5" >
-                                  <tr>
-                                    <td class="small"><strong>{$UMOD.LBL_MERGE_FIELDS}<br>
-                                    </strong>{$UMOD.LBL_USE_MERGE_FIELDS_TO_EMAIL_CONTENT}</td>
-                                  </tr>
-                                  <tr>
-                                    <td class="small" nowrap><strong>{$UMOD.LBL_STEP} 1. {$UMOD.LBL_SELECT_FIELD_TYPE}</strong></td>
-                                  </tr>
-				<tr><td><select class="detailedViewTextBox" id="entityType" ONCHANGE="modifyMergeFieldSelect(this, document.getElementById('mergeFieldSelect'));" tabindex="6">
-					<OPTION VALUE="0" selected>{$APP.LBL_NONE}                            
-					<OPTION VALUE="1">{$UMOD.LBL_ACCOUNT_FIELDS}                            
-                        	        <OPTION VALUE="2">{$UMOD.LBL_CONTACT_FIELDS}
-                      			<OPTION VALUE="3" >{$UMOD.LBL_LEAD_FIELDS}
-               				<OPTION VALUE="4" >{$UMOD.LBL_USER_FIELDS}
-					</select></td></tr>
-                                  <tr>
-                                    <td class="small"><strong>{$UMOD.LBL_STEP} 2. {$UMOD.LBL_SELECT_FIELD} </strong></td>
-                                  </tr>
-					<tr><td><select class="detailedViewTextBox" id="mergeFieldSelect" onchange="document.getElementById('mergeFieldValue').value=this.options[this.selectedIndex].value;" tabindex="7"><option value="0" selected>{$APP.LBL_NONE}</select></td></tr>
-                                  <tr>
-                                    <td class="small"><strong>{$UMOD.LBL_STEP} 3. {$UMOD.LBL_COPY_PASTE} </strong></td>
-                                  </tr>
-					<tr><td><input type="text"  id="mergeFieldValue" name="variable" value="variable" class="detailedViewTextBoxOn" tabindex="8"/></td></tr>
-                                </table></td>
-                              </tr>
-                          </table></td>
-                          
-                        </tr>
-                      </table></td>
-					  </tr>
-					</table>
-					<br>
-					<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr>
-					  <td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td>
-					</tr>
-					</table>
-				</td>
-				</tr>
-				</table>
-			
-			
-			
-			</td>
-			</tr>
-			</table>
-		</td>
-	</tr>
-	</form>
-	</table>
-		
-	</div>
-
-</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody>
-</table>
-<script>
-
-function check4null(form)
-{ldelim}
-
-        var isError = false;
-        var errorMessage = "";
-        // Here we decide whether to submit the form.
-        if (trim(form.templatename.value) =='') {ldelim}
-                isError = true;
-                errorMessage += "\n template name";
-                form.templatename.focus();
-        {rdelim}
-        if (trim(form.foldername.value) =='') {ldelim}
-                isError = true;
-                errorMessage += "\n folder name";
-                form.foldername.focus();
-        {rdelim}
-        if (trim(form.subject.value) =='') {ldelim}
-                isError = true;
-                errorMessage += "\n subject";
-                form.subject.focus();
-        {rdelim}
-
-        // Here we decide whether to submit the form.
-        if (isError == true) {ldelim}
-                alert("Missing required fields: " + errorMessage);
-                return false;
-        {rdelim}
- return true;
-
-{rdelim}
-
-init();
-
-</script>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+
+<script language="JavaScript" type="text/javascript">
+    var allOptions = null;
+
+    function setAllOptions(inputOptions) 
+    {ldelim}
+        allOptions = inputOptions;
+    {rdelim}
+
+    function modifyMergeFieldSelect(cause, effect) 
+    {ldelim}
+        var selected = cause.options[cause.selectedIndex].value;  id="mergeFieldValue"
+        var s = allOptions[cause.selectedIndex];
+            
+        effect.length = s;
+        for (var i = 0; i < s; i++) 
+	{ldelim}
+            effect.options[i] = s[i];
+        {rdelim}
+        document.getElementById('mergeFieldValue').value = '';
+    {rdelim}
+{literal}
+    function init() 
+    {
+        var blankOption = new Option('--None--', '--None--');
+        var allOpts = new Object(0);
+        var options = null;
+            
+	    options = new Object(19);
+            options[0] = blankOption;
+            
+                
+                options[1] = new Option('Account: Account Name', '$accounts-accountname$'); 
+                options[2] = new Option('Account: Account Type', '$accounts-account_type$'); 
+                options[3] = new Option('Account: Industry', '$accounts-industry$'); 
+                options[4] = new Option('Account: Annual Revenue', '$accounts-annualrevenue$'); 
+                options[5] = new Option('Account: Phone', '$accounts-phone$'); 
+                options[6] = new Option('Account: Email', '$accounts-email1$'); 
+                options[7] = new Option('Account: Rating', '$accounts-rating$'); 
+                options[8] = new Option('Account: Website', '$accounts-website$'); 
+                options[9] = new Option('Account: Fax', '$accounts-fax$'); 
+            
+	        allOpts[1] = options;
+        
+            options = new Object(11);
+            options[0] = blankOption;
+                
+                options[1] = new Option('Contact: First Name', '$contacts-firstname$'); 
+                options[2] = new Option('Contact: Last Name', '$contacts-lastname$'); 
+                options[3] = new Option('Contact: Salutation', '$contacts-salutation$'); 
+                options[4] = new Option('Contact: Title', '$contacts-title$'); 
+                options[5] = new Option('Contact: Email', '$contacts-email$'); 
+                options[6] = new Option('Contact: Department', '$contacts-department$'); 
+                options[7] = new Option('Contact: Other Email','$contacts-otheremail$'); 
+                options[8] = new Option('Contact: Phone', '$contacts-phone$'); 
+                options[9] = new Option('Contact: Mobile', '$contacts-mobile$'); 
+                options[10] = new Option('Contact: Currency', '$contacts-currency$'); 
+                            
+            allOpts[2] = options;
+        
+            
+            options = new Object(19);
+            options[0] = blankOption;
+            
+                
+                options[1] = new Option('Lead: First Name', '$leads-firstname$'); 
+                options[2] = new Option('Lead: Last Name', '$leads-lastname$'); 
+                options[3] = new Option('Lead: Lead Source', '$leads-leadsource$'); 
+                options[4] = new Option('Lead: Status', '$leads-leadstatus$'); 
+                options[5] = new Option('Lead: Rating', '$leads-rating$'); 
+                options[6] = new Option('Lead: Industry', '$leads-industry$'); 
+                options[7] = new Option('Lead: Yahoo ID', '$leads-yahooid$'); 
+                options[8] = new Option('Lead: Email', '$leads-email$'); 
+                options[9] = new Option('Lead: Annual Revenue', '$leads-annualrevenue$'); 
+                options[10] = new Option('Lead: Title', '$leads-designation$'); 
+                options[11] = new Option('Lead: Salutation', '$leads-salutation$'); 
+            
+	        allOpts[3] = options;
+
+	        options = new Object(19);
+                options[0] = blankOption;
+            
+                options[1] = new Option('User: First Name', '$users-first_name$'); 
+                options[2] = new Option('User: Last Name', '$users-last_name$'); 
+		options[3] = new Option('User: Title', '$users-title$'); 
+		options[4] = new Option('User: Department', '$users-department$'); 
+		options[5] = new Option('User: HomePhone', '$users-phone_home$'); 
+		options[6] = new Option('User: Mobile', '$users-phone_mobile$'); 
+		options[7] = new Option('User: Signature', '$users-signature$'); 
+		options[8] = new Option('User: Email', '$users-email$'); 
+		options[9] = new Option('User: Street', '$users-address_street$'); 
+		options[10] = new Option('User: City', '$users-address_city$'); 
+		options[11] = new Option('User: State', '$users-address_state$'); 
+		options[11] = new Option('User: Country', '$users-address_country$'); 
+		options[11] = new Option('User: PostalCode', '$users-address_postalcode$'); 
+            
+            	allOpts[4] = options;
+	    
+        setAllOptions(allOpts);
+    }
+	
+	function cancelForm(frm)
+	{
+		frm.action.value='detailviewemailtemplate';
+		frm.parenttab.value='Settings';
+		frm.submit();
+	}
+{/literal}
+</script>
+
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+<br>
+	<div align=center>
+	
+			{include file='SetMenu.tpl'}
+				<!-- DISPLAY -->
+				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
+				<form action="index.php" method="post" name="templatecreate" onsubmit="return check4null(templatecreate);">  
+				<input type="hidden" name="action">
+				<input type="hidden" name="mode" value="{$EMODE}">
+				<input type="hidden" name="module" value="Users">
+				<input type="hidden" name="templateid" value="{$TEMPLATEID}">
+				<input type="hidden" name="parenttab" value="PARENTTAB}">
+				<tr>
+					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}ViewTemplate.gif" alt="Users" width="45" height="60" border=0 title="Users"></td>
+				{if $EMODE eq 'edit'}
+					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$UMOD.LBL_EMAIL_TEMPLATES}</a> &gt; {$MOD.LBL_EDIT} &quot;{$TEMPLATENAME}&quot; </b></td>
+				{else}
+					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$UMOD.LBL_EMAIL_TEMPLATES}</a> &gt; {$MOD.LBL_CREATE_EMAIL_TEMPLATES} </b></td>
+				{/if}
+					
+				</tr>
+				<tr>
+					<td valign=top class="small">{$UMOD.LBL_EMAIL_TEMPLATE_DESC}</td>
+				</tr>
+				</table>
+				
+				<br>
+				<table border=0 cellspacing=0 cellpadding=10 width=100% >
+				<tr>
+				<td>
+				
+					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+					<tr>
+						{if $EMODE eq 'edit'}
+						<td class="big"><strong>{$UMOD.LBL_PROPERTIES} &quot;{$TEMPLATENAME}&quot; </strong></td>
+						{else}
+						<td class="big"><strong>{$MOD.LBL_CREATE_EMAIL_TEMPLATES}</strong></td>
+						{/if}
+						<td class="small" align=right>
+							<input type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}" class="crmButton small save" onclick="this.form.action.value='saveemailtemplate'; this.form.parenttab.value='Settings'" >&nbsp;&nbsp;
+			{if $EMODE eq 'edit'}
+				<input type="submit" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="crmButton small cancel" onclick="cancelForm(this.form)" />
+			{else}
+				<input type="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="crmButton small cancel" onclick="window.history.back()" >
+			{/if}
+						</td>
+					</tr>
+					</table>
+					
+					<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr>
+						<td width=20% class="small cellLabel"><font color="red">*</font><strong>{$UMOD.LBL_NAME}</strong></td>
+						<td width=80% class="small cellText"><input name="templatename" type="text" value="{$TEMPLATENAME}" class="detailedViewTextBox" tabindex="1">&nbsp;</td>
+					  </tr>
+					<tr>
+						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_DESCRIPTION}</strong></td>
+						<td class="cellText small" valign=top><span class="small cellText">
+						  <input name="description" type="text" value="{$DESCRIPTION}" class="detailedViewTextBox" tabindex="2">
+						</span></td>
+					  </tr>
+					<tr>
+						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_FOLDER}</strong></td>
+						<td class="cellText small" valign=top>
+						{if $EMODE eq 'edit'}
+						<select name="foldername" class="small" tabindex="" style="width:100%" tabindex="3">
+                                                    {foreach item=arr from=$FOLDERNAME}
+                                                     <option value="{$FOLDERNAME}" {$arr}>{$FOLDERNAME}</option>
+                                                        {if $FOLDERNAME == 'Public'}
+                                                          <option value="Personal">{$UMOD.LBL_PERSONAL}</option>
+                                                        {else}
+                                                          <option value="Public">{$UMOD.LBL_PUBLIC}</option>
+                                                         {/if}
+                                                   {/foreach}
+                                                 </select>
+						{else}
+						<select name="foldername" class="small" tabindex="" value="{$FOLDERNAME}" style="width:100%" tabindex="3">
+                                                    <option value="Personal">{$UMOD.LBL_PERSONAL}</option>
+                                                    <option value="Public" selected>{$UMOD.LBL_PUBLIC}</option>
+        	                                </select>
+						{/if}
+					
+						</td>
+					  </tr>
+					
+					
+					<tr>
+					  <td colspan="2" valign=top class="cellText small"><table width="100%"  border="0" cellspacing="0" cellpadding="0" class="thickBorder">
+                        <tr>
+                          <td valign=top><table width="100%"  border="0" cellspacing="0" cellpadding="5" >
+                              <tr>
+                                <td colspan="3" valign="top" class="small" style="background-color:#cccccc"><strong>{$UMOD.LBL_EMAIL_TEMPLATE}</strong></td>
+                                </tr>
+                              <tr>
+                                <td width="15%" valign="top" class="cellLabel small"><font color='red'>*</font>{$UMOD.LBL_SUBJECT}</td>
+                                <td width="85%" colspan="2" class="cellText small"><span class="small cellText">
+                                  <input name="subject" type="text" value="{$SUBJECT}" class="detailedViewTextBox" tabindex="4">
+                                </span></td>
+                              </tr>
+                              <tr>
+                                <td valign="top" width=10% class="cellLabel small">{$UMOD.LBL_MESSAGE}</td>
+                                 <td valign="top" width=60% class="cellText small"><p><textarea name="body" style="width:90%;height:200px" class=small tabindex="5">{$BODY}</textarea></p>
+                                    </td>
+                                <td valign="top" width=30% class="cellText small" style="border-left:2px dotted #cccccc;"><table width="100%"  border="0" cellspacing="0" cellpadding="5" >
+                                  <tr>
+                                    <td class="small"><strong>{$UMOD.LBL_MERGE_FIELDS}<br>
+                                    </strong>{$UMOD.LBL_USE_MERGE_FIELDS_TO_EMAIL_CONTENT}</td>
+                                  </tr>
+                                  <tr>
+                                    <td class="small" nowrap><strong>{$UMOD.LBL_STEP} 1. {$UMOD.LBL_SELECT_FIELD_TYPE}</strong></td>
+                                  </tr>
+				<tr><td><select class="detailedViewTextBox" id="entityType" ONCHANGE="modifyMergeFieldSelect(this, document.getElementById('mergeFieldSelect'));" tabindex="6">
+					<OPTION VALUE="0" selected>{$APP.LBL_NONE}                            
+					<OPTION VALUE="1">{$UMOD.LBL_ACCOUNT_FIELDS}                            
+                        	        <OPTION VALUE="2">{$UMOD.LBL_CONTACT_FIELDS}
+                      			<OPTION VALUE="3" >{$UMOD.LBL_LEAD_FIELDS}
+               				<OPTION VALUE="4" >{$UMOD.LBL_USER_FIELDS}
+					</select></td></tr>
+                                  <tr>
+                                    <td class="small"><strong>{$UMOD.LBL_STEP} 2. {$UMOD.LBL_SELECT_FIELD} </strong></td>
+                                  </tr>
+					<tr><td><select class="detailedViewTextBox" id="mergeFieldSelect" onchange="document.getElementById('mergeFieldValue').value=this.options[this.selectedIndex].value;" tabindex="7"><option value="0" selected>{$APP.LBL_NONE}</select></td></tr>
+                                  <tr>
+                                    <td class="small"><strong>{$UMOD.LBL_STEP} 3. {$UMOD.LBL_COPY_PASTE} </strong></td>
+                                  </tr>
+					<tr><td><input type="text"  id="mergeFieldValue" name="variable" value="variable" class="detailedViewTextBoxOn" tabindex="8"/></td></tr>
+                                </table></td>
+                              </tr>
+                          </table></td>
+                          
+                        </tr>
+                      </table></td>
+					  </tr>
+					</table>
+					<br>
+					<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr>
+					  <td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td>
+					</tr>
+					</table>
+				</td>
+				</tr>
+				</table>
+			
+			
+			
+			</td>
+			</tr>
+			</table>
+		</td>
+	</tr>
+	</form>
+	</table>
+		
+	</div>
+
+</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody>
+</table>
+<script>
+
+function check4null(form)
+{ldelim}
+
+        var isError = false;
+        var errorMessage = "";
+        // Here we decide whether to submit the form.
+        if (trim(form.templatename.value) =='') {ldelim}
+                isError = true;
+                errorMessage += "\n template name";
+                form.templatename.focus();
+        {rdelim}
+        if (trim(form.foldername.value) =='') {ldelim}
+                isError = true;
+                errorMessage += "\n folder name";
+                form.foldername.focus();
+        {rdelim}
+        if (trim(form.subject.value) =='') {ldelim}
+                isError = true;
+                errorMessage += "\n subject";
+                form.subject.focus();
+        {rdelim}
+
+        // Here we decide whether to submit the form.
+        if (isError == true) {ldelim}
+                alert("Missing required fields: " + errorMessage);
+                return false;
+        {rdelim}
+ return true;
+
+{rdelim}
+
+init();
+
+</script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/CreateView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/CreateView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/CreateView.tpl Tue Nov 14 03:16:10 2006
@@ -1,276 +1,285 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-{*<!-- module header -->*}
-
-<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
-<script type="text/javascript" src="jscalendar/calendar.js"></script>
-<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
-<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-
-<script type="text/javascript">
-function sensex_info()
-{ldelim}
-        var Ticker = $('tickersymbol').value;
-        if(Ticker!='')
-        {ldelim}
-                $("vtbusy_info").style.display="inline";
-                new Ajax.Request(
-                      'index.php',
-                      {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                                method: 'post',
-                                postBody: 'module={$MODULE}&action=Tickerdetail&tickersymbol='+Ticker,
-                                onComplete: function(response) {ldelim}
-                                        $('autocom').innerHTML = response.responseText;
-                                        $('autocom').style.display="block";
-                                        $("vtbusy_info").style.display="none";
-                                {rdelim}
-                        {rdelim}
-                );
-        {rdelim}
-{rdelim}
-</script>
-
-		{include file='Buttons_List1.tpl'}
-
-{*<!-- Contents -->*}
-<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
-   <tr>
-	<td valign=top>
-		<img src="{$IMAGE_PATH}showPanelTopLeft.gif">
-	</td>
-
-	<td class="showPanelBg" valign=top width=100%>
-	     {*<!-- PUBLIC CONTENTS STARTS-->*}
-	     <div class="small" style="padding:20px">
-		
-		 {if $OP_MODE eq 'edit_view'}   
-			 <span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$APP.LBL_EDITING} {$APP[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span> <br>
-			{$UPDATEINFO}	 
-		 {/if}
-		 {if $OP_MODE eq 'create_view'}
-			<span class="lvtHeaderText">{$APP.LBL_CREATING} {$APP.LBL_NEW} {$APP[$SINGLE_MOD]}</span> <br>
-		 {/if}
-
-		 <hr noshade size=1>
-		 <br> 
-		
-		{include file='EditViewHidden.tpl'}
-
-		{*<!-- Account details tabs -->*}
-		<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
-		   <tr>
-			<td>
-				<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
-				   <tr>
-					<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
-
-					{if $MODULE eq 'Leads' || $MODULE eq 'Accounts' || $MODULE eq 'Contacts' || $MODULE eq 'Products'}	
-						<td width=75 style="width:15%" align="center" nowrap class="dvtSelectedCell" id="bi" onclick="fnLoadValues('bi','mi','basicTab','moreTab','normal','{$MODULE}')"><b>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</b></td>
-                    				<td class="dvtUnSelectedCell" style="width: 100px;" align="center" nowrap id="mi" onclick="fnLoadValues('mi','bi','moreTab','basicTab','normal','{$MODULE}')"><b>{$APP.LBL_MORE} {$APP.LBL_INFORMATION} </b></td>
-                   				<td class="dvtTabCache" style="width:65%" nowrap>&nbsp;</td>
-					{else}
-						<td class="dvtSelectedCell" align=center nowrap>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</td>
-	                                        <td class="dvtTabCache" style="width:65%">&nbsp;</td>
-					{/if}
-				   <tr>
-				</table>
-			</td>
-		   </tr>
-		   <tr>
-			<td valign=top align=left >
-
-			    <!-- Basic Information Tab Opened -->
-			    <div id="basicTab">
-
-				<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
-				   <tr>
-					<td align=left>
-					<!-- content cache -->
-					
-						<table border=0 cellspacing=0 cellpadding=0 width=100%>
-						   <tr>
-							<td id ="autocom"></td>
-						   </tr>
-						   <tr>
-							<td style="padding:10px">
-							<!-- General details -->
-								<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
-								   <tr>
-									<td  colspan=4 style="padding:5px">
-									   <div align="center">
-										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-                                                                 		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-									   </div>
-									</td>
-								   </tr>
-
-								   {foreach key=header item=data from=$BASBLOCKS}
-								   <tr>
-									{if $header== 'Address Information' && ($MODULE == 'Accounts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
-                                                                        <td colspan=2 class="detailedViewHeader">
-                                                                        <b>{$header}</b></td>
-                                                                        <td class="detailedViewHeader">
-                                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
-                                                                        <td class="detailedViewHeader">
-                                                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
-
-									{elseif $header== 'Address Information' && $MODULE == 'Contacts'}
-									<td colspan=2 class="detailedViewHeader">
-                                                                        <b>{$header}</b></td>
-                                                                        <td class="detailedViewHeader">
-                                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_CPY_OTHER_ADDRESS}</b></td>
-                                                                        <td class="detailedViewHeader">
-                                                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_CPY_MAILING_ADDRESS}</b></td>
-                                                                        {else}
-						         		<td colspan=4 class="detailedViewHeader">
-                                                	        		<b>{$header}</b>
-									{/if}
-							 		</td>
-		                                        	   </tr>
-
-								   <!-- Here we should include the uitype handlings-->
-								   {include file="DisplayFields.tpl"}							
-								   <tr style="height:25px"><td>&nbsp;</td></tr>
-								   {/foreach}
-
-								   <tr>
-									<td  colspan=4 style="padding:5px">
-									   <div align="center">
-										{if $MODULE eq 'Emails'}
-                                                                			<input title="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_KEY}" class="crmbutton small create" onclick="window.open('index.php?module=Users&action=lookupemailtemplates&entityid={$ENTITY_ID}&entity={$ENTITY_TYPE}','emailtemplate','top=100,left=200,height=400,width=300,menubar=no,addressbar=no,status=yes')" type="button" name="button" value="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_LABEL}">
-                                                                			<input title="{$MOD.LBL_SEND}" accessKey="{$MOD.LBL_SEND}" class="crmbutton small save" onclick="this.form.action.value='Save';this.form.send_mail.value='true'; return formValidate()" type="submit" name="button" value="  {$MOD.LBL_SEND}  " >
-                                                                		{/if}
-                                                                		<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-                                                                		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-									   </div>
-									</td>
-								   </tr>
-								</table>
-							</td>
-						   </tr>
-						</table>
-					</td>
-				   </tr>
-				</table>
-					
-			    </div>
-			    <!-- Basic Information Tab Closed -->
-
-			    <!-- More Information Tab Opened -->
-			    <div id="moreTab">
-				<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
-				   <tr>
-					<td align=left>
-					{*<!-- content cache -->*}
-					
-						<table border=0 cellspacing=0 cellpadding=0 width=100%>
-						   <tr>
-							<td id ="autocom"></td>
-						   </tr>
-						   <tr>
-							<td style="padding:10px">
-							<!-- General details -->
-								<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
-								   <tr>
-									<td  colspan=4 style="padding:5px">
-									   <div align="center">
-										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-                                                                 		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-									   </div>
-									</td>
-								   </tr>
-
-								   {foreach key=header item=data from=$ADVBLOCKS}
-								   <tr>
-						         		<td colspan=4 class="detailedViewHeader">
-                                                	        		<b>{$header}</b>
-                                                         		</td>
-                                                         	   </tr>
-
-								   <!-- Here we should include the uitype handlings-->
-                                                        	   {include file="DisplayFields.tpl"}
-
-							 	   <tr style="height:25px"><td>&nbsp;</td></tr>
-								   {/foreach}
-
-								   <tr>
-									<td  colspan=4 style="padding:5px">
-									   <div align="center">
-										{if $MODULE eq 'Emails'}
-                                                                			<input title="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_KEY}" class="crmbutton small create" onclick="window.open('index.php?module=Users&action=lookupemailtemplates&entityid={$ENTITY_ID}&entity={$ENTITY_TYPE}','emailtemplate','top=100,left=200,height=400,width=300,menubar=no,addressbar=no,status=yes')" type="button" name="button" value="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_LABEL}">
-                                                                			<input title="{$MOD.LBL_SEND}" accessKey="{$MOD.LBL_SEND}" class="crmbutton small save" onclick="this.form.action.value='Save';this.form.send_mail.value='true'; return formValidate()" type="submit" name="button" value="  {$MOD.LBL_SEND}  " >
-                                                                		{/if}
-
-										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-										<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-									   </div>
-									</td>
-								   </tr>
-								</table>
-							</td>
-						   </tr>
-						</table>
-					</td>
-				   </tr>
-				</table>
-			    </div>
-
-			</td>
-		   </tr>
-		</table>
-	     </div>
-	</td>
-	<td align=right valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</table>
-</form>
-
-{if ($MODULE eq 'Emails' || 'Notes') and ($FCKEDITOR_DISPLAY eq 'true')}
-       <script type="text/javascript" src="include/fckeditor/fckeditor.js"></script>
-       <script type="text/javascript" defer="1">
-
-       var oFCKeditor = null;
-
-       {if $MODULE eq 'Notes'}
-               oFCKeditor = new FCKeditor( "notecontent" ) ;
-       {/if}
-
-       oFCKeditor.BasePath   = "include/fckeditor/" ;
-       oFCKeditor.ReplaceTextarea() ;
-
-       </script>
-{/if}
-{if $MODULE eq 'Accounts'}
-<script>
-	ScrollEffect.limit = 201;
-	ScrollEffect.closelimit= 200;
-</script>
-{/if}
-<script>
-
-
-
-        var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
-
-        var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
-
-        var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
-
-
-</script>
-
-
-
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+{*<!-- module header -->*}
+
+<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
+<script type="text/javascript" src="jscalendar/calendar.js"></script>
+<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
+<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+
+<script type="text/javascript">
+function sensex_info()
+{ldelim}
+        var Ticker = $('tickersymbol').value;
+        if(Ticker!='')
+        {ldelim}
+                $("vtbusy_info").style.display="inline";
+                new Ajax.Request(
+                      'index.php',
+                      {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                                method: 'post',
+                                postBody: 'module={$MODULE}&action=Tickerdetail&tickersymbol='+Ticker,
+                                onComplete: function(response) {ldelim}
+                                        $('autocom').innerHTML = response.responseText;
+                                        $('autocom').style.display="block";
+                                        $("vtbusy_info").style.display="none";
+                                {rdelim}
+                        {rdelim}
+                );
+        {rdelim}
+{rdelim}
+</script>
+
+		{include file='Buttons_List1.tpl'}
+
+{*<!-- Contents -->*}
+<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
+   <tr>
+	<td valign=top>
+		<img src="{$IMAGE_PATH}showPanelTopLeft.gif">
+	</td>
+
+	<td class="showPanelBg" valign=top width=100%>
+	     {*<!-- PUBLIC CONTENTS STARTS-->*}
+	     <div class="small" style="padding:20px">
+		
+		 {if $OP_MODE eq 'edit_view'}   
+			 <span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$APP.LBL_EDITING} {$APP[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span> <br>
+			{$UPDATEINFO}	 
+		 {/if}
+		 {if $OP_MODE eq 'create_view'}
+			<span class="lvtHeaderText">{$APP.LBL_CREATING} {$APP.LBL_NEW} {$APP[$SINGLE_MOD]}</span> <br>
+		 {/if}
+
+		 <hr noshade size=1>
+		 <br> 
+		
+		{include file='EditViewHidden.tpl'}
+
+		{*<!-- Account details tabs -->*}
+		<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
+		   <tr>
+			<td>
+				<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
+				   <tr>
+					<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+
+					{if $MODULE eq 'Leads' || $MODULE eq 'Accounts' || $MODULE eq 'Contacts' || $MODULE eq 'Products'}	
+						<td width=75 style="width:15%" align="center" nowrap class="dvtSelectedCell" id="bi" onclick="fnLoadValues('bi','mi','basicTab','moreTab','normal','{$MODULE}')"><b>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</b></td>
+                    				<td class="dvtUnSelectedCell" style="width: 100px;" align="center" nowrap id="mi" onclick="fnLoadValues('mi','bi','moreTab','basicTab','normal','{$MODULE}')"><b>{$APP.LBL_MORE} {$APP.LBL_INFORMATION} </b></td>
+                   				<td class="dvtTabCache" style="width:65%" nowrap>&nbsp;</td>
+					{else}
+						<td class="dvtSelectedCell" align=center nowrap>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</td>
+	                                        <td class="dvtTabCache" style="width:65%">&nbsp;</td>
+					{/if}
+				   <tr>
+				</table>
+			</td>
+		   </tr>
+		   <tr>
+			<td valign=top align=left >
+
+			    <!-- Basic Information Tab Opened -->
+			    <div id="basicTab">
+
+				<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
+				   <tr>
+					<td align=left>
+					<!-- content cache -->
+					
+						<table border=0 cellspacing=0 cellpadding=0 width=100%>
+						   <tr>
+							<td id ="autocom"></td>
+						   </tr>
+						   <tr>
+							<td style="padding:10px">
+							<!-- General details -->
+								<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
+								   <tr>
+									<td  colspan=4 style="padding:5px">
+									   <div align="center">
+										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+                                                                 		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+									   </div>
+									</td>
+								   </tr>
+
+								   {foreach key=header item=data from=$BASBLOCKS}
+								   <tr>
+									{if $header== $MOD.LBL_ADDRESS_INFORMATION && ($MODULE == 'Accounts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
+                                                                        <td colspan=2 class="detailedViewHeader">
+                                                                        <b>{$header}</b></td>
+                                                                        <td class="detailedViewHeader">
+                                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
+                                                                        <td class="detailedViewHeader">
+                                                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
+
+									{elseif $header== $MOD.LBL_ADDRESS_INFORMATION && $MODULE == 'Contacts'}
+									<td colspan=2 class="detailedViewHeader">
+                                                                        <b>{$header}</b></td>
+                                                                        <td class="detailedViewHeader">
+                                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_CPY_OTHER_ADDRESS}</b></td>
+                                                                        <td class="detailedViewHeader">
+                                                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_CPY_MAILING_ADDRESS}</b></td>
+                                                                        {else}
+						         		<td colspan=4 class="detailedViewHeader">
+                                                	        		<b>{$header}</b>
+									{/if}
+							 		</td>
+		                                        	   </tr>
+
+								   <!-- Here we should include the uitype handlings-->
+								   {include file="DisplayFields.tpl"}							
+								   <tr style="height:25px"><td>&nbsp;</td></tr>
+								   {/foreach}
+
+								   <!-- Added to display the Organization Units --> 
+								   {if $MODULE eq "Organization"}
+								   <tr>
+									<td colspan=4>
+									       {include file="DetailsViewOrgUnit.tpl"}
+									</td>
+								   </tr>
+								   {/if}
+
+								   <tr>
+									<td  colspan=4 style="padding:5px">
+									   <div align="center">
+										{if $MODULE eq 'Emails'}
+                                                                			<input title="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_KEY}" class="crmbutton small create" onclick="window.open('index.php?module=Users&action=lookupemailtemplates&entityid={$ENTITY_ID}&entity={$ENTITY_TYPE}','emailtemplate','top=100,left=200,height=400,width=300,menubar=no,addressbar=no,status=yes')" type="button" name="button" value="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_LABEL}">
+                                                                			<input title="{$MOD.LBL_SEND}" accessKey="{$MOD.LBL_SEND}" class="crmbutton small save" onclick="this.form.action.value='Save';this.form.send_mail.value='true'; return formValidate()" type="submit" name="button" value="  {$MOD.LBL_SEND}  " >
+                                                                		{/if}
+                                                                		<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+                                                                		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+									   </div>
+									</td>
+								   </tr>
+								</table>
+							</td>
+						   </tr>
+						</table>
+					</td>
+				   </tr>
+				</table>
+					
+			    </div>
+			    <!-- Basic Information Tab Closed -->
+
+			    <!-- More Information Tab Opened -->
+			    <div id="moreTab">
+				<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
+				   <tr>
+					<td align=left>
+					{*<!-- content cache -->*}
+					
+						<table border=0 cellspacing=0 cellpadding=0 width=100%>
+						   <tr>
+							<td id ="autocom"></td>
+						   </tr>
+						   <tr>
+							<td style="padding:10px">
+							<!-- General details -->
+								<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
+								   <tr>
+									<td  colspan=4 style="padding:5px">
+									   <div align="center">
+										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+                                                                 		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+									   </div>
+									</td>
+								   </tr>
+
+								   {foreach key=header item=data from=$ADVBLOCKS}
+								   <tr>
+						         		<td colspan=4 class="detailedViewHeader">
+                                                	        		<b>{$header}</b>
+                                                         		</td>
+                                                         	   </tr>
+
+								   <!-- Here we should include the uitype handlings-->
+                                                        	   {include file="DisplayFields.tpl"}
+
+							 	   <tr style="height:25px"><td>&nbsp;</td></tr>
+								   {/foreach}
+
+								   <tr>
+									<td  colspan=4 style="padding:5px">
+									   <div align="center">
+										{if $MODULE eq 'Emails'}
+                                                                			<input title="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_KEY}" class="crmbutton small create" onclick="window.open('index.php?module=Users&action=lookupemailtemplates&entityid={$ENTITY_ID}&entity={$ENTITY_TYPE}','emailtemplate','top=100,left=200,height=400,width=300,menubar=no,addressbar=no,status=yes')" type="button" name="button" value="{$APP.LBL_SELECTEMAILTEMPLATE_BUTTON_LABEL}">
+                                                                			<input title="{$MOD.LBL_SEND}" accessKey="{$MOD.LBL_SEND}" class="crmbutton small save" onclick="this.form.action.value='Save';this.form.send_mail.value='true'; return formValidate()" type="submit" name="button" value="  {$MOD.LBL_SEND}  " >
+                                                                		{/if}
+
+										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';return formValidate()" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+										<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+									   </div>
+									</td>
+								   </tr>
+								</table>
+							</td>
+						   </tr>
+						</table>
+					</td>
+				   </tr>
+				</table>
+			    </div>
+
+			</td>
+		   </tr>
+		</table>
+	     </div>
+	</td>
+	<td align=right valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</table>
+</form>
+
+{if ($MODULE eq 'Emails' || 'Notes') and ($FCKEDITOR_DISPLAY eq 'true')}
+       <script type="text/javascript" src="include/fckeditor/fckeditor.js"></script>
+       <script type="text/javascript" defer="1">
+
+       var oFCKeditor = null;
+
+       {if $MODULE eq 'Notes'}
+               oFCKeditor = new FCKeditor( "notecontent" ) ;
+       {/if}
+
+       oFCKeditor.BasePath   = "include/fckeditor/" ;
+       oFCKeditor.ReplaceTextarea() ;
+
+       </script>
+{/if}
+{if $MODULE eq 'Accounts'}
+<script>
+	ScrollEffect.limit = 201;
+	ScrollEffect.closelimit= 200;
+</script>
+{/if}
+<script>
+
+
+
+        var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
+
+        var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
+
+        var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
+
+
+</script>
+
+
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/CreateWordTemplate.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/CreateWordTemplate.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/CreateWordTemplate.tpl Tue Nov 14 03:16:10 2006
@@ -1,100 +1,100 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-<br>
-	<div align=center>
-	
-			{include file='SetMenu.tpl'}
-
-				<!-- DISPLAY -->
-				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
-				<form action="index.php?module=Users&action=add2db" method="post" enctype="multipart/form-data">
-				<input type="hidden" name="return_module" value="Settings">
-				<input type="hidden" name="parenttab" value="{$PARENTTAB}">
-				<input type="hidden" name="MAX_FILE_SIZE" value="100000">
-				<input type="hidden" name="action">
-				<tr>
-					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}mailmarge.gif" alt="Users" width="48" height="48" border=0 title="Users"></td>
-					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$UMOD.LBL_WORD_TEMPLATES}</a> > {$UMOD.LBL_NEW_TEMPLATE} </b></td>
-				</tr>
-				<tr>
-					<td valign=top class="small">{$MOD.LBL_MAIL_MERGE_DESC}</td>
-				</tr>
-				</table>
-				
-				<br>
-				<table border=0 cellspacing=0 cellpadding=10 width=100% >
-				<tr>
-				<td>
-				
-					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-					<tr>
-						<td class="big"><strong>{$UMOD.LBL_NEW_TEMPLATE}</strong><br>{$ERRORFLAG}</br></td>
-						<td class="small" align=right>
-							<input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" type="submit" tabindex="4" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" onclick="this.form.action.value='add2db'; this.form.parenttab.value='Settings'" class="crmButton small save" />&nbsp;
-							&nbsp;<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" tabindex="5"  onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="crmButton small cancel" />
-						</td>
-					</tr>
-					</table>
-					
-					<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr valign="top">
-					  <td nowrap class="cellLabel small"><font color="red">*</font><strong>{$UMOD.LBL_NEW} {$UMOD.LBL_TEMPLATE_FILE}</strong></td>
-					  <td class="cellText small"><strong>
-					    <input type="file" name="binFile" class="small">
-					  </strong></td>
-					  </tr>
-					<tr>
-						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_DESCRIPTION}</strong></td>
-						<td class="cellText small" valign=top><textarea name="txtDescription" class=small style="width:90%;height:50px" value={$textDesc}></textarea></td>
-					  </tr>
-					<tr>
-						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_MODULENAMES}</strong></td>
-						<td class="cellText small" valign=top>
-						<select name="target_module" size=1 class="small" tabindex="3">
-							<option value="Leads">{$APP.COMBO_LEADS}</option>	
-							<option value="Accounts">{$APP.COMBO_ACCOUNTS}</option>	
-							<option value="Contacts">{$APP.COMBO_CONTACTS}</option>	
-							<option value="HelpDesk">{$APP.COMBO_HELPDESK}</option>	
-			                      </select>
-						</td>
-					  </tr>
-					</table>
-					<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr>
-					  <td class="small" nowrap align=right><a href="#top">[Scroll to Top]</a></td>
-					</tr>
-					</table>
-				</td>
-				</tr>
-				</table>
-			
-			
-			
-			</td>
-			</tr>
-			</table>
-		</td>
-	</tr>
-	</form>
-	</table>
-</div>		
-	</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody>
-</table>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+<br>
+	<div align=center>
+	
+			{include file='SetMenu.tpl'}
+
+				<!-- DISPLAY -->
+				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
+				<form action="index.php?module=Users&action=add2db" method="post" enctype="multipart/form-data">
+				<input type="hidden" name="return_module" value="Settings">
+				<input type="hidden" name="parenttab" value="{$PARENTTAB}">
+				<input type="hidden" name="MAX_FILE_SIZE" value="{$MAX_FILE_SIZE}">
+				<input type="hidden" name="action">
+				<tr>
+					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}mailmarge.gif" alt="Users" width="48" height="48" border=0 title="Users"></td>
+					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$UMOD.LBL_WORD_TEMPLATES}</a> > {$UMOD.LBL_NEW_TEMPLATE} </b></td>
+				</tr>
+				<tr>
+					<td valign=top class="small">{$MOD.LBL_MAIL_MERGE_DESC}</td>
+				</tr>
+				</table>
+				
+				<br>
+				<table border=0 cellspacing=0 cellpadding=10 width=100% >
+				<tr>
+				<td>
+				
+					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+					<tr>
+						<td class="big"><strong>{$UMOD.LBL_NEW_TEMPLATE}</strong><br>{$ERRORFLAG}</br></td>
+						<td class="small" align=right>
+							<input title="{$APP.LBL_SAVE_BUTTON_LABEL}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" type="submit" tabindex="4" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" onclick="this.form.action.value='add2db'; this.form.parenttab.value='Settings'" class="crmButton small save" />&nbsp;
+							&nbsp;<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" tabindex="5"  onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" class="crmButton small cancel" />
+						</td>
+					</tr>
+					</table>
+					
+					<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr valign="top">
+					  <td nowrap class="cellLabel small"><font color="red">*</font><strong>{$UMOD.LBL_NEW} {$UMOD.LBL_TEMPLATE_FILE}</strong></td>
+					  <td class="cellText small"><strong>
+					    <input type="file" name="binFile" class="small">
+					  </strong></td>
+					  </tr>
+					<tr>
+						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_DESCRIPTION}</strong></td>
+						<td class="cellText small" valign=top><textarea name="txtDescription" class=small style="width:90%;height:50px" value={$textDesc}></textarea></td>
+					  </tr>
+					<tr>
+						<td valign=top class="small cellLabel"><strong>{$UMOD.LBL_MODULENAMES}</strong></td>
+						<td class="cellText small" valign=top>
+						<select name="target_module" size=1 class="small" tabindex="3">
+							<option value="Leads">{$APP.COMBO_LEADS}</option>	
+							<option value="Accounts">{$APP.COMBO_ACCOUNTS}</option>	
+							<option value="Contacts">{$APP.COMBO_CONTACTS}</option>	
+							<option value="HelpDesk">{$APP.COMBO_HELPDESK}</option>	
+			                      </select>
+						</td>
+					  </tr>
+					</table>
+					<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr>
+					  <td class="small" nowrap align=right><a href="#top">[Scroll to Top]</a></td>
+					</tr>
+					</table>
+				</td>
+				</tr>
+				</table>
+			
+			
+			
+			</td>
+			</tr>
+			</table>
+		</td>
+	</tr>
+	</form>
+	</table>
+</div>		
+	</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody>
+</table>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/DetailView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/DetailView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/DetailView.tpl Tue Nov 14 03:16:10 2006
@@ -73,20 +73,28 @@
 </script>
 {if $MODULE eq 'Accounts' || $MODULE eq 'Contacts' || $MODULE eq 'Leads'}
         {if $MODULE eq 'Accounts'}
-                {assign var=address1 value='Billing'}
-                {assign var=address2 value='Shipping'}
+                {assign var=address1 value='$MOD.LBL_BILLING_ADDRESS'}
+                {assign var=address2 value='$MOD.LBL_SHIPPING_ADDRESS'}
         {/if}
         {if $MODULE eq 'Contacts'}
-                {assign var=address1 value='Mailing'}
-                {assign var=address2 value='Other'}
+                {assign var=address1 value='$MOD.LBL_PRIMARY_ADDRESS'}
+                {assign var=address2 value='$MOD.LBL_ALTERNATE_ADDRESS'}
         {/if}
         <div id="locateMap" onMouseOut="fninvsh('locateMap')" onMouseOver="fnvshNrm('locateMap')">
                 <table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
                         <tr>
                                 <td>
-                                        <a href="javascript:;" onClick="fninvsh('locateMap'); searchMapLocation( 'Main' );" class="calMnu">{$address1} {$APP.LBL_ADDRESS}</a>
-                                        <a href="javascript:;" onClick="fninvsh('locateMap'); searchMapLocation( 'Other' );" class="calMnu">{$address2} {$APP.LBL_ADDRESS}</a>
-                                </td>
+                                {if $MODULE eq 'Accounts'}
+                                        <a href="javascript:;" onClick="fninvsh('locateMap'); searchMapLocation( 'Main' );" class="calMnu">{$MOD.LBL_BILLING_ADDRESS}</a>
+                                        <a href="javascript:;" onClick="fninvsh('locateMap'); searchMapLocation( 'Other' );" class="calMnu">{$MOD.LBL_SHIPPING_ADDRESS}</a>
+                               {/if}
+                               
+                               {if $MODULE eq 'Contacts'}
+                                <a href="javascript:;" onClick="fninvsh('locateMap'); searchMapLocation( 'Main' );" class="calMnu">{$MOD.LBL_PRIMARY_ADDRESS}</a>
+                                        <a href="javascript:;" onClick="fninvsh('locateMap'); searchMapLocation( 'Other' );" class="calMnu">{$MOD.LBL_ALTERNATE_ADDRESS}</a>
+                               {/if}
+                                        
+                                         </td>
                         </tr>
                 </table>
         </div>
@@ -221,7 +229,7 @@
                             <td>&nbsp;</td>
                             <td>&nbsp;</td>
                              <td align=right>
-							{if $header eq 'Address Information' && ($MODULE eq 'Accounts' || $MODULE eq 'Contacts' || $MODULE eq 'Leads') }
+							{if $header eq $MOD.LBL_ADDRESS_INFORMATION && ($MODULE eq 'Accounts' || $MODULE eq 'Contacts' || $MODULE eq 'Leads') }
                              {if $MODULE eq 'Leads'}
                              <input name="mapbutton" value="{$APP.LBL_LOCATE_MAP}" class="crmbutton small create" type="button" onClick="searchMapLocation( 'Main' )" title="{$APP.LBL_LOCATE_MAP}">
                              {else}
@@ -239,15 +247,10 @@
 								</td>
 							   </tr>
 							   <tr>
-							   			<td colspan=4 class="dvtCellInfo">{$COMMENT_BLOCK}</td>
+							     <td colspan=4 class="dvtCellInfo">{$COMMENT_BLOCK}</td>
 							   </tr>
 							   <tr><td>&nbsp;</td></tr>
 							{/if}
-
-
-
-
-
 						     <tr>{strip}
 						     <td colspan=4 class="dvInnerHeader">
 							<b>
@@ -255,46 +258,54 @@
 	  			     			</b>
 						     </td>{/strip}
 					             </tr>
-						   {foreach item=detail from=$detail}
-						     <tr style="height:25px">
-							{foreach key=label item=data from=$detail}
-							   {assign var=keyid value=$data.ui}
-							   {assign var=keyval value=$data.value}
-							   {assign var=keytblname value=$data.tablename}
-							   {assign var=keyfldname value=$data.fldname}
-							   {assign var=keyoptions value=$data.options}
-							   {assign var=keysecid value=$data.secid}
-							   {assign var=keyseclink value=$data.link}
-							   {assign var=keycursymb value=$data.cursymb}
-							   {assign var=keysalut value=$data.salut}
-							   {assign var=keycntimage value=$data.cntimage}
-							   {assign var=keyadmin value=$data.isadmin}
-							   
-							   
-							   
-                           {if $label ne ''}
-	                        {if $keycntimage ne ''}
-				<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$keycntimage}</td>
-				{elseif $keyid eq '71' || $keyid eq '72'}<!-- Currency symbol -->
-					<td class="dvtCellLabel" align=right width=25%>{$label}<input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input> ({$keycursymb})</td>
-				{else}
-					<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label}</td>
-				{/if}  
-{if $EDIT_PERMISSION eq 'yes'}							{include file="DetailViewUI.tpl"}
-{else}										{include file="DetailViewFields.tpl"}
-{/if}
-						   {else} 
-                                          <td class="dvtCellLabel" align=right>&nbsp;</td>
-                                           <td class="dvtCellInfo" align=left >&nbsp;</td>
-							   {/if}
-                                   {/foreach}
-						      </tr>	
-						   {/foreach}	
+						     {foreach item=detail from=$detail}
+						       <tr style="height:25px">
+						         {foreach key=label item=data from=$detail}
+						           {assign var=keyid value=$data.ui}
+						           {assign var=keyval value=$data.value}
+						           {assign var=keyinherit value=$data.inherit}
+						           {assign var=keytblname value=$data.tablename}
+					  	           {assign var=keyfldname value=$data.fldname}
+						           {assign var=keyoptions value=$data.options}
+						           {assign var=keysecid value=$data.secid}
+						           {assign var=keyseclink value=$data.link}
+						           {assign var=keycursymb value=$data.cursymb}
+						           {assign var=keysalut value=$data.salut}
+						           {assign var=keycntimage value=$data.cntimage}
+						           {assign var=keyadmin value=$data.isadmin}
+
+						           {if $label ne ''}
+						              {if $keycntimage ne ''}
+						                <td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$keycntimage}</td>
+						              {elseif $keyid eq '71' || $keyid eq '72'}<!-- Currency symbol -->
+						                <td class="dvtCellLabel" align=right width=25%>{$label}<input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input> ({$keycursymb})</td>
+						              {else}
+						                <td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label}</td>
+						              {/if}  
+						              {if $EDIT_PERMISSION eq 'yes'}
+						                {include file="DetailViewUI.tpl"}
+						              {else}
+						                {include file="DetailViewFields.tpl"}
+						              {/if}
+						            {else} 
+						              <td class="dvtCellLabel" align=right>&nbsp;</td>
+						              <td class="dvtCellInfo" align=left >&nbsp;</td>
+						            {/if}
+						          {/foreach}
+						        </tr>	
+						      {/foreach}	
 						     </table>
                      	                      </td>
 					   </tr>
 		<tr>                                                                                                               <td style="padding:10px">
 			{/foreach}
+			 {if $MODULE eq "Organization"}
+			     <tr>
+				<td style="padding:10px">
+				   {include file="DetailsViewOrgUnit.tpl"}
+				</td>
+			     </tr>
+			 {/if}
                     {*-- End of Blocks--*} 
 			</td>
                 </tr>
@@ -380,19 +391,14 @@
 		<td width=22% valign=top style="border-left:2px dashed #cccccc;padding:13px">
 						<!-- right side relevant info -->
 
-		<!-- Add Tag link added just above the tag cloud image -->
-		<table border=0 cellspacing=0 cellpadding=5 width=100% >
-		<tr>
-			<td align="left" class="genHeaderSmall"  nowrap><div id="addtagdiv"><a href="javascript:;" onClick="show('tagdiv'),fnhide('addtagdiv'),document.getElementById('txtbox_tagfields').focus()"><b>{$APP.LBL_ADD_TAG}</b></a></div><div id="tagdiv" style="display:none;"><input class="textbox"  type="text" id="txtbox_tagfields" name="textbox_First Name" value=""></input>&nbsp;&nbsp;<input name="button_tagfileds" type="button" class="crmbutton small save" value="{$APP.LBL_TAG_IT}" onclick="return tagvalidate()"/><input name="close" type="button" class="crmbutton small cancel" value="{$APP.LBL_CLOSE}" onClick="fnhide('tagdiv'),show('addtagdiv')"></div></td>
-		</tr>
-		</table>
-		<br>
-		<!-- Eng Add Tag Link -->
 		<!-- Tag cloud display -->
 		<table border=0 cellspacing=0 cellpadding=0 width=100% class="tagCloud">
 		<tr>
 			<td class="tagCloudTopBg"><img src="{$IMAGE_PATH}tagCloudName.gif" border=0></td>
 		</tr>
+		<tr>
+                      	<td><div id="tagdiv" style="display:visible;"><input class="textbox"  type="text" id="txtbox_tagfields" name="textbox_First Name" value="" style="width:100px;margin-left:5px;"></input>&nbsp;&nbsp;<input name="button_tagfileds" type="button" class="crmbutton small save" value="{$APP.LBL_TAG_IT}" onclick="return tagvalidate()"/></div></td>
+                </tr>
 		<tr>
 			<td class="tagCloudDisplay" valign=top> <span id="tagfields">{$ALL_TAG}</span></td>
 		</tr>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewFields.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewFields.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewFields.tpl Tue Nov 14 03:16:10 2006
@@ -1,91 +1,115 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-<!-- This file is used to display the fields based on the ui type in detailview -->
-		{if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72'} <!--TextBox-->
-                                         		<td width=25% class="dvtCellInfo" align="left">&nbsp;
-                                         		      {if $keyid eq '55'}<!--SalutationSymbol-->
-                                         		            {$keysalut}
-                                         		      {*elseif $keyid eq '71' || $keyid eq '72'}  <!--CurrencySymbol-->
-                                         		            {$keycursymb*}
-                                                        	{/if}
-                                                       {$keyval}
-                                                  </td>
-                                             {elseif $keyid eq '13'} <!--Email-->
-                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;<a href="mailto:{$keyval}" target="_blank">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} <!--ComboBox-->
-               							<td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}
-               							</td>
-                                             {elseif $keyid eq '17'} <!--WebSite-->
-                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;<a href="http://{$keyval}" target="_blank">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq '19' || $keyid eq '20'} <!--TextArea/Description-->
-                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}                   
-                                                  </td>
-                                             {elseif $keyid eq '21' || $keyid eq '24' || $keyid eq '22'} <!--TextArea/Street-->
-                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}
-                                                  </td>
-                                             {elseif $keyid eq '50' || $keyid eq '73' || $keyid eq '51' || $keyid eq '57' || $keyid eq '59' || $keyid eq '75' || $keyid eq '81' || $keyid eq '76' || $keyid eq '78' || $keyid eq '80'} <!--AccountPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq 82} <!--Email Body-->
-                                                  <td colspan="3" width=100% class="dvtCellInfo" align="left">&nbsp;{$keyval}
-                                                  </td>
-					{elseif $keyid eq '53'} <!--Assigned To-->
-                    <td width=25% class="dvtCellInfo" align="left">&nbsp;
-                    {if $keyseclink eq ''}
-                        {$keyval}
-                    {else}
-                        <a href="{$keyseclink}">{$keyval}</a>         
-                    {/if}
-					&nbsp;
-                    
-                    </td>
-		    {elseif $keyid eq '56'} <!--CheckBox--> 
-                      <td width=25% class="dvtCellInfo" align="left">{$keyval}&nbsp;
-                        </td>     
-		{elseif $keyid eq 83}<!-- Handle the Tax in Inventory -->
-							<td align="right" class="dvtCellLabel">
-							{$APP.LBL_VAT} {$APP.COVERED_PERCENTAGE}
-							
-							</td>
-							<td class="dvtCellInfo" align="left">&nbsp;
-							{$VAT_TAX}
-							</td>
-							<td colspan="2" class="dvtCellInfo">&nbsp;</td>
-						   </tr>
-		   				   <tr>
-							<td align="right" class="dvtCellLabel">
-							{$APP.LBL_SALES} {$APP.LBL_TAX} {$APP.COVERED_PERCENTAGE}
-							</td> 
-							<td class="dvtCellInfo" align="left">&nbsp;
-								{$SALES_TAX}
-							</td>	
-							<td colspan="2" class="dvtCellInfo">&nbsp;</td>
-						   </tr>
-				   		   <tr>
-							<td align="right" class="dvtCellLabel">
-								{$APP.LBL_SERVICE} {$APP.LBL_TAX} {$APP.COVERED_PERCENTAGE}
-							</td>
-							<td class="dvtCellInfo" align="left" >&nbsp;
-								{$SERVICE_TAX}
-							</td>
-	
-
-				{elseif $keyid eq 69}<!-- for Image Reflection -->
-                                                  	<td align="left" width=25%">&nbsp;{$keyval}</td>
-				{else}									
-                                                  	<td class="dvtCellInfo" align="left" width=25%">&nbsp;{$keyval}</td>
-				{/if}
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+<!-- This file is used to display the fields based on the ui type in detailview -->
+		{if $keyid eq '1' || $keyid eq 2 ||$keyid eq 8 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72'} <!--TextBox-->
+                                         		<td width=25% class="dvtCellInfo" align="left">&nbsp;
+                                         		      {if $keyid eq '55'}<!--SalutationSymbol-->
+                                         		            {$keysalut}
+                                         		      {*elseif $keyid eq '71' || $keyid eq '72'}  <!--CurrencySymbol-->
+                                         		            {$keycursymb*}
+                                                        	{/if}
+                                                       {$keyval}
+                                                  </td>
+                                             {elseif $keyid eq '13'} <!--Email-->
+                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;<a href="mailto:{$keyval}" target="_blank">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq '14'} <!-- Organization picklist-->
+                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}
+						  </td>
+                                             {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} <!--ComboBox-->
+               							<td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}
+               							</td>
+                                             {elseif $keyid eq '17'} <!--WebSite-->
+                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;<a href="http://{$keyval}" target="_blank">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq '19' || $keyid eq '20'} <!--TextArea/Description-->
+                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}                   
+                                                  </td>
+                                             {elseif $keyid eq '21' || $keyid eq '24' || $keyid eq '22'} <!--TextArea/Street-->
+                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;{$keyval}
+                                                  </td>
+                                             {elseif $keyid eq '12'} <!-- Orgunit picklist-->
+					          <td width=25% class="dvtCellInfo" align="left">&nbsp;{$ASSIGN_ORGUNIT_LIST.$keyval.name}
+						  </td>
+					     {elseif $keyid eq '3' || $keyid eq '4' || $keyid eq '32' || $keyid eq '31'} <!--TextBox with Inheritance/Extension-->
+					     <td width=25% class="dvtCellInfo" align="left">&nbsp;
+						 {if $keyinherit == 1}
+						     {if $keyid eq '32' || $keyid eq '31'}
+							 {$keyval}&nbsp;&nbsp;<font color="blue">EXT</font>
+						     {else}
+							 <font color="blue">{$MOD.LBL_INHERIT_PARENT}</font>
+						     {/if}
+						 {else}
+						     {$keyval}
+						 {/if}
+					     </td>
+                                             {elseif $keyid eq '50' || $keyid eq '73' || $keyid eq '51' || $keyid eq '57' || $keyid eq '59' || $keyid eq '75' || $keyid eq '81' || $keyid eq '76' || $keyid eq '78' || $keyid eq '80'} <!--AccountPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq 82} <!--Email Body-->
+                                                  <td colspan="3" width=100% class="dvtCellInfo" align="left">&nbsp;{$keyval}
+                                                  </td>
+					{elseif $keyid eq '53'} <!--Assigned To-->
+                    <td width=25% class="dvtCellInfo" align="left">&nbsp;
+                    {if $keyseclink eq ''}
+                        {$keyval}
+                    {else}
+                        <a href="{$keyseclink}">{$keyval}</a>         
+                    {/if}
+					&nbsp;
+                    
+                    </td>
+		    {elseif $keyid eq '56'} <!--CheckBox--> 
+                      <td width=25% class="dvtCellInfo" align="left">{$keyval}&nbsp;
+                        </td>     
+		{elseif $keyid eq 83}<!-- Handle the Tax in Inventory -->
+							<td align="right" class="dvtCellLabel">
+							{$APP.LBL_VAT} {$APP.COVERED_PERCENTAGE}
+							
+							</td>
+							<td class="dvtCellInfo" align="left">&nbsp;
+							{$VAT_TAX}
+							</td>
+							<td colspan="2" class="dvtCellInfo">&nbsp;</td>
+						   </tr>
+		   				   <tr>
+							<td align="right" class="dvtCellLabel">
+							{$APP.LBL_SALES} {$APP.LBL_TAX} {$APP.COVERED_PERCENTAGE}
+							</td> 
+							<td class="dvtCellInfo" align="left">&nbsp;
+								{$SALES_TAX}
+							</td>	
+							<td colspan="2" class="dvtCellInfo">&nbsp;</td>
+						   </tr>
+				   		   <tr>
+							<td align="right" class="dvtCellLabel">
+								{$APP.LBL_SERVICE} {$APP.LBL_TAX} {$APP.COVERED_PERCENTAGE}
+							</td>
+							<td class="dvtCellInfo" align="left" >&nbsp;
+								{$SERVICE_TAX}
+							</td>
+	
+
+				{elseif $keyid eq 69}<!-- for Image Reflection -->
+                                                  	<td align="left" width=25%">&nbsp;{$keyval}</td>
+				{elseif $keyid eq 107}<!-- Company Logo -->
+				    <td class="dvtCellInfo" align="left" width="25%">
+					{if $keyval ne ""}
+					    <img src="test/logo/{$keyval}" width="96" height="48" alt="{$keyval}" title="{$keyval}" border="0">
+					{/if}
+				    </td>
+				{else}									
+                                                  	<td class="dvtCellInfo" align="left" width=25%">&nbsp;{$keyval}</td>
+				{/if}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewHidden.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewHidden.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewHidden.tpl Tue Nov 14 03:16:10 2006
@@ -192,6 +192,17 @@
         <input type="hidden" name="return_module">
         <input type="hidden" name="return_action">
         <input type="hidden" name="return_id">
+{elseif $MODULE eq 'Organization' ||  $MODULE eq 'OrgUnit'}
+        <input type="hidden" name="module" value="{$MODULE}">
+        <input type="hidden" name="record" value="{$ID}">
+        <input type="hidden" name="isDuplicate" value=false>
+        <input type="hidden" name="action">
+        <input type="hidden" name="return_module">
+        <input type="hidden" name="return_action">
+        <input type="hidden" name="return_id">
+	{if $MODULE eq 'OrgUnit'}
+		<input type="hidden" name="organizationname" value="{$PARENTORG}">
+	{/if}
 {/if}
 
 

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewUI.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewUI.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/DetailViewUI.tpl Tue Nov 14 03:16:10 2006
@@ -1,277 +1,430 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-<!-- This file is used to display the fields based on the ui type in detailview -->
-		{if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '103'} <!--TextBox-->
-                                         		<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
-                                         		      {if $keyid eq '55'}<!--SalutationSymbol-->
-                                         		            {$keysalut}
-                                         		      {*elseif $keyid eq '71' || $keyid eq '72'}  <!--CurrencySymbol-->
-                                         		            {$keycursymb*}
-                                                        {/if}
-                                                       &nbsp;&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
-                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>
-                                             {elseif $keyid eq '13' || $keyid eq '104'} <!--Email-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="mailto:{$keyval}" target="_blank">{$keyval}</a></span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
-                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>
-						<!-- uitype 111 added for noneditable existing picklist values - ahmed -->
-                                             {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} <!--ComboBox-->
-               							<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                    							   <select id="txtbox_{$label}" name="{$keyfldname}">
-                    								{foreach item=arr from=$keyoptions}
-                    									{foreach key=sel_value item=value from=$arr}
-                    										<option value="{$sel_value}" {$value}>{$sel_value}</option>
-                    									{/foreach}
-                    								{/foreach}
-                    							   </select>
-                    							   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                    							</div>
-               							</td>
-                                          {elseif $keyid eq '33'}<!--Multi Select Combo box-->
-						<!--code given by Neil start Ref:http://forums.vtiger.com/viewtopic.php?p=31096#31096-->
-						{assign var="MULTISELECT_COMBO_BOX_ITEM_SEPARATOR_STRING" value=", "}  {* Separates Multi-Select Combo Box items *}
-						{assign var="DETAILVIEW_WORDWRAP_WIDTH" value="70"} {* No. of chars for word wrapping long lines of Multi-Select Combo Box items *}
-                                          <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">
-						{$keyval|replace:$MULTISELECT_COMBO_BOX_ITEM_SEPARATOR_STRING:"\x1"|replace:" ":"\x0"|replace:"\x1":$MULTISELECT_COMBO_BOX_ITEM_SEPARATOR_STRING|wordwrap:$DETAILVIEW_WORDWRAP_WIDTH:"<br>&nbsp;"|replace:"\x0":"&nbsp;"}
-						</span>
-						<!--code given by Neil End-->
-                                          <div id="editarea_{$label}" style="display:none;">
-                                          <select MULTIPLE id="txtbox_{$label}" name="{$keyfldname}" size="4" style="width:160px;">
-				                                    {foreach item=arr from=$keyoptions}
-					                                     {foreach key=sel_value item=value from=$arr}
-						                                      <option value="{$sel_value}" {$value}>{$sel_value}</option>
-					                                     {/foreach}
-				                                    {/foreach}
-			                                   </select>
-			                                   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                    							</div>
-               							</td>
-						{elseif $keyid eq '115'} <!--ComboBox Status edit only for admin Users-->
-								{if $keyadmin eq 1}
-               							<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                    							   <select id="txtbox_{$label}" name="{$keyfldname}">
-                    								{foreach item=arr from=$keyoptions}
-                    									{foreach key=sel_value item=value from=$arr}
-                    										<option value="{$sel_value}" {$value}>{$sel_value}</option>
-                    									{/foreach}
-                    								{/foreach}
-                    							   </select>
-                    							   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                    							</div>
-								{else}
-               							<td width=25% class="dvtCellInfo" align="left">{$keyval}
-								{/if}	
-								
-               							</td>
-						{elseif $keyid eq '116'} <!--ComboBox currency id edit only for admin Users-->
-								{if $keyadmin eq 1}
-               							<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
-								<div id="editarea_{$label}" style="display:none;">
-                    							   <select id="txtbox_{$label}" name="{$keyfldname}">
-									{foreach item=arr key=uivalueid from=$keyoptions}
-									{foreach key=sel_value item=value from=$arr}
-										<option value="{$uivalueid}" {$value}>{$sel_value}</option>	
-									{/foreach}
-									{/foreach}
-                    							   </select>
-                    							   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                    							</div>
-								{else}
-               							<td width=25% class="dvtCellInfo" align="left">{$keyval}
-								{/if}	
-
-                                        		
-               							</td>
-                                             {elseif $keyid eq '17'} <!--WebSite-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="http://{$keyval}" target="_blank">{$keyval}</a></span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
-                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>
-                                             {elseif $keyid eq '19' || $keyid eq '20'} <!--TextArea/Description-->
-						<!-- we will empty the value of ticket and faq comment -->
-						{if $label eq $MOD.LBL_ADD_COMMENT}
-							{assign var=keyval value=''}
-						{/if}
-							{assign var="DESCRIPTION_SEPARATOR_STRING" value=" "}  {* Separates Description *}
-							{assign var="DESCRIPTION_WORDWRAP_WIDTH" value="70"} {* No. of chars for word wrapping long lines of Description *}
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">
-							{$keyval|replace:$DESCRIPTION_SEPARATOR_STRING:"\x1"|replace:" ":"\x0"|replace:"\x1":$DESCRIPTION_SEPARATOR_STRING|wordwrap:$DESCRIPTION_WORDWRAP_WIDTH:"<br>&nbsp;"|replace:"\x0":"&nbsp;"}
-							</span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                                              		  <textarea id="txtbox_{$label}" name="{$keyfldname}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$keyval}</textarea>                                            		  
-                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>
-                                             {elseif $keyid eq '21' || $keyid eq '24' || $keyid eq '22'} <!--TextArea/Street-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
-                                              		<div id="editarea_{$label}" style="display:none;">
-                                              		  <textarea id="txtbox_{$label}" name="{$keyfldname}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" rows=2>{$keyval}</textarea>                                            		  
-                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>
-                                             {elseif $keyid eq '50' || $keyid eq '73' || $keyid eq '51'} <!--AccountPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq '57'} <!--ContactPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="{$keyseclink}">{$keyval}</a></span>
-                                              		<div id="editarea_{$label}" style="display:none;">                                              		  
-                                                         <input id="popuptxt_{$label}" name="contact_name" readonly type="text" style="border:1px solid #bababa;" value="{$keyval}"><input id="txtbox_{$label}" name="{$keyfldname}" type="hidden" value="{$keysecid}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=600,height=602,resizable=1,scrollbars=1");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.contact_id.value=''; this.form.contact_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-                                                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>                                                  
-                                             {elseif $keyid eq '59'} <!--ProductPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="{$keyseclink}">{$keyval}</a></span>
-                                              		<div id="editarea_{$label}" style="display:none;">                                              		  
-                                                         <input id="popuptxt_{$label}" name="product_name" readonly type="text" value="{$keyval}"><input id="txtbox_{$label}" name="{$keyfldname}" type="hidden" value="{$keysecid}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype=specific","test","width=600,height=602,resizable=1,scrollbars=1,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.product_id.value=''; this.form.product_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-                                                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
-                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                                                       </div>
-                                                  </td>
-                                             {elseif $keyid eq '75' || $keyid eq '81'} <!--VendorPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq 76} <!--PotentialPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq 78} <!--QuotePopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
-                                                  </td>
-                                             {elseif $keyid eq 82} <!--Email Body-->
-                                                  <td colspan="3" width=100% class="dvtCellInfo" align="left"><div id="dtlview_{$label}" style="width:100%;height:200px;overflow:hidden;border:1px solid gray" class="detailedViewTextBox" onmouseover="this.className='detailedViewTextBoxOn'" onmouseout="this.className='detailedViewTextBox'">{$keyval}</div>
-                                                  </td>
-                                             {elseif $keyid eq 80} <!--SalesOrderPopup-->
-                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
-                                                  </td>
-					     {elseif $keyid eq '53'} <!--Assigned To-->
-                    				  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">
-                    				{if $keyoptions.0 eq 'User' && $keyadmin eq 1}
-			                        	<a href="{$keyseclink.0}">{$keyval}</a>         
-			                        {elseif $keyoptions.0 eq 'Group' && $keyadmin eq 1}
-                        				<a href="{$keyseclink.1}">{$keyval}</a>         
-						{else}	
-                        				{$keyval}
-                    				{/if}
-					&nbsp;</span>
-                    				<div id="editarea_{$label}" style="display:none;">
-			                   	<input type="hidden" id="hdtxt_{$label}" value="{$keyval}"></input>
-						{if $keyoptions.0 eq 'User'}
-							<input name="assigntype" id="assigntype" checked="checked" value="U" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_USER}
-							{if $keyoptions.2 neq ''}
-								<input name="assigntype" id="assigntype" value="T" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_GROUP_NAME}
-							{/if}
-							<span id="assign_user" style="display: block;">
-						{else}
-							<input name="assigntype" id="assigntype" value="U" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_USER}
-							<input name="assigntype" checked="checked" id="assigntype" value="T" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_GROUP_NAME}
-							<span id="assign_user" style="display: none;">
-						{/if}
-                   				<select id="txtbox_U{$label}" onchange="setSelectValue('{$label}')" name="{$keyfldname}">
-				                    {foreach item=arr key=id from=$keyoptions.1}
-				                    	{foreach key=sel_value item=value from=$arr}
-                       						 <option value="{$id}" {$value}>{$sel_value}</option>
-				                        {/foreach}
-				                    {/foreach}
-			                    	</select>
-						</span>
-					{if $keyoptions.0 eq 'Group'}
-						<span id="assign_team" style="display: block;">
-					{else}
-						<span id="assign_team" style="display: none;">
-					{/if}
-                   	<select id="txtbox_G{$label}" onchange="setSelectValue('{$label}')" name="{$keyfldname}">
-                    {foreach item=arr key=id from=$keyoptions.2}
-                    	{foreach key=sel_value item=value from=$arr}
-                       		 <option value="{$id}" {$value}>{$sel_value}</option>
-                        {/foreach}
-                    {/foreach}
-                    </select>
-					</span>
-
-                    <br>
-                    <input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> {$APP.LBL_OR}
-                    <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                    </div>
-                    </td>
-						{elseif $keyid eq '99'}<!-- Password Field-->
-						<td width=25% class="dvtCellInfo" align="left">{$CHANGE_PW_BUTTON}</td>	
-					    {elseif $keyid eq '56'} <!--CheckBox--> 
-                      <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onMouseOver="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}&nbsp;</span>
-                    	<div id="editarea_{$label}" style="display:none;">
-                        {if $keyval eq 'yes'}                                              		  
-                            <input id="txtbox_{$label}" name="{$keyfldname}" type="checkbox" style="border:1px solid #bababa;" checked value="1">
-                        {else}
-                          <input id="txtbox_{$label}" type="checkbox" name="{$keyfldname}" style="border:1px solid #bababa;" value="0">
-                       	{/if}
-                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> {$APP.LBL_OR}
-                          <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                        </div>
-                        </td>    
-			{elseif $keyid eq '156'} <!--CheckBox for is admin-->
-			{if $smarty.request.record neq $CURRENT_USERID && $keyadmin eq 1} 
-                      <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onMouseOver="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}&nbsp;</span>
-                    	<div id="editarea_{$label}" style="display:none;">
-                        {if $keyval eq 'on'}                                              		  
-                            <input id="txtbox_{$label}" name="{$keyfldname}" type="checkbox" style="border:1px solid #bababa;" checked value="1">
-                        {else}
-                          <input id="txtbox_{$label}" type="checkbox" name="{$keyfldname}" style="border:1px solid #bababa;" value="0">
-                       	{/if}
-                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> {$APP.LBL_OR}
-                          <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
-                        </div>
-			{else}
-				 <td width=25% class="dvtCellInfo" align="left">{$keyval}
-			{/if}
-                        </td>    
-			 
-						{elseif $keyid eq 83}<!-- Handle the Tax in Inventory -->
-							{foreach item=tax key=count from=$TAX_DETAILS}
-								<td align="right" class="dvtCellLabel">
-									{$tax.taxlabel} {$APP.COVERED_PERCENTAGE}
-							
-								</td>
-								<td class="dvtCellInfo" align="left">
-									{$tax.percentage}
-								</td>
-								<td colspan="2" class="dvtCellInfo">&nbsp;</td>
-							   </tr>
-							{/foreach}
-
-
-				{elseif $keyid eq 69}<!-- for Image Reflection -->
-                                                  	<td align="left" width=25%">&nbsp;{$keyval}</td>
-				{else}									
-                                                  	<td class="dvtCellInfo" align="left" width=25%">&nbsp;{$keyval}</td>
-				{/if}
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+<!-- This file is used to display the fields based on the ui type in detailview -->
+		{if $keyid eq '1' || $keyid eq 2 || $keyid eq '11' || $keyid eq '7' || $keyid eq '9' || $keyid eq '55' || $keyid eq '71' || $keyid eq '72' || $keyid eq '103'} <!--TextBox-->
+                                         		<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
+                                         		      {if $keyid eq '55'}<!--SalutationSymbol-->
+                                         		            {$keysalut}
+                                         		      {*elseif $keyid eq '71' || $keyid eq '72'}  <!--CurrencySymbol-->
+                                         		            {$keycursymb*}
+                                                        {/if}
+                                                       &nbsp;&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
+                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>
+                                             {elseif $keyid eq '8'} <!--Non editable text field-->
+						 <td width=25% class="dvtCellInfo" align="left">&nbsp;&nbsp;{$keyval}</td>
+                                             {elseif $keyid eq '13' || $keyid eq '104'} <!--Email-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="mailto:{$keyval}" target="_blank">{$keyval}</a></span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
+                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>
+						<!-- uitype 111 added for noneditable existing picklist values - ahmed -->
+                                             {elseif $keyid eq '15' || $keyid eq '16' || $keyid eq '111'} <!--ComboBox-->
+               							<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                    							   <select id="txtbox_{$label}" name="{$keyfldname}">
+                    								{foreach item=arr from=$keyoptions}
+                    									{foreach key=sel_value item=value from=$arr}
+                    										<option value="{$sel_value}" {$value}>{if $APP.$sel_value}{$APP.$sel_value}{else}{$sel_value}{/if}</option>
+                    									
+                    									{/foreach}
+                    								{/foreach}
+                    							   </select>
+                    							   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                    							</div>
+               							</td>
+                                             {elseif $keyid eq '12'} <!-- OrgUnit picklist-->
+					     <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$ASSIGN_ORGUNIT_LIST.$keyval.name}</span>
+						 <div id="editarea_{$label}" style="display:none;">
+						     <select id="txtbox_{$label}" name="{$keyfldname}">
+							 {if $keyval == ""}
+							     <option selected value="0" "-- None --">-- None --</option>
+							 {else}
+							     <option value="0" "-- None --">-- None --</option>
+							 {/if}
+							 {foreach key=orgunitid item=arr from=$ASSIGN_ORGUNIT_LIST}
+							     {if $orgunitid == $keyval}
+								 <option selected value="{$orgunitid}" {$arr.name}>{$arr.name}</option>
+							     {else}
+								 <option value="{$orgunitid}" {$arr.name}>{$arr.name}</option>
+							     {/if}
+							 {/foreach}
+						     </select>
+						     <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+						     <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+						 </div>
+					     </td>
+                                             {elseif $keyid eq '14'} <!-- Organization picklist-->
+					     <td width=25% class="dvtCellInfo" align="left"
+						 {if $keyval.$CURRENT_ORGANIZATION eq 1}
+						     id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');"
+						     onmouseout="fnhide('crmspanid');"
+						 {/if}>
+						 <!-- @#@#@#@# {$label} @#@#@#@# -->
+						 <span id="dtlview_{$label}">{foreach key=org item=sel from=$keyval}&nbsp;{$org}{if $sel eq 1}&nbsp;(*){/if}<br>{/foreach}</span>
+						 {if $keyval.$CURRENT_ORGANIZATION eq 1}
+						     <div id="editarea_{$label}" style="display:none;">
+							<select multiple id="txtbox_{$label}" name="{$keyfldname}[]">
+							    {foreach key=maintabs item=detail from=$USER_ORGANIZATIONS}
+								{if $CURRENT_ORGANIZATION ne $maintabs && $keyval.$maintabs ne 1}
+								    <option value="{$maintabs}" {if $keyval.$maintabs ne ''}selected{/if}>{$maintabs}</option>
+								{/if}
+							    {/foreach}
+							</select>
+							 <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+							 <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+						     </div>
+						 <!-- @#@#@#@# {$label} @#@#@#@# -->
+						 {/if}
+					     </td>
+					  {elseif $keyid eq '3' || $keyid eq '4' || $keyid eq '32' || $keyid eq '31'} <!--TextBox with Inheritance/Extension-->
+					    <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}"
+						onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
+						<!-- @#@#@#@# {$label} @#@#@#@# -->
+						<span id="dtlview_{$label}">
+						    {if $keyinherit == 1}
+							{if $keyid eq '32' || $keyid eq '31'}
+							    {$keyval}&nbsp;&nbsp;<font color="blue">EXT</font>
+							{else}
+							    <font color="blue">{$MOD.LBL_INHERIT_PARENT}</font>
+							{/if}
+						    {else}
+							{$keyval}
+						    {/if}
+						</span>
+						<div id="editarea_{$label}" style="display:none;">
+						    {if $keyid eq '32' || $keyid eq '31'}
+							{if $keyinherit == 1}
+							    <input id="txtbox_{$label}_inh" name="{$keyfldname}@##@" type="checkbox"
+								style="border:1px solid #bababa;" checked value="1"/>
+							{else}
+							    <input id="txtbox_{$label}_inh" type="checkbox" name="{$keyfldname}@##@"
+								style="border:1px solid #bababa;" value="0"/>
+							{/if}
+							{$MOD.LBL_EXTEND_PARENT}
+							<br>
+							<input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'"
+							    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}"
+							    name="{$keyfldname}" maxlength='100' value="{$keyval}" tabindex="{$vt_tab}"></input>
+						    {else}
+							{if $keyinherit == 1}
+							    <input id="txtbox_{$label}_inh" name="{$keyfldname}@##@" type="checkbox"
+								style="border:1px solid #bababa;" checked value="1"
+								onClick="this.form.{$keyfldname}.disabled=this.checked;"/>
+								{$MOD.LBL_INHERIT_PARENT}
+							    <br>
+							    <input disabled class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'"
+								onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}"
+								name="{$keyfldname}" maxlength='100' value="{$keyval}" tabindex="{$vt_tab}"></input>
+							{else}
+							    <input id="txtbox_{$label}_inh" type="checkbox" name="{$keyfldname}@##@"
+								style="border:1px solid #bababa;" value="0"
+								onClick="this.form.{$keyfldname}.disabled=this.checked;"/>
+								{$MOD.LBL_INHERIT_PARENT}
+							    <br>
+							    <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'"
+								onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}"
+								name="{$keyfldname}" maxlength='100' value="{$keyval}" tabindex="{$vt_tab}"></input>
+							{/if}
+						    {/if}
+						    <br>
+						    <input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/>
+						    {$APP.LBL_OR}
+						    <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+						</div>
+						<!-- @#@#@#@# {$label} @#@#@#@# -->
+					    </td>
+                                          {elseif $keyid eq '33'}<!--Multi Select Combo box-->
+						<!--code given by Neil start Ref:http://forums.vtiger.com/viewtopic.php?p=31096#31096-->
+						{assign var="MULTISELECT_COMBO_BOX_ITEM_SEPARATOR_STRING" value=", "}  {* Separates Multi-Select Combo Box items *}
+						{assign var="DETAILVIEW_WORDWRAP_WIDTH" value="70"} {* No. of chars for word wrapping long lines of Multi-Select Combo Box items *}
+                                          <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">
+						{$keyval|replace:$MULTISELECT_COMBO_BOX_ITEM_SEPARATOR_STRING:"\x1"|replace:" ":"\x0"|replace:"\x1":$MULTISELECT_COMBO_BOX_ITEM_SEPARATOR_STRING|wordwrap:$DETAILVIEW_WORDWRAP_WIDTH:"<br>&nbsp;"|replace:"\x0":"&nbsp;"}
+						</span>
+						<!--code given by Neil End-->
+                                          <div id="editarea_{$label}" style="display:none;">
+                                          <select MULTIPLE id="txtbox_{$label}" name="{$keyfldname}" size="4" style="width:160px;">
+				                                    {foreach item=arr from=$keyoptions}
+					                                     {foreach key=sel_value item=value from=$arr}
+						                                      <option value="{$sel_value}" {$value}>{$sel_value}</option>
+					                                     {/foreach}
+				                                    {/foreach}
+			                                   </select>
+			                                   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                    							</div>
+               							</td>
+						{elseif $keyid eq '115'} <!--ComboBox Status edit only for admin Users-->
+								{if $keyadmin eq 1}
+               							<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                    							   <select id="txtbox_{$label}" name="{$keyfldname}">
+                    								{foreach item=arr from=$keyoptions}
+                    									{foreach key=sel_value item=value from=$arr}
+                    										<option value="{$sel_value}" {$value}>{$sel_value}</option>
+                    									{/foreach}
+                    								{/foreach}
+                    							   </select>
+                    							   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                    							</div>
+								{else}
+               							<td width=25% class="dvtCellInfo" align="left">{$keyval}
+								{/if}	
+								
+               							</td>
+						{elseif $keyid eq '116'} <!--ComboBox currency id edit only for admin Users-->
+								{if $keyadmin eq 1}
+               							<td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
+								<div id="editarea_{$label}" style="display:none;">
+                    							   <select id="txtbox_{$label}" name="{$keyfldname}">
+									{foreach item=arr key=uivalueid from=$keyoptions}
+									{foreach key=sel_value item=value from=$arr}
+										<option value="{$uivalueid}" {$value}>{$sel_value}</option>	
+									{/foreach}
+									{/foreach}
+                    							   </select>
+                    							   <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		   <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                    							</div>
+								{else}
+               							<td width=25% class="dvtCellInfo" align="left">{$keyval}
+								{/if}	
+
+                                        		
+               							</td>
+                                             {elseif $keyid eq '17'} <!--WebSite-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="http://{$keyval}" target="_blank">{$keyval}</a></span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
+                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>
+					     {elseif $keyid eq '85'}<!--Skype-->
+                                                <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<img src="{$IMAGE_PATH}skype.gif" alt="Skype" title="Skype" LANGUAGE=javascript align="absmiddle"></img><span id="dtlview_{$label}"><a href="skype:{$keyval}?call">{$keyval}</a></span>
+                                                        <div id="editarea_{$label}" style="display:none;">
+                                                          <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
+                                                          <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                                          <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>	
+                                             {elseif $keyid eq '18'} <!--WebSite with Inheritance-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
+						  <!-- @#@#@#@# {$label} @#@#@#@# -->
+						  &nbsp;<span id="dtlview_{$label}"><a href="http://{$keyval}" target="_blank">{$keyval}</a></span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+							    {if $keyinherit == 1}
+								<input id="txtbox_{$label}_inh" name="{$keyfldname}@##@" type="checkbox"
+								    style="border:1px solid #bababa;" checked value="1
+								    onClick="this.form.{$keyfldname}.disabled=this.checked;"/>
+								    {$MOD.LBL_INHERIT_PARENT}
+								<br>
+								&nbsp;&nbsp;http://&nbsp;
+								<input disabled tyle="border:1px solid #bababa;" size="27" 
+								    onFocus="this.className='detailedViewTextBoxOn'"
+								    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}"
+								    name="{$keyfldname}" maxlength='100' value="{$keyval}" tabindex="{$vt_tab}"></input>
+							    {else}
+								<input id="txtbox_{$label}_inh" type="checkbox" name="{$keyfldname}@##@"
+								    style="border:1px solid #bababa;" value="0"
+								    onClick="this.form.{$keyfldname}.disabled=this.checked;"/>
+								    {$MOD.LBL_INHERIT_PARENT}
+								<br>
+								&nbsp;&nbsp;http://&nbsp;
+								<input tyle="border:1px solid #bababa;" size="27" 
+								    onFocus="this.className='detailedViewTextBoxOn'"
+								    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}"
+								    name="{$keyfldname}" maxlength='100' value="{$keyval}" tabindex="{$vt_tab}"></input>
+							    {/if}
+                                              		    <br>
+							    <input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/>
+							    {$APP.LBL_OR}
+                                              		    <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+						  <!-- @#@#@#@# {$label} @#@#@#@# -->
+                                                  </td>
+                                             {elseif $keyid eq '19' || $keyid eq '20'} <!--TextArea/Description-->
+						<!-- we will empty the value of ticket and faq comment -->
+						{if $label eq $MOD.LBL_ADD_COMMENT}
+							{assign var=keyval value=''}
+						{/if}
+							<!--{assign var="DESCRIPTION_SEPARATOR_STRING" value=" "}  {* Separates Description *}-->
+							<!--{assign var="DESCRIPTION_WORDWRAP_WIDTH" value="70"} {* No. of chars for word wrapping long lines of Description *}-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">
+							{$keyval}<!--|replace:$DESCRIPTION_SEPARATOR_STRING:"\x1"|replace:" ":"\x0"|replace:"\x1":$DESCRIPTION_SEPARATOR_STRING|wordwrap:$DESCRIPTION_WORDWRAP_WIDTH:"<br>&nbsp;"|replace:"\x0":"&nbsp;"}-->
+							</span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                                              		  <textarea id="txtbox_{$label}" name="{$keyfldname}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$keyval}</textarea>                                            		  
+                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>
+                                             {elseif $keyid eq '21' || $keyid eq '24' || $keyid eq '22'} <!--TextArea/Street-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}</span>
+                                              		<div id="editarea_{$label}" style="display:none;">
+                                              		  <textarea id="txtbox_{$label}" name="{$keyfldname}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" rows=2>{$keyval}</textarea>                                            		  
+                                              		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>
+                                             {elseif $keyid eq '50' || $keyid eq '73' || $keyid eq '51'} <!--AccountPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq '57'} <!--ContactPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="{$keyseclink}">{$keyval}</a></span>
+                                              		<div id="editarea_{$label}" style="display:none;">                                              		  
+                                                         <input id="popuptxt_{$label}" name="contact_name" readonly type="text" style="border:1px solid #bababa;" value="{$keyval}"><input id="txtbox_{$label}" name="{$keyfldname}" type="hidden" value="{$keysecid}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&action=Popup&Parent={$ID}&html=Popup_picker&popuptype=specific&form=EditView","test","width=600,height=602,resizable=1,scrollbars=1");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.contact_id.value=''; this.form.contact_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+                                                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>                                                  
+                                             {elseif $keyid eq '59'} <!--ProductPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}"><a href="{$keyseclink}">{$keyval}</a></span>
+                                              		<div id="editarea_{$label}" style="display:none;">                                              		  
+                                                         <input id="popuptxt_{$label}" name="product_name" readonly type="text" value="{$keyval}"><input id="txtbox_{$label}" name="{$keyfldname}" type="hidden" value="{$keysecid}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype=specific","test","width=600,height=602,resizable=1,scrollbars=1,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.product_id.value=''; this.form.product_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+                                                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
+                                              		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                                                       </div>
+                                                  </td>
+                                             {elseif $keyid eq '75' || $keyid eq '81'} <!--VendorPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq 76} <!--PotentialPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq 78} <!--QuotePopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
+                                                  </td>
+                                             {elseif $keyid eq 82} <!--Email Body-->
+                                                  <td colspan="3" width=100% class="dvtCellInfo" align="left"><div id="dtlview_{$label}" style="width:100%;height:200px;overflow:hidden;border:1px solid gray" class="detailedViewTextBox" onmouseover="this.className='detailedViewTextBoxOn'" onmouseout="this.className='detailedViewTextBox'">{$keyval}</div>
+                                                  </td>
+                                             {elseif $keyid eq 80} <!--SalesOrderPopup-->
+                                                  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}">&nbsp;<a href="{$keyseclink}">{$keyval}</a>
+                                                  </td>
+					     {elseif $keyid eq '53'} <!--Assigned To-->
+                    				  <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">
+                    				{if $keyoptions.0 eq 'User' && $keyadmin eq 1}
+			                        	<a href="{$keyseclink.0}">{$keyval}</a>         
+			                        {elseif $keyoptions.0 eq 'Group' && $keyadmin eq 1}
+                        				<a href="{$keyseclink.1}">{$keyval}</a>         
+						{else}	
+                        				{$keyval}
+                    				{/if}
+					&nbsp;</span>
+                    				<div id="editarea_{$label}" style="display:none;">
+			                   	<input type="hidden" id="hdtxt_{$label}" value="{$keyval}"></input>
+						{if $keyoptions.0 eq 'User'}
+							<input name="assigntype" id="assigntype" checked="checked" value="U" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_USER}
+							{if $keyoptions.2 neq ''}
+								<input name="assigntype" id="assigntype" value="T" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_GROUP_NAME}
+							{/if}
+							<span id="assign_user" style="display: block;">
+						{else}
+							<input name="assigntype" id="assigntype" value="U" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_USER}
+							<input name="assigntype" checked="checked" id="assigntype" value="T" onclick="toggleAssignType(this.value),setSelectValue('{$label}');" type="radio">&nbsp;{$APP.LBL_GROUP_NAME}
+							<span id="assign_user" style="display: none;">
+						{/if}
+                   				<select id="txtbox_U{$label}" onchange="setSelectValue('{$label}')" name="{$keyfldname}">
+				                    {foreach item=arr key=id from=$keyoptions.1}
+				                    	{foreach key=sel_value item=value from=$arr}
+                       						 <option value="{$id}" {$value}>{$sel_value}</option>
+				                        {/foreach}
+				                    {/foreach}
+			                    	</select>
+						</span>
+					{if $keyoptions.0 eq 'Group'}
+						<span id="assign_team" style="display: block;">
+					{else}
+						<span id="assign_team" style="display: none;">
+					{/if}
+                   	<select id="txtbox_G{$label}" onchange="setSelectValue('{$label}')" name="{$keyfldname}">
+                    {foreach item=arr key=id from=$keyoptions.2}
+                    	{foreach key=sel_value item=value from=$arr}
+                       		 <option value="{$id}" {$value}>{$sel_value}</option>
+                        {/foreach}
+                    {/foreach}
+                    </select>
+					</span>
+
+                    <br>
+                    <input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> {$APP.LBL_OR}
+                    <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                    </div>
+                    </td>
+						{elseif $keyid eq '99'}<!-- Password Field-->
+						<td width=25% class="dvtCellInfo" align="left">{$CHANGE_PW_BUTTON}</td>	
+					    {elseif $keyid eq '56'} <!--CheckBox--> 
+                      <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onMouseOver="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}&nbsp;</span>
+                    	<div id="editarea_{$label}" style="display:none;">
+                        {if $keyval eq 'yes'}                                              		  
+                            <input id="txtbox_{$label}" name="{$keyfldname}" type="checkbox" style="border:1px solid #bababa;" checked value="1">
+                        {else}
+                          <input id="txtbox_{$label}" type="checkbox" name="{$keyfldname}" style="border:1px solid #bababa;" value="0">
+                       	{/if}
+                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> {$APP.LBL_OR}
+                          <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                        </div>
+                        </td>    
+			{elseif $keyid eq '156'} <!--CheckBox for is admin-->
+			{if $smarty.request.record neq $CURRENT_USERID && $keyadmin eq 1} 
+                      <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onMouseOver="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">&nbsp;<span id="dtlview_{$label}">{$keyval}&nbsp;</span>
+                    	<div id="editarea_{$label}" style="display:none;">
+                        {if $keyval eq 'on'}                                              		  
+                            <input id="txtbox_{$label}" name="{$keyfldname}" type="checkbox" style="border:1px solid #bababa;" checked value="1">
+                        {else}
+                          <input id="txtbox_{$label}" type="checkbox" name="{$keyfldname}" style="border:1px solid #bababa;" value="0">
+                       	{/if}
+                         <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> {$APP.LBL_OR}
+                          <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
+                        </div>
+			{else}
+				 <td width=25% class="dvtCellInfo" align="left">{$keyval}
+			{/if}
+                        </td>    
+			 
+						{elseif $keyid eq 83}<!-- Handle the Tax in Inventory -->
+							{foreach item=tax key=count from=$TAX_DETAILS}
+								<td align="right" class="dvtCellLabel">
+									{$tax.taxlabel} {$APP.COVERED_PERCENTAGE}
+							
+								</td>
+								<td class="dvtCellInfo" align="left">
+									{$tax.percentage}
+								</td>
+								<td colspan="2" class="dvtCellInfo">&nbsp;</td>
+							   </tr>
+							{/foreach}
+
+
+				{elseif $keyid eq 69}<!-- for Image Reflection -->
+				    <td align="left" width=25%">&nbsp;{$keyval}</td>
+				{elseif $keyid eq 107}<!-- Company Logo -->
+				    <td class="dvtCellInfo" align="left" width="25%">
+					{if $keyval ne ""}
+					    <img src="test/logo/{$keyval}" width="96" height="48" alt="{$keyval}" title="{$keyval}" border="0">
+					{/if}
+				    </td>
+				{else}									
+				    <td class="dvtCellInfo" align="left" width=25%">&nbsp;{$keyval}</td>
+				{/if}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/DisplayFields.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/DisplayFields.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/DisplayFields.tpl Tue Nov 14 03:16:10 2006
@@ -1,687 +1,826 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-<!-- Added this file to display the fields in Create Entity page based on ui types  -->
-{foreach key=label item=subdata from=$data}
-	{if $header eq 'Product Details'}
-		<tr>
-	{else}
-		<tr style="height:25px">
-	{/if}
-	{foreach key=mainlabel item=maindata from=$subdata}
-		{assign var="uitype" value="$maindata[0][0]"}
-		{assign var="fldlabel" value="$maindata[1][0]"}
-		{assign var="fldlabel_sel" value="$maindata[1][1]"}
-		{assign var="fldlabel_combo" value="$maindata[1][2]"}
-		{assign var="fldname" value="$maindata[2][0]"}
-		{assign var="fldvalue" value="$maindata[3][0]"}
-		{assign var="secondvalue" value="$maindata[3][1]"}
-		{assign var="thirdvalue" value="$maindata[3][2]"}
-		{assign var="vt_tab" value="$maindata[4][0]"}
-
-		{if $uitype eq 2}
-			<td width=20% class="dvtCellLabel" align=right>
-				<font color="red">*</font>{$fldlabel}
-			</td>
-			<td width=30% align=left class="dvtCellInfo">
-				<input type="text" name="{$fldname}" tabindex="{$vt_tab}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
-			</td>
-		{elseif $uitype eq 11 || $uitype eq 1 || $uitype eq 13 || $uitype eq 7 || $uitype eq 9}
-			<td width=20% class="dvtCellLabel" align=right>{$fldlabel}</td>
-
-			{if $fldname eq 'tickersymbol' && $MODULE eq 'Accounts'}
-				<td width=30% align=left class="dvtCellInfo">
-					<input type="text" name="{$fldname}" tabindex="{$vt_tab}" id ="{$fldname}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn';" onBlur="this.className='detailedViewTextBox';{if $fldname eq 'tickersymbol' && $MODULE eq 'Accounts'}sensex_info(){/if}">
-					<span id="vtbusy_info" style="display:none;">
-						<img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span>
-				</td>
-			{else}
-				<td width=30% align=left class="dvtCellInfo"><input type="text" tabindex="{$vt_tab}" name="{$fldname}" id ="{$fldname}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-			{/if}
-		{elseif $uitype eq 19 || $uitype eq 20}
-			<!-- In Add Comment are we should not display anything -->
-			{if $fldlabel eq 'Add Comment'}
-				{assign var=fldvalue value=""}
-			{/if}
-			<td width=20% class="dvtCellLabel" align=right>
-				{if $uitype eq 20}
-					<font color="red">*</font>
-				{/if}
-				{$fldlabel}
-			</td>
-			<td colspan=3>
-				<textarea class="detailedViewTextBox" tabindex="{$vt_tab}" onFocus="this.className='detailedViewTextBoxOn'" name="{$fldname}"  onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$fldvalue}</textarea>
-			</td>
-		{elseif $uitype eq 21 || $uitype eq 24}
-			<td width=20% class="dvtCellLabel" align=right>
-				{if $uitype eq 24}
-					<font color="red">*</font>
-				{/if}
-				{$fldlabel}
-			</td>
-			<td width=30% align=left class="dvtCellInfo">
-				<textarea value="{$fldvalue}" name="{$fldname}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" rows=2>{$fldvalue}</textarea>
-			</td>
-		{elseif $uitype eq 15 || $uitype eq 16 || $uitype eq 111} <!-- uitype 111 added for noneditable existing picklist values - ahmed -->
-			<td width="20%" class="dvtCellLabel" align=right>
-				{if $uitype eq 16}
-					<font color="red">*</font>
-				{/if}
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-			   <select name="{$fldname}" tabindex="{$vt_tab}" >
-				{foreach item=arr from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-						<option value="{$sel_value}" {$value}>
-                                                {if $APP[$sel_value] neq ''}
-                                                        {$APP[$sel_value]}
-                                                {else}
-                                                        {$sel_value}
-                                                {/if}
-                                                </option>
-					{/foreach}
-				{/foreach}
-			   </select>
-			</td>
-		{elseif $uitype eq 33}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-			   <select MULTIPLE name="{$fldname}[]" size="4" style="width:160px;" tabindex="{$vt_tab}" >
-				{foreach item=arr from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-						<option value="{$sel_value}" {$value}>{$sel_value}</option>
-					{/foreach}
-				{/foreach}
-			   </select>
-			</td>
-
-		{elseif $uitype eq 53}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				{assign var=check value=1}
-				{foreach key=key_one item=arr from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-						{if $value ne ''}
-							{assign var=check value=$check*0}
-						{else}
-							{assign var=check value=$check*1}
-						{/if}
-					{/foreach}
-				{/foreach}
-
-				{if $check eq 0}
-					{assign var=select_user value='checked'}
-					{assign var=style_user value='display:block'}
-					{assign var=style_group value='display:none'}
-				{else}
-					{assign var=select_group value='checked'}
-					{assign var=style_user value='display:none'}
-					{assign var=style_group value='display:block'}
-				{/if}
-
-				<input type="radio" tabindex="{$vt_tab}" name="assigntype" {$select_user} value="U" onclick="toggleAssignType(this.value)">&nbsp;User
-
-				{if $secondvalue neq ''}
-					<input type="radio" name="assigntype" {$select_group} value="T" onclick="toggleAssignType(this.value)">&nbsp;Group
-				{/if}
-				<span id="assign_user" style="{$style_user}">
-					<select name="assigned_user_id">
-						{foreach key=key_one item=arr from=$fldvalue}
-							{foreach key=sel_value item=value from=$arr}
-								<option value="{$key_one}" {$value}>{$sel_value}</option>
-							{/foreach}
-						{/foreach}
-					</select>
-				</span>
-
-				{if $secondvalue neq ''}
-					<span id="assign_team" style="{$style_group}">
-						<select name="assigned_group_name">';
-							{foreach key=key_one item=arr from=$secondvalue}
-								{foreach key=sel_value item=value from=$arr}
-									<option value="{$sel_value}" {$value}>{$sel_value}</option>
-								{/foreach}
-							{/foreach}
-						</select>
-					</span>
-				{/if}
-			</td>
-		{elseif $uitype eq 52 || $uitype eq 77}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				{if $uitype eq 52}
-					<select name="assigned_user_id">
-				{elseif $uitype eq 77}
-					<select name="assigned_user_id1" tabindex="{$vt_tab}" >
-				{else}
-					<select name="{$fldname}" tabindex="{$vt_tab}" >
-				{/if}
-
-				{foreach key=key_one item=arr from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-						<option value="{$key_one}" {$value}>{$sel_value}</option>
-					{/foreach}
-				{/foreach}
-				</select>
-			</td>
-		{elseif $uitype eq 51}
-			{if $MODULE eq 'Accounts'}
-				{assign var='popuptype' value = 'specific_account_address'}
-			{else}
-				{assign var='popuptype' value = 'specific_contact_account_address'}
-			{/if}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input readonly name="account_name" style="border:1px solid #bababa;" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype={$popuptype}&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.account_id.value=''; this.form.account_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 50}
-			<td width="20%" class="dvtCellLabel" align=right>
-				<font color="red">*</font>{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input readonly name="account_name" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype=specific&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-		{elseif $uitype eq 73}
-			<td width="20%" class="dvtCellLabel" align=right>
-				<font color="red">*</font>{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input readonly name="account_name" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype=specific_account_address&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 75 || $uitype eq 81}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{if $uitype eq 81}
-					<font color="red">*</font>
-					{assign var="pop_type" value="specific_vendor_address"}
-					{else}{assign var="pop_type" value="specific"}
-				{/if}
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="vendor_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Vendors&action=Popup&html=Popup_picker&popuptype={$pop_type}&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
-				{if $uitype eq 75}
-					&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.vendor_id.value='';this.form.vendor_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-				{/if}
-			</td>
-		{elseif $uitype eq 57}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="contact_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.contact_id.value=''; this.form.contact_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-		
-		{elseif $uitype eq 58}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="campaignname" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Campaigns&action=Popup&html=Popup_picker&popuptype=specific_campaign&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.campaignid.value=''; this.form.campaignname.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 80}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="salesorder_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=SalesOrder&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.salesorder_id.value=''; this.form.salesorder_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 78}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="quote_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$QUOTE_ID}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Quotes&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.quote_id.value=''; this.form.quote_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 76}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="potential_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Potentials&action=Popup&html=Popup_picker&popuptype=specific_potential_account_address&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.potential_id.value=''; this.form.potential_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 17}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				&nbsp;&nbsp;http://&nbsp;
-				<input type="text" tabindex="{$vt_tab}" name="{$fldname}" style="border:1px solid #bababa;" size="27" onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" value="{$fldvalue}">
-			</td>
-
-		{elseif $uitype eq 71 || $uitype eq 72}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{if $uitype eq 72}
-					<font color="red">*</font>
-				{/if}
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="{$fldname}" tabindex="{$vt_tab}" type="text" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"  value="{$fldvalue}">
-			</td>
-
-		{elseif $uitype eq 56}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			{if $fldname eq 'notime' && $ACTIVITY_MODE eq 'Events'}
-				{if $fldvalue eq 1}
-					<td width="30%" align=left class="dvtCellInfo">
-						<input name="{$fldname}" type="checkbox" tabindex="{$vt_tab}" onclick="toggleTime()" checked>
-					</td>
-				{else}
-					<td width="30%" align=left class="dvtCellInfo">
-						<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox" onclick="toggleTime()" >
-					</td>
-				{/if}
-			{else}
-				{if $fldvalue eq 1}
-					<td width="30%" align=left class="dvtCellInfo">
-						<input name="{$fldname}" type="checkbox" tabindex="{$vt_tab}" checked>
-					</td>
-				{else}
-					<td width="30%" align=left class="dvtCellInfo">
-						<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox">
-					</td>
-				{/if}
-			{/if}
-		{elseif $uitype eq 23 || $uitype eq 5 || $uitype eq 6}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				{foreach key=date_value item=time_value from=$fldvalue}
-					{assign var=date_val value="$date_value"}
-					{assign var=time_val value="$time_value"}
-				{/foreach}
-
-				<input name="{$fldname}" tabindex="{$vt_tab}" id="jscal_field_{$fldname}" type="text" style="border:1px solid #bababa;" size="11" maxlength="10" value="{$date_val}">
-				<img src="{$IMAGE_PATH}calendar.gif" id="jscal_trigger_{$fldname}">
-
-				{if $uitype eq 6}
-					<input name="time_start" tabindex="{$vt_tab}" style="border:1px solid #bababa;" size="5" maxlength="5" type="text" value="{$time_val}">
-				{/if}
-
-				{foreach key=date_format item=date_str from=$secondvalue}
-					{assign var=dateFormat value="$date_format"}
-					{assign var=dateStr value="$date_str"}
-				{/foreach}
-
-				{if $uitype eq 5 || $uitype eq 23}
-					<br><font size=1><em old="(yyyy-mm-dd)">({$dateStr})</em></font>
-				{else}
-					<br><font size=1><em old="(yyyy-mm-dd)">({$dateStr})</em></font>
-				{/if}
-
-				<script type="text/javascript">
-					Calendar.setup ({ldelim}
-						inputField : "jscal_field_{$fldname}", ifFormat : "{$dateFormat}", showsTime : false, button : "jscal_trigger_{$fldname}", singleClick : true, step : 1
-					{rdelim})
-				</script>
-
-
-			</td>
-
-		{elseif $uitype eq 63}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="{$fldname}" type="text" size="2" value="{$fldvalue}" tabindex="{$vt_tab}" >&nbsp;
-				<select name="duration_minutes" tabindex="{$vt_tab}" >
-					{foreach key=labelval item=selectval from=$secondvalue}
-						<option value="{$labelval}" {$selectval}>{$labelval}</option>
-					{/foreach}
-				</select>
-
-		{elseif $uitype eq 68 || $uitype eq 66 || $uitype eq 62}
-			<td width="20%" class="dvtCellLabel" align=right>
-				<select name="parent_type" onChange='document.EditView.parent_name.value=""; document.EditView.parent_id.value=""'>
-					{section name=combo loop=$fldlabel}
-						<option value="{$fldlabel_combo[combo]}" {$fldlabel_sel[combo]}>{$fldlabel[combo]}</option>
-					{/section}
-				</select>
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
-				<input name="parent_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}">
-				&nbsp;<img src="{$IMAGE_PATH}select.gif" tabindex="{$vt_tab}" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&html=Popup_picker&form=HelpDeskEditView","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=''; this.form.parent_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 357}
-			<td width="20%" class="dvtCellLabel" align=right>To:&nbsp;</td>
-			<td width="90%" colspan="3">
-				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
-				<textarea readonly name="parent_name" cols="70" rows="2">{$fldvalue}</textarea>&nbsp;
-				<select name="parent_type">
-					{foreach key=labelval item=selectval from=$fldlabel}
-						<option value="{$labelval}" {$selectval}>{$labelval}</option>
-					{/foreach}
-				</select>
-				&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&html=Popup_picker&form=HelpDeskEditView","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=''; this.form.parent_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-		   <tr style="height:25px">
-			<td width="20%" class="dvtCellLabel" align=right>CC:&nbsp;</td>	
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="ccmail" type="text" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"  value="">
-			</td>
-			<td width="20%" class="dvtCellLabel" align=right>BCC:&nbsp;</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="bccmail" type="text" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"  value="">
-			</td>
-		   </tr>
-
-		{elseif $uitype eq 59}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
-				<input name="product_name" readonly type="text" value="{$fldvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype=specific","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.product_id.value=''; this.form.product_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
-			</td>
-
-		{elseif $uitype eq 55} 
-			<td width="20%" class="dvtCellLabel" align=right>{$fldlabel}</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<select name="salutationtype">
-					{foreach item=arr from=$fldvalue}
-						{foreach key=sel_value item=value from=$arr}
-							<option value="{$sel_value}" {$value}>{$sel_value}</option>
-						{/foreach}
-					{/foreach}
-				</select>
-				<input type="text" name="{$fldname}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" value= "{$secondvalue}">
-			</td>
-
-		{elseif $uitype eq 22}
-			<td width="20%" class="dvtCellLabel" align=right>
-				<font color="red">*</font>{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-				<textarea name="{$fldname}" cols="30" tabindex="{$vt_tab}" rows="2">{$fldvalue}</textarea>
-			</td>
-
-		{elseif $uitype eq 69}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td colspan="3" width="30%" align=left class="dvtCellInfo">
-				{if $MODULE eq 'Products'}
-					<input name="del_file_list" type="hidden" value="">
-					<div id="files_list" style="border: 1px solid grey; width: 500px; padding: 5px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; font-size: x-small">Files Maximum 6
-						<input id="my_file_element" type="file" name="file_1" tabindex="{$vt_tab}" >
-						{assign var=image_count value=0}
-						{if $maindata[3].0.name neq ''}
-						   {foreach name=image_loop key=num item=image_details from=$maindata[3]}
-							<div align="center">
-								<img src="{$image_details.path}{$image_details.name}" height="50">&nbsp;&nbsp;[{$image_details.name}]<input id="file_{$num}" value="Delete" type="button" class="crmbutton small delete" onclick='this.parentNode.parentNode.removeChild(this.parentNode);delRowEmt("{$image_details.name}")'>
-							</div>
-					   	   {assign var=image_count value=$smarty.foreach.image_loop.iteration}
-					   	   {/foreach}
-						{/if}
-					</div>
-
-					<script>
-						{*<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->*}
-						var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 6 );
-						multi_selector.count = {$image_count}
-						{*<!-- Pass in the file element -->*}
-						multi_selector.addElement( document.getElementById( 'my_file_element' ) );
-					</script>
-				{else}
-					<input name="{$fldname}"  type="file" value="{$maindata[3].0.name}" tabindex="{$vt_tab}" />
-					<input type="hidden" name="id" value=""/>
-					{ if $maindata[3].0.name != "" }
-						
-				<div id="replaceimage">[{$maindata[3].0.name}] <a href="javascript:;" onClick="delimage({$ID})">Del</a></div>
-					{/if}
-					
-				{/if}
-			</td>
-
-		{elseif $uitype eq 61}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td colspan="3" width="30%" align=left class="dvtCellInfo">
-				<input name="{$fldname}"  type="file" value="{$secondvalue}" tabindex="{$vt_tab}" />
-				<input type="hidden" name="id" value=""/>{$fldvalue}
-			</td>
-		{elseif $uitype eq 156}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-				{if $fldvalue eq 'on'}
-					<td width="30%" align=left class="dvtCellInfo">
-						{if ($secondvalue eq 1 && $CURRENT_USERID != $smarty.request.record) || ($MODE == 'create')}
-							<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox" checked>
-						{else}
-							<input name="{$fldname}" type="hidden" value="on">
-							<input name="{$fldname}" disabled tabindex="{$vt_tab}" type="checkbox" checked>
-						{/if}	
-					</td>
-				{else}
-					<td width="30%" align=left class="dvtCellInfo">
-						{if ($secondvalue eq 1 && $CURRENT_USERID != $smarty.request.record) || ($MODE == 'create')}
-							<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox">
-						{else}
-							<input name="{$fldname}" disabled tabindex="{$vt_tab}" type="checkbox">
-						{/if}	
-					</td>
-				{/if}
-		{elseif $uitype eq 98}<!-- Role Selection Popup -->		
-			<td width="20%" class="dvtCellLabel" align=right>
-			<font color="red">*</font>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-			{if $thirdvalue eq 1}
-				<input name="role_name" id="role_name" readonly class="txtBox" tabindex="{$vt_tab}" value="{$secondvalue}" type="text">&nbsp;
-				<a href="javascript:openPopup();"><img src="{$IMAGE_PATH}select.gif" align="absmiddle" border="0"></a>
-			{else}	
-				<input name="role_name" id="role_name" tabindex="{$vt_tab}" class="txtBox" readonly value="{$secondvalue}" type="text">&nbsp;
-			{/if}	
-			<input name="user_role" id="user_role" value="{$fldvalue}" type="hidden">
-			</td>
-		{elseif $uitype eq 104}<!-- Mandatory Email Fields -->			
-			 <td width=20% class="dvtCellLabel" align=right>
-			 <font color="red">*</font>
-			 {$fldlabel}
-			 </td>
-    	     <td width=30% align=left class="dvtCellInfo"><input type="text" name="{$fldname}" id ="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
-			{elseif $uitype eq 115}<!-- for Status field Disabled for nonadmin -->
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-			   {if $secondvalue eq 1}
-			   	<select name="{$fldname}" tabindex="{$vt_tab}" >
-			   {else}
-			   	<select disabled name="{$fldname}">
-			   {/if} 
-				{foreach item=arr from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-						<option value="{$sel_value}" {$value}>{$sel_value}</option>
-					{/foreach}
-				{/foreach}
-			   </select>
-			</td>
-			{elseif $uitype eq 105}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-					<input name="{$fldname}"  type="file" value="{$maindata[3].0.name}" tabindex="{$vt_tab}" />
-					<input type="hidden" name="id" value=""/>
-					{$maindata[3].0.name}
-			</td>
-			{elseif $uitype eq 103}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" colspan="3" align=left class="dvtCellInfo">
-				<input type="text" name="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
-			</td>	
-			{elseif $uitype eq 101}<!-- for reportsto field USERS POPUP -->
-				<td width="20%" class="dvtCellLabel" align=right>
-			       {$fldlabel}
-	            </td>
-				<td width="30%" align=left class="dvtCellInfo">
-				<input readonly name='reports_to_name' class="small" type="text" value='{$fldvalue}' tabindex="{$vt_tab}" ><input name='reports_to_id' type="hidden" value='{$secondvalue}'>&nbsp;<input title="Change [Alt+C]" accessKey="C" type="button" class="small" value='{$UMOD.LBL_CHANGE}' name=btn1 LANGUAGE=javascript onclick='return window.open("index.php?module=Users&action=Popup&form=UsersEditView&form_submit=false","test","width=640,height=522,resizable=0,scrollbars=0");'>
-	            </td>
-			{elseif $uitype eq 116}<!-- for currency in users details-->	
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td width="30%" align=left class="dvtCellInfo">
-			   {if $secondvalue eq 1}
-			   	<select name="{$fldname}" tabindex="{$vt_tab}" >
-			   {else}
-			   	<select disabled name="{$fldname}" tabindex="{$vt_tab}" >
-			   {/if} 
-
-				{foreach item=arr key=uivalueid from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-						<option value="{$uivalueid}" {$value}>{$sel_value}</option>
-					{/foreach}
-				{/foreach}
-			   </select>
-			</td>
-			{elseif $uitype eq 106}
-			<td width=20% class="dvtCellLabel" align=right>
-				<font color="red">*</font>{$fldlabel}
-			</td>
-			<td width=30% align=left class="dvtCellInfo">
-				{if $MODE eq 'edit'}
-				<input type="text" readonly name="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
-				{else}
-				<input type="text" name="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
-				{/if}
-			</td>
-			{elseif $uitype eq 99}
-				{if $MODE eq 'create'}
-				<td width=20% class="dvtCellLabel" align=right>
-					<font color="red">*</font>{$fldlabel}
-				</td>
-				<td width=30% align=left class="dvtCellInfo">
-					<input type="password" name="{$fldname}" tabindex="{$vt_tab}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
-				</td>
-				{/if}
-		{elseif $uitype eq 30}
-			<td width="20%" class="dvtCellLabel" align=right>
-				{$fldlabel}
-			</td>
-			<td colspan="3" width="30%" align=left class="dvtCellInfo">
-				{assign var=check value=$secondvalue[0]}
-				{assign var=yes_val value=$secondvalue[1]}
-				{assign var=no_val value=$secondvalue[2]}
-
-				<input type="radio" name="set_reminder" tabindex="{$vt_tab}" value="Yes" {$check}>&nbsp;{$yes_val}&nbsp;
-				<input type="radio" name="set_reminder" value="No">&nbsp;{$no_val}&nbsp;
-
-				{foreach item=val_arr from=$fldvalue}
-					{assign var=start value="$val_arr[0]"}
-					{assign var=end value="$val_arr[1]"}
-					{assign var=sendname value="$val_arr[2]"}
-					{assign var=disp_text value="$val_arr[3]"}
-					{assign var=sel_val value="$val_arr[4]"}
-					<select name="{$sendname}">
-						{section name=reminder start=$start max=$end loop=$end step=1 }
-							{if $smarty.section.reminder.index eq $sel_val}
-								{assign var=sel_value value="SELECTED"}
-							{else}
-								{assign var=sel_value value=""}
-							{/if}
-							<OPTION VALUE="{$smarty.section.reminder.index}" "{$sel_value}">{$smarty.section.reminder.index}</OPTION>
-						{/section}
-					</select>
-					&nbsp;{$disp_text}
-				{/foreach}
-			</td>
-		{elseif $uitype eq 83} <!-- Handle the Tax in Inventory -->
-			{foreach item=tax key=count from=$TAX_DETAILS}
-				{if $tax.check_value eq 1}
-					{assign var=check_value value="checked"}
-					{assign var=show_value value="visible"}
-				{else}
-					{assign var=check_value value=""}
-					{assign var=show_value value="hidden"}
-				{/if}
-				<td align="right" class="dvtCellLabel" style="border:0px solid red;">
-					{$tax.taxlabel} {$APP.COVERED_PERCENTAGE}
-					<input type="checkbox" name="{$tax.check_name}" id="{$tax.check_name}" class="small" onclick="fnshowHide(this,'{$tax.taxname}')" {$check_value}>
-				</td>
-				<td class="dvtCellInfo" align="left" style="border:0px solid red;">
-					<input type="text" class="detailedViewTextBox" name="{$tax.taxname}" id="{$tax.taxname}" value="{$tax.percentage}" style="visibility:{$show_value};" onBlur="fntaxValidation('{$tax.taxname}')">
-				</td>
-			   </tr>
-			{/foreach}
-
-			<td colspan="2" class="dvtCellInfo">&nbsp;</td>
-		{/if}
-	{/foreach}
-   </tr>
-{/foreach}
-
-<script language="javascript">
-	function fnshowHide(currObj,txtObj)
-	{ldelim}
-			if(currObj.checked == true)
-				document.getElementById(txtObj).style.visibility = 'visible';
-			else
-				document.getElementById(txtObj).style.visibility = 'hidden';
-	{rdelim}
-	
-	function fntaxValidation(txtObj)
-	{ldelim}
-			temp= /^\d+\.\d+$/.test(document.getElementById(txtObj).value);
-			if(temp == false)
-				alert("Please enter Valid TAX value");
-	{rdelim}	
-
-function delimage(id)
-{ldelim}
-	new Ajax.Request(
-		'index.php',
-		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-			method: 'post',
-			postBody: 'module=Contacts&action=ContactsAjax&file=DelImage&recordid='+id,
-			onComplete: function(response)
-				    {ldelim}
-					if(response.responseText.indexOf("SUCESS")>-1)
-						$("replaceimage").innerHTML='{$APP.LBL_IMAGE_DELETED}';
-					else
-						alert("Error while Deleting")
-				    {rdelim}
-		{rdelim}
-	);
-
-{rdelim}
-
-
-</script>
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+<!-- Added this file to display the fields in Create Entity page based on ui types  -->
+{foreach key=label item=subdata from=$data}
+	{if $header eq 'Product Details'}
+		<tr>
+	{else}
+		<tr style="height:25px">
+	{/if}
+	{foreach key=mainlabel item=maindata from=$subdata}
+		{assign var="uitype" value="$maindata[0][0]"}
+		{assign var="fldlabel" value="$maindata[1][0]"}
+		{assign var="fldlabel_sel" value="$maindata[1][1]"}
+		{assign var="fldlabel_combo" value="$maindata[1][2]"}
+		{assign var="fldname" value="$maindata[2][0]"}
+		{assign var="fldvalue" value="$maindata[3][0]"}
+		{assign var="secondvalue" value="$maindata[3][1]"}
+		{assign var="thirdvalue" value="$maindata[3][2]"}
+		{assign var="vt_tab" value="$maindata[4][0]"}
+
+		{if $uitype eq 2}
+			<td width=20% class="dvtCellLabel" align=right>
+				<font color="red">*</font>{$fldlabel}
+			</td>
+			<td width=30% align=left class="dvtCellInfo">
+				<input type="text" name="{$fldname}" tabindex="{$vt_tab}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
+			</td>
+		{elseif $uitype eq 8}
+			<td width=20% class="dvtCellLabel" align=right>{$fldlabel}</td>
+			<input type="hidden"  name="{$fldname}" tabindex="{$vt_tab}" value="{$fldvalue}">
+			<td width=30% class="dvtCellInfo" align="left">&nbsp;&nbsp;{$fldvalue}</td>
+		{elseif $uitype eq 11 || $uitype eq 1 || $uitype eq 13 || $uitype eq 7 || $uitype eq 9}
+			<td width=20% class="dvtCellLabel" align=right>{$fldlabel}</td>
+
+			{if $fldname eq 'tickersymbol' && $MODULE eq 'Accounts'}
+				<td width=30% align=left class="dvtCellInfo">
+					<input type="text" name="{$fldname}" tabindex="{$vt_tab}" id ="{$fldname}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn';" onBlur="this.className='detailedViewTextBox';{if $fldname eq 'tickersymbol' && $MODULE eq 'Accounts'}sensex_info(){/if}">
+					<span id="vtbusy_info" style="display:none;">
+						<img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span>
+				</td>
+			{else}
+				<td width=30% align=left class="dvtCellInfo"><input type="text" tabindex="{$vt_tab}" name="{$fldname}" id ="{$fldname}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
+			{/if}
+		{elseif $uitype eq '14'} <!-- Organization picklist-->
+			<td width=20% class="dvtCellLabel" align=right>{$fldlabel}</td>
+			<td>
+			{if $fldvalue.$CURRENT_ORGANIZATION eq 1}
+			    <select multiple id="txtbox_{$label}" name="{$fldname}[]">
+				{foreach key=maintabs item=detail from=$USER_ORGANIZATIONS}
+				    {if $CURRENT_ORGANIZATION ne $maintabs && $fldvalue.$maintabs ne 1}
+					<option value="{$maintabs}"{if $fldvalue.$maintabs ne ''}selected{/if}>{$maintabs}</option>
+				    {/if}
+				{/foreach}
+			    </select>
+			{else}
+			    {foreach key=org item=sel from=$fldvalue}{$org}<br>{/foreach}
+			{/if}
+			</td>
+		{elseif $uitype eq 19 || $uitype eq 20}
+			<!-- In Add Comment are we should not display anything -->
+			{if $fldlabel eq $MOD.LBL_ADD_COMMENT}
+				{assign var=fldvalue value=""}
+			{/if}
+			<td width=20% class="dvtCellLabel" align=right>
+				{if $uitype eq 20}
+					<font color="red">*</font>
+				{/if}
+				{$fldlabel}
+			</td>
+			<td colspan=3>
+				<textarea class="detailedViewTextBox" tabindex="{$vt_tab}" onFocus="this.className='detailedViewTextBoxOn'" name="{$fldname}"  onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$fldvalue}</textarea>
+			</td>
+		{elseif $uitype eq 21 || $uitype eq 24}
+			<td width=20% class="dvtCellLabel" align=right>
+				{if $uitype eq 24}
+					<font color="red">*</font>
+				{/if}
+				{$fldlabel}
+			</td>
+			<td width=30% align=left class="dvtCellInfo">
+				<textarea value="{$fldvalue}" name="{$fldname}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" rows=2>{$fldvalue}</textarea>
+			</td>
+		{elseif $uitype eq 15 || $uitype eq 16 || $uitype eq 111} <!-- uitype 111 added for noneditable existing picklist values - ahmed -->
+			<td width="20%" class="dvtCellLabel" align=right>
+				{if $uitype eq 16}
+					<font color="red">*</font>
+				{/if}
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+			   <select name="{$fldname}" tabindex="{$vt_tab}" class="small">
+				{foreach item=arr from=$fldvalue}
+					{foreach key=sel_value item=value from=$arr}
+						<option value="{$sel_value}" {$value}>
+                                                {if $APP.$sel_value neq ''}
+                                                {$APP.$sel_value}
+                                                {else}
+                                                        {$sel_value}
+                                                {/if}
+                                                </option>
+					{/foreach}
+				{/foreach}
+			   </select>
+			</td>
+		{elseif $uitype eq '12'} <!-- Orgunit picklist-->
+		    <td width=20% class="dvtCellLabel" align="right">{$fldlabel}</td>
+		    <td width=30% class="dvtCellInfo" align="left">
+			<select id="txtbox_{$label}" name="{$fldname}">
+			    {if $fldvalue == ""}
+				<option selected value="0" "-- None --">-- None --</option>
+			    {else}
+				<option value="0" "-- None --">-- None --</option>
+			    {/if}
+			    {foreach key=orgunitid item=arr from=$ASSIGN_ORGUNIT_LIST}
+				{if $orgunitid == $fldvalue}
+				    <option selected value="{$orgunitid}" {$arr.name}>{$arr.name}</option>
+				{else}
+				    <option value="{$orgunitid}" {$arr.name}>{$arr.name}</option>
+				{/if}
+			    {/foreach}
+			</select>
+		    </td>
+		{elseif $uitype eq 3 || $uitype eq 4 || $uitype eq 31 || $uitype eq 32}
+		    {if $uitype eq 4 || $uitype eq 32}
+			<td width=20% class="dvtCellLabel" align=right>
+			    <font color="red">*</font>{$fldlabel}
+			</td>
+		    {else}
+			<td width=20% class="dvtCellLabel" align=right>{$fldlabel}</td>
+		    {/if}
+		    <td width=30% align=left class="dvtCellInfo">
+			{if $uitype eq '32' || $uitype eq '31'}
+			    {if $secondvalue == 1}
+				<input id="txtbox_{$fldlabel}_inh" name="{$fldname}@##@" type="checkbox"
+				    style="border:1px solid #bababa;" checked value="1"/>
+			    {else}
+				<input id="txtbox_{$fldlabel}_inh" type="checkbox" name="{$fldname}@##@"
+				    style="border:1px solid #bababa;" value="1"/>
+			    {/if}
+			    {$MOD.LBL_EXTEND_PARENT}
+			    <br>
+			    <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'"
+				onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$fldlabel}"
+				name="{$fldname}" maxlength='100' value="{$fldvalue}" tabindex="{$vt_tab}"></input>
+			{else}
+			    {if $secondvalue == 1}
+				<input id="txtbox_{$fldlabel}_inh" name="{$fldname}@##@" type="checkbox"
+				    style="border:1px solid #bababa;" checked value="1"
+				    onClick="this.form.{$fldname}.disabled=this.checked;"/>
+				    {$MOD.LBL_INHERIT_PARENT}
+				<br>
+				<input disabled class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'"
+				    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$fldlabel}"
+				    name="{$fldname}" maxlength='100' value="{$fldvalue}" tabindex="{$vt_tab}"></input>
+			    {else}
+				<input id="txtbox_{$fldlabel}_inh" type="checkbox" name="{$fldname}@##@"
+				    style="border:1px solid #bababa;" value="1"
+				    onClick="this.form.{$fldname}.disabled=this.checked;"/>
+				    {$MOD.LBL_INHERIT_PARENT}
+				<br>
+				<input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'"
+				    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$fldlabel}"
+				    name="{$fldname}" maxlength='100' value="{$fldvalue}" tabindex="{$vt_tab}"></input>
+			    {/if}
+			{/if}
+		    </td>
+		{elseif $uitype eq 33}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+			   <select MULTIPLE name="{$fldname}[]" size="4" style="width:160px;" tabindex="{$vt_tab}" class="small">
+				                    									{foreach key=sel_value item=value from=$arr}
+                    										<option value="{$sel_value}" {$value}>{if $APP.$sel_value}{$APP.$sel_value}{else}{$sel_value}{/if}</option>
+                    									
+                    									{/foreach}
+			   </select>
+			</td>
+
+		{elseif $uitype eq 53}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				{assign var=check value=1}
+				{foreach key=key_one item=arr from=$fldvalue}
+					{foreach key=sel_value item=value from=$arr}
+						{if $value ne ''}
+							{assign var=check value=$check*0}
+						{else}
+							{assign var=check value=$check*1}
+						{/if}
+					{/foreach}
+				{/foreach}
+
+				{if $check eq 0}
+					{assign var=select_user value='checked'}
+					{assign var=style_user value='display:block'}
+					{assign var=style_group value='display:none'}
+				{else}
+					{assign var=select_group value='checked'}
+					{assign var=style_user value='display:none'}
+					{assign var=style_group value='display:block'}
+				{/if}
+
+				<input type="radio" tabindex="{$vt_tab}" name="assigntype" {$select_user} value="U" onclick="toggleAssignType(this.value)" >&nbsp;{$APP.LBL_USER}
+
+				{if $secondvalue neq ''}
+					<input type="radio" name="assigntype" {$select_group} value="T" onclick="toggleAssignType(this.value)">&nbsp;{$APP.LBL_GROUP}
+				{/if}
+				<span id="assign_user" style="{$style_user}">
+					<select name="assigned_user_id" class="small">
+						{foreach key=key_one item=arr from=$fldvalue}
+							{foreach key=sel_value item=value from=$arr}
+								<option value="{$key_one}" {$value}>{$sel_value}</option>
+							{/foreach}
+						{/foreach}
+					</select>
+				</span>
+
+				{if $secondvalue neq ''}
+					<span id="assign_team" style="{$style_group}">
+						<select name="assigned_group_name" class="small">';
+							{foreach key=key_one item=arr from=$secondvalue}
+								{foreach key=sel_value item=value from=$arr}
+									<option value="{$sel_value}" {$value}>{$sel_value}</option>
+								{/foreach}
+							{/foreach}
+						</select>
+					</span>
+				{/if}
+			</td>
+		{elseif $uitype eq 52 || $uitype eq 77}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				{if $uitype eq 52}
+					<select name="assigned_user_id" class="small">
+				{elseif $uitype eq 77}
+					<select name="assigned_user_id1" tabindex="{$vt_tab}" class="small">
+				{else}
+					<select name="{$fldname}" tabindex="{$vt_tab}" class="small">
+				{/if}
+
+				{foreach key=key_one item=arr from=$fldvalue}
+					{foreach key=sel_value item=value from=$arr}
+						<option value="{$key_one}" {$value}>{$sel_value}</option>
+					{/foreach}
+				{/foreach}
+				</select>
+			</td>
+		{elseif $uitype eq 51}
+			{if $MODULE eq 'Accounts'}
+				{assign var='popuptype' value = 'specific_account_address'}
+			{else}
+				{assign var='popuptype' value = 'specific_contact_account_address'}
+			{/if}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input readonly name="account_name" style="border:1px solid #bababa;" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype={$popuptype}&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.account_id.value=''; this.form.account_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 50}
+			<td width="20%" class="dvtCellLabel" align=right>
+				<font color="red">*</font>{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input readonly name="account_name" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype=specific&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+		{elseif $uitype eq 73}
+			<td width="20%" class="dvtCellLabel" align=right>
+				<font color="red">*</font>{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input readonly name="account_name" type="text" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Accounts&action=Popup&popuptype=specific_account_address&form=TasksEditView&form_submit=false","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 74}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="orgunit" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Organization&action=Popup&html=Popup_picker&popuptype=specific_orgunit&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.orgunit.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 75 || $uitype eq 81}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{if $uitype eq 81}
+					<font color="red">*</font>
+					{assign var="pop_type" value="specific_vendor_address"}
+					{else}{assign var="pop_type" value="specific"}
+				{/if}
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="vendor_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Vendors&action=Popup&html=Popup_picker&popuptype={$pop_type}&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>
+				{if $uitype eq 75}
+					&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.vendor_id.value='';this.form.vendor_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+				{/if}
+			</td>
+		{elseif $uitype eq 57}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="contact_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&action=Popup&Parent={$ID}&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.contact_id.value=''; this.form.contact_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+		
+		{elseif $uitype eq 58}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="campaignname" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Campaigns&action=Popup&html=Popup_picker&popuptype=specific_campaign&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.campaignid.value=''; this.form.campaignname.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 80}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="salesorder_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=SalesOrder&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.salesorder_id.value=''; this.form.salesorder_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 78}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="quote_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$QUOTE_ID}">&nbsp;<img src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Quotes&action=Popup&html=Popup_picker&popuptype=specific&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" tabindex="{$vt_tab}" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.quote_id.value=''; this.form.quote_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 76}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="potential_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}"><input name="{$fldname}" type="hidden" value="{$secondvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Potentials&action=Popup&html=Popup_picker&popuptype=specific_potential_account_address&form=EditView","test","width=640,height=602,resizable=0,scrollbars=0");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.potential_id.value=''; this.form.potential_name.value='';return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 17}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				&nbsp;&nbsp;http://&nbsp;
+				<input type="text" tabindex="{$vt_tab}" name="{$fldname}" style="border:1px solid #bababa;" size="27" onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" value="{$fldvalue}">
+			</td>
+
+		{elseif $uitype eq 85}
+                        <td width="20%" class="dvtCellLabel" align=right>
+                                {$fldlabel}
+                        </td>
+                        <td width="30%" align=left class="dvtCellInfo">
+                                <img src="{$IMAGE_PATH}skype.gif" alt="Skype" title="Skype" LANGUAGE=javascript align="absmiddle"></img><input type="text" tabindex="{$vt_tab}" name="{$fldname}" style="border:1px solid #bababa;" size="27" onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" value="{$fldvalue}">
+                        </td>
+
+		{elseif $uitype eq 18}
+			<td width="20%" class="dvtCellLabel" align=right>
+			    {$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+			    {if $secondvalue == 1}
+				<input id="txtbox_{$fldlabel}_inh" name="{$fldname}@##@" type="checkbox"
+				    style="border:1px solid #bababa;" checked value="1
+				    onClick="this.form.{$fldname}.disabled=this.checked;"/>
+				    {$MOD.LBL_INHERIT_PARENT}
+				<br>
+				&nbsp;&nbsp;http://&nbsp;
+				<input disabled tyle="border:1px solid #bababa;" size="27" 
+				    onFocus="this.className='detailedViewTextBoxOn'"
+				    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$fldlabel}"
+				    name="{$fldname}" maxlength='100' value="{$fldvalue}" tabindex="{$vt_tab}"></input>
+			    {else}
+				<input id="txtbox_{$fldlabel}_inh" type="checkbox" name="{$fldname}@##@"
+				    style="border:1px solid #bababa;" value="1"
+				    onClick="this.form.{$fldname}.disabled=this.checked;"/>
+				    {$MOD.LBL_INHERIT_PARENT}
+				<br>
+				&nbsp;&nbsp;http://&nbsp;
+				<input tyle="border:1px solid #bababa;" size="27" 
+				    onFocus="this.className='detailedViewTextBoxOn'"
+				    onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$fldlabel}"
+				    name="{$fldname}" maxlength='100' value="{$fldvalue}" tabindex="{$vt_tab}"></input>
+			    {/if}
+			</td>
+
+		{elseif $uitype eq 71 || $uitype eq 72}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{if $uitype eq 72}
+					<font color="red">*</font>
+				{/if}
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="{$fldname}" tabindex="{$vt_tab}" type="text" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"  value="{$fldvalue}">
+			</td>
+
+		{elseif $uitype eq 56}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			{if $fldname eq 'notime' && $ACTIVITY_MODE eq 'Events'}
+				{if $fldvalue eq 1}
+					<td width="30%" align=left class="dvtCellInfo">
+						<input name="{$fldname}" type="checkbox" tabindex="{$vt_tab}" onclick="toggleTime()" checked>
+					</td>
+				{else}
+					<td width="30%" align=left class="dvtCellInfo">
+						<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox" onclick="toggleTime()" >
+					</td>
+				{/if}
+			{else}
+				{if $fldvalue eq 1}
+					<td width="30%" align=left class="dvtCellInfo">
+						<input name="{$fldname}" type="checkbox" tabindex="{$vt_tab}" checked>
+					</td>
+				{else}
+					<td width="30%" align=left class="dvtCellInfo">
+						<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox">
+					</td>
+				{/if}
+			{/if}
+		{elseif $uitype eq 23 || $uitype eq 5 || $uitype eq 6}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				{foreach key=date_value item=time_value from=$fldvalue}
+					{assign var=date_val value="$date_value"}
+					{assign var=time_val value="$time_value"}
+				{/foreach}
+
+				<input name="{$fldname}" tabindex="{$vt_tab}" id="jscal_field_{$fldname}" type="text" style="border:1px solid #bababa;" size="11" maxlength="10" value="{$date_val}">
+				<img src="{$IMAGE_PATH}calendar.gif" id="jscal_trigger_{$fldname}">
+
+				{if $uitype eq 6}
+					<input name="time_start" tabindex="{$vt_tab}" style="border:1px solid #bababa;" size="5" maxlength="5" type="text" value="{$time_val}">
+				{/if}
+
+				{foreach key=date_format item=date_str from=$secondvalue}
+					{assign var=dateFormat value="$date_format"}
+					{assign var=dateStr value="$date_str"}
+				{/foreach}
+
+				{if $uitype eq 5 || $uitype eq 23}
+					<br><font size=1><em old="(yyyy-mm-dd)">({$dateStr})</em></font>
+				{else}
+					<br><font size=1><em old="(yyyy-mm-dd)">({$dateStr})</em></font>
+				{/if}
+
+				<script type="text/javascript">
+					Calendar.setup ({ldelim}
+						inputField : "jscal_field_{$fldname}", ifFormat : "{$dateFormat}", showsTime : false, button : "jscal_trigger_{$fldname}", singleClick : true, step : 1
+					{rdelim})
+				</script>
+
+
+			</td>
+
+		{elseif $uitype eq 63}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="{$fldname}" type="text" size="2" value="{$fldvalue}" tabindex="{$vt_tab}" >&nbsp;
+				<select name="duration_minutes" tabindex="{$vt_tab}" class="small">
+					{foreach key=labelval item=selectval from=$secondvalue}
+						<option value="{$labelval}" {$selectval}>{$labelval}</option>
+					{/foreach}
+				</select>
+
+		{elseif $uitype eq 68 || $uitype eq 66 || $uitype eq 62}
+			<td width="20%" class="dvtCellLabel" align=right>
+				<select class="small" name="parent_type" onChange='document.EditView.parent_name.value=""; document.EditView.parent_id.value=""'>
+					{section name=combo loop=$fldlabel}
+						<option value="{$fldlabel_combo[combo]}" {$fldlabel_sel[combo]}>{$fldlabel[combo]}</option>
+					{/section}
+				</select>
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
+				<input name="parent_name" readonly type="text" style="border:1px solid #bababa;" value="{$fldvalue}">
+				&nbsp;<img src="{$IMAGE_PATH}select.gif" tabindex="{$vt_tab}" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&html=Popup_picker&form=HelpDeskEditView","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=''; this.form.parent_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 357}
+			<td width="20%" class="dvtCellLabel" align=right>To:&nbsp;</td>
+			<td width="90%" colspan="3">
+				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
+				<textarea readonly name="parent_name" cols="70" rows="2">{$fldvalue}</textarea>&nbsp;
+				<select name="parent_type" class="small">
+					{foreach key=labelval item=selectval from=$fldlabel}
+						<option value="{$labelval}" {$selectval}>{$labelval}</option>
+					{/foreach}
+				</select>
+				&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&html=Popup_picker&form=HelpDeskEditView","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=''; this.form.parent_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+		   <tr style="height:25px">
+			<td width="20%" class="dvtCellLabel" align=right>CC:&nbsp;</td>	
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="ccmail" type="text" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"  value="">
+			</td>
+			<td width="20%" class="dvtCellLabel" align=right>BCC:&nbsp;</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="bccmail" type="text" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"  value="">
+			</td>
+		   </tr>
+
+		{elseif $uitype eq 59}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<input name="{$fldname}" type="hidden" value="{$secondvalue}">
+				<input name="product_name" readonly type="text" value="{$fldvalue}">&nbsp;<img tabindex="{$vt_tab}" src="{$IMAGE_PATH}select.gif" alt="Select" title="Select" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&action=Popup&html=Popup_picker&form=HelpDeskEditView&popuptype=specific","test","width=640,height=602,resizable=0,scrollbars=0,top=150,left=200");' align="absmiddle" style='cursor:hand;cursor:pointer'>&nbsp;<input type="image" src="{$IMAGE_PATH}clear_field.gif" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.product_id.value=''; this.form.product_name.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'>
+			</td>
+
+		{elseif $uitype eq 55} 
+			<td width="20%" class="dvtCellLabel" align=right>{$fldlabel}</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<select name="salutationtype" class="small">
+					{foreach item=arr from=$fldvalue}
+						{foreach key=sel_value item=value from=$arr}
+							<option value="{$sel_value}" {$value}>{$sel_value}</option>
+						{/foreach}
+					{/foreach}
+				</select>
+				<input type="text" name="{$fldname}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" value= "{$secondvalue}">
+			</td>
+
+		{elseif $uitype eq 22}
+			<td width="20%" class="dvtCellLabel" align=right>
+				<font color="red">*</font>{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+				<textarea name="{$fldname}" cols="30" tabindex="{$vt_tab}" rows="2">{$fldvalue}</textarea>
+			</td>
+
+		{elseif $uitype eq 69}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td colspan="3" width="30%" align=left class="dvtCellInfo">
+				{if $MODULE eq 'Products'}
+					<input name="del_file_list" type="hidden" value="">
+					<div id="files_list" style="border: 1px solid grey; width: 500px; padding: 5px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; font-size: x-small">Files Maximum 6
+						<input id="my_file_element" type="file" name="file_1" tabindex="{$vt_tab}" >
+						{assign var=image_count value=0}
+						{if $maindata[3].0.name neq ''}
+						   {foreach name=image_loop key=num item=image_details from=$maindata[3]}
+							<div align="center">
+								<img src="{$image_details.path}{$image_details.name}" height="50">&nbsp;&nbsp;[{$image_details.name}]<input id="file_{$num}" value="Delete" type="button" class="crmbutton small delete" onclick='this.parentNode.parentNode.removeChild(this.parentNode);delRowEmt("{$image_details.name}")'>
+							</div>
+					   	   {assign var=image_count value=$smarty.foreach.image_loop.iteration}
+					   	   {/foreach}
+						{/if}
+					</div>
+
+					<script>
+						{*<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->*}
+						var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 6 );
+						multi_selector.count = {$image_count}
+						{*<!-- Pass in the file element -->*}
+						multi_selector.addElement( document.getElementById( 'my_file_element' ) );
+					</script>
+				{else}
+					<input name="{$fldname}"  type="file" value="{$maindata[3].0.name}" tabindex="{$vt_tab}" />
+					<input type="hidden" name="id" value=""/>
+					{ if $maindata[3].0.name != "" }
+						
+				<div id="replaceimage">[{$maindata[3].0.name}] <a href="javascript:;" onClick="delimage({$ID})">Del</a></div>
+					{/if}
+					
+				{/if}
+			</td>
+
+		{elseif $uitype eq 61}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td colspan="3" width="30%" align=left class="dvtCellInfo">
+				<input name="{$fldname}"  type="file" value="{$secondvalue}" tabindex="{$vt_tab}" />
+				<input type="hidden" name="id" value=""/>{$fldvalue}
+			</td>
+		{elseif $uitype eq 156}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+				{if $fldvalue eq 'on'}
+					<td width="30%" align=left class="dvtCellInfo">
+						{if ($secondvalue eq 1 && $CURRENT_USERID != $smarty.request.record) || ($MODE == 'create')}
+							<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox" checked>
+						{else}
+							<input name="{$fldname}" type="hidden" value="on">
+							<input name="{$fldname}" disabled tabindex="{$vt_tab}" type="checkbox" checked>
+						{/if}	
+					</td>
+				{else}
+					<td width="30%" align=left class="dvtCellInfo">
+						{if ($secondvalue eq 1 && $CURRENT_USERID != $smarty.request.record) || ($MODE == 'create')}
+							<input name="{$fldname}" tabindex="{$vt_tab}" type="checkbox">
+						{else}
+							<input name="{$fldname}" disabled tabindex="{$vt_tab}" type="checkbox">
+						{/if}	
+					</td>
+				{/if}
+		{elseif $uitype eq 98}<!-- Role Selection Popup -->		
+			<td width="20%" class="dvtCellLabel" align=right>
+			<font color="red">*</font>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+			{if $thirdvalue eq 1}
+				<input name="role_name" id="role_name" readonly class="txtBox" tabindex="{$vt_tab}" value="{$secondvalue}" type="text">&nbsp;
+				<a href="javascript:openPopup();"><img src="{$IMAGE_PATH}select.gif" align="absmiddle" border="0"></a>
+			{else}	
+				<input name="role_name" id="role_name" tabindex="{$vt_tab}" class="txtBox" readonly value="{$secondvalue}" type="text">&nbsp;
+			{/if}	
+			<input name="{$fldname}" id="user_role" value="{$fldvalue}" type="hidden">
+			</td>
+		{elseif $uitype eq 104}<!-- Mandatory Email Fields -->			
+			 <td width=20% class="dvtCellLabel" align=right>
+			 <font color="red">*</font>
+			 {$fldlabel}
+			 </td>
+    	     <td width=30% align=left class="dvtCellInfo"><input type="text" name="{$fldname}" id ="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'"></td>
+			{elseif $uitype eq 115}<!-- for Status field Disabled for nonadmin -->
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+			   {if $secondvalue eq 1}
+			   	<select name="{$fldname}" tabindex="{$vt_tab}" class="small">
+			   {else}
+			   	<select disabled name="{$fldname}" class="small">
+			   {/if} 
+				{foreach item=arr from=$fldvalue}
+					{foreach key=sel_value item=value from=$arr}
+						<option value="{$sel_value}" {$value}>{$sel_value}</option>
+					{/foreach}
+				{/foreach}
+			   </select>
+			</td>
+			{elseif $uitype eq 105}
+			    <td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			    </td>
+			    <td width="30%" align=left class="dvtCellInfo">
+					<input name="{$fldname}"  type="file" value="{$maindata[3].0.name}" tabindex="{$vt_tab}" />
+					<input type="hidden" name="id" value=""/>
+					{$maindata[3].0.name}
+			    </td>
+			{elseif $uitype eq 107}<!-- Company Logo -->
+			    <td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			    </td>
+			    <td class="dvtCellInfo" align="left" width="25%">&nbsp;
+				{if $fldvalue ne ""}
+				    <img src="test/logo/{$fldvalue}" width="96" height="48" alt="{$fldvalue}" title="{$fldvalue}" border="0">
+				    <br>
+				{/if}
+				<input type="hidden" name="MAX_FILE_SIZE" value="800000">
+				<input type="hidden" name="PREV_FILE" value="{$fldvalue}">
+				<input type="file" name="logo" value="{$fldvalue}" tabindex="1">
+			    </td>
+			{elseif $uitype eq 103}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" colspan="3" align=left class="dvtCellInfo">
+				<input type="text" name="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
+			</td>	
+			{elseif $uitype eq 101}<!-- for reportsto field USERS POPUP -->
+				<td width="20%" class="dvtCellLabel" align=right>
+			       {$fldlabel}
+	            </td>
+				<td width="30%" align=left class="dvtCellInfo">
+				<input readonly name='reports_to_name' class="small" type="text" value='{$fldvalue}' tabindex="{$vt_tab}" ><input name='reports_to_id' type="hidden" value='{$secondvalue}'>&nbsp;<input title="Change [Alt+C]" accessKey="C" type="button" class="small" value='{$UMOD.LBL_CHANGE}' name=btn1 LANGUAGE=javascript onclick='return window.open("index.php?module=Users&action=Popup&form=UsersEditView&form_submit=false","test","width=640,height=522,resizable=0,scrollbars=0");'>
+	            </td>
+			{elseif $uitype eq 116}<!-- for currency in users details-->	
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td width="30%" align=left class="dvtCellInfo">
+			   {if $secondvalue eq 1}
+			   	<select name="{$fldname}" tabindex="{$vt_tab}" class="small">
+			   {else}
+			   	<select disabled name="{$fldname}" tabindex="{$vt_tab}" class="small">
+			   {/if} 
+
+				{foreach item=arr key=uivalueid from=$fldvalue}
+					{foreach key=sel_value item=value from=$arr}
+						<option value="{$uivalueid}" {$value}>{$sel_value}</option>
+					{/foreach}
+				{/foreach}
+			   </select>
+			</td>
+			{elseif $uitype eq 106}
+			<td width=20% class="dvtCellLabel" align=right>
+				<font color="red">*</font>{$fldlabel}
+			</td>
+			<td width=30% align=left class="dvtCellInfo">
+				{if $MODE eq 'edit'}
+				<input type="text" readonly name="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
+				{else}
+				<input type="text" name="{$fldname}" value="{$fldvalue}" tabindex="{$vt_tab}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
+				{/if}
+			</td>
+			{elseif $uitype eq 99}
+				{if $MODE eq 'create'}
+				<td width=20% class="dvtCellLabel" align=right>
+					<font color="red">*</font>{$fldlabel}
+				</td>
+				<td width=30% align=left class="dvtCellInfo">
+					<input type="password" name="{$fldname}" tabindex="{$vt_tab}" value="{$fldvalue}" class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'">
+				</td>
+				{/if}
+		{elseif $uitype eq 30}
+			<td width="20%" class="dvtCellLabel" align=right>
+				{$fldlabel}
+			</td>
+			<td colspan="3" width="30%" align=left class="dvtCellInfo">
+				{assign var=check value=$secondvalue[0]}
+				{assign var=yes_val value=$secondvalue[1]}
+				{assign var=no_val value=$secondvalue[2]}
+
+				<input type="radio" name="set_reminder" tabindex="{$vt_tab}" value="Yes" {$check}>&nbsp;{$yes_val}&nbsp;
+				<input type="radio" name="set_reminder" value="No">&nbsp;{$no_val}&nbsp;
+
+				{foreach item=val_arr from=$fldvalue}
+					{assign var=start value="$val_arr[0]"}
+					{assign var=end value="$val_arr[1]"}
+					{assign var=sendname value="$val_arr[2]"}
+					{assign var=disp_text value="$val_arr[3]"}
+					{assign var=sel_val value="$val_arr[4]"}
+					<select name="{$sendname}" class="small">
+						{section name=reminder start=$start max=$end loop=$end step=1 }
+							{if $smarty.section.reminder.index eq $sel_val}
+								{assign var=sel_value value="SELECTED"}
+							{else}
+								{assign var=sel_value value=""}
+							{/if}
+							<OPTION VALUE="{$smarty.section.reminder.index}" "{$sel_value}">{$smarty.section.reminder.index}</OPTION>
+						{/section}
+					</select>
+					&nbsp;{$disp_text}
+				{/foreach}
+			</td>
+		{elseif $uitype eq 83} <!-- Handle the Tax in Inventory -->
+			{foreach item=tax key=count from=$TAX_DETAILS}
+				{if $tax.check_value eq 1}
+					{assign var=check_value value="checked"}
+					{assign var=show_value value="visible"}
+				{else}
+					{assign var=check_value value=""}
+					{assign var=show_value value="hidden"}
+				{/if}
+				<td align="right" class="dvtCellLabel" style="border:0px solid red;">
+					{$tax.taxlabel} {$APP.COVERED_PERCENTAGE}
+					<input type="checkbox" name="{$tax.check_name}" id="{$tax.check_name}" class="small" onclick="fnshowHide(this,'{$tax.taxname}')" {$check_value}>
+				</td>
+				<td class="dvtCellInfo" align="left" style="border:0px solid red;">
+					<input type="text" class="detailedViewTextBox" name="{$tax.taxname}" id="{$tax.taxname}" value="{$tax.percentage}" style="visibility:{$show_value};" onBlur="fntaxValidation('{$tax.taxname}')">
+				</td>
+			   </tr>
+			{/foreach}
+
+			<td colspan="2" class="dvtCellInfo">&nbsp;</td>
+		{/if}
+	{/foreach}
+   </tr>
+{/foreach}
+
+<script language="javascript">
+	function fnshowHide(currObj,txtObj)
+	{ldelim}
+			if(currObj.checked == true)
+				document.getElementById(txtObj).style.visibility = 'visible';
+			else
+				document.getElementById(txtObj).style.visibility = 'hidden';
+	{rdelim}
+	
+	function fntaxValidation(txtObj)
+	{ldelim}
+			temp= /^\d+\.\d+$/.test(document.getElementById(txtObj).value);
+			if(temp == false)
+				alert("Please enter Valid TAX value");
+	{rdelim}	
+
+function delimage(id)
+{ldelim}
+	new Ajax.Request(
+		'index.php',
+		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+			method: 'post',
+			postBody: 'module=Contacts&action=ContactsAjax&file=DelImage&recordid='+id,
+			onComplete: function(response)
+				    {ldelim}
+					if(response.responseText.indexOf("SUCESS")>-1)
+						$("replaceimage").innerHTML='{$APP.LBL_IMAGE_DELETED}';
+					else
+						alert("Error while Deleting")
+				    {rdelim}
+		{rdelim}
+	);
+
+{rdelim}
+
+
+</script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/EditViewHidden.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/EditViewHidden.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/EditViewHidden.tpl Tue Nov 14 03:16:10 2006
@@ -58,8 +58,11 @@
         <form name="EditView" method="POST" action="index.php">
         <input type="hidden" name="campaignid" value="{$campaignid}">
 
-{elseif $MODULE eq 'Accounts' || $MODULE eq 'Faq' || $MODULE eq 'PriceBooks' || $MODULE eq 'Vendors'}
+{elseif $MODULE eq 'Accounts' || $MODULE eq 'Faq' || $MODULE eq 'PriceBooks' || $MODULE eq 'Vendors' || $MODULE eq 'OrgUnit'}
 	<form name="EditView" method="POST" action="index.php">
+
+{elseif $MODULE eq 'Organization'}
+	<form name="EditView" method="POST" ENCTYPE="multipart/form-data" action="index.php">
 
 {elseif $MODULE eq 'Notes'}
 	<form name="EditView" method="POST" ENCTYPE="multipart/form-data" action="index.php">

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetailView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetailView.tpl Tue Nov 14 03:16:10 2006
@@ -61,7 +61,7 @@
    </tr>
    {elseif $elements.fldname eq 'description'}
    <tr>
-	<td style="padding: 5px;" colspan="3" valign="top"><div style="overflow:auto;height:415px;width:100%;">{$BLOCKS.4.Description.value}</div></td>
+	<td style="padding: 5px;" colspan="3" valign="top"><div style="overflow:auto;height:415px;width:100%;">{$elements.value}</div></td>
 
    </tr>
    {elseif $elements.fldname eq 'filename'}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetails.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetails.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/EmailDetails.tpl Tue Nov 14 03:16:10 2006
@@ -1,84 +1,84 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
-<tr>
-    <td class="hdrNameBg">
-  		<table width="100%"  border="0" cellspacing="5" cellpadding="0">
-		<tr>
-		{if $BLOCKS neq ''}
-			<td align="left">
-			  	<input type="button" name="forward" value=" {$MOD.LBL_FORWARD_BUTTON} " class="crmbutton small edit" onClick=OpenCompose('{$ID}','forward')>&nbsp;
-				{if $EMAIL_FLAG neq 'WEBMAIL'}
-			  	<input type="button" name="Send" value=" {$MOD.LBL_SEND} " class="crmbutton small save" onClick=OpenCompose('{$ID}','edit')>&nbsp;
-				{else}
-			  	<input type="button" name="Send" value=" {$MOD.LBL_REPLY_BUTTON} " class="crmbutton small edit" onClick=OpenCompose('{$ID}','edit')>&nbsp;
-				{/if}
-				{foreach item=row from=$BLOCKS}	
-				{foreach item=elements key=title from=$row}	
-					{if $elements.fldname eq 'filename' && $elements.value != ''}
-						<input type="button" name="download" value=" {$MOD.LBL_DOWNLOAD_ATTCH_BUTTON} " class="crmbutton small save" onclick="fnvshobj(this,'reportLay')"/>
-					{/if}
-				{/foreach}
-				{/foreach}
-			</td>
-						<td width="25%" align="right"><input type="button" name="Button" value=" {$APP.LBL_DELETE_BUTTON} "  class="crmbutton small delete" onClick="DeleteEmail('{$ID}')"/></td>
-						{else}
-						<td colspan="2">&nbsp;</td>
-						{/if}
-		</tr>
-		</table>
-	</td>
-</tr>
-<tr>
-	<td height="250" bgcolor="#FFFFFF" valign="top" style="padding-top:10px;">
-	{foreach item=row from=$BLOCKS}	
-	{foreach item=elements from=$row}	
-		{if $elements.fldname eq 'subject'}
-		<table width="100%" border="0" cellpadding="0" cellspacing="0">
-	{if $EMAIL_FLAG neq 'WEBMAIL'}
-	<tr><td width="20%" align="right" valign="top"><b>{$MOD.LBL_TO}</b></td><td width="2%" align="left">&nbsp;</td><td align="left">{$TO_MAIL}&nbsp;</td></tr>
-	<tr><td align="right" valign="top">{$MOD.LBL_CC}</td><td align="left">&nbsp;</td><td align="left">{$CC_MAIL}&nbsp;</td></tr>
-	<tr><td align="right" valign="top">{$MOD.LBL_BCC}</td><td align="left">&nbsp;</td><td align="left">{$BCC_MAIL}&nbsp;</td></tr>
-	{else}
-	<tr><td width="20%" align="right" valign="top"><b>{$MOD.LBL_FROM}</b></td><td width="2%" align="left">&nbsp;</td><td align="left">{$TO_MAIL}&nbsp;</td></tr>
-	{/if}
-	<tr><td align="right"><b>{$MOD.LBL_SUBJECT}</b></td><td align="left">&nbsp;</td><td align="left">{$elements.value}&nbsp;</td></tr>
-			<tr><td align="right" style="border-bottom:1px solid #666666;" colspan="3">&nbsp;</td></tr>
-		</table>
-		{elseif $elements.fldname eq 'description'}
-		<div>
-			{$BLOCKS.4.Description.value}
-		</div>
-		{/if}
-	{/foreach}
-	{/foreach}
-	</td>
-</tr>
-</table>
-{foreach item=row from=$BLOCKS}	
-	{foreach item=elements key=title from=$row}	
-	{if $elements.fldname eq 'filename'}
-	<div id="reportLay" style="width:130px;" onmouseout="fninvsh('reportLay')" onmouseover="fnvshNrm('reportLay')">
-		<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
-		{foreach item=attachments from=$elements.options}
-		<tr>
-			<td style="border-bottom: 1px solid rgb(204, 204, 204); padding: 5px;">
-				{$attachments}
-			</td>
-		</tr>
-		{/foreach}
-		</table>
-	</div>
-	{/if}
-	{/foreach}
-{/foreach}
-
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
+<tr>
+    <td class="hdrNameBg">
+  		<table width="100%"  border="0" cellspacing="5" cellpadding="0">
+		<tr>
+		{if $BLOCKS neq ''}
+			<td align="left">
+			  	<input type="button" name="forward" value=" {$MOD.LBL_FORWARD_BUTTON} " class="crmbutton small edit" onClick=OpenCompose('{$ID}','forward')>&nbsp;
+				{if $EMAIL_FLAG neq 'WEBMAIL'}
+			  	<input type="button" name="Send" value=" {$MOD.LBL_SEND} " class="crmbutton small save" onClick=OpenCompose('{$ID}','edit')>&nbsp;
+				{else}
+			  	<input type="button" name="Send" value=" {$MOD.LBL_REPLY_BUTTON} " class="crmbutton small edit" onClick=OpenCompose('{$ID}','edit')>&nbsp;
+				{/if}
+				{foreach item=row from=$BLOCKS}	
+				{foreach item=elements key=title from=$row}	
+					{if $elements.fldname eq 'filename' && $elements.value != ''}
+						<input type="button" name="download" value=" {$MOD.LBL_DOWNLOAD_ATTCH_BUTTON} " class="crmbutton small save" onclick="fnvshobj(this,'reportLay')"/>
+					{/if}
+				{/foreach}
+				{/foreach}
+			</td>
+						<td width="25%" align="right"><input type="button" name="Button" value=" {$APP.LBL_DELETE_BUTTON} "  class="crmbutton small delete" onClick="DeleteEmail('{$ID}')"/></td>
+						{else}
+						<td colspan="2">&nbsp;</td>
+						{/if}
+		</tr>
+		</table>
+	</td>
+</tr>
+<tr>
+	<td height="250" bgcolor="#FFFFFF" valign="top" style="padding-top:10px;">
+	{foreach item=row from=$BLOCKS}	
+	{foreach item=elements from=$row}	
+		{if $elements.fldname eq 'subject'}
+		<table width="100%" border="0" cellpadding="0" cellspacing="0">
+	{if $EMAIL_FLAG neq 'WEBMAIL'}
+	<tr><td width="20%" align="right" valign="top"><b>{$MOD.LBL_TO}</b></td><td width="2%" align="left">&nbsp;</td><td align="left">{$TO_MAIL}&nbsp;</td></tr>
+	<tr><td align="right" valign="top">{$MOD.LBL_CC}</td><td align="left">&nbsp;</td><td align="left">{$CC_MAIL}&nbsp;</td></tr>
+	<tr><td align="right" valign="top">{$MOD.LBL_BCC}</td><td align="left">&nbsp;</td><td align="left">{$BCC_MAIL}&nbsp;</td></tr>
+	{else}
+	<tr><td width="20%" align="right" valign="top"><b>{$MOD.LBL_FROM}</b></td><td width="2%" align="left">&nbsp;</td><td align="left">{$TO_MAIL}&nbsp;</td></tr>
+	{/if}
+	<tr><td align="right"><b>{$MOD.LBL_SUBJECT}</b></td><td align="left">&nbsp;</td><td align="left">{$elements.value}&nbsp;</td></tr>
+			<tr><td align="right" style="border-bottom:1px solid #666666;" colspan="3">&nbsp;</td></tr>
+		</table>
+		{elseif $elements.fldname eq 'description'}
+		<div>
+			{$elements.value}
+		</div>
+		{/if}
+	{/foreach}
+	{/foreach}
+	</td>
+</tr>
+</table>
+{foreach item=row from=$BLOCKS}	
+	{foreach item=elements key=title from=$row}	
+	{if $elements.fldname eq 'filename'}
+	<div id="reportLay" style="width:130px;" onmouseout="fninvsh('reportLay')" onmouseover="fnvshNrm('reportLay')">
+		<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
+		{foreach item=attachments from=$elements.options}
+		<tr>
+			<td style="border-bottom: 1px solid rgb(204, 204, 204); padding: 5px;">
+				{$attachments}
+			</td>
+		</tr>
+		{/foreach}
+		</table>
+	</div>
+	{/if}
+	{/foreach}
+{/foreach}
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Header.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Header.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Header.tpl Tue Nov 14 03:16:10 2006
@@ -36,6 +36,21 @@
 	<TABLE border=0 cellspacing=0 cellpadding=0 width=100% class="hdrNameBg">
 	<tr>
 		<td valign=top><img src="{$IMAGEPATH}/vtiger-crm.gif" alt="vtiger CRM" title="vtiger CRM" border=0></td>
+		{if $USER_ORGANIZATIONS_COUNT gt 1}
+		    <td style="padding-left:10px;padding-right:10px" class=small nowrap>
+			<select {if $CHGORGOK eq 1}onchange="set_org(this);"{else}disabled{/if} class=small id="orgcombo" style="width:240px">
+			    {foreach key=maintabs item=detail from=$USER_ORGANIZATIONS}
+				{if $CURRENT_ORGANIZATION eq $maintabs}
+				    <option value="{$maintabs}" selected>{$maintabs}</option>
+				{else}
+				    <option value="{$maintabs}">{$maintabs}</option>
+				{/if}
+			    {/foreach}
+			</select>
+		    </td>
+		{else}
+		    <td style="padding-left:10px;padding-right:10px" class=small nowrap>{$CURRENT_ORGANIZATION}</td>
+		{/if}
 		<td width=100% align=center>
 		<marquee id="rss" direction="left" scrolldelay="10" scrollamount="3" behavior="scroll" class="marStyle" onMouseOver="javascript:stop();" onMouseOut="javascript:start();">&nbsp;{$ANNOUNCEMENT}</marquee>		
 		</td>
@@ -145,6 +160,26 @@
 <div id="qcform" style="position:absolute;width:500px;top:60px;left:450px;z-index:5000;"></div>
 
 <script>
+function set_org(orgoptions)
+{ldelim}
+	var neworg = orgoptions.options[orgoptions.options.selectedIndex].value;
+	new Ajax.Request(
+		'index.php',
+		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+			method: 'post',
+			postBody: 'module={$MODULE_NAME}&action={$MODULE_NAME}Ajax&file=ListView&org='+neworg+'&ajax=true',
+			onComplete: function(response) {ldelim}
+                        	$("status").style.display="none";
+                                result = response.responseText.split('&#&#&#');
+                                $("ListViewContents").innerHTML= result[2];
+                                if(result[1] != '')
+                                        alert(result[1]);
+                  	{rdelim}
+		{rdelim}
+	);
+
+{rdelim}
+
 function fetch_clock()
 {ldelim}
 	new Ajax.Request(

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/HomePage.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/HomePage.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/HomePage.tpl Tue Nov 14 03:16:10 2006
@@ -18,7 +18,26 @@
 <script language="javascript" type="text/javascript" src="include/scriptaculous/slider.js"></script>
 <script language="javascript" type="text/javascript" src="include/scriptaculous/dom-drag.js"></script>
 <script type="text/javascript" language="JavaScript" src="include/js/general.js"></script>
-
+<script language="javascript">
+function getHomeActivities(mode,view)
+
+{ldelim}
+        new Ajax.Request(
+                'index.php',
+                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                        method: 'post',
+                        postBody: 'module=Calendar&action=ActivityAjax&file=OpenListView&activity_view='+view+'&mode='+mode+'&parenttab=My Home Page&ajax=true',
+                        onComplete: function(response) {ldelim}
+                                if(mode == 0)
+                                        $("upcomingActivities").innerHTML=response.responseText;
+                                else
+                                        $("pendingActivities").innerHTML=response.responseText;
+                        {rdelim}
+                {rdelim}
+        );
+{rdelim}
+
+</script>
 
 {*<!--Home Page Entries  -->*}
 
@@ -141,7 +160,7 @@
 							{/if}	
 							{else}
 								<div class="MatrixLayer" style="float:left;width:61%;" id="homepagedb">
-									<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+									<table width="100%" border="0" cellpadding="8" cellspacing="0" class="small">
 										<tr style="cursor:move;">
 											<td align="left" class="homePageMatrixHdr"><b>{$APP.LBL_HOMEPAGE_DASHBOARD}</b></td>
 											<td align="right" class="homePageMatrixHdr"><img src="{$IMAGE_PATH}uparrow.gif" align="absmiddle" /></td>
@@ -169,75 +188,12 @@
 			</div>
 		</td>
 		<td width="25%" valign="top" style="padding:5px;">
-			{if $ACTIVITIES.0.Entries.noofactivities > 0}	
-				<table width="100%" border="0" cellpadding="0" cellspacing="0">
-					<tr>
-						<td><img src="{$IMAGE_PATH}upcoming_left.gif" align="top"  /></td>
-						<td width="100%" background="{$IMAGE_PATH}upcomingEvents.gif" style="background-repeat:repeat-x; "></td>
-						<td><img src="{$IMAGE_PATH}upcoming_right.gif" align="top"  /></td>
-					</tr>		
-					<tr>
-						<td colspan="3" bgcolor="#FFFFCF" style="border-left:2px solid #A6A4A5;border-right:2px solid #A6A4A5;padding-left:10px;"><b class="fontBold">{$MOD.LBL_UPCOMING_EVENTS}</b><br />
-						<!-- Check for Single/Multiple Event(s) -->
-						{if $ACTIVITIES.0.Entries.noofactivities eq 1}
-						{$ACTIVITIES.0.Entries.noofactivities} {$APP.Event} {$APP.LBL_FOR} {$MOD[$ACTIVITIES.0.Title.0]}
-						{else}	
-							{$ACTIVITIES.0.Entries.noofactivities} {$APP.Events} {$APP.LBL_FOR} {$MOD[$ACTIVITIES.0.Title.0]}
-						{/if}
-						</td>
-					</tr>
-					<tr>
-						<td colspan="3" bgcolor="#FFFFCF" style="border-left:2px solid #A6A4A5;border-right:2px solid #A6A4A5;border-bottom:2px solid #A6A4A5;">
-							<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-bottom:1px dashed #aaaaaa;">
-								
-						
-						{foreach item=entries from=$ACTIVITIES.0.Entries}
-						<tr bgcolor="#FFFFCF">
-						<td style="border-bottom:1px dotted #dddddd;" align="right" width="20" valign=top>{$entries.IMAGE}</td>
-						<td style="border-bottom:1px dotted #dddddd;" align="left" valign="middle" colspan="2" width="85%"><b>{$entries.0}</b><br />{$entries.ACCOUNT_NAME}</td>
-					</tr>
-						{/foreach}
-						</table>
-						</td>
-					</tr>
-				</table>
-				<br>
-			{/if}
-		
-
-{if $ACTIVITIES.1.Entries.noofactivities > 0}	
-<table width="100%" border="0" cellpadding="0" cellspacing="0" class="small">
-	<tr>
-		<td><img src="{$IMAGE_PATH}pending_left.gif"></td>
-		<td width="100%" background="{$IMAGE_PATH}pendingEvents.gif" valign="bottom" style="background-repeat:repeat-x;">
-			<b class="fontBold">{$MOD.LBL_PENDING_EVENTS}</b><br />
-				<!-- Check for Single/Multiple Event(s) --> 
-	 	                {if $ACTIVITIES.1.Entries.noofactivities eq 1}   
-	 	                        {$ACTIVITIES.1.Entries.noofactivities} {$MOD.LBL_SINGLE_PENDING_EVENT} 
-	 	                {else} 
-	 	                        {$ACTIVITIES.1.Entries.noofactivities} {$MOD.LBL_MULTIPLE_PENDING_EVENTS} 
-	 	                {/if}    
-	 	        </td> 
-		
-		<td><img src="{$IMAGE_PATH}pending_right.gif"></td>
-	</tr>		
-	<tr>
-		<td colspan="3" bgcolor="#FEF7C1" style="border-left:2px solid #A6A4A5;border-right:2px solid #A6A4A5;border-bottom:2px solid #A6A4A5;">
-			<table width="100%" border="0" cellpadding="5" cellspacing="0">
-				{foreach item=entries from=$ACTIVITIES.1.Entries}
-				<tr>	
-					<td  style="border-bottom:1px dotted #dddddd;"  align="right" width="20">{$entries.IMAGE}</td>
-					<td  style="border-bottom:1px dotted #dddddd;" align="left" valign="middle" colspan="2" width="85%"><b class="style_Gray">{$entries.0}</b><br />{$entries.ACCOUNT_NAME}</td>
-				</tr>
-				{/foreach}
-			</table>
-		</td>
-</tr>
-</table>
-
-<br>
-{/if}
-
+			<div id="upcomingActivities">
+                                {include file="upcomingActivities.tpl"}
+                        </div><br>
+                        <div id="pendingActivities">
+                                {include file="pendingActivities.tpl"}
+                        </div><br>
 <table border=0 cellspacing=0 cellpadding=0 width=100% class="tagCloud">
 <tr>
 <td class="tagCloudTopBg"><img src="{$IMAGE_PATH}tagCloudName.gif" border=0></td>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ImportStep2.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ImportStep2.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ImportStep2.tpl Tue Nov 14 03:16:10 2006
@@ -1,160 +1,188 @@
-{*<!--
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
--->*}
-
-
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<script type="text/javascript" src="include/js/general.js"></script>
-<script>
-
-function getImportSavedMap(impoptions)
-{ldelim}
-	var mapping = impoptions.options[impoptions.options.selectedIndex].value;
-	new Ajax.Request(
-		'index.php',
-		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-			method: 'post',
-			postBody: 'module=Import&mapping='+mapping+'&action=ImportAjax',
-			onComplete: function(response) {ldelim}
-					$("importmapform").innerHTML = response.responseText;
-				{rdelim}
-			{rdelim}
-		);
-{rdelim}
-
-</script>
-<!-- header - level 2 tabs -->
-{include file='Buttons_List1.tpl'}	
-
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%" class="small">
-<tbody>
-   <tr>
-	<td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif" /></td>
-	<td class="showPanelBg" valign="top" width="100%">
-		<table  cellpadding="0" cellspacing="0" width="100%" class="small">
-		   <tr>
-			<td width="75%" valign=top>
-				<form enctype="multipart/form-data" name="Import" method="POST" action="index.php">
-				<input type="hidden" name="module" value="{$MODULE}">
-				<input type="hidden" name="action" value="Import">
-				<input type="hidden" name="step" value="3">
-				<input type="hidden" name="has_header" value="{$HAS_HEADER}">
-				<input type="hidden" name="source" value="{$SOURCE}">
-				<input type="hidden" name="delimiter" value="{$DELIMITER}">
-				<input type="hidden" name="tmp_file" value="{$TMP_FILE}">
-				<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
-				<input type="hidden" name="return_id" value="{$RETURN_ID}">
-				<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
-				<input type="hidden" name="parenttab" value="{$CATEGORY}">
-
-				<!-- IMPORT LEADS STARTS HERE  -->
-				<br />
-				<table align="center" cellpadding="5" cellspacing="0" width="95%" class="mailClient importLeadUI small">
-				   <tr>
-					<td class="mailClientBg genHeaderSmall" height="50" valign="middle" align="left" >{$MOD.LBL_MODULE_NAME} {$MODULE}</td>
-				   </tr>
-				   <tr>
-					<td>&nbsp;</td>
-				   </tr>
-				   <tr>
-					<td align="left"  style="padding-left:40px;">
-						<span class="genHeaderGray">{$MOD.LBL_STEP_2_3} </span>&nbsp; 
-						<span class="genHeaderSmall">{$MODULE} {$MOD.LBL_LIST_MAPPING} </span>
-					</td>
-				   </tr>
-				   <tr>
-					<td align="left" style="padding-left:40px;"> 
-					   {$MOD.LBL_STEP_2_MSG} {$MODULE} {$MOD.LBL_STEP_2_MSG1} 
-					   {$MOD.LBL_STEP_2_TXT} {$MODULE}. 
-					</td>
-				   </tr>
-				   <tr>
-					<td>&nbsp;</td>
-				   </tr>
-				   <tr>
-					<td align="left" style="padding-left:40px;" >
-						<input type="checkbox" name="use_saved_mapping" id="saved_map_checkbox" onclick="ActivateCheckBox()" />&nbsp;&nbsp;
-						{$MOD.LBL_USE_SAVED_MAPPING}&nbsp;&nbsp;&nbsp;{$SAVED_MAP_LISTS}
-					</td>
-				   </tr>
-				   <tr>
-					<td  align="left"style="padding-left:40px;padding-right:40px;">
-						<table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="5" cellspacing="1" width="100%" >
-						   <tr bgcolor="white">
-							<td width="25%" class="lvtCol" align="center"><b>{$MOD.LBL_MAPPING}</b></td>
-							{if $HASHEADER eq 1}
-							<td width="25%" bgcolor="#E1E1E1"  ><b>{$MOD.LBL_HEADERS}</b></td>
-							<td width="25%" ><b>{$MOD.LBL_ROW} 1</b></td>
-							<td width="25%" ><b>{$MOD.LBL_ROW} 2</b></td>
-							{else}
-							<td width="25%" ><b>{$MOD.LBL_ROW} 1</b></td>
-							<td width="25%" ><b>{$MOD.LBL_ROW} 2</b></td>
-							<td width="25%" ><b>{$MOD.LBL_ROW} 3</b></td>
-							{/if}
-						   </tr>
-						</table>
-						{assign var="Firstrow" value=$FIRSTROW}
-						{assign var="Secondrow" value=$SECONDROW}
-						{assign var="Thirdrow" value=$THIRDROW}				
-						<table border="0" cellpadding="0" cellspacing="0" width="100%">
-						   <tr>
-							<td width="25%" valign="top">
-								<div id="importmapform">
-									{include file="ImportMap.tpl"}
-								</div>
-							</td>	
-							<td valign="top">
-								<table border="0" cellpadding="0" cellspacing="1" width="100%" valign="top"  class="small">
-								   {foreach name=iter item=row1 from=$Firstrow}
-									{assign var="counter" value=$smarty.foreach.iter.iteration}
-									{math assign="num" equation="x - y" x=$counter y=1}	
-								   <tr bgcolor="white" >
-									{if $HASHEADER eq 1}
-										<td bgcolor="#E1E1E1" width="33%" height="30">&nbsp;{$row1}</td>
-										<td width="34%">&nbsp;{$Secondrow[$num]}</td>
-										<td>&nbsp;{$Thirdrow[$num]}</td>
-									{else}
-										<td width="31%" height="30">&nbsp;{$row1}</td>
-										<td width="30%">&nbsp;{$Secondrow[$num]}</td>
-										<td>&nbsp;{$Thirdrow[$num]}</td>
-									{/if}	
-								   </tr>
-								   {/foreach}
-								</table>
-							</td>
-						   </tr>
-						</table>	
-					</td>
-				   </tr>
-				   <tr>
-					<td align="left" style="padding-left:40px;" >
-						<input type="checkbox" name="save_map" id="save_map" onclick="set_readonly(this.form)" />&nbsp;&nbsp;
-						{$MOD.LBL_SAVE_AS_CUSTOM} &nbsp;&nbsp;&nbsp;
-						<input type="text" readonly name="save_map_as" id="save_map_as" value="" class="importBox" >
-					</td>
-				   </tr>
-				   <tr >
-					<td align="right" style="padding-right:40px;" class="reportCreateBottom" >
-						<input type="submit" name="button"  value=" &nbsp;&lsaquo; {$MOD.LBL_BACK} &nbsp; " class="crmbutton small cancel" onclick="this.form.action.value='Import';this.form.step.value='1'; return true;" />
-						&nbsp;&nbsp;
-						<input type="submit" name="button"  value=" &nbsp; {$MOD.LBL_IMPORT_NOW} &rsaquo; &nbsp; " class="crmbutton small save" onclick="this.form.action.value='Import';this.form.step.value='3'; return validate_import_map();" />
-					</td>
-				   </tr>
-				  </table>
-				</form>
-				<!-- IMPORT LEADS ENDS HERE -->	
-			</td>
-		   </tr>
-		</table>
-	</td>
-   </tr>
-</table>
-
+{*<!--
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+-->*}
+
+
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<script type="text/javascript" src="include/js/general.js"></script>
+<script>
+
+function getImportSavedMap(impoptions)
+{ldelim}
+	var mapping = impoptions.options[impoptions.options.selectedIndex].value;
+
+	//added to show the delete link
+	if(mapping != -1)
+		document.getElementById("delete_mapping").style.visibility = "visible";
+	else
+		document.getElementById("delete_mapping").style.visibility = "hidden";
+
+	new Ajax.Request(
+		'index.php',
+		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+			method: 'post',
+			postBody: 'module=Import&mapping='+mapping+'&action=ImportAjax',
+			onComplete: function(response) {ldelim}
+					$("importmapform").innerHTML = response.responseText;
+				{rdelim}
+			{rdelim}
+		);
+{rdelim}
+function deleteMapping()
+{ldelim}
+	var options_collection = document.getElementById("saved_source").options;
+	var mapid = options_collection[options_collection.selectedIndex].value;
+
+	new Ajax.Request(
+		'index.php',
+		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+			method: 'post',
+			postBody: 'module=Import&mapping='+mapid+'&action=ImportAjax&delete_map='+mapid,
+			onComplete: function(response) {ldelim}
+					$("importmapform").innerHTML = response.responseText;
+				{rdelim}
+			{rdelim}
+		);
+
+	//we have emptied the map name from the select list
+	document.getElementById("saved_source").options[options_collection.selectedIndex] = null;
+	document.getElementById("delete_mapping").style.visibility = "hidden";
+	alert("This map has been deleted. You cannot use this map again");
+{rdelim}
+
+</script>
+<!-- header - level 2 tabs -->
+{include file='Buttons_List1.tpl'}	
+
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%" class="small">
+<tbody>
+   <tr>
+	<td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif" /></td>
+	<td class="showPanelBg" valign="top" width="100%">
+		<table  cellpadding="0" cellspacing="0" width="100%" class="small">
+		   <tr>
+			<td width="75%" valign=top>
+				<form enctype="multipart/form-data" name="Import" method="POST" action="index.php">
+				<input type="hidden" name="module" value="{$MODULE}">
+				<input type="hidden" name="action" value="Import">
+				<input type="hidden" name="step" value="3">
+				<input type="hidden" name="has_header" value="{$HAS_HEADER}">
+				<input type="hidden" name="source" value="{$SOURCE}">
+				<input type="hidden" name="delimiter" value="{$DELIMITER}">
+				<input type="hidden" name="tmp_file" value="{$TMP_FILE}">
+				<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
+				<input type="hidden" name="return_id" value="{$RETURN_ID}">
+				<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
+				<input type="hidden" name="parenttab" value="{$CATEGORY}">
+
+				<!-- IMPORT LEADS STARTS HERE  -->
+				<br />
+				<table align="center" cellpadding="5" cellspacing="0" width="95%" class="mailClient importLeadUI small">
+				   <tr>
+					<td class="mailClientBg genHeaderSmall" height="50" valign="middle" align="left" >{$MOD.LBL_MODULE_NAME} {$MODULE}</td>
+				   </tr>
+				   <tr>
+					<td>&nbsp;</td>
+				   </tr>
+				   <tr>
+					<td align="left"  style="padding-left:40px;">
+						<span class="genHeaderGray">{$MOD.LBL_STEP_2_3} </span>&nbsp; 
+						<span class="genHeaderSmall">{$MODULE} {$MOD.LBL_LIST_MAPPING} </span>
+					</td>
+				   </tr>
+				   <tr>
+					<td align="left" style="padding-left:40px;"> 
+					   {$MOD.LBL_STEP_2_MSG} {$MODULE} {$MOD.LBL_STEP_2_MSG1} 
+					   {$MOD.LBL_STEP_2_TXT} {$MODULE}. 
+					</td>
+				   </tr>
+				   <tr>
+					<td>&nbsp;</td>
+				   </tr>
+				   <tr>
+					<td align="left" style="padding-left:40px;" >
+						<input type="checkbox" name="use_saved_mapping" id="saved_map_checkbox" onclick="ActivateCheckBox()" />&nbsp;&nbsp;
+						{$MOD.LBL_USE_SAVED_MAPPING}&nbsp;&nbsp;&nbsp;{$SAVED_MAP_LISTS}
+					</td>
+				   </tr>
+				   <tr>
+					<td  align="left"style="padding-left:40px;padding-right:40px;">
+						<table style="background-color: rgb(204, 204, 204);" class="small" border="0" cellpadding="5" cellspacing="1" width="100%" >
+						   <tr bgcolor="white">
+							<td width="25%" class="lvtCol" align="center"><b>{$MOD.LBL_MAPPING}</b></td>
+							{if $HASHEADER eq 1}
+							<td width="25%" bgcolor="#E1E1E1"  ><b>{$MOD.LBL_HEADERS}</b></td>
+							<td width="25%" ><b>{$MOD.LBL_ROW} 1</b></td>
+							<td width="25%" ><b>{$MOD.LBL_ROW} 2</b></td>
+							{else}
+							<td width="25%" ><b>{$MOD.LBL_ROW} 1</b></td>
+							<td width="25%" ><b>{$MOD.LBL_ROW} 2</b></td>
+							<td width="25%" ><b>{$MOD.LBL_ROW} 3</b></td>
+							{/if}
+						   </tr>
+						</table>
+						{assign var="Firstrow" value=$FIRSTROW}
+						{assign var="Secondrow" value=$SECONDROW}
+						{assign var="Thirdrow" value=$THIRDROW}				
+						<table border="0" cellpadding="0" cellspacing="0" width="100%">
+						   <tr>
+							<td width="25%" valign="top">
+								<div id="importmapform">
+									{include file="ImportMap.tpl"}
+								</div>
+							</td>	
+							<td valign="top">
+								<table border="0" cellpadding="0" cellspacing="1" width="100%" valign="top"  class="small">
+								   {foreach name=iter item=row1 from=$Firstrow}
+									{assign var="counter" value=$smarty.foreach.iter.iteration}
+									{math assign="num" equation="x - y" x=$counter y=1}	
+								   <tr bgcolor="white" >
+									{if $HASHEADER eq 1}
+										<td bgcolor="#E1E1E1" width="33%" height="30">&nbsp;{$row1}</td>
+										<td width="34%">&nbsp;{$Secondrow[$num]}</td>
+										<td>&nbsp;{$Thirdrow[$num]}</td>
+									{else}
+										<td width="31%" height="30">&nbsp;{$row1}</td>
+										<td width="30%">&nbsp;{$Secondrow[$num]}</td>
+										<td>&nbsp;{$Thirdrow[$num]}</td>
+									{/if}	
+								   </tr>
+								   {/foreach}
+								</table>
+							</td>
+						   </tr>
+						</table>	
+					</td>
+				   </tr>
+				   <tr>
+					<td align="left" style="padding-left:40px;" >
+						<input type="checkbox" name="save_map" id="save_map" onclick="set_readonly(this.form)" />&nbsp;&nbsp;
+						{$MOD.LBL_SAVE_AS_CUSTOM} &nbsp;&nbsp;&nbsp;
+						<input type="text" readonly name="save_map_as" id="save_map_as" value="" class="importBox" >
+					</td>
+				   </tr>
+				   <tr >
+					<td align="right" style="padding-right:40px;" class="reportCreateBottom" >
+						<input type="submit" name="button"  value=" &nbsp;&lsaquo; {$MOD.LBL_BACK} &nbsp; " class="crmbutton small cancel" onclick="this.form.action.value='Import';this.form.step.value='1'; return true;" />
+						&nbsp;&nbsp;
+						<input type="submit" name="button"  value=" &nbsp; {$MOD.LBL_IMPORT_NOW} &rsaquo; &nbsp; " class="crmbutton small save" onclick="this.form.action.value='Import';this.form.step.value='3'; return validate_import_map();" />
+					</td>
+				   </tr>
+				  </table>
+				</form>
+				<!-- IMPORT LEADS ENDS HERE -->	
+			</td>
+		   </tr>
+		</table>
+	</td>
+   </tr>
+</table>
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryCreateView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryCreateView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryCreateView.tpl Tue Nov 14 03:16:10 2006
@@ -1,205 +1,205 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-{*<!-- module header -->*}
-
-<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
-<script type="text/javascript" src="jscalendar/calendar.js"></script>
-<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
-<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<script type="text/javascript" src="include/js/Inventory.js"></script>
-
-<script type="text/javascript">
-
-function sensex_info()
-{ldelim}
-        var Ticker = $('tickersymbol').value;
-        if(Ticker!='')
-        {ldelim}
-		$("vtbusy_info").style.display="inline";
-		new Ajax.Request(
-          	      'index.php',
-                      {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                      		method: 'post',
-                        	postBody: 'module={$MODULE}&action=Tickerdetail&tickersymbol='+Ticker,
-	                        onComplete: function(response) {ldelim}
-					$('autocom').innerHTML = response.responseText;
-				        $('autocom').style.display="block";
-        	                        $("vtbusy_info").style.display="none";
-                	        {rdelim}
-                	{rdelim}
-        	);
-        {rdelim}
-{rdelim}
-
-</script>
-
-{include file='Buttons_List1.tpl'}
-
-{*<!-- Contents -->*}
-<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
-   <tr>
-	<td valign=top>
-		<img src="{$IMAGE_PATH}showPanelTopLeft.gif">
-	</td>
-
-	<td class="showPanelBg" valign=top width=100%>
-	     {*<!-- PUBLIC CONTENTS STARTS-->*}
-		{include file='EditViewHidden.tpl'}
-	     <div class="small" style="padding:20px">
-		
-		 {if $OP_MODE eq 'edit_view'}   
-			 <span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$APP.LBL_EDITING} {$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span> <br>
-			{$UPDATEINFO}	 
-		 {/if}
-		 {if $OP_MODE eq 'create_view'}
-			<span class="lvtHeaderText">{$APP.LBL_CREATING} {$APP.LBL_NEW} {$MOD[$SINGLE_MOD]}</span> <br>
-		 {/if}
-
-		 <hr noshade size=1>
-		 <br> 
-		
-		
-
-		{*<!-- Account details tabs -->*}
-		<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
-		   <tr>
-			<td>
-				<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
-				   <tr>
-					<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
-
-					{if $BLOCKS_COUNT eq 2}	
-						<td width=75 style="width:15%" align="center" nowrap class="dvtSelectedCell" id="bi" onclick="fnLoadValues('bi','mi','basicTab','moreTab','inventory','{$MODULE}')"><b>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</b></td>
-                    				<td class="dvtUnSelectedCell" style="width: 100px;" align="center" nowrap id="mi" onclick="fnLoadValues('mi','bi','moreTab','basicTab','inventory','{$MODULE}')"><b>{$APP.LBL_MORE} {$APP.LBL_INFORMATION} </b></td>
-                   				<td class="dvtTabCache" style="width:65%" nowrap>&nbsp;</td>
-					{else}
-						<td class="dvtSelectedCell" align=center nowrap>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</td>
-	                                        <td class="dvtTabCache" style="width:65%">&nbsp;</td>
-					{/if}
-				   <tr>
-				</table>
-			</td>
-		   </tr>
-		   <tr>
-			<td valign=top align=left >
-
-			    {foreach item=blockInfo key=divName from=$BLOCKS}
-			    <!-- Basic and More Information Tab Opened -->
-			    <div id="{$divName}">
-
-				<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
-				   <tr>
-					<!--this td is to display the entity details -->
-					<td align=left>
-					<!-- content cache -->
-
-						<table border=0 cellspacing=0 cellpadding=0 width=100%>
-						   <tr>
-							<td id ="autocom"></td>
-						   </tr>
-						   <tr>
-							<td style="padding:10px">
-							<!-- General details -->
-								<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
-								   <tr>
-									<td  colspan=4 style="padding:5px">
-									   <div align="center">
-										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-                                                                 		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-									   </div>
-									</td>
-								   </tr>
-
-								   {foreach key=header item=data from=$blockInfo}
-								   <tr>
-									{if $header== 'Address Information' && ($MODULE == 'Accounts' || $MODULE == 'Contacts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
-                                                                        <td colspan=2 class="detailedViewHeader">
-                                                                        <b>{$header}</b></td>
-                                                                        <td class="detailedViewHeader">
-                                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
-                                                                        <td class="detailedViewHeader">
-                                                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
-                                                                        {else}
-						         		<td colspan=4 class="detailedViewHeader">
-                                                	        		<b>{$header}</b>
-									{/if}
-									</td>
-								   </tr>
-
-								   <!-- Here we should include the uitype handlings-->
-								   {include file="DisplayFields.tpl"}
-
-								   <tr style="height:25px"><td>&nbsp;</td></tr>
-								   {/foreach}
-
-								   <!-- This if is added to restrict display in more tab-->
-								   {if $divName eq 'basicTab'}
-								   {if $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Invoice'}
-								   	<!-- Added to display the product details -->
-									<!-- This if is added when we want to populate product details from the related entity  for ex. populate product details in new SO page when select Quote -->
-									{if $AVAILABLE_PRODUCTS eq true}
-										{include file="Inventory/ProductDetailsEditView.tpl"}
-									{else}
-										{include file="Inventory/ProductDetails.tpl"}
-									{/if}
-
-								   {/if}
-								   {/if}
-
-								   <tr>
-									<td  colspan=4 style="padding:5px">
-									   <div align="center">
-										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save'; return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-										<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-									   </div>
-									</td>
-								   </tr>
-								</table>
-								<!-- General details - end -->
-							</td>
-						   </tr>
-						</table>
-					</td>
-				   </tr>
-				</table>
-							
-			    </div>
-			    {/foreach}
-			</td>
-		   </tr>
-		</table>
-	 </div>
-	</td>
-	<td align=right valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</table>
-</form>
-
-<!-- This div is added to get the left and top values to show the tax details-->
-<div id="tax_container" style="display:none; position:absolute; z-index:1px;"></div>
-
-<script>
-
-
-
-        var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
-
-        var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
-
-        var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
-
-
-</script>
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+{*<!-- module header -->*}
+
+<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
+<script type="text/javascript" src="jscalendar/calendar.js"></script>
+<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
+<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<script type="text/javascript" src="include/js/Inventory.js"></script>
+
+<script type="text/javascript">
+
+function sensex_info()
+{ldelim}
+        var Ticker = $('tickersymbol').value;
+        if(Ticker!='')
+        {ldelim}
+		$("vtbusy_info").style.display="inline";
+		new Ajax.Request(
+          	      'index.php',
+                      {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                      		method: 'post',
+                        	postBody: 'module={$MODULE}&action=Tickerdetail&tickersymbol='+Ticker,
+	                        onComplete: function(response) {ldelim}
+					$('autocom').innerHTML = response.responseText;
+				        $('autocom').style.display="block";
+        	                        $("vtbusy_info").style.display="none";
+                	        {rdelim}
+                	{rdelim}
+        	);
+        {rdelim}
+{rdelim}
+
+</script>
+
+{include file='Buttons_List1.tpl'}
+
+{*<!-- Contents -->*}
+<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
+   <tr>
+	<td valign=top>
+		<img src="{$IMAGE_PATH}showPanelTopLeft.gif">
+	</td>
+
+	<td class="showPanelBg" valign=top width=100%>
+	     {*<!-- PUBLIC CONTENTS STARTS-->*}
+		{include file='EditViewHidden.tpl'}
+	     <div class="small" style="padding:20px">
+		
+		 {if $OP_MODE eq 'edit_view'}   
+			 <span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$APP.LBL_EDITING} {$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span> <br>
+			{$UPDATEINFO}	 
+		 {/if}
+		 {if $OP_MODE eq 'create_view'}
+			<span class="lvtHeaderText">{$APP.LBL_CREATING} {$APP.LBL_NEW} {$MOD[$SINGLE_MOD]}</span> <br>
+		 {/if}
+
+		 <hr noshade size=1>
+		 <br> 
+		
+		
+
+		{*<!-- Account details tabs -->*}
+		<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
+		   <tr>
+			<td>
+				<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
+				   <tr>
+					<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+
+					{if $BLOCKS_COUNT eq 2}	
+						<td width=75 style="width:15%" align="center" nowrap class="dvtSelectedCell" id="bi" onclick="fnLoadValues('bi','mi','basicTab','moreTab','inventory','{$MODULE}')"><b>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</b></td>
+                    				<td class="dvtUnSelectedCell" style="width: 100px;" align="center" nowrap id="mi" onclick="fnLoadValues('mi','bi','moreTab','basicTab','inventory','{$MODULE}')"><b>{$APP.LBL_MORE} {$APP.LBL_INFORMATION} </b></td>
+                   				<td class="dvtTabCache" style="width:65%" nowrap>&nbsp;</td>
+					{else}
+						<td class="dvtSelectedCell" align=center nowrap>{$APP.LBL_BASIC} {$APP.LBL_INFORMATION}</td>
+	                                        <td class="dvtTabCache" style="width:65%">&nbsp;</td>
+					{/if}
+				   <tr>
+				</table>
+			</td>
+		   </tr>
+		   <tr>
+			<td valign=top align=left >
+
+			    {foreach item=blockInfo key=divName from=$BLOCKS}
+			    <!-- Basic and More Information Tab Opened -->
+			    <div id="{$divName}">
+
+				<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
+				   <tr>
+					<!--this td is to display the entity details -->
+					<td align=left>
+					<!-- content cache -->
+
+						<table border=0 cellspacing=0 cellpadding=0 width=100%>
+						   <tr>
+							<td id ="autocom"></td>
+						   </tr>
+						   <tr>
+							<td style="padding:10px">
+							<!-- General details -->
+								<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
+								   <tr>
+									<td  colspan=4 style="padding:5px">
+									   <div align="center">
+										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+                                                                 		<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+									   </div>
+									</td>
+								   </tr>
+
+								   {foreach key=header item=data from=$blockInfo}
+								   <tr>
+									{if $header== $MOD.LBL_ADDRESS_INFORMATION && ($MODULE == 'Accounts' || $MODULE == 'Contacts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
+                                                                        <td colspan=2 class="detailedViewHeader">
+                                                                        <b>{$header}</b></td>
+                                                                        <td class="detailedViewHeader">
+                                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
+                                                                        <td class="detailedViewHeader">
+                                                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
+                                                                        {else}
+						         		<td colspan=4 class="detailedViewHeader">
+                                                	        		<b>{$header}</b>
+									{/if}
+									</td>
+								   </tr>
+
+								   <!-- Here we should include the uitype handlings-->
+								   {include file="DisplayFields.tpl"}
+
+								   <tr style="height:25px"><td>&nbsp;</td></tr>
+								   {/foreach}
+
+								   <!-- This if is added to restrict display in more tab-->
+								   {if $divName eq 'basicTab'}
+								   {if $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Invoice'}
+								   	<!-- Added to display the product details -->
+									<!-- This if is added when we want to populate product details from the related entity  for ex. populate product details in new SO page when select Quote -->
+									{if $AVAILABLE_PRODUCTS eq true}
+										{include file="Inventory/ProductDetailsEditView.tpl"}
+									{else}
+										{include file="Inventory/ProductDetails.tpl"}
+									{/if}
+
+								   {/if}
+								   {/if}
+
+								   <tr>
+									<td  colspan=4 style="padding:5px">
+									   <div align="center">
+										<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save'; return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+										<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+									   </div>
+									</td>
+								   </tr>
+								</table>
+								<!-- General details - end -->
+							</td>
+						   </tr>
+						</table>
+					</td>
+				   </tr>
+				</table>
+							
+			    </div>
+			    {/foreach}
+			</td>
+		   </tr>
+		</table>
+	 </div>
+	</td>
+	<td align=right valign=top><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</table>
+</form>
+
+<!-- This div is added to get the left and top values to show the tax details-->
+<div id="tax_container" style="display:none; position:absolute; z-index:1px;"></div>
+
+<script>
+
+
+
+        var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
+
+        var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
+
+        var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
+
+
+</script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryDetailView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryDetailView.tpl Tue Nov 14 03:16:10 2006
@@ -1,326 +1,339 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
-<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
-<div id="convertleaddiv" style="display:block;position:absolute;left:225px;top:150px;"></div>
-<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
-   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
-</span>
-<script>
-function tagvalidate()
-{ldelim}
-	if(document.getElementById('txtbox_tagfields').value != '')
-		SaveTag('txtbox_tagfields','{$ID}','{$MODULE}');	
-	else
-	{ldelim}
-		alert("Please enter a tag");
-		return false;
-	{rdelim}
-{rdelim}
-function DeleteTag(id)
-{ldelim}
-	$("vtbusy_info").style.display="inline";
-	Effect.Fade('tag_'+id);
-	new Ajax.Request(
-		'index.php',
-                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                        method: 'post',
-                        postBody: "file=TagCloud&module={$MODULE}&action={$MODULE}Ajax&ajxaction=DELETETAG&tagid=" +id,
-                        onComplete: function(response) {ldelim}
-						getTagCloud();
-						$("vtbusy_info").style.display="none";
-                        {rdelim}
-                {rdelim}
-        );
-{rdelim}
-
-</script>
-
-<table width="100%" cellpadding="2" cellspacing="0" border="0">
-   <tr>
-	<td>
-		{include file='Buttons_List1.tpl'}
-
-		<!-- Contents -->
-		<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
-		   <tr>
-			<td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-			<td class="showPanelBg" valign=top width=100%>
-			<!-- PUBLIC CONTENTS STARTS-->
-			   <div class="small" style="padding:20px" >
-		
-				<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
-				   <tr>
-					<td>
-						<span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span>&nbsp;&nbsp;<span id="vtbusy_info" style="display:none;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span><span id="vtbusy_info" style="visibility:hidden;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span>
-					</td>
-					<td>&nbsp;</td>
-				   </tr>
-				   <tr height=20>
-					<td>{$UPDATEINFO}</td>
-				   </tr>
-				</table>
-
-				<hr noshade size=1>
-		
-				<!-- Entity and More information tabs -->
-				<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
-				   <tr>
-					<td>
-						<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
-						   <tr>
-							<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
-							<td class="dvtSelectedCell" align=center nowrap>{$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</td>	
-							<td class="dvtTabCache" style="width:10px">&nbsp;</td>
-							{if $SinglePane_View eq 'false'}
-								<td class="dvtUnSelectedCell" align=center nowrap><a href="index.php?action=CallRelatedList&module={$MODULE}&record={$ID}&parenttab={$CATEGORY}">{$APP.LBL_MORE} {$APP.LBL_INFORMATION}</a></td>
-							{/if}
-							<td class="dvtTabCache" style="width:100%">&nbsp;</td>
-						   </tr>
-						</table>
-					</td>
-				   </tr>
-				   <tr>
-					<td valign=top align=left >
-						<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
-						   <tr>
-
-							<td align=left style="padding:10px;">
-							<!-- content cache -->
-								<!-- Entity informations display - starts -->	
-								<table border=0 cellspacing=0 cellpadding=0 width=100%>
-			                			   <tr>
-									<td style="padding:10px;border-right:1px dashed #CCCCCC;" width="80%">
-
-
-
-<!-- The following table is used to display the buttons -->
-   <form action="index.php" method="post" name="DetailView" id="form">
-					{include file='DetailViewHidden.tpl'}
-<table border=0 cellspacing=0 cellpadding=0 width=100%>
-   {strip}
-   <tr nowrap>
-	<td  colspan=4 style="padding:5px">
-		{if $EDIT_DUPLICATE eq 'permitted'}
-			<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="{$APP.LBL_EDIT_BUTTON_LABEL}">&nbsp;
-		<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
-		{/if}
-		{if $DELETE eq 'permitted'}
-			<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
-		{/if}
-		<!-- Commented the buttons in DetailView because these buttons have been given as links
-		{if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
-			{if $CREATEPDF eq 'permitted'}
-				<input title="Export To PDF" accessKey="Alt+e" class="small" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}'; this.form.module.value='{$MODULE}'; {if $MODULE eq 'SalesOrder'} this.form.action.value='CreateSOPDF'" {else} this.form.action.value='CreatePDF'" {/if} type="submit" name="Export To PDF" value="{$APP.LBL_EXPORT_TO_PDF}">&nbsp;
-			{/if}
-		{/if}
-		{if $MODULE eq 'Quotes'}
-			{if $CONVERTSALESORDER eq 'permitted'}
-				<input title="{$APP.LBL_CONVERTSO_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTSO_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='SalesOrder'; this.form.return_action.value='DetailView'; this.form.convertmode.value='quotetoso';this.form.module.value='SalesOrder'; this.form.action.value='EditView'" type="submit" name="Convert To SalesOrder" value="{$APP.LBL_CONVERTSO_BUTTON_LABEL}">&nbsp;
-			{/if}
-		{/if}
-		{if $MODULE eq 'Potentials' || $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder'}
-			{if $CONVERTINVOICE eq 'permitted'}
-				<input title="{$APP.LBL_CONVERTINVOICE_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTINVOICE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.convertmode.value='{$CONVERTMODE}';this.form.module.value='Invoice'; this.form.action.value='EditView'" type="submit" name="Convert To Invoice" value="{$APP.LBL_CONVERTINVOICE_BUTTON_LABEL}">&nbsp;
-			{/if}
-		{/if}
-		-->
-	</td>
-   </tr>
-   {/strip}
-</table>
-<!-- Button displayed - finished-->
-
-<!-- Entity information(blocks) display - start -->
-{foreach key=header item=detail from=$BLOCKS}
-	<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
-	   <tr>
-		<td>&nbsp;</td>
-		<td>&nbsp;</td>
-		<td>&nbsp;</td>
-		<td align=right>
-		</td>
-	   </tr>
-	   <tr>
-		{strip}
-		<td colspan=4 class="dvInnerHeader" >
-			<b>
-			       	{$header}
-			</b>
-		</td>
-		{/strip}
-	   </tr>
-
-	   {foreach item=detail from=$detail}
-	   <tr style="height:25px">
-		{foreach key=label item=data from=$detail}
-			{assign var=keyid value=$data.ui}
-			{assign var=keyval value=$data.value}
-			{assign var=keytblname value=$data.tablename}
-			{assign var=keyfldname value=$data.fldname}
-			{assign var=keyoptions value=$data.options}
-			{assign var=keysecid value=$data.secid}
-			{assign var=keyseclink value=$data.link}
-			{assign var=keycursymb value=$data.cursymb}
-			{assign var=keysalut value=$data.salut}
-			{assign var=keycntimage value=$data.cntimage}
-			   {assign var=keyadmin value=$data.isadmin}
-							   
-
-				{if $label ne ''}
-					{if $keycntimage ne ''}
-						<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$keycntimage}</td>
-					{elseif $label neq 'Tax Class'}<!-- Avoid to display the label Tax Class -->
-						{if $keyid eq '71' || $keyid eq '72'}  <!--CurrencySymbol-->
-							<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label} ({$keycursymb})</td>
-						{else}
-							<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label}</td>
-						{/if}
-					{/if}  
-					{if $EDIT_PERMISSION eq 'yes'}
-						{include file="DetailViewUI.tpl"}
-					{else}
-						{include file="DetailViewFields.tpl"}
-					{/if}
-				{else} 
-					<td class="dvtCellLabel" align=right>&nbsp;</td>
-					<td class="dvtCellInfo" align=left >&nbsp;</td>
-				{/if}
-		{/foreach}
-	   </tr>	
-	   {/foreach}	
-	</table>
-{/foreach}
-{*-- End of Blocks--*} 
-<!-- Entity information(blocks) display - ends -->
-
-									<br>
-
-										<!-- Product Details informations -->
-										{$ASSOCIATED_PRODUCTS}
-
-									</td>
-<!-- The following table is used to display the buttons -->
-								<table border=0 cellspacing=0 cellpadding=0 width=100%>
-			                			   <tr>
-									<td style="padding:10px;border-right:1px dashed #CCCCCC;" width="80%">
-			{if $SinglePane_View eq 'false'}
-<table border=0 cellspacing=0 cellpadding=0 width=100%>
-   {strip}
-   <tr nowrap>
-	<td  colspan=4 style="padding:5px">
-		{if $EDIT_DUPLICATE eq 'permitted'}
-			<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="{$APP.LBL_EDIT_BUTTON_LABEL}">&nbsp;
-		<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
-		{/if}
-		{if $DELETE eq 'permitted'}
-			<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
-		{/if}
-		<!-- Commented the buttons in DetailView because these buttons have been given as links
-		{if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
-			{if $CREATEPDF eq 'permitted'}
-				<input title="Export To PDF" accessKey="Alt+e" class="small" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}'; this.form.module.value='{$MODULE}'; {if $MODULE eq 'SalesOrder'} this.form.action.value='CreateSOPDF'" {else} this.form.action.value='CreatePDF'" {/if} type="submit" name="Export To PDF" value="{$APP.LBL_EXPORT_TO_PDF}">&nbsp;
-			{/if}
-		{/if}
-		{if $MODULE eq 'Quotes'}
-			{if $CONVERTSALESORDER eq 'permitted'}
-				<input title="{$APP.LBL_CONVERTSO_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTSO_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='SalesOrder'; this.form.return_action.value='DetailView'; this.form.convertmode.value='quotetoso';this.form.module.value='SalesOrder'; this.form.action.value='EditView'" type="submit" name="Convert To SalesOrder" value="{$APP.LBL_CONVERTSO_BUTTON_LABEL}">&nbsp;
-			{/if}
-		{/if}
-		{if $MODULE eq 'Potentials' || $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder'}
-			{if $CONVERTINVOICE eq 'permitted'}
-				<input title="{$APP.LBL_CONVERTINVOICE_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTINVOICE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.convertmode.value='{$CONVERTMODE}';this.form.module.value='Invoice'; this.form.action.value='EditView'" type="submit" name="Convert To Invoice" value="{$APP.LBL_CONVERTINVOICE_BUTTON_LABEL}">&nbsp;
-			{/if}
-		{/if}
-		-->
-	</td>
-   </tr>
-   {/strip}
-</table>
-{/if}
-</form>
-		<table border=0 cellspacing=0 cellpadding=0 width=100%>
-		  <tr>
-			<td style="border-right:1px dashed #CCCCCC;" width="100%">
-			{if $SinglePane_View eq 'true'}
-				{include file= 'RelatedListNew.tpl'}
-			{/if}
-		</td></tr></table>
-</td></tr></table>
-<!-- Button displayed - finished-->
-									<!-- Inventory Actions - ends -->	
-									<td width=22% valign=top style="padding:10px;">
-										<!-- right side InventoryActions -->
-										{include file="Inventory/InventoryActions.tpl"}
-
-										<br>
-										<!-- Add Tag link added just above the tag cloud image -->
-										<table border=0 cellspacing=0 cellpadding=5 width=100% >
-										<tr>
-											<td align="left" class="genHeaderSmall" nowrap><div id="addtagdiv"><a href="javascript:;" onClick="show('tagdiv'),fnhide('addtagdiv'),document.getElementById('txtbox_tagfields').focus()"><b>{$APP.LBL_ADD_TAG}</b></a></div><div id="tagdiv" style="display:none;"><input class="textbox"  type="text" id="txtbox_tagfields" name="textbox_First Name" value=""></input>&nbsp;&nbsp;<input name="button_tagfileds" type="button" class="crmbutton small save" value="{$APP.LBL_TAG_IT}" onclick="return tagvalidate()"/><input name="close" type="button" class="crmbutton small cancel" value="{$APP.LBL_CLOSE}" onClick="fnhide('tagdiv'),show('addtagdiv')"></div></td>
-										</tr>
-										</table>
-										<!-- Eng Add Tag Link -->
-										<br>
-										<!-- To display the Tag Clouds -->
-										<div>
-										      {include file="TagCloudDisplay.tpl"}
-										</div>
-									</td>
-								   </tr>
-								</table>
-							</td>
-						   </tr>
-						</table>
-					<!-- PUBLIC CONTENTS STOPS-->
-					</td>
-					<td align=right valign=top>
-						<img src="{$IMAGE_PATH}showPanelTopRight.gif">
-					</td>
-				   </tr>
-				</table>
-			   </div>
-			</td>
-		   </tr>
-		</table>
-		<!-- Contents - end -->
-
-<script>
-function getTagCloud()
-{ldelim}
-new Ajax.Request(
-        'index.php',
-        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-        method: 'post',
-        postBody: 'module={$MODULE}&action={$MODULE}Ajax&file=TagCloud&ajxaction=GETTAGCLOUD&recordid={$ID}',
-        onComplete: function(response) {ldelim}
-                                $("tagfields").innerHTML=response.responseText;
-                                $("txtbox_tagfields").value ='';
-                        {rdelim}
-        {rdelim}
-);
-{rdelim}
-getTagCloud();
-</script>
-
-	</td>
-   </tr>
-</table>
-<script language="javascript">
-  var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
-  var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
-  var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
-</script>
-
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
+<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
+<div id="convertleaddiv" style="display:block;position:absolute;left:225px;top:150px;"></div>
+<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
+   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
+</span>
+<script>
+function tagvalidate()
+{ldelim}
+	if(document.getElementById('txtbox_tagfields').value != '')
+		SaveTag('txtbox_tagfields','{$ID}','{$MODULE}');	
+	else
+	{ldelim}
+		alert("Please enter a tag");
+		return false;
+	{rdelim}
+{rdelim}
+function DeleteTag(id)
+{ldelim}
+	$("vtbusy_info").style.display="inline";
+	Effect.Fade('tag_'+id);
+	new Ajax.Request(
+		'index.php',
+                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                        method: 'post',
+                        postBody: "file=TagCloud&module={$MODULE}&action={$MODULE}Ajax&ajxaction=DELETETAG&tagid=" +id,
+                        onComplete: function(response) {ldelim}
+						getTagCloud();
+						$("vtbusy_info").style.display="none";
+                        {rdelim}
+                {rdelim}
+        );
+{rdelim}
+
+</script>
+
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+   <tr>
+	<td>
+		{include file='Buttons_List1.tpl'}
+
+		<!-- Contents -->
+		<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
+		   <tr>
+			<td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+			<td class="showPanelBg" valign=top width=100%>
+			<!-- PUBLIC CONTENTS STARTS-->
+			   <div class="small" style="padding:20px" >
+		
+				<table align="center" border="0" cellpadding="0" cellspacing="0" width="95%">
+				   <tr>
+					<td>
+						<span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} -  {$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span>&nbsp;&nbsp;<span id="vtbusy_info" style="display:none;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span><span id="vtbusy_info" style="visibility:hidden;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span>
+					</td>
+					<td>&nbsp;</td>
+				   </tr>
+				   <tr height=20>
+					<td>{$UPDATEINFO}</td>
+				   </tr>
+				</table>
+
+				<hr noshade size=1>
+		
+				<!-- Entity and More information tabs -->
+				<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
+				   <tr>
+					<td>
+						<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
+						   <tr>
+							<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+							<td class="dvtSelectedCell" align=center nowrap>{$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</td>	
+							<td class="dvtTabCache" style="width:10px">&nbsp;</td>
+							{if $SinglePane_View eq 'false'}
+								<td class="dvtUnSelectedCell" align=center nowrap><a href="index.php?action=CallRelatedList&module={$MODULE}&record={$ID}&parenttab={$CATEGORY}">{$APP.LBL_MORE} {$APP.LBL_INFORMATION}</a></td>
+							{/if}
+							<td class="dvtTabCache" style="width:100%">&nbsp;</td>
+						   </tr>
+						</table>
+					</td>
+				   </tr>
+				   <tr>
+					<td valign=top align=left >
+						<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
+						   <tr>
+
+							<td align=left style="padding:10px;">
+							<!-- content cache -->
+								<!-- Entity informations display - starts -->	
+								<table border=0 cellspacing=0 cellpadding=0 width=100%>
+			                			   <tr>
+									<td style="padding:10px;border-right:1px dashed #CCCCCC;" width="80%">
+
+
+
+<!-- The following table is used to display the buttons -->
+   <form action="index.php" method="post" name="DetailView" id="form">
+					{include file='DetailViewHidden.tpl'}
+<table border=0 cellspacing=0 cellpadding=0 width=100%>
+   {strip}
+   <tr>
+	<td  colspan=4 style="padding:5px">
+		<table border=0 cellspacing=0 cellpadding=0 width=100%>
+                   <tr>
+                        <td>
+				{if $EDIT_DUPLICATE eq 'permitted'}
+				<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="{$APP.LBL_EDIT_BUTTON_LABEL}">&nbsp;
+				{/if}
+			</td>
+			<td align=right>
+				{if $EDIT_DUPLICATE eq 'permitted'}
+				<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
+				{/if}
+				{if $DELETE eq 'permitted'}
+				<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
+				{/if}
+			</td>
+                   </tr>
+                </table>
+		<!-- Commented the buttons in DetailView because these buttons have been given as links
+		{if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
+			{if $CREATEPDF eq 'permitted'}
+				<input title="Export To PDF" accessKey="Alt+e" class="small" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}'; this.form.module.value='{$MODULE}'; {if $MODULE eq 'SalesOrder'} this.form.action.value='CreateSOPDF'" {else} this.form.action.value='CreatePDF'" {/if} type="submit" name="Export To PDF" value="{$APP.LBL_EXPORT_TO_PDF}">&nbsp;
+			{/if}
+		{/if}
+		{if $MODULE eq 'Quotes'}
+			{if $CONVERTSALESORDER eq 'permitted'}
+				<input title="{$APP.LBL_CONVERTSO_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTSO_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='SalesOrder'; this.form.return_action.value='DetailView'; this.form.convertmode.value='quotetoso';this.form.module.value='SalesOrder'; this.form.action.value='EditView'" type="submit" name="Convert To SalesOrder" value="{$APP.LBL_CONVERTSO_BUTTON_LABEL}">&nbsp;
+			{/if}
+		{/if}
+		{if $MODULE eq 'Potentials' || $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder'}
+			{if $CONVERTINVOICE eq 'permitted'}
+				<input title="{$APP.LBL_CONVERTINVOICE_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTINVOICE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.convertmode.value='{$CONVERTMODE}';this.form.module.value='Invoice'; this.form.action.value='EditView'" type="submit" name="Convert To Invoice" value="{$APP.LBL_CONVERTINVOICE_BUTTON_LABEL}">&nbsp;
+			{/if}
+		{/if}
+		-->
+	</td>
+   </tr>
+   {/strip}
+</table>
+<!-- Button displayed - finished-->
+
+<!-- Entity information(blocks) display - start -->
+{foreach key=header item=detail from=$BLOCKS}
+	<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
+	   <tr>
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+		<td>&nbsp;</td>
+		<td align=right>
+		</td>
+	   </tr>
+	   <tr>
+		{strip}
+		<td colspan=4 class="dvInnerHeader" >
+			<b>
+			       	{$header}
+			</b>
+		</td>
+		{/strip}
+	   </tr>
+
+	   {foreach item=detail from=$detail}
+	   <tr style="height:25px">
+		{foreach key=label item=data from=$detail}
+			{assign var=keyid value=$data.ui}
+			{assign var=keyval value=$data.value}
+			{assign var=keytblname value=$data.tablename}
+			{assign var=keyfldname value=$data.fldname}
+			{assign var=keyoptions value=$data.options}
+			{assign var=keysecid value=$data.secid}
+			{assign var=keyseclink value=$data.link}
+			{assign var=keycursymb value=$data.cursymb}
+			{assign var=keysalut value=$data.salut}
+			{assign var=keycntimage value=$data.cntimage}
+			   {assign var=keyadmin value=$data.isadmin}
+							   
+
+				{if $label ne ''}
+					{if $keycntimage ne ''}
+						<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$keycntimage}</td>
+					{elseif $label neq 'Tax Class'}<!-- Avoid to display the label Tax Class -->
+						{if $keyid eq '71' || $keyid eq '72'}  <!--CurrencySymbol-->
+							<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label} ({$keycursymb})</td>
+						{else}
+							<td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label}</td>
+						{/if}
+					{/if}  
+					{if $EDIT_PERMISSION eq 'yes'}
+						{include file="DetailViewUI.tpl"}
+					{else}
+						{include file="DetailViewFields.tpl"}
+					{/if}
+				{else} 
+					<td class="dvtCellLabel" align=right>&nbsp;</td>
+					<td class="dvtCellInfo" align=left >&nbsp;</td>
+				{/if}
+		{/foreach}
+	   </tr>	
+	   {/foreach}	
+	</table>
+{/foreach}
+{*-- End of Blocks--*} 
+<!-- Entity information(blocks) display - ends -->
+
+									<br>
+
+										<!-- Product Details informations -->
+										{$ASSOCIATED_PRODUCTS}
+
+									</td>
+<!-- The following table is used to display the buttons -->
+								<table border=0 cellspacing=0 cellpadding=0 width=100%>
+			                			   <tr>
+									<td style="padding:10px;border-right:1px dashed #CCCCCC;" width="80%">
+			{if $SinglePane_View eq 'false'}
+<table border=0 cellspacing=0 cellpadding=0 width=100%>
+   {strip}
+   <tr>
+	<td  colspan=4 style="padding:5px">
+		<table border=0 cellspacing=0 cellpadding=0 width=100%>
+                   <tr>
+                        <td>
+				{if $EDIT_DUPLICATE eq 'permitted'}
+				<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="crmbutton small edit" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.module.value='{$MODULE}';this.form.action.value='EditView'" type="submit" name="Edit" value="{$APP.LBL_EDIT_BUTTON_LABEL}">&nbsp;
+				{/if}
+			</td>
+			<td align=right>
+				{if $EDIT_DUPLICATE eq 'permitted'}
+				<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value='true';this.form.module.value='{$MODULE}'; this.form.action.value='EditView'" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}">&nbsp;
+				{/if}
+				{if $DELETE eq 'permitted'}
+				<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="crmbutton small delete" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='index'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}">&nbsp;
+				{/if}
+			</td>
+                   </tr>
+                </table>
+
+		<!-- Commented the buttons in DetailView because these buttons have been given as links
+		{if $MODULE eq 'Quotes' || $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Invoice'}
+			{if $CREATEPDF eq 'permitted'}
+				<input title="Export To PDF" accessKey="Alt+e" class="small" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}'; this.form.module.value='{$MODULE}'; {if $MODULE eq 'SalesOrder'} this.form.action.value='CreateSOPDF'" {else} this.form.action.value='CreatePDF'" {/if} type="submit" name="Export To PDF" value="{$APP.LBL_EXPORT_TO_PDF}">&nbsp;
+			{/if}
+		{/if}
+		{if $MODULE eq 'Quotes'}
+			{if $CONVERTSALESORDER eq 'permitted'}
+				<input title="{$APP.LBL_CONVERTSO_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTSO_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='SalesOrder'; this.form.return_action.value='DetailView'; this.form.convertmode.value='quotetoso';this.form.module.value='SalesOrder'; this.form.action.value='EditView'" type="submit" name="Convert To SalesOrder" value="{$APP.LBL_CONVERTSO_BUTTON_LABEL}">&nbsp;
+			{/if}
+		{/if}
+		{if $MODULE eq 'Potentials' || $MODULE eq 'Quotes' || $MODULE eq 'SalesOrder'}
+			{if $CONVERTINVOICE eq 'permitted'}
+				<input title="{$APP.LBL_CONVERTINVOICE_BUTTON_TITLE}" accessKey="{$APP.LBL_CONVERTINVOICE_BUTTON_KEY}" class="crmbutton small create" onclick="this.form.return_module.value='{$MODULE}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$ID}';this.form.convertmode.value='{$CONVERTMODE}';this.form.module.value='Invoice'; this.form.action.value='EditView'" type="submit" name="Convert To Invoice" value="{$APP.LBL_CONVERTINVOICE_BUTTON_LABEL}">&nbsp;
+			{/if}
+		{/if}
+		-->
+	</td>
+   </tr>
+   {/strip}
+</table>
+{/if}
+</form>
+		<table border=0 cellspacing=0 cellpadding=0 width=100%>
+		  <tr>
+			<td style="border-right:1px dashed #CCCCCC;" width="100%">
+			{if $SinglePane_View eq 'true'}
+				{include file= 'RelatedListNew.tpl'}
+			{/if}
+		</td></tr></table>
+</td></tr></table>
+<!-- Button displayed - finished-->
+									<!-- Inventory Actions - ends -->	
+									<td width=22% valign=top style="padding:10px;">
+										<!-- right side InventoryActions -->
+										{include file="Inventory/InventoryActions.tpl"}
+
+										<br>
+										<!-- To display the Tag Clouds -->
+										<div>
+										      {include file="TagCloudDisplay.tpl"}
+										</div>
+									</td>
+								   </tr>
+								</table>
+							</td>
+						   </tr>
+						</table>
+					<!-- PUBLIC CONTENTS STOPS-->
+					</td>
+					<td align=right valign=top>
+						<img src="{$IMAGE_PATH}showPanelTopRight.gif">
+					</td>
+				   </tr>
+				</table>
+			   </div>
+			</td>
+		   </tr>
+		</table>
+		<!-- Contents - end -->
+
+<script>
+function getTagCloud()
+{ldelim}
+new Ajax.Request(
+        'index.php',
+        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+        method: 'post',
+        postBody: 'module={$MODULE}&action={$MODULE}Ajax&file=TagCloud&ajxaction=GETTAGCLOUD&recordid={$ID}',
+        onComplete: function(response) {ldelim}
+                                $("tagfields").innerHTML=response.responseText;
+                                $("txtbox_tagfields").value ='';
+                        {rdelim}
+        {rdelim}
+);
+{rdelim}
+getTagCloud();
+</script>
+
+	</td>
+   </tr>
+</table>
+<script language="javascript">
+  var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
+  var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
+  var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
+</script>
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryEditView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryEditView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Inventory/InventoryEditView.tpl Tue Nov 14 03:16:10 2006
@@ -1,197 +1,197 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-{*<!-- module header -->*}
-
-<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
-<script type="text/javascript" src="jscalendar/calendar.js"></script>
-<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
-<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
-<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<script type="text/javascript" src="include/js/Inventory.js"></script>
-<script type="text/javascript">
-
-function sensex_info()
-{ldelim}
-        var Ticker = $('tickersymbol').value;
-        if(Ticker!='')
-        {ldelim}
-                $("vtbusy_info").style.display="inline";
-                new Ajax.Request(
-                      'index.php',
-                      {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                                method: 'post',
-                                postBody: 'module={$MODULE}&action=Tickerdetail&tickersymbol='+Ticker,
-                                onComplete: function(response) {ldelim}
-                                        $('autocom').innerHTML = response.responseText;
-                                        $('autocom').style.display="block";
-                                        $("vtbusy_info").style.display="none";
-                                {rdelim}
-                        {rdelim}
-                );
-        {rdelim}
-{rdelim}
-
-</script>
-
-		{include file='Buttons_List1.tpl'}	
-
-{*<!-- Contents -->*}
-<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
-   <tr>
-	<td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-
-	<td class="showPanelBg" valign=top width=100%>
-		{*<!-- PUBLIC CONTENTS STARTS-->*}
-		<div class="small" style="padding:20px">
-		
-			{if $OP_MODE eq 'edit_view'}   
-				<span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} - {$APP.LBL_EDITING} {$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span> <br>
-				{$UPDATEINFO}	 
-			{/if}
-			{if $OP_MODE eq 'create_view'}
-				<span class="lvtHeaderText">{$APP.LBL_CREATING} {$MOD[$SINGLE_MOD]}</span> <br>
-			{/if}
-
-			<hr noshade size=1>
-			<br> 
-		
-			{include file='EditViewHidden.tpl'}
-
-			{*<!-- Account details tabs -->*}
-			<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
-			   <tr>
-				<td>
-					<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
-					   <tr>
-						<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
-                                        	<td class="dvtSelectedCell" align=center nowrap>{$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</td>
-	                                        <td class="dvtTabCache" style="width:10px">&nbsp;</td>
-                	                        <td class="dvtTabCache" style="width:100%">&nbsp;</td>
-					   </tr>
-					</table>
-				</td>
-			   </tr>
-			   <tr>
-				<td valign=top align=left >
-					<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
-					   <tr>
-
-						<td align=left style="padding:10px;border-right:1px dashed #CCCCCC;" width=80%>
-							{*<!-- content cache -->*}
-					
-							<table border=0 cellspacing=0 cellpadding=0 width=100%>
-							   <tr>
-								<td id ="autocom"></td>
-							   </tr>
-							   <tr>
-								<td style="padding:10px">
-								<!-- General details -->
-									<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
-									   <tr>
-										<td  colspan=4 style="padding:5px">
-										   <div align="center">
-											<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save'; displaydeleted(); return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-											<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-										   </div>
-										</td>
-									   </tr>
-
-									   <!-- included to handle the edit fields based on ui types -->
-									   {foreach key=header item=data from=$BLOCKS}
-									      <tr>
-										{if $header== 'Address Information' && ($MODULE == 'Accounts' || $MODULE == 'Contacts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
-                                                                        	<td colspan=2 class="detailedViewHeader">
-	                                                                        <b>{$header}</b></td>
-        	                                                                <td class="detailedViewHeader">
-                	                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
-                        	                                                <td class="detailedViewHeader">
-                                	                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
-                                        	                                {else}
-										<td colspan=4 class="detailedViewHeader">
-											<b>{$header}</b>
-										{/if}
-										</td>
-									      </tr>
-
-										<!-- Handle the ui types display -->
-										{include file="DisplayFields.tpl"}
-
-									      <tr style="height:25px"><td>&nbsp;</td></tr>
-
-									   {/foreach}
-
-
-									   <!-- Added to display the Product Details in Inventory-->
-									   {if $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Invoice'}
-									   <tr>
-										<td colspan=4>
-											{include file="Inventory/ProductDetailsEditView.tpl"}
-										</td>
-									   </tr>
-									   {/if}
-
-									   <tr>
-										<td  colspan=4 style="padding:5px">
-											<div align="center">
-												<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  displaydeleted();return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
-												<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
-											</div>
-										</td>
-									   </tr>
-									</table>
-								</td>
-							   </tr>
-							</table>
-						</td>
-						<!-- Inventory Actions - ends -->
-						<td width=20% valign=top style="padding:10px;">
-							<!-- right side InventoryActions -->
-							{include file="Inventory/InventoryActions.tpl"}
-						</td>
-					   </tr>
-					</table>
-				</td>
-			   </tr>
-			</table>
-		</div>
-	</td>
-   </tr>
-</table>
-</form>
-
-<!-- This div is added to get the left and top values to show the tax details-->
-<div id="tax_container" style="display:none; position:absolute; z-index:1px;"></div>
-
-<script>	
-        var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
-
-        var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
-
-        var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
-
-	var ProductImages=new Array();
-	var count=0;
-	function delRowEmt(imagename)
-	{ldelim}
-		ProductImages[count++]=imagename;
-		multi_selector.current_element.disabled = false;
-		multi_selector.count--;
-	{rdelim}
-	function displaydeleted()
-	{ldelim}
-		if(ProductImages.length > 0)
-			document.EditView.del_file_list.value=ProductImages.join('###');
-	{rdelim}
-</script>
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+{*<!-- module header -->*}
+
+<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
+<script type="text/javascript" src="jscalendar/calendar.js"></script>
+<script type="text/javascript" src="jscalendar/lang/calendar-{$CALENDAR_LANG}.js"></script>
+<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
+<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
+<script type="text/javascript" src="include/js/Inventory.js"></script>
+<script type="text/javascript">
+
+function sensex_info()
+{ldelim}
+        var Ticker = $('tickersymbol').value;
+        if(Ticker!='')
+        {ldelim}
+                $("vtbusy_info").style.display="inline";
+                new Ajax.Request(
+                      'index.php',
+                      {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                                method: 'post',
+                                postBody: 'module={$MODULE}&action=Tickerdetail&tickersymbol='+Ticker,
+                                onComplete: function(response) {ldelim}
+                                        $('autocom').innerHTML = response.responseText;
+                                        $('autocom').style.display="block";
+                                        $("vtbusy_info").style.display="none";
+                                {rdelim}
+                        {rdelim}
+                );
+        {rdelim}
+{rdelim}
+
+</script>
+
+		{include file='Buttons_List1.tpl'}	
+
+{*<!-- Contents -->*}
+<table border=0 cellspacing=0 cellpadding=0 width=98% align=center>
+   <tr>
+	<td valign=top><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+
+	<td class="showPanelBg" valign=top width=100%>
+		{*<!-- PUBLIC CONTENTS STARTS-->*}
+		<div class="small" style="padding:20px">
+		
+			{if $OP_MODE eq 'edit_view'}   
+				<span class="lvtHeaderText"><font color="purple">[ {$ID} ] </font>{$NAME} - {$APP.LBL_EDITING} {$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</span> <br>
+				{$UPDATEINFO}	 
+			{/if}
+			{if $OP_MODE eq 'create_view'}
+				<span class="lvtHeaderText">{$APP.LBL_CREATING} {$MOD[$SINGLE_MOD]}</span> <br>
+			{/if}
+
+			<hr noshade size=1>
+			<br> 
+		
+			{include file='EditViewHidden.tpl'}
+
+			{*<!-- Account details tabs -->*}
+			<table border=0 cellspacing=0 cellpadding=0 width=95% align=center>
+			   <tr>
+				<td>
+					<table border=0 cellspacing=0 cellpadding=3 width=100% class="small">
+					   <tr>
+						<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+                                        	<td class="dvtSelectedCell" align=center nowrap>{$MOD[$SINGLE_MOD]} {$APP.LBL_INFORMATION}</td>
+	                                        <td class="dvtTabCache" style="width:10px">&nbsp;</td>
+                	                        <td class="dvtTabCache" style="width:100%">&nbsp;</td>
+					   </tr>
+					</table>
+				</td>
+			   </tr>
+			   <tr>
+				<td valign=top align=left >
+					<table border=0 cellspacing=0 cellpadding=3 width=100% class="dvtContentSpace">
+					   <tr>
+
+						<td align=left style="padding:10px;border-right:1px dashed #CCCCCC;" width=80%>
+							{*<!-- content cache -->*}
+					
+							<table border=0 cellspacing=0 cellpadding=0 width=100%>
+							   <tr>
+								<td id ="autocom"></td>
+							   </tr>
+							   <tr>
+								<td style="padding:10px">
+								<!-- General details -->
+									<table border=0 cellspacing=0 cellpadding=0 width=100% class="small">
+									   <tr>
+										<td  colspan=4 style="padding:5px">
+										   <div align="center">
+											<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save'; displaydeleted(); return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+											<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+										   </div>
+										</td>
+									   </tr>
+
+									   <!-- included to handle the edit fields based on ui types -->
+									   {foreach key=header item=data from=$BLOCKS}
+									      <tr>
+										{if $header== $MOD.LBL_ADDRESS_INFORMATION && ($MODULE == 'Accounts' || $MODULE == 'Contacts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
+                                                                        	<td colspan=2 class="detailedViewHeader">
+	                                                                        <b>{$header}</b></td>
+        	                                                                <td class="detailedViewHeader">
+                	                                                        <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
+                        	                                                <td class="detailedViewHeader">
+                                	                                        <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
+                                        	                                {else}
+										<td colspan=4 class="detailedViewHeader">
+											<b>{$header}</b>
+										{/if}
+										</td>
+									      </tr>
+
+										<!-- Handle the ui types display -->
+										{include file="DisplayFields.tpl"}
+
+									      <tr style="height:25px"><td>&nbsp;</td></tr>
+
+									   {/foreach}
+
+
+									   <!-- Added to display the Product Details in Inventory-->
+									   {if $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Invoice'}
+									   <tr>
+										<td colspan=4>
+											{include file="Inventory/ProductDetailsEditView.tpl"}
+										</td>
+									   </tr>
+									   {/if}
+
+									   <tr>
+										<td  colspan=4 style="padding:5px">
+											<div align="center">
+												<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="crmbutton small save" onclick="this.form.action.value='Save';  displaydeleted();return validateInventory('{$MODULE}')" type="submit" name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  " style="width:70px" >
+												<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="crmbutton small cancel" onclick="window.history.back()" type="button" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " style="width:70px">
+											</div>
+										</td>
+									   </tr>
+									</table>
+								</td>
+							   </tr>
+							</table>
+						</td>
+						<!-- Inventory Actions - ends -->
+						<td width=20% valign=top style="padding:10px;">
+							<!-- right side InventoryActions -->
+							{include file="Inventory/InventoryActions.tpl"}
+						</td>
+					   </tr>
+					</table>
+				</td>
+			   </tr>
+			</table>
+		</div>
+	</td>
+   </tr>
+</table>
+</form>
+
+<!-- This div is added to get the left and top values to show the tax details-->
+<div id="tax_container" style="display:none; position:absolute; z-index:1px;"></div>
+
+<script>	
+        var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
+
+        var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
+
+        var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
+
+	var ProductImages=new Array();
+	var count=0;
+	function delRowEmt(imagename)
+	{ldelim}
+		ProductImages[count++]=imagename;
+		multi_selector.current_element.disabled = false;
+		multi_selector.count--;
+	{rdelim}
+	function displaydeleted()
+	{ldelim}
+		if(ProductImages.length > 0)
+			document.EditView.del_file_list.value=ProductImages.join('###');
+	{rdelim}
+</script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ListEmailTemplates.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ListEmailTemplates.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ListEmailTemplates.tpl Tue Nov 14 03:16:10 2006
@@ -1,155 +1,192 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<script>
-function massDelete()
-{ldelim}
-        x = document.massdelete.selected_id.length;
-        idstring = "";
-
-        if ( x == undefined)
-        {ldelim}
-
-                if (document.massdelete.selected_id.checked)
-               {ldelim}
-                        document.massdelete.idlist.value=document.massdelete.selected_id.value+';';
-			xx=1;
-                {rdelim}
-                else
-                {ldelim}
-                        alert("Please select at least one entity");
-                        return false;
-                {rdelim}
-        {rdelim}
-        else
-        {ldelim}
-                xx = 0;
-                for(i = 0; i < x ; i++)
-                {ldelim}
-                        if(document.massdelete.selected_id[i].checked)
-                        {ldelim}
-                                idstring = document.massdelete.selected_id[i].value +";"+idstring
-                        xx++
-                        {rdelim}
-                {rdelim}
-                if (xx != 0)
-                {ldelim}
-                        document.massdelete.idlist.value=idstring;
-                {rdelim}
-               else
-                {ldelim}
-                        alert("Please select at least one entity");
-                        return false;
-                {rdelim}
-       {rdelim}
-		if(confirm("Are you sure you want to delete the selected "+xx+" records ?"))
-		{ldelim}
-	        document.massdelete.action="index.php?module=Users&action=deleteemailtemplate&return_module=Users&return_action=listemailtemplates";
-		{rdelim}
-		else
-		{ldelim}
-			return false;
-		{rdelim}
-
-{rdelim}
-</script>
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-<br>
-	<div align=center>
-	
-			{include file='SetMenu.tpl'}
-
-				<!-- DISPLAY -->
-				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
-				<form  name="massdelete" method="POST">
-	    			<input name="idlist" type="hidden">
-    				<input name="module" type="hidden" value="Users">
-    				<input name="action" type="hidden" value="deleteemailtemplate">
-				<tr>
-					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}ViewTemplate.gif" width="45" height="60" border=0></td>
-					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$UMOD.LBL_EMAIL_TEMPLATES} </b></td>
-				</tr>
-				<tr>
-					<td valign=top class="small">{$UMOD.LBL_EMAIL_TEMPLATE_DESC}</td>
-				</tr>
-				</table>
-				
-				<br>
-				<table border=0 cellspacing=0 cellpadding=10 width=100% >
-				<tr>
-				<td>
-				
-					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-					<tr>
-						<td class="big"><strong>{$UMOD.LBL_EMAIL_TEMPLATES}</strong></td>
-						<td class="small" align=right>&nbsp;
-						</td>
-					</tr>
-					</table>
-					
-					<table border=0 cellspacing=0 cellpadding=5 width=100% class="listTableTopButtons">
-					<tr>
-						<td class=small><input type="submit" value="{$UMOD.LBL_DELETE}" onclick="return massDelete();" class="crmButton delete small"></td>
-						<td class=small align=right><input class="crmButton create small" type="submit" value="{$UMOD.LBL_NEW_TEMPLATE}" name="profile"  class="classBtn" onclick="this.form.action.value='createemailtemplate';this.form.parenttab.value='Settings';"></td>
-					</tr>
-					</table>
-					<table border="0" cellspacing="0" cellpadding="5" width="100%" class="listTable">
-					<tr>
-						<td width="2%" class="colHeader small">#</td>
-						<td width="3%" class="colHeader small">{$UMOD.LBL_LIST_SELECT}</td>
-						<td width="25%" class="colHeader small">{$UMOD.LBL_EMAIL_TEMPLATE}</td>
-						<td width="50%" class="colHeader small">{$UMOD.LBL_DESCRIPTION}</td>
-					        <td width="20%" class="colHeader small">{$UMOD.LBL_TEMPLATE_TOOLS}</td>
-					</tr>
-					{foreach name=emailtemplate item=template from=$TEMPLATES}
-					<tr>
-						<td class="listTableRow small" valign=top>{$smarty.foreach.emailtemplate.iteration}</td>
-						<td class="listTableRow small" valign=top><input type="checkbox" name="selected_id" value="{$template.templateid}" onClick=toggleSelectAll(this.name,"selectall") class=small></td>
-						<td class="listTableRow small" valign=top>
-							<a href="index.php?module=Users&action=detailviewemailtemplate&parenttab=Settings&templateid={$template.templateid}" ><b>{$template.templatename}</b></a>
-						</td>
-						<td class="listTableRow small" valign=top>{$template.description}&nbsp;</td>
-					        <td class="listTableRow small" valign=top>
-							<a href="index.php?module=Users&action=detailviewemailtemplate&parenttab=Settings&templateid={$template.templateid}">{$UMOD.LNK_SAMPLE_EMAIL}</a>
-						</td>
-					</tr>
-					{/foreach}	
-					</table>
-					<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr>
-					  <td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td>
-					</tr>
-					</table>
-				</td>
-				</tr>
-				</table>
-			
-			
-			
-			</td>
-			</tr>
-			</table>
-		</td>
-	</tr>
-	</form>
-	</table>
-		
-	</div>
-</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody>
-</table>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<script>
+function ifselected()
+{ldelim}
+  
+      
+      var sel =document.massdelete.selected_id.length;
+      var returnval=false;
+      
+     for(i=0; i < sel; i++)
+     {ldelim}
+     
+      if(document.massdelete.selected_id[i].checked == true)
+        {ldelim}
+            returnval=true;
+            break;
+        {rdelim}
+        
+      {rdelim}
+      
+      
+          if(returnval==true)
+           {ldelim}
+               document.getElementById("myProfile").style.display="none";
+           {rdelim}
+          else
+           {ldelim}
+              document.getElementById("myProfile").style.display="block";
+          {rdelim}
+    	
+{rdelim}
+
+
+function massDelete()
+{ldelim}
+        
+        x = document.massdelete.selected_id.length;
+        idstring = "";
+
+        if ( x == undefined)
+        {ldelim}
+
+                if (document.massdelete.selected_id.checked)
+               {ldelim}
+                        document.massdelete.idlist.value=document.massdelete.selected_id.value+';';
+                          
+                        
+			xx=1;
+                {rdelim}
+                else
+                {ldelim}
+                         document.massdelete.profile.style.display="none";
+                        alert("Please select at least one entity");
+                        
+                        return false;
+                {rdelim}
+        {rdelim}
+        else
+        {ldelim}
+                xx = 0;
+                for(i = 0; i < x ; i++)
+                {ldelim}
+                        if(document.massdelete.selected_id[i].checked)
+                        {ldelim}
+                                idstring = document.massdelete.selected_id[i].value +";"+idstring
+                        xx++
+                        {rdelim}
+                {rdelim}
+                if (xx != 0)
+                {ldelim}
+                        document.massdelete.idlist.value=idstring;
+                {rdelim}
+               else
+                {ldelim}
+                        alert("Please select at least one entity");
+                        return false;
+                {rdelim}
+       {rdelim}
+		if(confirm("Are you sure you want to delete the selected "+xx+" records ?"))
+		{ldelim}
+	        document.massdelete.action="index.php?module=Users&action=deleteemailtemplate&return_module=Users&return_action=listemailtemplates";
+		{rdelim}
+		else
+		{ldelim}
+			return false;
+		{rdelim}
+
+{rdelim}
+</script>
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+<br>
+	<div align=center>
+	
+			{include file='SetMenu.tpl'}
+
+				<!-- DISPLAY -->
+				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
+				<form  name="massdelete" method="POST">
+	    			<input name="idlist" type="hidden">
+    				<input name="module" type="hidden" value="Users">
+    				<input name="action" type="hidden" value="deleteemailtemplate">
+				<tr>
+					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}ViewTemplate.gif" width="45" height="60" border=0></td>
+					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$UMOD.LBL_EMAIL_TEMPLATES} </b></td>
+				</tr>
+				<tr>
+					<td valign=top class="small">{$UMOD.LBL_EMAIL_TEMPLATE_DESC}</td>
+				</tr>
+				</table>
+				
+				<br>
+				<table border=0 cellspacing=0 cellpadding=10 width=100% >
+				<tr>
+				<td>
+				
+					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+					<tr>
+						<td class="big"><strong>{$UMOD.LBL_EMAIL_TEMPLATES}</strong></td>
+						<td class="small" align=right>&nbsp;
+						</td>
+					</tr>
+					</table>
+					
+					<table border=0 cellspacing=0 cellpadding=5 width=100% class="listTableTopButtons">
+					<tr>
+						<td class=small><input type="submit" value="{$UMOD.LBL_DELETE}" onclick="return massDelete();" class="crmButton delete small"></td>
+						<td class=small align=right id="new_template"><div id = "myProfile"><input class="crmButton create small" type="submit" value="{$UMOD.LBL_NEW_TEMPLATE}" name="profile"  class="classBtn" onclick="this.form.action.value='createemailtemplate';this.form.parenttab.value='Settings';"></div></td>
+					</tr>
+					</table>
+					<table border="0" cellspacing="0" cellpadding="5" width="100%" class="listTable">
+					<tr>
+						<td width="2%" class="colHeader small">#</td>
+						<td width="3%" class="colHeader small">{$UMOD.LBL_LIST_SELECT}</td>
+						<td width="25%" class="colHeader small">{$UMOD.LBL_EMAIL_TEMPLATE}</td>
+						<td width="50%" class="colHeader small">{$UMOD.LBL_DESCRIPTION}</td>
+					        <td width="20%" class="colHeader small">{$UMOD.LBL_TEMPLATE_TOOLS}</td>
+					</tr>
+					{foreach name=emailtemplate item=template from=$TEMPLATES}
+					<tr>
+						<td class="listTableRow small" valign=top>{$smarty.foreach.emailtemplate.iteration}</td>
+						<td class="listTableRow small" valign=top><input type="checkbox" name="selected_id" value="{$template.templateid}" onClick="ifselected(); " class=small></td>
+						<td class="listTableRow small" valign=top>
+							<a href="index.php?module=Users&action=detailviewemailtemplate&parenttab=Settings&templateid={$template.templateid}" ><b>{$template.templatename}</b></a>
+						</td>
+						<td class="listTableRow small" valign=top>{$template.description}&nbsp;</td>
+					        <td class="listTableRow small" valign=top>
+							<a href="index.php?module=Users&action=detailviewemailtemplate&parenttab=Settings&templateid={$template.templateid}">{$UMOD.LNK_SAMPLE_EMAIL}</a>
+						</td>
+					</tr>
+					{/foreach}	
+					</table>
+					<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr>
+					  <td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td>
+					</tr>
+					</table>
+				</td>
+				</tr>
+				</table>
+			
+			
+			
+			</td>
+			</tr>
+			</table>
+		</td>
+	</tr>
+	</form>
+	</table>
+		
+	</div>
+</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody>
+</table>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ListRoles.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ListRoles.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ListRoles.tpl Tue Nov 14 03:16:10 2006
@@ -1,270 +1,270 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<style type="text/css">
-a.x {ldelim}
-		color:black;
-		text-align:center;
-		text-decoration:none;
-		padding:5px;
-		font-weight:bold;
-{rdelim}
-	
-a.x:hover {ldelim}
-		color:#333333;
-		text-decoration:underline;
-		font-weight:bold;
-{rdelim}
-
-ul {ldelim}color:black;{rdelim}	 
-	
-.drag_Element{ldelim}
-	position:relative;
-	left:0px;
-	top:0px;
-	padding-left:5px;
-	padding-right:5px;
-	border:0px dashed #CCCCCC;
-	visibility:hidden;
-{rdelim}
-
-#Drag_content{ldelim}
-	position:absolute;
-	left:0px;
-	top:0px;
-	padding-left:5px;
-	padding-right:5px;
-	background-color:#000066;
-	color:#FFFFFF;
-	border:1px solid #CCCCCC;
-	font-weight:bold;
-	display:none;
-{rdelim}
-</style>
-<script>
- if(!e)
-  window.captureEvents(Event.MOUSEMOVE);
-
-//  window.onmousemove= displayCoords;
-//  window.onclick = fnRevert;
-  
-   function displayCoords(event) 
-	 {ldelim}
-				var move_Element = document.getElementById('Drag_content').style;
-				if(!event){ldelim}
-						move_Element.left = e.pageX +'px' ;
-						move_Element.top = e.pageY+10 + 'px';	
-				{rdelim}
-				else{ldelim}
-						move_Element.left = event.clientX +'px' ;
-					    move_Element.top = event.clientY+10 + 'px';	
-				{rdelim}
-	{rdelim}
-  
-	  function fnRevert(e)
-	  {ldelim}
-		  	if(e.button == 2){ldelim}
-				document.getElementById('Drag_content').style.display = 'none';
-				hideAll = false;
-				parentId = "Head";
-	    		parentName = "DEPARTMENTS";
-			    childId ="NULL";
-	    		childName = "NULL";
-			{rdelim}
-	{rdelim}
-
-</script>
-
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-	<div align=center>
-<br>
-	
-				{include file="SetMenu.tpl"}
-				<!-- DISPLAY -->
-				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
-				<tr>
-					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}ico-roles.gif" alt="Roles" width="48" height="48" border=0 title="Roles"></td>
-					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$MOD.LBL_ROLES}</b></td>
-				</tr>
-				<tr>
-					<td valign=top class="small">{$MOD.LBL_ROLE_DESCRIPTION}</td>
-				</tr>
-				</table>
-				
-				<br>
-				<table border=0 cellspacing=0 cellpadding=10 width=100% >
-				<tr>
-				<td>
-				
-					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-					<tr>
-						<td class="big"><strong>{$MOD.LBL_ROLE_HIERARCHY_TREE}</strong></td>
-						<td class="small" align=right>&nbsp;</td>
-					</tr>
-					</table>
-
-					<div id='RoleTreeFull'  onMouseMove="displayCoords(event)"> 
-                			        {include file='RoleTree.tpl'}
-		                	</div>
-
-{*					<table border=0 cellspacing=0 cellpadding=20 width=100% >
-					<tr>
-						<td>
-							<!-- Home node -->
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeHome.gif"></td><td class="small">&nbsp;<strong>Organization</strong></td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Administrator</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">CEO</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Manager - Sales</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeNorthSouth.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Asst Manager - Sales</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Manager - Products</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeNorthSouth.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Asst Manager - Products</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Manager - Office</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeGap.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Asst Manager - Office</td><tr></table>
-							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">CFO</td><tr></table>
-						</td>
-					</tr>
-					</table> *}
-					
-					
-					
-					
-					<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr><td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
-					</table>
-				</td>
-				</tr>
-				</table>
-			
-			
-			
-			</td>
-			</tr>
-			</table>
-		</td>
-	</tr>
-	</table>
-		
-	</div>
-
-</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody>
-</table>
-	<div id="Drag_content">&nbsp;</div>
-
-<script language="javascript" type="text/javascript">
-	var hideAll = false;
-	var parentId = "";
-	var parentName = "";
-	var childId ="NULL";
-	var childName = "NULL";
-
-		
-	
-	 function get_parent_ID(obj,currObj)
-	 {ldelim}
-			var leftSide = findPosX(obj);
-    			var topSide = findPosY(obj);
-			var move_Element = document.getElementById('Drag_content');
-		 	childName  = document.getElementById(currObj).innerHTML;
-			childId = currObj;
-			move_Element.innerHTML = childName;
-			move_Element.style.left = leftSide + 15 + 'px';
-			move_Element.style.top = topSide + 15+ 'px';
-			move_Element.style.display = 'block';
-			hideAll = true;	
-	{rdelim}
-	
-	function put_child_ID(currObj)
-	{ldelim}
-			var move_Element = $('Drag_content');
-	 		parentName  = $(currObj).innerHTML;
-			parentId = currObj;
-			move_Element.style.display = 'none';
-			hideAll = false;	
-			if(childId == "NULL")
-			{ldelim}
-//				alert("Please Select the Node");
-				parentId = parentId.replace(/user_/gi,'');
-				window.location.href="index.php?module=Users&action=RoleDetailView&parenttab=Settings&roleid="+parentId;
-			{rdelim}
-			else
-			{ldelim}
-				childId = childId.replace(/user_/gi,'');
-				parentId = parentId.replace(/user_/gi,'');
-				new Ajax.Request(
-  					'index.php',
-				        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-					        method: 'post',
-					        postBody: 'module=Users&action=UsersAjax&file=RoleDragDrop&ajax=true&parentId='+parentId+'&childId='+childId,
-						onComplete: function(response) {ldelim}
-							if(response.responseText != 'You cannot move a Parent Node under a Child Node')
-							{ldelim}
-						                $('RoleTreeFull').innerHTML=response.responseText;
-						                hideAll = false;
-							        parentId = "";
-						                parentName = "";
-						                childId ="NULL";
-								childName = "NULL";
-						        {rdelim}
-						        else
-						                alert(response.responseText);
-			                        {rdelim}
-				        {rdelim}
-				);
-			{rdelim}
-	{rdelim}
-
-	function fnVisible(Obj)
-	{ldelim}
-			if(!hideAll)
-				document.getElementById(Obj).style.visibility = 'visible';
-	{rdelim}
-
-	function fnInVisible(Obj)
-	{ldelim}
-		document.getElementById(Obj).style.visibility = 'hidden';
-	{rdelim}
-
-	
-
-
-function showhide(argg,imgId)
-{ldelim}
-	var harray=argg.split(",");
-	var harrlen = harray.length;
-	var i;
-	for(i=0; i<harrlen; i++)
-	{ldelim}
-			var x=document.getElementById(harray[i]).style;
-        	if (x.display=="none")
-        	{ldelim}
-            		x.display="block";
-					//document.all[imgId].src = "{$IMAGE_PATH}minus.gif";   By Ela	
-        	{rdelim}
-        	else
-			{ldelim}
-            			x.display="none";
-						//document.all[imgId].src = "{$IMAGE_PATH}plus.gif"; By Ela
-            {rdelim}
-	{rdelim}
-{rdelim}
-
-
-
-</script>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<style type="text/css">
+a.x {ldelim}
+		color:black;
+		text-align:center;
+		text-decoration:none;
+		padding:5px;
+		font-weight:bold;
+{rdelim}
+	
+a.x:hover {ldelim}
+		color:#333333;
+		text-decoration:underline;
+		font-weight:bold;
+{rdelim}
+
+ul {ldelim}color:black;{rdelim}	 
+	
+.drag_Element{ldelim}
+	position:relative;
+	left:0px;
+	top:0px;
+	padding-left:5px;
+	padding-right:5px;
+	border:0px dashed #CCCCCC;
+	visibility:hidden;
+{rdelim}
+
+#Drag_content{ldelim}
+	position:absolute;
+	left:0px;
+	top:0px;
+	padding-left:5px;
+	padding-right:5px;
+	background-color:#000066;
+	color:#FFFFFF;
+	border:1px solid #CCCCCC;
+	font-weight:bold;
+	display:none;
+{rdelim}
+</style>
+<script>
+ if(!e)
+  window.captureEvents(Event.MOUSEMOVE);
+
+//  window.onmousemove= displayCoords;
+//  window.onclick = fnRevert;
+  
+   function displayCoords(event) 
+	 {ldelim}
+				var move_Element = document.getElementById('Drag_content').style;
+				if(!event){ldelim}
+						move_Element.left = e.pageX +'px' ;
+						move_Element.top = e.pageY+10 + 'px';	
+				{rdelim}
+				else{ldelim}
+						move_Element.left = event.clientX +'px' ;
+					    move_Element.top = event.clientY+10 + 'px';	
+				{rdelim}
+	{rdelim}
+  
+	  function fnRevert(e)
+	  {ldelim}
+		  	if(e.button == 2){ldelim}
+				document.getElementById('Drag_content').style.display = 'none';
+				hideAll = false;
+				parentId = "Head";
+	    		parentName = "DEPARTMENTS";
+			    childId ="NULL";
+	    		childName = "NULL";
+			{rdelim}
+	{rdelim}
+
+</script>
+
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+	<div align=center>
+<br>
+	
+				{include file="SetMenu.tpl"}
+				<!-- DISPLAY -->
+				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
+				<tr>
+					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}ico-roles.gif" alt="Roles" width="48" height="48" border=0 title="Roles"></td>
+					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$MOD.LBL_ROLES}</b></td>
+				</tr>
+				<tr>
+					<td valign=top class="small">{$MOD.LBL_ROLE_DESCRIPTION}</td>
+				</tr>
+				</table>
+				
+				<br>
+				<table border=0 cellspacing=0 cellpadding=10 width=100% >
+				<tr>
+				<td>
+				
+					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+					<tr>
+						<td class="big"><strong>{$MOD.LBL_ROLE_HIERARCHY_TREE}</strong></td>
+						<td class="small" align=right>&nbsp;</td>
+					</tr>
+					</table>
+
+					<div id='RoleTreeFull'  onMouseMove="displayCoords(event)"> 
+                			        {include file='RoleTree.tpl'}
+		                	</div>
+
+{*					<table border=0 cellspacing=0 cellpadding=20 width=100% >
+					<tr>
+						<td>
+							<!-- Home node -->
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeHome.gif"></td><td class="small">&nbsp;<strong>Organization</strong></td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Administrator</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">CEO</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Manager - Sales</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeNorthSouth.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Asst Manager - Sales</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeExSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Manager - Products</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeNorthSouth.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Asst Manager - Products</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Manager - Office</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeNorthSouth.gif"><img src="images/treeGap.gif"><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">Asst Manager - Office</td><tr></table>
+							<table cellspacing=0 cellpadding=0 class="treeTable1"><tr><td><img src="images/treeSubNode.gif"><img src="images/treePaper.gif"></td><td class="small">CFO</td><tr></table>
+						</td>
+					</tr>
+					</table> *}
+					
+					
+					
+					
+					<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr><td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
+					</table>
+				</td>
+				</tr>
+				</table>
+			
+			
+			
+			</td>
+			</tr>
+			</table>
+		</td>
+	</tr>
+	</table>
+		
+	</div>
+
+</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody>
+</table>
+	<div id="Drag_content">&nbsp;</div>
+
+<script language="javascript" type="text/javascript">
+	var hideAll = false;
+	var parentId = "";
+	var parentName = "";
+	var childId ="NULL";
+	var childName = "NULL";
+
+		
+	
+	 function get_parent_ID(obj,currObj)
+	 {ldelim}
+			var leftSide = findPosX(obj);
+    			var topSide = findPosY(obj);
+			var move_Element = document.getElementById('Drag_content');
+		 	childName  = document.getElementById(currObj).innerHTML;
+			childId = currObj;
+			move_Element.innerHTML = childName;
+			move_Element.style.left = leftSide + 15 + 'px';
+			move_Element.style.top = topSide + 15+ 'px';
+			move_Element.style.display = 'block';
+			hideAll = true;	
+	{rdelim}
+	
+	function put_child_ID(currObj)
+	{ldelim}
+			var move_Element = $('Drag_content');
+	 		parentName  = $(currObj).innerHTML;
+			parentId = currObj;
+			move_Element.style.display = 'none';
+			hideAll = false;	
+			if(childId == "NULL")
+			{ldelim}
+//				alert("Please Select the Node");
+				parentId = parentId.replace(/user_/gi,'');
+				window.location.href="index.php?module=Users&action=RoleDetailView&parenttab=Settings&roleid="+parentId;
+			{rdelim}
+			else
+			{ldelim}
+				childId = childId.replace(/user_/gi,'');
+				parentId = parentId.replace(/user_/gi,'');
+				new Ajax.Request(
+  					'index.php',
+				        {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+					        method: 'post',
+					        postBody: 'module=Users&action=UsersAjax&file=RoleDragDrop&ajax=true&parentId='+parentId+'&childId='+childId,
+						onComplete: function(response) {ldelim}
+							if(response.responseText != 'You cannot move a Parent Node under a Child Node')
+							{ldelim}
+						                $('RoleTreeFull').innerHTML=response.responseText;
+						                hideAll = false;
+							        parentId = "";
+						                parentName = "";
+						                childId ="NULL";
+								childName = "NULL";
+						        {rdelim}
+						        else
+						                alert(response.responseText);
+			                        {rdelim}
+				        {rdelim}
+				);
+			{rdelim}
+	{rdelim}
+
+	function fnVisible(Obj)
+	{ldelim}
+			if(!hideAll)
+				document.getElementById(Obj).style.visibility = 'visible';
+	{rdelim}
+
+	function fnInVisible(Obj)
+	{ldelim}
+		document.getElementById(Obj).style.visibility = 'hidden';
+	{rdelim}
+
+	
+
+
+function showhide(argg,imgId)
+{ldelim}
+	var harray=argg.split(",");
+	var harrlen = harray.length;	
+	var i;
+	for(i=0; i<harrlen; i++)
+	{ldelim}
+		var x=document.getElementById(harray[i]).style;
+        	if (x.display=="none")
+        	{ldelim}
+           		x.display="block";
+			document.getElementById(imgId).src="{$IMAGE_PATH}minus.gif";
+         	{rdelim}
+        	else
+		{ldelim}
+			x.display="none";
+			document.getElementById(imgId).src="{$IMAGE_PATH}plus.gif";
+		{rdelim}
+	{rdelim}
+{rdelim}
+
+
+
+</script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ListView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ListView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ListView.tpl Tue Nov 14 03:16:10 2006
@@ -21,7 +21,20 @@
 {/if}
 <script language="JavaScript" type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
 <script language="javascript">
-
+function checkgroup()
+{ldelim}
+  if(document.change_ownerform_name.user_lead_owner[1].checked)
+  {ldelim}
+  document.change_ownerform_name.lead_group_owner.style.display = "block";
+  document.change_ownerform_name.lead_owner.style.display = "none";
+  {rdelim}
+  else
+  {ldelim}
+  document.change_ownerform_name.lead_owner.style.display = "block";
+  document.change_ownerform_name.lead_group_owner.style.display = "none";
+  {rdelim}    
+  
+{rdelim}
 function callSearch(searchtype)
 {ldelim}
 	for(i=1;i<=26;i++)
@@ -258,18 +271,24 @@
 		<td class=small >
 		
 			<!-- popup specific content fill in starts -->
-
+      <form name="change_ownerform_name">
 			<table border=0 celspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
 				<tr>
 					<td width="50%"><b>{$APP.LBL_TRANSFER_OWNERSHIP}</b></td>
 					<td width="2%"><b>:</b></td>
 					<td width="48%">
+					<input type = "radio" name = "user_lead_owner"  onclick=checkgroup(); checked>{$APP.LBL_USER}&nbsp;
+					<input type = "radio" name = "user_lead_owner" onclick=checkgroup(); >{$APP.LBL_GROUP}<br>
 					<select name="lead_owner" id="lead_owner" class="detailedViewTextBox">
 					{$CHANGE_OWNER}
+					</select>
+					<select name="lead_group_owner" id="lead_group_owner" class="detailedViewTextBox" style="display:none;">
+					{$CHANGE_GROUP_OWNER}
 					</select>
 					</td>
 				</tr>
 			</table>
+			</form>
 		</td>
 	</tr>
 </table>
@@ -342,13 +361,22 @@
 	}
 	else if(statusname == 'owner')
 	{
-		fninvsh('changeowner');
-		var url='&user_id='+document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
-		
-{/literal}
-		var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
-{literal}
-
+	   if(document.change_ownerform_name.user_lead_owner[0].checked)
+	   {
+		    fninvsh('changeowner');
+		    var url='&user_id='+document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
+		    {/literal}
+		        var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
+		    {literal}
+     }
+    else
+    {
+        fninvsh('changeowner');
+		    var url='&group_id='+document.getElementById('lead_group_owner').options[document.getElementById('lead_group_owner').options.selectedIndex].value;
+	       {/literal}
+		        var urlstring ="module=Users&action=updateLeadDBStatus&return_module={$MODULE}"+url+"&viewname="+viewid+"&idlist="+idstring;
+        {literal}
+    }
 	}
 	new Ajax.Request(
                 'index.php',

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/MigrationStep1.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/MigrationStep1.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/MigrationStep1.tpl Tue Nov 14 03:16:10 2006
@@ -1,383 +1,389 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-
-
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
-
-<form name="Migration" method="POST" action="index.php" enctype="multipart/form-data">
-<input type="hidden" name="module" value="Migration">
-<input type="hidden" name="action" value="MigrationCheck">
-<input type="hidden" name="migration_option" value="">
-<input type="hidden" name="parenttab" value="Settings">
-<input type="hidden" id="getmysqlpath" name="getmysqlpath" value="{$GET_MYSQL_PATH}">
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%" class="small">
-   <tr>
-	<td class="showPanelBg" valign="top" width="95%"  style="padding-left:20px; "><br />
-		<span class="lvtHeaderText"> {$MOD.LBL_SETTINGS} &gt; {$MOD.LBL_UPGRADE_VTIGER}</span>
-		<hr noshade="noshade" size="1" />
-	</td>
-	<td width="5%" class="showPanelBg">&nbsp;</td>
-   </tr>
-   <tr>
-	<td width="98%" style="padding-left:20px;" valign="top">
-		<!-- module Select Table -->
-		<table width="95%"  border="0" cellspacing="0" cellpadding="0" align="center" class="mailClient">
-		   <tr>
-			<td class="mailClientBg" width="7"></td>
-			<td class="mailClientBg" style="padding-left:10px;padding-top:10px;vertical-align:top;">
-				<table width="100%"  border="0" cellpadding="5" cellspacing="0" class="small">
-				   <tr>
-					<td width="10%"><img src="{$IMAGE_PATH}migrate.gif" align="absmiddle"/></td>
-					<td width="90%">
-						<span class="genHeaderBig">{$MOD.LBL_UPGRADE_VTIGER}</span><br />
-						({$MOD.LBL_UPGRADE_FROM_VTIGER_423})
-					</td>
-				   </tr>
-					   <tr>
-					<td colspan="2" class="hdrNameBg">
-						<span class="genHeaderGray">{$MOD.LBL_STEP} 1 : </span>
-				  		<span class="genHeaderSmall">{$MOD.LBL_SELECT_SOURCE}</span><br />
-						{$MOD.LBL_STEP1_DESC}<br /><br />
-					</td>
-				   </tr>
-				   <tr bgcolor="#FFFFFF">
-					<td align="right" valign="top">
-						<input type="radio" name="radio" id="db_details" value="db_details" onclick="fnChangeMigrate()" "{$DB_DETAILS_CHECKED}" />
-					</td>
-					<td>
-						<b>{$MOD.LBL_RADIO_BUTTON1_TEXT}</b><br /><br />
-						<b>{$MOD.LBL_NOTE_TITLE}</b> {$MOD.LBL_RADIO_BUTTON1_DESC}
-					</td>
-				   </tr>
-				   <tr><td colspan="2" bgcolor="#FFFFFF" height="10"></td></tr>
-				   <tr bgcolor="#FFFFFF">
-					<td align="right" valign="top">
-						<input type="radio" name="radio" id="dump_details" value="dump_details" onclick="fnChangeMigrate()" "{$DUMP_DETAILS_CHECKED}"/>
-					</td>
-					<td>
-						<b>{$MOD.LBL_RADIO_BUTTON2_TEXT}</b><br /><br />
-						<b>{$MOD.LBL_NOTE_TITLE}</b> {$MOD.LBL_RADIO_BUTTON2_DESC}
-					</td>
-				   </tr>
-				   <tr><td colspan="2" bgcolor="#FFFFFF" height="10"></td></tr>
-				   <tr bgcolor="#FFFFFF">
-					<td align="right" valign="top">
-						<input type="radio" name="radio" id="alter_db_details" value="alter_db_details" onclick="fnChangeMigrate()" "{$ALTER_DB_DETAILS_CHECKED}"/>
-					</td>
-					<td>
-						<b>{$MOD.LBL_RADIO_BUTTON3_TEXT}</b><br /><br /><b>{$MOD.LBL_NOTE_TITLE}</b> {$MOD.LBL_RADIO_BUTTON3_DESC}
-					</td>
-				   </tr>
-				   <tr><td colspan="2" bgcolor="#FFFFFF" height="10"></td></tr>
-
-				   <tr><td colspan="2" height="10"></td></tr>
-				   <tr>
-					<td colspan="2" class="hdrNameBg">
-
-
-						<!-- OPTION 1 -->
-						<div id="mnuTab" style="display:{$SHOW_DB_DETAILS}">
-							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
-							   <tr >
-								<td colspan="2">
-									<span class="genHeaderGray">{$MOD.LBL_STEP} 2 : </span>
-									<span class="genHeaderSmall">{$MOD.LBL_HOST_DB_ACCESS_DETAILS}</span><br /><br />
-								</td>
-							   </tr>
-							   <tr>
-								<td width="30%" align="right">{$MOD.LBL_SOURCE_HOST_NAME}</td>
-								<td width="70%"><input type="text" name="old_host_name" class="importBox" value="{$OLD_HOST_NAME}" /></td>
-							   </tr>
-							   <tr>
-								<td align="right">{$MOD.LBL_SOURCE_MYSQL_PORT_NO}</td>
-								<td><input type="text" name="old_port_no" class="importBox" value="{$OLD_PORT_NO}" /></td>
-							   </tr>
-							   <tr>
-								<td align="right">{$MOD.LBL_SOURCE_MYSQL_USER_NAME}</td>
-								<td><input type="text" name="old_mysql_username" class="importBox" value="{$OLD_MYSQL_USERNAME}" /></td>
-							   </tr>
-							   <tr>
-								<td align="right">{$MOD.LBL_SOURCE_MYSQL_PASSWORD}</td>
-								<td><input type="text" name="old_mysql_password" class="importBox" value="{$OLD_MYSQL_PASSWORD}" /></td>
-							   </tr>
-							   <tr>
-								<td align="right">{$MOD.LBL_SOURCE_DB_NAME}</td>
-								<td><input type="text" name="old_dbname" class="importBox" value="{$OLD_DBNAME}" /></td>
-							   </tr>
-							</table>
-						</div>
-
-						<!-- OPTION 2 -->
-						<div id="mnuTab1" style="display:{$SHOW_DUMP_DETAILS}">
-							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
-							   <tr >
-								<td colspan="2">
-									<span class="genHeaderGray">{$MOD.LBL_STEP} 2 : </span>
-									<span class="genHeaderSmall">{$MOD.LBL_LOCATE_DB_DUMP_FILE}</span><br /><br />
-								</td>
-							   </tr>
-							   <tr>
-								<td width="10%">&nbsp;</td>
-								<td width="90%">
-									{$MOD.LBL_DUMP_FILE_LOCATION}
-									<input type="file" name="old_dump_filename" class="txtBox" />
-								</td>
-							   </tr>
-							   <tr><td colspan="2" height="10"></td></tr>
-							   <tr bgcolor="#FFFFFF">
-								<td align="right" valign="top"><b>{$MOD.LBL_NOTE_TITLE}</b></td>
-								<td>{$MOD.LBL_NOTES_DUMP_PROCESS}</td>
-							   </tr>
-							</table>
-						</div>
-
-
-						<!-- OPTION 3 -->
-						<div id="mnuTab2" style="display:{$SHOW_ALTER_DB_DETAILS}">
-							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
-							   <tr>
-								<td colspan="3">
-									<span class="genHeaderGray">{$MOD.LBL_STEP} 2 : </span>
-									<span class="genHeaderSmall">{$MOD.LBL_HOST_DB_ACCESS_DETAILS}</span><br /><br />
-								</td>
-							   </tr>
-							   <tr>
-								<td width="5%">&nbsp;</td>
-								<td width="20%" align="right">{$MOD.LBL_MYSQL_HOST_NAME_IP}</td>
-								<td width="75%"><input type="text" name="alter_old_host_name" class="importBox" value="{$ALTER_OLD_HOST_NAME}" /></td>
-							   </tr>
-							   <tr>
-								<td>&nbsp;</td>
-								<td align="right">{$MOD.LBL_MYSQL_PORT}</td>
-								<td><input type="text" name="alter_old_port_no" class="importBox" value="{$ALTER_OLD_PORT_NO}" /></td>
-							   </tr>
-							   <tr>
-								<td>&nbsp;</td>
-								<td align="right">{$MOD.LBL_MYSQL_USER_NAME}</td>
-								<td><input type="text" name="alter_old_mysql_username" class="importBox" value="{$ALTER_OLD_MYSQL_USERNAME}" /></td>
-							   </tr>
-							   <tr>
-								<td>&nbsp;</td>
-								<td align="right">{$MOD.LBL_MYSQL_PASSWORD}</td>
-								<td><input type="text" name="alter_old_mysql_password" class="importBox" value="{$ALTER_OLD_MYSQL_PASSWORD}" /></td>
-							   </tr>
-							   <tr>
-								<td>&nbsp;</td>
-								<td align="right">{$MOD.LBL_DB_NAME}</td>
-								<td><input type="text" name="alter_old_dbname" class="importBox" value="{$ALTER_OLD_DBNAME}" /></td>
-							   </tr>
-							   <tr><td colspan="3" height="10"></td></tr>
-							   <tr bgcolor="#FFFFFF">
-								<td align="right" valign="top"><b>{$MOD.LBL_NOTE_TITLE}</b></td>
-								<td width="90%" colspan="2">
-
-									{$MOD.LBL_RADIO_BUTTON3_PROCESS}
-								</td>
-							   </tr>
-
-							</table>
-						</div>
-
-
-					</td>
-				   </tr>
-
-				   <!-- this if condition is added to display the text box to get the mysql server path -->
-				   {if $GET_MYSQL_PATH eq 1}
-				   <tr><td colspan="2" height="10"></td></tr>
-				   <tr>
-					<td colspan="2" class="hdrNameBg">
-						<!-- OPTION 3 -->
-						<div id="mnuTab3" style="width:100%; display:{$SHOW_MYSQL_PATH}">
-							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
-							   <tr>
-								<td colspan="2" >
-									<span class="genHeaderGray">{$MOD.LBL_STEP} 3 : </span>
-									<span class="genHeaderSmall">{$MOD.LBL_ENTER_MYSQL_SERVER_PATH}</span><br>{$MOD.LBL_SERVER_PATH_DESC}<br /><br />
-								</td>
-							   </tr>
-							   <tr>
-								<td align="right" width="30%">{$MOD.LBL_MYSQL_SERVER_PATH}</td>
-								<td width="70%">
-									<input type="text" name="server_mysql_path" class="txtBox" value="{$SERVER_MYSQL_PATH}" />
-								</td>
-							   </tr>
-							</table>
-						</div>
-
-
-					</td>
-				   </tr>
-				   {/if}
-				   <tr>
-					<td colspan="2" style="padding:10px;" align="center">
-						<input type="submit" name="migrate" value="  {$MOD.LBL_MIGRATE_BUTTON}  "  class="crmbutton small save" onclick="return validate_migration(Migration);"/>
-						&nbsp;<input type="submit" name="cancel" value=" &nbsp;{$MOD.LBL_CANCEL_BUTTON}&nbsp; "  class="crmbutton small cancel" onclick="this.form.module.value='Settings';this.form.action.value='index';"/>
- 					</td>
-				   </tr>
-				</table>
-			</td>
-			<td class="mailClientBg" width="8"></td>
-		   </tr>
-		  </table>
-		<br />
-	</td>
-	<td>&nbsp;</td>
-   </tr>
-</table>
-<!-- END -->
-</form>
-
-<script language="javascript" type="text/javascript">
-	//function to show and hide the db_details or dump_details details based on the radio option selected
-	function fnChangeMigrate()
-	{ldelim}
-		var opt_one = document.getElementById('db_details').checked;
-		var opt_two = document.getElementById('dump_details').checked;
-		var opt_three = document.getElementById('alter_db_details').checked;
-		if(opt_one)
-		{ldelim}
-			document.getElementById('mnuTab').style.display = 'block';
-			document.getElementById('mnuTab1').style.display = 'none';
-			document.getElementById('mnuTab2').style.display = 'none';
-		{rdelim}
-		else if(opt_two)
-		{ldelim}
-			document.getElementById('mnuTab').style.display = 'none';
-			document.getElementById('mnuTab1').style.display = 'block';
-			document.getElementById('mnuTab2').style.display = 'none';
-		{rdelim}
-		else
-		{ldelim}
-			document.getElementById('mnuTab').style.display = 'none';
-			document.getElementById('mnuTab1').style.display = 'none';
-			document.getElementById('mnuTab2').style.display = 'block';
-		{rdelim}
-
-		//show/hide MySQL server path
-		if(document.getElementById('getmysqlpath').value == 1 && document.getElementById('mnuTab2').style.display == 'none')
-		{ldelim}
-			//show MySQL server path
-			document.getElementById('mnuTab3').style.display = 'block';
-		{rdelim}
-		else
-		{ldelim}
-			//hide MySQL server path
-			document.getElementById('mnuTab3').style.display = 'none';
-		{rdelim}
-	{rdelim}
-
-	//function to validate the input values based on the radio option selected
-	function validate_migration(formname)
-	{ldelim}
-
-		var error = false;
-		var mig_option = '';
-
-		if(document.getElementById("db_details").checked == true)
-		{ldelim}
-			formname.migration_option.value = 'db_details';
-			//check whether the user entered the valid Source MySQL database details when db details selected
-			if(trim(formname.old_host_name.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Source Host Name";
-				error = true;
-			{rdelim}
-			else if(trim(formname.old_port_no.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Source MySql Port Number";
-				error = true;
-			{rdelim}
-			else if(trim(formname.old_mysql_username.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Source MySql User Name";
-				error = true;
-			{rdelim}
-			else if(trim(formname.old_dbname.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Source Database Name";
-				error = true;
-			{rdelim}
-		{rdelim}
-		else if(document.getElementById("dump_details").checked == true)
-		{ldelim}
-			formname.migration_option.value = 'dump_details';
-			//check whether the user entered the MySQL File when dump file details selected
-			if(trim(formname.old_dump_filename.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Valid MySQL Dump File";
-				error = true;
-			{rdelim}
-		{rdelim}
-		else if(document.getElementById("alter_db_details").checked == true)
-		{ldelim}
-			formname.migration_option.value = 'alter_db_details';
-			//check whether the user entered the valid Source MySQL database details when db details selected
-			if(trim(formname.alter_old_host_name.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Host Name";
-				error = true;
-			{rdelim}
-			else if(trim(formname.alter_old_port_no.value) == '')
-			{ldelim}
-				error_msg = "Please enter the MySql Port Number";
-				error = true;
-			{rdelim}
-			else if(trim(formname.alter_old_mysql_username.value) == '')
-			{ldelim}
-				error_msg = "Please enter the MySql User Name";
-				error = true;
-			{rdelim}
-			else if(trim(formname.alter_old_dbname.value) == '')
-			{ldelim}
-				error_msg = "Please enter the Database Name";
-				error = true;
-			{rdelim}
-		{rdelim}
-		else
-		{ldelim}
-			formname.migration_option.value = '';
-			error_msg = "Please select any one option";
-			error = true;
-		{rdelim}
-
-		//this is added to check whether the getmysql path is true and the user has entered the path or not
-		if(error != true)
-		{ldelim}
-			if(document.getElementById("getmysqlpath").value == 1 && trim(formname.server_mysql_path.value) == '' && document.getElementById("alter_db_details").checked != true)
-			{ldelim}
-				//alert(document.getElementById("getmysqlpath").value+" Enter the mysql path");
-				error_msg = "Please enter the Correct MySQL Path";
-				error = true;
-			{rdelim}
-			else
-			{ldelim}
-				//alert(document.getElementById("getmysqlpath").value+" MySQL path found");
-				error = false;
-			{rdelim}
-		{rdelim}
-
-		//if there is any error then alert the user and return false;
-		if(error == true)
-		{ldelim}
-			alert(error_msg);
-			return false;
-		{rdelim}
-		else
-		{ldelim}
-			return true;
-		{rdelim}
-	{rdelim}
-</script>
-
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+
+
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
+
+<form name="Migration" method="POST" action="index.php" enctype="multipart/form-data">
+<input type="hidden" name="module" value="Migration">
+<input type="hidden" name="action" value="MigrationCheck">
+<input type="hidden" name="migration_option" value="">
+<input type="hidden" name="parenttab" value="Settings">
+<input type="hidden" id="getmysqlpath" name="getmysqlpath" value="{$GET_MYSQL_PATH}">
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%" class="small">
+   <tr>
+	<td class="showPanelBg" valign="top" width="95%"  style="padding-left:20px; "><br />
+		<span class="lvtHeaderText"> {$MOD.LBL_SETTINGS} &gt; {$MOD.LBL_UPGRADE_VTIGER}</span>
+		<span class="lvtHeaderText" align="right">
+			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+			{if $502_PATCH eq 'apply'}
+				<a style="color:red;" href="index.php?module=Migration&action=502DBChanges&parenttab=Settings">Click here to apply the 5.0.2 Database changes from 5.0.0/5.0.1</a>
+			{/if}
+		</span>
+		<hr noshade="noshade" size="1" />
+	</td>
+	<td width="5%" class="showPanelBg">&nbsp;</td>
+   </tr>
+   <tr>
+	<td width="98%" style="padding-left:20px;" valign="top">
+		<!-- module Select Table -->
+		<table width="95%"  border="0" cellspacing="0" cellpadding="0" align="center" class="mailClient">
+		   <tr>
+			<td class="mailClientBg" width="7"></td>
+			<td class="mailClientBg" style="padding-left:10px;padding-top:10px;vertical-align:top;">
+				<table width="100%"  border="0" cellpadding="5" cellspacing="0" class="small">
+				   <tr>
+					<td width="10%"><img src="{$IMAGE_PATH}migrate.gif" align="absmiddle"/></td>
+					<td width="90%">
+						<span class="genHeaderBig">{$MOD.LBL_UPGRADE_VTIGER}</span><br />
+						({$MOD.LBL_UPGRADE_FROM_VTIGER_423})
+					</td>
+				   </tr>
+					   <tr>
+					<td colspan="2" class="hdrNameBg">
+						<span class="genHeaderGray">{$MOD.LBL_STEP} 1 : </span>
+				  		<span class="genHeaderSmall">{$MOD.LBL_SELECT_SOURCE}</span><br />
+						{$MOD.LBL_STEP1_DESC}<br /><br />
+					</td>
+				   </tr>
+				   <tr bgcolor="#FFFFFF">
+					<td align="right" valign="top">
+						<input type="radio" name="radio" id="db_details" value="db_details" onclick="fnChangeMigrate()" "{$DB_DETAILS_CHECKED}" />
+					</td>
+					<td>
+						<b>{$MOD.LBL_RADIO_BUTTON1_TEXT}</b><br /><br />
+						<b>{$MOD.LBL_NOTE_TITLE}</b> {$MOD.LBL_RADIO_BUTTON1_DESC}
+					</td>
+				   </tr>
+				   <tr><td colspan="2" bgcolor="#FFFFFF" height="10"></td></tr>
+				   <tr bgcolor="#FFFFFF">
+					<td align="right" valign="top">
+						<input type="radio" name="radio" id="dump_details" value="dump_details" onclick="fnChangeMigrate()" "{$DUMP_DETAILS_CHECKED}"/>
+					</td>
+					<td>
+						<b>{$MOD.LBL_RADIO_BUTTON2_TEXT}</b><br /><br />
+						<b>{$MOD.LBL_NOTE_TITLE}</b> {$MOD.LBL_RADIO_BUTTON2_DESC}
+					</td>
+				   </tr>
+				   <tr><td colspan="2" bgcolor="#FFFFFF" height="10"></td></tr>
+				   <tr bgcolor="#FFFFFF">
+					<td align="right" valign="top">
+						<input type="radio" name="radio" id="alter_db_details" value="alter_db_details" onclick="fnChangeMigrate()" "{$ALTER_DB_DETAILS_CHECKED}"/>
+					</td>
+					<td>
+						<b>{$MOD.LBL_RADIO_BUTTON3_TEXT}</b><br /><br /><b>{$MOD.LBL_NOTE_TITLE}</b> {$MOD.LBL_RADIO_BUTTON3_DESC}
+					</td>
+				   </tr>
+				   <tr><td colspan="2" bgcolor="#FFFFFF" height="10"></td></tr>
+
+				   <tr><td colspan="2" height="10"></td></tr>
+				   <tr>
+					<td colspan="2" class="hdrNameBg">
+
+
+						<!-- OPTION 1 -->
+						<div id="mnuTab" style="display:{$SHOW_DB_DETAILS}">
+							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+							   <tr >
+								<td colspan="2">
+									<span class="genHeaderGray">{$MOD.LBL_STEP} 2 : </span>
+									<span class="genHeaderSmall">{$MOD.LBL_HOST_DB_ACCESS_DETAILS}</span><br /><br />
+								</td>
+							   </tr>
+							   <tr>
+								<td width="30%" align="right">{$MOD.LBL_SOURCE_HOST_NAME}</td>
+								<td width="70%"><input type="text" name="old_host_name" class="importBox" value="{$OLD_HOST_NAME}" /></td>
+							   </tr>
+							   <tr>
+								<td align="right">{$MOD.LBL_SOURCE_MYSQL_PORT_NO}</td>
+								<td><input type="text" name="old_port_no" class="importBox" value="{$OLD_PORT_NO}" /></td>
+							   </tr>
+							   <tr>
+								<td align="right">{$MOD.LBL_SOURCE_MYSQL_USER_NAME}</td>
+								<td><input type="text" name="old_mysql_username" class="importBox" value="{$OLD_MYSQL_USERNAME}" /></td>
+							   </tr>
+							   <tr>
+								<td align="right">{$MOD.LBL_SOURCE_MYSQL_PASSWORD}</td>
+								<td><input type="text" name="old_mysql_password" class="importBox" value="{$OLD_MYSQL_PASSWORD}" /></td>
+							   </tr>
+							   <tr>
+								<td align="right">{$MOD.LBL_SOURCE_DB_NAME}</td>
+								<td><input type="text" name="old_dbname" class="importBox" value="{$OLD_DBNAME}" /></td>
+							   </tr>
+							</table>
+						</div>
+
+						<!-- OPTION 2 -->
+						<div id="mnuTab1" style="display:{$SHOW_DUMP_DETAILS}">
+							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+							   <tr >
+								<td colspan="2">
+									<span class="genHeaderGray">{$MOD.LBL_STEP} 2 : </span>
+									<span class="genHeaderSmall">{$MOD.LBL_LOCATE_DB_DUMP_FILE}</span><br /><br />
+								</td>
+							   </tr>
+							   <tr>
+								<td width="10%">&nbsp;</td>
+								<td width="90%">
+									{$MOD.LBL_DUMP_FILE_LOCATION}
+									<input type="file" name="old_dump_filename" class="txtBox" />
+								</td>
+							   </tr>
+							   <tr><td colspan="2" height="10"></td></tr>
+							   <tr bgcolor="#FFFFFF">
+								<td align="right" valign="top"><b>{$MOD.LBL_NOTE_TITLE}</b></td>
+								<td>{$MOD.LBL_NOTES_DUMP_PROCESS}</td>
+							   </tr>
+							</table>
+						</div>
+
+
+						<!-- OPTION 3 -->
+						<div id="mnuTab2" style="display:{$SHOW_ALTER_DB_DETAILS}">
+							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+							   <tr>
+								<td colspan="3">
+									<span class="genHeaderGray">{$MOD.LBL_STEP} 2 : </span>
+									<span class="genHeaderSmall">{$MOD.LBL_HOST_DB_ACCESS_DETAILS}</span><br /><br />
+								</td>
+							   </tr>
+							   <tr>
+								<td width="5%">&nbsp;</td>
+								<td width="20%" align="right">{$MOD.LBL_MYSQL_HOST_NAME_IP}</td>
+								<td width="75%"><input type="text" name="alter_old_host_name" class="importBox" value="{$ALTER_OLD_HOST_NAME}" /></td>
+							   </tr>
+							   <tr>
+								<td>&nbsp;</td>
+								<td align="right">{$MOD.LBL_MYSQL_PORT}</td>
+								<td><input type="text" name="alter_old_port_no" class="importBox" value="{$ALTER_OLD_PORT_NO}" /></td>
+							   </tr>
+							   <tr>
+								<td>&nbsp;</td>
+								<td align="right">{$MOD.LBL_MYSQL_USER_NAME}</td>
+								<td><input type="text" name="alter_old_mysql_username" class="importBox" value="{$ALTER_OLD_MYSQL_USERNAME}" /></td>
+							   </tr>
+							   <tr>
+								<td>&nbsp;</td>
+								<td align="right">{$MOD.LBL_MYSQL_PASSWORD}</td>
+								<td><input type="text" name="alter_old_mysql_password" class="importBox" value="{$ALTER_OLD_MYSQL_PASSWORD}" /></td>
+							   </tr>
+							   <tr>
+								<td>&nbsp;</td>
+								<td align="right">{$MOD.LBL_DB_NAME}</td>
+								<td><input type="text" name="alter_old_dbname" class="importBox" value="{$ALTER_OLD_DBNAME}" /></td>
+							   </tr>
+							   <tr><td colspan="3" height="10"></td></tr>
+							   <tr bgcolor="#FFFFFF">
+								<td align="right" valign="top"><b>{$MOD.LBL_NOTE_TITLE}</b></td>
+								<td width="90%" colspan="2">
+
+									{$MOD.LBL_RADIO_BUTTON3_PROCESS}
+								</td>
+							   </tr>
+
+							</table>
+						</div>
+
+
+					</td>
+				   </tr>
+
+				   <!-- this if condition is added to display the text box to get the mysql server path -->
+				   {if $GET_MYSQL_PATH eq 1}
+				   <tr><td colspan="2" height="10"></td></tr>
+				   <tr>
+					<td colspan="2" class="hdrNameBg">
+						<!-- OPTION 3 -->
+						<div id="mnuTab3" style="width:100%; display:{$SHOW_MYSQL_PATH}">
+							<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+							   <tr>
+								<td colspan="2" >
+									<span class="genHeaderGray">{$MOD.LBL_STEP} 3 : </span>
+									<span class="genHeaderSmall">{$MOD.LBL_ENTER_MYSQL_SERVER_PATH}</span><br>{$MOD.LBL_SERVER_PATH_DESC}<br /><br />
+								</td>
+							   </tr>
+							   <tr>
+								<td align="right" width="30%">{$MOD.LBL_MYSQL_SERVER_PATH}</td>
+								<td width="70%">
+									<input type="text" name="server_mysql_path" class="txtBox" value="{$SERVER_MYSQL_PATH}" />
+								</td>
+							   </tr>
+							</table>
+						</div>
+
+
+					</td>
+				   </tr>
+				   {/if}
+				   <tr>
+					<td colspan="2" style="padding:10px;" align="center">
+						<input type="submit" name="migrate" value="  {$MOD.LBL_MIGRATE_BUTTON}  "  class="crmbutton small save" onclick="return validate_migration(Migration);"/>
+						&nbsp;<input type="submit" name="cancel" value=" &nbsp;{$MOD.LBL_CANCEL_BUTTON}&nbsp; "  class="crmbutton small cancel" onclick="this.form.module.value='Settings';this.form.action.value='index';"/>
+ 					</td>
+				   </tr>
+				</table>
+			</td>
+			<td class="mailClientBg" width="8"></td>
+		   </tr>
+		  </table>
+		<br />
+	</td>
+	<td>&nbsp;</td>
+   </tr>
+</table>
+<!-- END -->
+</form>
+
+<script language="javascript" type="text/javascript">
+	//function to show and hide the db_details or dump_details details based on the radio option selected
+	function fnChangeMigrate()
+	{ldelim}
+		var opt_one = document.getElementById('db_details').checked;
+		var opt_two = document.getElementById('dump_details').checked;
+		var opt_three = document.getElementById('alter_db_details').checked;
+		if(opt_one)
+		{ldelim}
+			document.getElementById('mnuTab').style.display = 'block';
+			document.getElementById('mnuTab1').style.display = 'none';
+			document.getElementById('mnuTab2').style.display = 'none';
+		{rdelim}
+		else if(opt_two)
+		{ldelim}
+			document.getElementById('mnuTab').style.display = 'none';
+			document.getElementById('mnuTab1').style.display = 'block';
+			document.getElementById('mnuTab2').style.display = 'none';
+		{rdelim}
+		else
+		{ldelim}
+			document.getElementById('mnuTab').style.display = 'none';
+			document.getElementById('mnuTab1').style.display = 'none';
+			document.getElementById('mnuTab2').style.display = 'block';
+		{rdelim}
+
+		//show/hide MySQL server path
+		if(document.getElementById('getmysqlpath').value == 1 && document.getElementById('mnuTab2').style.display == 'none')
+		{ldelim}
+			//show MySQL server path
+			document.getElementById('mnuTab3').style.display = 'block';
+		{rdelim}
+		else
+		{ldelim}
+			//hide MySQL server path
+			document.getElementById('mnuTab3').style.display = 'none';
+		{rdelim}
+	{rdelim}
+
+	//function to validate the input values based on the radio option selected
+	function validate_migration(formname)
+	{ldelim}
+
+		var error = false;
+		var mig_option = '';
+
+		if(document.getElementById("db_details").checked == true)
+		{ldelim}
+			formname.migration_option.value = 'db_details';
+			//check whether the user entered the valid Source MySQL database details when db details selected
+			if(trim(formname.old_host_name.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Source Host Name";
+				error = true;
+			{rdelim}
+			else if(trim(formname.old_port_no.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Source MySql Port Number";
+				error = true;
+			{rdelim}
+			else if(trim(formname.old_mysql_username.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Source MySql User Name";
+				error = true;
+			{rdelim}
+			else if(trim(formname.old_dbname.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Source Database Name";
+				error = true;
+			{rdelim}
+		{rdelim}
+		else if(document.getElementById("dump_details").checked == true)
+		{ldelim}
+			formname.migration_option.value = 'dump_details';
+			//check whether the user entered the MySQL File when dump file details selected
+			if(trim(formname.old_dump_filename.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Valid MySQL Dump File";
+				error = true;
+			{rdelim}
+		{rdelim}
+		else if(document.getElementById("alter_db_details").checked == true)
+		{ldelim}
+			formname.migration_option.value = 'alter_db_details';
+			//check whether the user entered the valid Source MySQL database details when db details selected
+			if(trim(formname.alter_old_host_name.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Host Name";
+				error = true;
+			{rdelim}
+			else if(trim(formname.alter_old_port_no.value) == '')
+			{ldelim}
+				error_msg = "Please enter the MySql Port Number";
+				error = true;
+			{rdelim}
+			else if(trim(formname.alter_old_mysql_username.value) == '')
+			{ldelim}
+				error_msg = "Please enter the MySql User Name";
+				error = true;
+			{rdelim}
+			else if(trim(formname.alter_old_dbname.value) == '')
+			{ldelim}
+				error_msg = "Please enter the Database Name";
+				error = true;
+			{rdelim}
+		{rdelim}
+		else
+		{ldelim}
+			formname.migration_option.value = '';
+			error_msg = "Please select any one option";
+			error = true;
+		{rdelim}
+
+		//this is added to check whether the getmysql path is true and the user has entered the path or not
+		if(error != true)
+		{ldelim}
+			if(document.getElementById("getmysqlpath").value == 1 && trim(formname.server_mysql_path.value) == '' && document.getElementById("alter_db_details").checked != true)
+			{ldelim}
+				//alert(document.getElementById("getmysqlpath").value+" Enter the mysql path");
+				error_msg = "Please enter the Correct MySQL Path";
+				error = true;
+			{rdelim}
+			else
+			{ldelim}
+				//alert(document.getElementById("getmysqlpath").value+" MySQL path found");
+				error = false;
+			{rdelim}
+		{rdelim}
+
+		//if there is any error then alert the user and return false;
+		if(error == true)
+		{ldelim}
+			alert(error_msg);
+			return false;
+		{rdelim}
+		else
+		{ldelim}
+			return true;
+		{rdelim}
+	{rdelim}
+</script>
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Popup.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Popup.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Popup.tpl Tue Nov 14 03:16:10 2006
@@ -18,7 +18,7 @@
 <script language="javascript" type="text/javascript" src="include/scriptaculous/prototype.js"></script>
 <script type="text/javascript">
 function add_data_to_relatedlist(entity_id,recordid,mod) {ldelim}
-        opener.document.location.href="index.php?module={$RETURN_MODULE}&action=updateRelations&destination_module="+mod+"&entityid="+entity_id+"&parid="+recordid;
+        opener.document.location.href="index.php?module={$RETURN_MODULE}&action=updateRelations&destination_module="+mod+"&entityid="+entity_id+"&parid="+recordid+"&return_action={$RETURN_ACTION}";
 {rdelim}
 
 </script>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/ProfileDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/ProfileDetailView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/ProfileDetailView.tpl Tue Nov 14 03:16:10 2006
@@ -1,312 +1,398 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-{literal}
-<style>
-.showTable{
-	display:inline-table;
-}
-.hideTable{
-	display:none;
-}
-</style>
-{/literal}
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-        <br>
-	<div align=center>
-			{include file='SetMenu.tpl'}
-				<form action="index.php" method="post" name="new" id="form">
-			        <input type="hidden" name="module" value="Users">
-			        <input type="hidden" name="action" value="profilePrivileges">
-			        <input type="hidden" name="parenttab" value="Settings">
-			        <input type="hidden" name="return_action" value="profilePrivileges">
-			        <input type="hidden" name="mode" value="edit">
-			        <input type="hidden" name="profileid" value="{$PROFILEID}">
-				<!-- DISPLAY -->
-				<table class="settingsSelUITopLine" border="0" cellpadding="5" cellspacing="0" width="100%">
-				<tbody><tr>
-					<td rowspan="2" valign="top" width="50"><img src="{$IMAGE_PATH}ico-profile.gif" alt="{$MOD.LBL_PROFILES}" title="{$MOD.LBL_PROFILES}" border="0" height="48" width="48"></td>
-					<td class="heading2" valign="bottom"><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$CMOD.LBL_PROFILE_PRIVILEGES}</a> &gt; {$CMOD.LBL_VIEWING} &quot;{$PROFILE_NAME}&quot;</b></td>
-				</tr>
-				<tr>
-					<td class="small" valign="top">{$CMOD.LBL_PROFILE_MESG} &quot;{$PROFILE_NAME}&quot; </td>
-				</tr>
-				</tbody></table>
-				
-				
-				<table border="0" cellpadding="10" cellspacing="0" width="100%">
-				<tbody><tr>
-				<td valign="top">
-					<table border="0" cellpadding="0" cellspacing="0" width="100%">
-                      <tbody><tr>
-                        <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
-                            <tbody><tr class="small">
-                              <td><img src="{$IMAGE_PATH}prvPrfTopLeft.gif"></td>
-                              <td class="prvPrfTopBg" width="100%"></td>
-                              <td><img src="{$IMAGE_PATH}prvPrfTopRight.gif"></td>
-                            </tr>
-                          </tbody></table>
-                            <table class="prvPrfOutline" border="0" cellpadding="0" cellspacing="0" width="100%">
-                              <tbody><tr>
-                                <td><!-- tabs -->
-                                    
-                                    <!-- Headers -->
-                                    <table border="0" cellpadding="5" cellspacing="0" width="100%">
-                                      <tbody><tr>
-                                        <td><table class="small" border="0" cellpadding="5" cellspacing="0" width="100%">
-                                            <tbody><tr>
-                                              <td><!-- Module name heading -->
-                                                  <table class="small" border="0" cellpadding="2" cellspacing="0">
-                                                    <tbody><tr>
-                                                      <td valign="top"><img src="{$IMAGE_PATH}prvPrfHdrArrow.gif"> </td>
-                                                      <td class="prvPrfBigText"><b> {$CMOD.LBL_DEFINE_PRIV_FOR} &lt;{$PROFILE_NAME}&gt; </b><br>
-                                                      <font class="small">{$CMOD.LBL_USE_OPTION_TO_SET_PRIV}</font> </td>
-                                                      <td class="small" style="padding-left: 10px;" align="right"></td>
-
-                                                    </tr>
-                                                </tbody></table></td>
-                                              <td align="right" valign="bottom">&nbsp;<input type="submit" value="{$APP.LBL_EDIT_BUTTON_LABEL}" class="crmButton small edit" name="edit">											  </td>
-                                            </tr>
-                                          </tbody></table>
-                                            <!-- privilege lists -->
-                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
-                                              <tbody><tr>
-                                                <td style="height: 10px;" align="center"><img src="{$IMAGE_PATH}prvPrfLine.gif" style="width: 100%; height: 1px;"></td>
-                                              </tr>
-                                            </tbody></table>
-                                            <table border="0" cellpadding="10" cellspacing="0" width="100%">
-                                              <tbody><tr>
-                                                <td>
-						<table border="0" cellpadding="5" cellspacing="0" width="100%">
-  						<tbody>
-							<tr>
-    							<td class="cellLabel big"> {$CMOD.LBL_SUPER_USER_PRIV} </td>
-						       </tr>
-						</tbody>
-						</table>
-						<table class="small" align="center" border="0" cellpadding="5" cellspacing="0" width="90%">
-                                                <tbody><tr>
-                                                    <td class="prvPrfTexture" style="width: 20px;">&nbsp;</td>
-                                                    <td valign="top" width="97%"><table class="small" border="0" cellpadding="2" cellspacing="0" width="100%">
-                                                      <tbody>
-				                         <tr id="gva">
-                                                          <td valign="top">{$GLOBAL_PRIV.0}</td>
-                                                          <td ><b>{$CMOD.LBL_VIEW_ALL}</b> </td>
-                                                        </tr>
-                                                        <tr >
-                                                          <td valign="top"></td>
-                                                          <td width="100%" >{$CMOD.LBL_ALLOW} "{$PROFILE_NAME}" {$CMOD.LBL_MESG_VIEW}</td>
-                                                        </tr>
-                                                        <tr>
-                                                          <td>&nbsp;</td>
-                                                        </tr>
-							<tr>
-							<td valign="top">{$GLOBAL_PRIV.1}</td>
-							<td ><b>{$CMOD.LBL_EDIT_ALL}</b> </td>
-							</tr>
-                                                        <tr>
-                                                          <td valign="top"></td>
-                                                          <td > {$CMOD.LBL_ALLOW} "{$PROFILE_NAME}" {$CMOD.LBL_MESG_EDIT}</td>
-                                                        </tr>
-
-                                                      </tbody></table>
-						</td>
-                                                  </tr>
-                                                </tbody></table>
-<br>
-
-			<table border="0" cellpadding="5" cellspacing="0" width="100%">
-			  <tbody><tr>
-			    <td class="cellLabel big"> {$CMOD.LBL_SET_PRIV_FOR_EACH_MODULE} </td>
-			  </tr>
-			</tbody></table>
-			<table class="small" align="center" border="0" cellpadding="5" cellspacing="0" width="90%">
-			  <tbody><tr>
-			    <td class="prvPrfTexture" style="width: 20px;">&nbsp;</td>
-			    <td valign="top" width="97%">
-				<table class="small listTable" border="0" cellpadding="5" cellspacing="0" width="100%">
-			        <tbody>
-				<tr id="gva">
-			          <td colspan="2" rowspan="2" class="small colHeader"><strong> {$CMOD.LBL_TAB_MESG_OPTION} </strong><strong></strong></td>
-			          <td colspan="3" class="small colHeader"><div align="center"><strong> {$CMOD.LBL_EDIT_PERMISSIONS} </strong></div></td>
-			          <td rowspan="2" class="small colHeader" nowrap="nowrap"> {$CMOD.LBL_FIELDS_AND_TOOLS_SETTINGS} </td>
-			        </tr>
-			        <tr id="gva">
-			          <td class="small colHeader"><div align="center"><strong>{$CMOD.LBL_CREATE_EDIT}
-			          </strong></div></td>
-			          <td class="small colHeader"> <div align="center"><strong>{$CMOD.LBL_VIEW} </strong></div></td>
-			          <td class="small colHeader"> <div align="center"><strong>{$CMOD.LBL_DELETE}</strong></div></td>
-			        </tr>
-					
-				<!-- module loops-->
-			        {foreach key=tabid item=elements from=$TAB_PRIV}	
-			        <tr>
-                                        {assign var=modulename value=$TAB_PRIV[$tabid][0]}
-			          <td class="small cellLabel" width="3%"><div align="right">
-					{$TAB_PRIV[$tabid][1]}
-			          </div></td>
-			          <td class="small cellLabel" width="40%"><p>{$APP[$modulename]}</p></td>
-			          <td class="small cellText" width="15%">&nbsp;<div align="center">
-					{$STANDARD_PRIV[$tabid][1]}
-			          </div></td>
-			          <td class="small cellText" width="15%">&nbsp;<div align="center">
-					{$STANDARD_PRIV[$tabid][3]}
-			          </div></td>
-			          <td class="small cellText" width="15%">&nbsp;<div align="center">
-					{$STANDARD_PRIV[$tabid][2]}
-        			  </div></td>
-			          <td class="small cellText" width="22%">&nbsp;<div align="center">
-				{if $FIELD_PRIVILEGES[$tabid] neq NULL || $modulename eq 'Emails'}
-				<img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onclick="fnToggleVIew('{$modulename}_view')" border="0" height="16" width="40">
-				{/if}
-				</div></td>
-				  </tr>
-		                  <tr class="hideTable" id="{$modulename}_view" className="hideTable">
-				          <td colspan="6" class="small settingsSelectedUI">
-						<table class="small" border="0" cellpadding="2" cellspacing="0" width="100%">
-			        	    	<tbody>
-						{if $FIELD_PRIVILEGES[$tabid] neq ''}
-						<tr>
-							{if $modulename eq 'Calendar'}
-				                	<td class="small colHeader" colspan="6" valign="top">{$CMOD.LBL_FIELDS_SELECT_DESELECT} ({$APP.Tasks})</td>
-							{else}
-				                	<td class="small colHeader" colspan="6" valign="top">{$CMOD.LBL_FIELDS_SELECT_DESELECT}</td>
-							{/if}
-					        </tr>
-						{/if}
-						{foreach item=row_values from=$FIELD_PRIVILEGES[$tabid]}
-				            	<tr>
-						      {foreach item=element from=$row_values}
-					              <td valign="top">{$element.1}</td>
-					              <td>{$element.0}</td>
-						      {/foreach}
-				                </tr>
-						{/foreach}
-						{if $modulename eq 'Calendar'}
-						<tr>
-				                	<td class="small colHeader" colspan="6" valign="top">{$CMOD.LBL_FIELDS_SELECT_DESELECT}  ({$APP.Events})</td>
-					        </tr>
-						{foreach item=row_values from=$FIELD_PRIVILEGES[16]}
-				            	<tr>
-						      {foreach item=element from=$row_values}
-					              <td valign="top">{$element.1}</td>
-					              <td>{$element.0}</td>
-						      {/foreach}
-				                </tr>
-						{/foreach}
-						{/if}
-						{if $UTILITIES_PRIV[$tabid] neq ''}
-					        <tr>
-					              <td colspan="6" class="small colHeader" valign="top">{$CMOD.LBL_TOOLS_TO_BE_SHOWN} </td>
-						</tr>
-						{/if}
-						{foreach item=util_value from=$UTILITIES_PRIV[$tabid]}
-						<tr>
-							{foreach item=util_elements from=$util_value}
-					              		<td valign="top">{$util_elements.1}</td>
-						                <td>{$APP[$util_elements.0]}</td>
-							{/foreach}
-				               	</tr>
-						{/foreach}
-					        </tbody>
-						</table>
-					</td>
-			          </tr>
-				  {/foreach}	
-			    	  </tbody>
-				  </table>
-			  </td>
-			  </tr>
-                          </tbody>
-			</table>
-		</td>
-                </tr>
-		<table border="0" cellpadding="2" cellspacing="0">
-			<tr>
-				<td align="left"><font color="red" size=5>*</font>{$CMOD.LBL_MANDATORY_MSG}</td>
-			</tr>
-			<tr>
-				<td align="left"><font color="blue" size=5>*</font>{$CMOD.LBL_DISABLE_FIELD_MSG}</td>
-			</tr>
-		</table>
-		<tr>
-		<td style="border-top: 2px dotted rgb(204, 204, 204);" align="right">
-		<!-- wizard buttons -->
-		<table border="0" cellpadding="2" cellspacing="0">
-		<tbody>
-			<tr>
-				<td><input type="submit" value="{$APP.LBL_EDIT_BUTTON_LABEL}" class="crmButton small edit" name="edit"></td>
-				<td>&nbsp;</td>
-			</tr>
-			
-		</tbody>
-		</table>
-		</td>
-		</tr>
-          </tbody>
-	  </table>
-	</td>
-        </tr>
-        </tbody>
-	</table>
-      </td>
-      </tr>
-      </tbody></table>
-      <table class="small" border="0" cellpadding="0" cellspacing="0" width="100%">
-           <tbody><tr>
-                <td><img src="{$IMAGE_PATH}prvPrfBottomLeft.gif"></td>
-                <td class="prvPrfBottomBg" width="100%"></td>
-                <td><img src="{$IMAGE_PATH}prvPrfBottomRight.gif"></td>
-                </tr>
-            </tbody>
-      </table></td>
-      </tr>
-      </tbody></table>
-	<p>&nbsp;</p>
-	<table border="0" cellpadding="5" cellspacing="0" width="100%">
-	<tbody><tr><td class="small" align="right" nowrap="nowrap"><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
-	</tbody></table>
-					
-	</td>
-	</tr>
-	</tbody></table>
-	</form>	
-	<!-- End of Display -->
-	</td>
-	</tr>
-	</table>
-	</td>
-	</tr>
-	</table>
-	</div>
-
-	</td>
-	<td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-	</tr>
-</tbody>
-</table>
-<script language="javascript" type="text/javascript">
-{literal}
-function fnToggleVIew(obj){
-	var tagStyle = document.getElementById(obj).className;
-	if(tagStyle == 'hideTable')
-		document.getElementById(obj).className = 'showTable';
-	else
-		document.getElementById(obj).className = 'hideTable';
-}
-{/literal}
-</script>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+{literal}
+<style>
+.showTable{
+	display:inline-table;
+}
+.hideTable{
+	display:none;
+}
+</style>
+{/literal}
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/general.js"></script>
+<script language="JAVASCRIPT" type="text/javascript">
+{literal}
+function UpdateProfile()
+{
+	var prof_name = $('profile_name').value;
+	var prof_desc = $('description').value;
+	if(prof_name == '')
+	{
+		
+		$('profile_name').focus();
+		alert("Profile Name Cannot be empty");
+	}
+	else
+	{
+		
+{/literal}
+		
+		var urlstring ="module=Users&action=UsersAjax&file=RenameProfile&profileid="+{$PROFILEID}+"&profilename="+prof_name+"&description="+prof_desc;
+{literal}
+	new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody:urlstring,
+			onComplete: function(response)
+			{
+				$('renameProfile').style.display="none";
+				window.location.reload();
+				alert("Profile Details are updated");
+			}
+                }
+		);
+	}
+		
+	
+}
+</script>
+{/literal}
+
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+        <br>
+	<div align=center>
+			{include file='SetMenu.tpl'}
+			
+				<form  method="post" name="new" id="form">
+			        <input type="hidden" name="module" value="Users">
+			        <input type="hidden" name="action" value="profilePrivileges">
+			        <input type="hidden" name="parenttab" value="Settings">
+			        <input type="hidden" name="return_action" value="profilePrivileges">
+			        <input type="hidden" name="mode" value="edit">
+			        <input type="hidden" name="profileid" value="{$PROFILEID}">
+				
+				<!-- DISPLAY -->
+				<table class="settingsSelUITopLine" border="0" cellpadding="5" cellspacing="0" width="100%">
+				<tbody><tr>
+					<td rowspan="2" valign="top" width="50"><img src="{$IMAGE_PATH}ico-profile.gif" alt="{$MOD.LBL_PROFILES}" title="{$MOD.LBL_PROFILES}" border="0" height="48" width="48"></td>
+					<td class="heading2" valign="bottom"><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > <a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$CMOD.LBL_PROFILE_PRIVILEGES}</a> &gt; {$CMOD.LBL_VIEWING} &quot;{$PROFILE_NAME}&quot;</b></td>
+				</tr>
+				<tr>
+					<td class="small" valign="top">{$CMOD.LBL_PROFILE_MESG} &quot;{$PROFILE_NAME}&quot; </td>
+				</tr>
+				</tbody></table>
+				
+				
+				<table border="0" cellpadding="10" cellspacing="0" width="100%">
+				<tbody><tr>
+				<td valign="top">
+					<table border="0" cellpadding="0" cellspacing="0" width="100%">
+                      <tbody><tr>
+                        <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
+                            <tbody><tr class="small">
+                              <td><img src="{$IMAGE_PATH}prvPrfTopLeft.gif"></td>
+                              <td class="prvPrfTopBg" width="100%"></td>
+                              <td><img src="{$IMAGE_PATH}prvPrfTopRight.gif"></td>
+                            </tr>
+                          </tbody></table>
+                            <table class="prvPrfOutline" border="0" cellpadding="0" cellspacing="0" width="100%">
+                              <tbody><tr>
+                                <td><!-- tabs -->
+                                    
+                                    <!-- Headers -->
+                                    <table border="0" cellpadding="5" cellspacing="0" width="100%">
+                                      <tbody><tr>
+                                        <td><table class="small" border="0" cellpadding="5" cellspacing="0" width="100%">
+                                            <tbody><tr>
+                                              <td><!-- Module name heading -->
+                                                  <table class="small" border="0" cellpadding="2" cellspacing="0">
+                                                    <tbody><tr>
+                                                      <td valign="top"><img src="{$IMAGE_PATH}prvPrfHdrArrow.gif"> </td>
+                                                      <td class="prvPrfBigText"><b> {$CMOD.LBL_DEFINE_PRIV_FOR} &lt;{$PROFILE_NAME}&gt; </b><br>
+                                                      <font class="small">{$CMOD.LBL_USE_OPTION_TO_SET_PRIV}</font> </td>
+                                                      <td class="small" style="padding-left: 10px;" align="right"></td>
+
+                                                    </tr>
+                                                </tbody></table></td>
+                                              <td align="right" valign="bottom">&nbsp;<input type="button" value="{$APP.LBL_RENAMEPROFILE_BUTTON_LABEL}" class="crmButton small edit" name="rename_profile"  onClick = "fnvshobj(this,'renameProfile');">&nbsp;<input type="submit" value="{$APP.LBL_EDIT_BUTTON_LABEL}" class="crmButton small edit" name="edit" >
+                              		     </td>
+					    	
+                                            </tr></tbody></table>
+					    <!-- RenameProfile Div start -->	 
+					    <div id="renameProfile" style="left: 49px; top: 152px; display: none; visibility: visible;position:absolute;" class="layerPopup">
+						<table class="layerHeadingULine" border="0" cellpadding="3" cellspacing="0" width="100%">
+						<tr style="cursor:move;">
+						<td class="layerPopupHeading" id = "renameUI" align="left" width="60%">{$APP.LBL_RENAME_PROFILE}</td>
+						<td align="right" width="40%"><a href="javascript:fninvsh('renameProfile');"><img src="themes/bluelagoon/images/close.gif" align="middle" border="0"></a></td>
+						</tr>
+						</table>
+					    <table align="center" border="0" cellpadding="5" cellspacing="0" width="95%">
+
+						<tr>
+						<td class="small">
+							<table celspacing="0" align="center" bgcolor="white" border="0" cellpadding="5" width="100%">
+								<tr>
+								<td align="right" width="25%" style="padding-right:10px;" nowrap><b>{$APP.LBL_PROFILE_NAME} :</b></td>
+								<td align="left" width="75%" style="padding-right:10px;"><input id = "profile_name" name="profile_name" class="txtBox" value="{$Profile_Name}" type="text"></td>
+								</tr>
+								<tr>
+                                                                <td align="right" width="25%" style="padding-right:10px;" nowrap><b>{$APP.LBL_DESCRIPTION} :</b></td>
+                                                                <td align="left" width="75%" style="padding-right:10px;"><textarea name="description" id = "description" class="txtBox">{$Profile_Description} </textarea></td>
+                                                                </tr>
+							</table>
+						</td>
+						</tr>
+					    </table>
+					    <table class="layerPopupTransport" border="0" cellpadding="5" cellspacing="0" width="100%">
+					    <tr>
+						<td align = "center">
+							<input name="save" value="Update" class="crmbutton small save" onclick="UpdateProfile();" type="button">&nbsp;&nbsp;
+							<input name="cancel" value="Cancel" class="crmbutton small save" onclick="fninvsh('renameProfile');" type="button">&nbsp;&nbsp;
+						</td>
+					    </tr>		
+					    </table>		
+					    </div>		
+				             <!- RenameProfile Div end -->		
+
+                                         
+                                            <!-- privilege lists -->
+                                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
+                                              <tbody><tr>
+                                                <td style="height: 10px;" align="center"><img src="{$IMAGE_PATH}prvPrfLine.gif" style="width: 100%; height: 1px;"></td>
+                                              </tr>
+                                            </tbody></table>
+                                            <table border="0" cellpadding="10" cellspacing="0" width="100%">
+                                              <tbody><tr>
+                                                <td>
+						<table border="0" cellpadding="5" cellspacing="0" width="100%">
+  						<tbody>
+							<tr>
+    							<td class="cellLabel big"> {$CMOD.LBL_SUPER_USER_PRIV} </td>
+						       </tr>
+						</tbody>
+						</table>
+						<table class="small" align="center" border="0" cellpadding="5" cellspacing="0" width="90%">
+                                                <tbody><tr>
+                                                    <td class="prvPrfTexture" style="width: 20px;">&nbsp;</td>
+                                                    <td valign="top" width="97%"><table class="small" border="0" cellpadding="2" cellspacing="0" width="100%">
+                                                      <tbody>
+				                         <tr id="gva">
+                                                          <td valign="top">{$GLOBAL_PRIV.0}</td>
+                                                          <td ><b>{$CMOD.LBL_VIEW_ALL}</b> </td>
+                                                        </tr>
+                                                        <tr >
+                                                          <td valign="top"></td>
+                                                          <td width="100%" >{$CMOD.LBL_ALLOW} "{$PROFILE_NAME}" {$CMOD.LBL_MESG_VIEW}</td>
+                                                        </tr>
+                                                        <tr>
+                                                          <td>&nbsp;</td>
+                                                        </tr>
+							<tr>
+							<td valign="top">{$GLOBAL_PRIV.1}</td>
+							<td ><b>{$CMOD.LBL_EDIT_ALL}</b> </td>
+							</tr>
+                                                        <tr>
+                                                          <td valign="top"></td>
+                                                          <td > {$CMOD.LBL_ALLOW} "{$PROFILE_NAME}" {$CMOD.LBL_MESG_EDIT}</td>
+                                                        </tr>
+
+                                                      </tbody></table>
+						</td>
+                                                  </tr>
+                                                </tbody></table>
+<br>
+
+			<table border="0" cellpadding="5" cellspacing="0" width="100%">
+			  <tbody><tr>
+			    <td class="cellLabel big"> {$CMOD.LBL_SET_PRIV_FOR_EACH_MODULE} </td>
+			  </tr>
+			</tbody></table>
+			<table class="small" align="center" border="0" cellpadding="5" cellspacing="0" width="90%">
+			  <tbody><tr>
+			    <td class="prvPrfTexture" style="width: 20px;">&nbsp;</td>
+			    <td valign="top" width="97%">
+				<table class="small listTable" border="0" cellpadding="5" cellspacing="0" width="100%">
+			        <tbody>
+				<tr id="gva">
+			          <td colspan="2" rowspan="2" class="small colHeader"><strong> {$CMOD.LBL_TAB_MESG_OPTION} </strong><strong></strong></td>
+			          <td colspan="3" class="small colHeader"><div align="center"><strong> {$CMOD.LBL_EDIT_PERMISSIONS} </strong></div></td>
+			          <td rowspan="2" class="small colHeader" nowrap="nowrap"> {$CMOD.LBL_FIELDS_AND_TOOLS_SETTINGS} </td>
+			        </tr>
+			        <tr id="gva">
+			          <td class="small colHeader"><div align="center"><strong>{$CMOD.LBL_CREATE_EDIT}
+			          </strong></div></td>
+			          <td class="small colHeader"> <div align="center"><strong>{$CMOD.LBL_VIEW} </strong></div></td>
+			          <td class="small colHeader"> <div align="center"><strong>{$CMOD.LBL_DELETE}</strong></div></td>
+			        </tr>
+					
+				<!-- module loops-->
+			        {foreach key=tabid item=elements from=$TAB_PRIV}	
+			        <tr>
+                                        {assign var=modulename value=$TAB_PRIV[$tabid][0]}
+			          <td class="small cellLabel" width="3%"><div align="right">
+					{$TAB_PRIV[$tabid][1]}
+			          </div></td>
+			          <td class="small cellLabel" width="40%"><p>{$APP[$modulename]}</p></td>
+			          <td class="small cellText" width="15%">&nbsp;<div align="center">
+					{$STANDARD_PRIV[$tabid][1]}
+			          </div></td>
+			          <td class="small cellText" width="15%">&nbsp;<div align="center">
+					{$STANDARD_PRIV[$tabid][3]}
+			          </div></td>
+			          <td class="small cellText" width="15%">&nbsp;<div align="center">
+					{$STANDARD_PRIV[$tabid][2]}
+        			  </div></td>
+			          <td class="small cellText" width="22%">&nbsp;<div align="center">
+				{if $FIELD_PRIVILEGES[$tabid] neq NULL || $modulename eq 'Emails'}
+				<img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onclick="fnToggleVIew('{$modulename}_view')" border="0" height="16" width="40">
+				{/if}
+				</div></td>
+				  </tr>
+		                  <tr class="hideTable" id="{$modulename}_view" className="hideTable">
+				          <td colspan="6" class="small settingsSelectedUI">
+						<table class="small" border="0" cellpadding="2" cellspacing="0" width="100%">
+			        	    	<tbody>
+						{if $FIELD_PRIVILEGES[$tabid] neq ''}
+						<tr>
+							{if $modulename eq 'Calendar'}
+				                	<td class="small colHeader" colspan="6" valign="top">{$CMOD.LBL_FIELDS_SELECT_DESELECT} ({$APP.Tasks})</td>
+							{else}
+				                	<td class="small colHeader" colspan="6" valign="top">{$CMOD.LBL_FIELDS_SELECT_DESELECT}</td>
+							{/if}
+					        </tr>
+						{/if}
+						{foreach item=row_values from=$FIELD_PRIVILEGES[$tabid]}
+				            	<tr>
+						      {foreach item=element from=$row_values}
+					              <td valign="top">{$element.1}</td>
+					              <td>{$element.0}</td>
+						      {/foreach}
+				                </tr>
+						{/foreach}
+						{if $modulename eq 'Calendar'}
+						<tr>
+				                	<td class="small colHeader" colspan="6" valign="top">{$CMOD.LBL_FIELDS_SELECT_DESELECT}  ({$APP.Events})</td>
+					        </tr>
+						{foreach item=row_values from=$FIELD_PRIVILEGES[16]}
+				            	<tr>
+						      {foreach item=element from=$row_values}
+					              <td valign="top">{$element.1}</td>
+					              <td>{$element.0}</td>
+						      {/foreach}
+				                </tr>
+						{/foreach}
+						{/if}
+						{if $UTILITIES_PRIV[$tabid] neq ''}
+					        <tr>
+					              <td colspan="6" class="small colHeader" valign="top">{$CMOD.LBL_TOOLS_TO_BE_SHOWN} </td>
+						</tr>
+						{/if}
+						{foreach item=util_value from=$UTILITIES_PRIV[$tabid]}
+						<tr>
+							{foreach item=util_elements from=$util_value}
+					              		<td valign="top">{$util_elements.1}</td>
+						                <td>{$APP[$util_elements.0]}</td>
+							{/foreach}
+				               	</tr>
+						{/foreach}
+					        </tbody>
+						</table>
+					</td>
+			          </tr>
+				  {/foreach}	
+			    	  </tbody>
+				  </table>
+			  </td>
+			  </tr>
+                          </tbody>
+			</table>
+		</td>
+                </tr>
+		<table border="0" cellpadding="2" cellspacing="0">
+			<tr>
+				<td align="left"><font color="red" size=5>*</font>{$CMOD.LBL_MANDATORY_MSG}</td>
+			</tr>
+			<tr>
+				<td align="left"><font color="blue" size=5>*</font>{$CMOD.LBL_DISABLE_FIELD_MSG}</td>
+			</tr>
+		</table>
+		<tr>
+		<td style="border-top: 2px dotted rgb(204, 204, 204);" align="right">
+		<!-- wizard buttons -->
+		<table border="0" cellpadding="2" cellspacing="0">
+		<tbody>
+			<tr>
+				<td><input type="submit" value="{$APP.LBL_EDIT_BUTTON_LABEL}" class="crmButton small edit" name="edit"></td>
+				<td>&nbsp;</td>
+			</tr>
+			
+		</tbody>
+		</table>
+		</td>
+		</tr>
+          </tbody>
+	  </table>
+	</td>
+        </tr>
+        </tbody>
+	</table>
+      </td>
+      </tr>
+      </tbody></table>
+      <table class="small" border="0" cellpadding="0" cellspacing="0" width="100%">
+           <tbody><tr>
+                <td><img src="{$IMAGE_PATH}prvPrfBottomLeft.gif"></td>
+                <td class="prvPrfBottomBg" width="100%"></td>
+                <td><img src="{$IMAGE_PATH}prvPrfBottomRight.gif"></td>
+                </tr>
+            </tbody>
+      </table></td>
+      </tr>
+      </tbody></table>
+	<p>&nbsp;</p>
+	<table border="0" cellpadding="5" cellspacing="0" width="100%">
+	<tbody><tr><td class="small" align="right" nowrap="nowrap"><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
+	</tbody></table>
+					
+	</td>
+	</tr>
+	</tbody></table>
+	</form>	
+	<!-- End of Display -->
+	</td>
+	</tr>
+	</table>
+	</td>
+	</tr>
+	</table>
+	</div>
+
+	</td>
+	<td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+	</tr>
+</tbody>
+</table>
+<script language="javascript" type="text/javascript">
+{literal}
+function fnToggleVIew(obj){
+	var tagStyle = document.getElementById(obj).className;
+	if(tagStyle == 'hideTable')
+		document.getElementById(obj).className = 'showTable';
+	else
+		document.getElementById(obj).className = 'hideTable';
+}
+{/literal}
+{literal}
+        //for move RenameProfile
+        var theEventHandle = document.getElementById("renameUI");
+        var theEventRoot   = document.getElementById("renameProfile");
+        Drag.init(theEventHandle, theEventRoot);
+{/literal}
+</script>
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/QuickCreate.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/QuickCreate.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/QuickCreate.tpl Tue Nov 14 03:16:10 2006
@@ -68,10 +68,9 @@
 				<td width="30%" align=left class="cellText">
 					<select name="{$fldname}">
 					{foreach item=arr from=$fldvalue}
-					{foreach key=sel_value item=value from=$arr}
-					<option value="{$sel_value}" {$value}>{$sel_value}</option>
-					{/foreach}
-					
+						{foreach key=sel_value item=value from=$arr}
+							<option value="{$sel_value}" {$value}>{$MOD.$sel_value}</option>
+						{/foreach}
 					{/foreach}
 					</select>
 				</td>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/RelatedListContents.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/RelatedListContents.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/RelatedListContents.tpl Tue Nov 14 03:16:10 2006
@@ -1,146 +1,147 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-
-{if $SinglePane_View eq 'true'}
-	{assign var = return_modname value='DetailView'}
-{else}
-	{assign var = return_modname value='CallRelatedList'}
-{/if}
-
-{foreach key=header item=detail from=$RELATEDLISTS}
-
-<table border=0 cellspacing=0 cellpadding=0 width=100% class="small" style="border-bottom:1px solid #999999;padding:5px;">
-        <tr>
-                <td  valign=bottom><b>{$APP.$header}</b></td>
-                {if $detail ne ''}
-                <td align=center>{$detail.navigation.0}</td>
-                {$detail.navigation.1}
-                {/if}
-                <td align=right>
-			{if $header eq 'Potentials'}
-                                <input title="{$APP.LBL_ADD_NEW} {$APP.Potential}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Potentials'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Potential}">
-                </td>
-                        {elseif $header eq 'PriceBooks'}
-                                {if $MODULE eq 'Products'}
-                                <input title="{$APP.LBL_ADD_TO} {$APP.PriceBook}" accessKey="" class="crmbutton small edit" value="{$APP.LBL_ADD_TO} {$APP.PriceBook}" LANGUAGE=javascript onclick="this.form.action.value='AddProductToPriceBooks';this.form.module.value='Products'"  type="submit" name="button">
-                                {/if}
-                        {elseif $header eq 'Products'}
-                                {if $MODULE eq 'PriceBooks'}
-                                <input title="{$APP.LBL_SELECT_PRODUCT_BUTTON_LABEL}" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_PRODUCT_BUTTON_LABEL}" LANGUAGE=javascript onclick="this.form.action.value='AddProductsToPriceBook';this.form.module.value='Products';this.form.return_module.value='Products';this.form.return_action.value='PriceBookDetailView'"  type="submit" name="button"></td>
-				{elseif $MODULE eq 'Potentials'}
-					<input title="Change" accessKey="" class="crmbutton small save" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">&nbsp;
-					<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small save" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
-					
-				{elseif $MODULE eq 'Vendors'}
-					<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'; this.form.parent_id.value='';" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
-                                {else}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
-				{/if}
-			{elseif $header eq 'Leads'}
-				{if $MODULE eq 'Campaigns'}
-				{$LEADCVCOMBO} <span id="lead_list_button"><input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button"></span>
-				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Lead}" LANGUAGE=javascript onclick='return window.open("index.php?module=Leads&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">
-				{/if}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Lead}" accessyKey="F" class="crmbutton small edit" onclick="this.form.action.value='EditView';this.form.module.value='Leads'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Lead}"></td>
-			{elseif $header eq 'Contacts' }
-				{if $MODULE eq 'Calendar' || $MODULE eq 'Potentials' || $MODULE eq 'Vendors'}
-				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
-				{elseif $MODULE eq 'Emails'}
-				<input title="{$APP.LBL_BULK_MAILS}" accessykey="F" class="crmbutton small create" onclick="this.form.action.value='sendmail';this.form.return_action.value='DetailView';this.form.module.value='Emails';this.form.return_module.value='Emails';" name="button" value="{$APP.LBL_BULK_MAILS}" type="submit">&nbsp;
-				<input title="Change" accessKey="" class="crmbutton small create" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module=Emails&action=Popup&popuptype=detailview&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
-				{elseif $MODULE eq 'Campaigns'}
-				{$CONTCVCOMBO}  <span id="contact_list_button"><input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button"></span>
-				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Contact}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Contacts'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Contact}"></td>
-				{else}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Contact}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Contacts'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Contact}"></td>
-				{/if}
-			{elseif $header eq 'Activities'}
-				{if $MODULE eq 'PurchaseOrder' || $MODULE eq 'Invoice' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Campaigns'}
-				<input type="hidden" name="activity_mode">
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Todo}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Calendar'; this.form.return_module.value='{$MODULE}'; this.form.activity_mode.value='Task'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Todo}"></td>
-				{else}
-				<input type="hidden" name="activity_mode">
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Todo}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Calendar'; this.form.return_module.value='{$MODULE}'; this.form.activity_mode.value='Task'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Todo}">&nbsp;
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Event}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Calendar'; this.form.return_module.value='{$MODULE}'; this.form.activity_mode.value='Events'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Event}"></td>
-				{/if}
-			{elseif $header eq 'HelpDesk'}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Ticket}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='HelpDesk'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Ticket}"></td>
-			{elseif $header eq 'Campaigns'}
-                                <input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Campaign}" LANGUAGE=javascript onclick='return window.open("index.php?module=Campaigns&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
-			{elseif $header eq 'Attachments'}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Note}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Notes'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Note}">&nbsp;
-				<input type="hidden" name="fileid">
-				<input title="{$APP.LBL_ADD_NEW} {$APP.LBL_ATTACHMENT}" accessyKey="F" class="crmbutton small create" onclick="window.open('index.php?module=uploads&action=uploadsAjax&file=upload&return_action={$return_modname}&return_module={$MODULE}&return_id={$ID}','Attachments','width=500,height=300');" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.LBL_ATTACHMENT}"></td>
-			{elseif $header eq 'Quotes'}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Quote}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Quotes'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Quote}"></td>
-			{elseif $header eq 'Invoice'}
-				{if $MODULE eq 'SalesOrder'}
-				<input type="hidden">
-				{else}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.Invoice}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Invoice'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Invoice}"></td>
-				{/if}
-			{elseif $header eq 'Sales Order'}
-				{if $MODULE eq 'Quotes'}
-				<input type="hidden">
-				{else}
-				<input title="{$APP.LBL_ADD_NEW} {$APP.SalesOrder}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='SalesOrder'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.SalesOrder}"></td>
-				{/if}
-			{elseif $header eq 'Purchase Order'}
-                                <input title="{$APP.LBL_ADD_NEW} {$APP.PurchaseOrder}" accessyKey="O" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.module.value='PurchaseOrder'; this.form.return_module.value='{$MODULE}'; this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.PurchaseOrder}"></td>
-                        {elseif $header eq 'Emails'}
-                                <input type="hidden" name="email_directing_module">
-                                <input type="hidden" name="record">
-                                <input title="{$APP.LBL_ADD_NEW} {$APP.Email}" accessyKey="F" class="crmbutton small create" onclick="fnvshobj(this,'sendmail_cont');sendmail('{$MODULE}',{$ID});" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Email}"></td>
-			{elseif $header eq 'Users'}
-                                {if $MODULE eq 'Calendar'}
-				<input title="Change" accessKey="" tabindex="2" type="button" class="crmbutton small edit" value="{$APP.LBL_SELECT_USER_BUTTON_LABEL}" name="button" LANGUAGE=javascript onclick='return window.open("index.php?module=Users&return_module=Calendar&return_action={$return_modname}&activity_mode=Events&action=Popup&popuptype=detailview&form=EditView&form_submit=true&select=enable&return_id={$ID}&recordid={$ID}","test","width=640,height=525,resizable=0,scrollbars=0")';>
-                                {elseif $MODULE eq 'Emails'}
-                                <input title="{$APP.LBL_BULK_MAILS}" accessykey="F" class="crmbutton small create" onclick="this.form.action.value='sendmail';this.form.return_action.value='DetailView';this.form.module.value='Emails';this.form.return_module.value='Emails';" name="button" value="{$APP.LBL_BULK_MAILS}" type="submit">&nbsp;
-                                <input title="Change" accesskey="" tabindex="2" class="crmbutton small edit" value="{$APP.LBL_SELECT_USER_BUTTON_LABEL}" name="Button" language="javascript" onclick='return window.open("index.php?module=Users&return_module=Emails&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=true&return_id={$ID}&recordid={$ID}","test","width=640,height=520,resizable=0,scrollbars=0");' type="button">&nbsp;</td>
-                                {/if}
-                        {elseif $header eq 'Activity History'}
-                                &nbsp;</td>
-                        {/if}
-        </tr>
-</table>
-{if $detail ne ''}
-	{foreach key=header item=detail from=$detail}
-		{if $header eq 'header'}
-			<table border=0 cellspacing=1 cellpadding=3 width=100% style="background-color:#eaeaea;" class="small">
-				<tr style="height:25px" bgcolor=white>
-				{foreach key=header item=headerfields from=$detail}
-					<td class="lvtCol">{$headerfields}</td>
-				{/foreach}
-                                </tr>
-		{elseif $header eq 'entries'}
-			{foreach key=header item=detail from=$detail}
-				<tr bgcolor=white>
-				{foreach key=header item=listfields from=$detail}
-	                                 <td>{$listfields}</td>
-				{/foreach}
-				</tr>
-			{/foreach}
-			</table>
-		{/if}
-	{/foreach}
-{else}
-	<table style="background-color:#eaeaea;color:eeeeee" border="0" cellpadding="3" cellspacing="1" width="100%" class="small">
-		<tr style="height: 25px;" bgcolor="white">
-			<td><i>{$APP.LBL_NONE_INCLUDED}</i></td>
-		</tr>
-	</table>
-{/if}
-<br><br>
-{/foreach}
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+
+{if $SinglePane_View eq 'true'}
+	{assign var = return_modname value='DetailView'}
+{else}
+	{assign var = return_modname value='CallRelatedList'}
+{/if}
+
+{foreach key=header item=detail from=$RELATEDLISTS}
+
+<table border=0 cellspacing=0 cellpadding=0 width=100% class="small" style="border-bottom:1px solid #999999;padding:5px;">
+        <tr>
+                <td  valign=bottom><b>{$APP.$header}</b></td>
+                {if $detail ne ''}
+                <td align=center>{$detail.navigation.0}</td>
+                {$detail.navigation.1}
+                {/if}
+                <td align=right>
+			{if $header eq 'Potentials'}
+                                <input title="{$APP.LBL_ADD_NEW} {$APP.Potential}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Potentials'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Potential}">
+                </td>
+                        {elseif $header eq 'PriceBooks'}
+                                {if $MODULE eq 'Products'}
+                                <input title="{$APP.LBL_ADD_TO} {$APP.PriceBook}" accessKey="" class="crmbutton small edit" value="{$APP.LBL_ADD_TO} {$APP.PriceBook}" LANGUAGE=javascript onclick="this.form.action.value='AddProductToPriceBooks';this.form.module.value='Products'"  type="submit" name="button">
+                                {/if}
+                        {elseif $header eq 'Products'}
+                                {if $MODULE eq 'PriceBooks'}
+	                                <input title="{$APP.LBL_SELECT_PRODUCT_BUTTON_LABEL}" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_PRODUCT_BUTTON_LABEL}" LANGUAGE=javascript onclick="this.form.action.value='AddProductsToPriceBook';this.form.module.value='Products';this.form.return_module.value='Products';this.form.return_action.value='PriceBookDetailView'"  type="submit" name="button"></td>
+				{elseif $MODULE eq 'Potentials'}
+					<input title="Change" accessKey="" class="crmbutton small save" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">&nbsp;
+					<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small save" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
+
+				{elseif $MODULE eq 'Vendors'}
+					<input title="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}" accessyKey="F" class="crmbutton small create" LANGUAGE=javascript onclick='return window.open("index.php?module=Products&return_module=Products&action=Popup&return_action={$return_modname}&popuptype=detailview&form=DetailView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button" name="button" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Product}">
+					<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'; this.form.parent_id.value='';" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
+                                {else}
+					<input title="{$APP.LBL_ADD_NEW} {$APP.Product}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Products';this.form.return_module.value='{$MODULE}';this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Product}"></td>
+				{/if}
+			{elseif $header eq 'Leads'}
+				{if $MODULE eq 'Campaigns'}
+				{$LEADCVCOMBO} <span id="lead_list_button"><input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button"></span>
+				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Lead}" LANGUAGE=javascript onclick='return window.open("index.php?module=Leads&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">
+				{/if}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Lead}" accessyKey="F" class="crmbutton small edit" onclick="this.form.action.value='EditView';this.form.module.value='Leads'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Lead}"></td>
+			{elseif $header eq 'Contacts' }
+				{if $MODULE eq 'Calendar' || $MODULE eq 'Potentials' || $MODULE eq 'Vendors'}
+				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
+				{elseif $MODULE eq 'Emails'}
+				<input title="{$APP.LBL_BULK_MAILS}" accessykey="F" class="crmbutton small create" onclick="this.form.action.value='sendmail';this.form.return_action.value='DetailView';this.form.module.value='Emails';this.form.return_module.value='Emails';" name="button" value="{$APP.LBL_BULK_MAILS}" type="submit">&nbsp;
+				<input title="Change" accessKey="" class="crmbutton small create" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module=Emails&action=Popup&popuptype=detailview&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
+				{elseif $MODULE eq 'Campaigns'}
+				{$CONTCVCOMBO}  <span id="contact_list_button"><input title="{$MOD.LBL_LOAD_LIST}" accessKey="" class="crmbutton small edit" value="{$MOD.LBL_LOAD_LIST}" type="button"  name="button"></span>
+				<input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Contact}" LANGUAGE=javascript onclick='return window.open("index.php?module=Contacts&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button">
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Contact}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Contacts'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Contact}"></td>
+				{else}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Contact}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Contacts'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Contact}"></td>
+				{/if}
+			{elseif $header eq 'Activities'}
+				{if $MODULE eq 'PurchaseOrder' || $MODULE eq 'Invoice' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Campaigns'}
+				<input type="hidden" name="activity_mode">
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Todo}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Calendar'; this.form.return_module.value='{$MODULE}'; this.form.activity_mode.value='Task'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Todo}"></td>
+				{else}
+				<input type="hidden" name="activity_mode">
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Todo}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Calendar'; this.form.return_module.value='{$MODULE}'; this.form.activity_mode.value='Task'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Todo}">&nbsp;
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Event}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Calendar'; this.form.return_module.value='{$MODULE}'; this.form.activity_mode.value='Events'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Event}"></td>
+				{/if}
+			{elseif $header eq 'HelpDesk'}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Ticket}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='HelpDesk'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Ticket}"></td>
+			{elseif $header eq 'Campaigns'}
+                                <input title="Change" accessKey="" class="crmbutton small edit" value="{$APP.LBL_SELECT_BUTTON_LABEL} {$APP.Campaign}" LANGUAGE=javascript onclick='return window.open("index.php?module=Campaigns&return_module={$MODULE}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$ID}","test","width=640,height=602,resizable=0,scrollbars=0");' type="button"  name="button"></td>
+			{elseif $header eq 'Attachments'}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Note}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.return_action.value='{$return_modname}'; this.form.module.value='Notes'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Note}">&nbsp;
+				<input type="hidden" name="fileid">
+				<input title="{$APP.LBL_ADD_NEW} {$APP.LBL_ATTACHMENT}" accessyKey="F" class="crmbutton small create" onclick="window.open('index.php?module=uploads&action=uploadsAjax&file=upload&return_action={$return_modname}&return_module={$MODULE}&return_id={$ID}','Attachments','width=500,height=300');" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.LBL_ATTACHMENT}"></td>
+			{elseif $header eq 'Quotes'}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Quote}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Quotes'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Quote}"></td>
+			{elseif $header eq 'Invoice'}
+				{if $MODULE eq 'SalesOrder'}
+				<input type="hidden">
+				{else}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.Invoice}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='Invoice'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Invoice}"></td>
+				{/if}
+			{elseif $header eq 'Sales Order'}
+				{if $MODULE eq 'Quotes'}
+				<input type="hidden">
+				{else}
+				<input title="{$APP.LBL_ADD_NEW} {$APP.SalesOrder}" accessyKey="F" class="crmbutton small create" onclick="this.form.action.value='EditView';this.form.module.value='SalesOrder'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.SalesOrder}"></td>
+				{/if}
+			{elseif $header eq 'Purchase Order'}
+                                <input title="{$APP.LBL_ADD_NEW} {$APP.PurchaseOrder}" accessyKey="O" class="crmbutton small create" onclick="this.form.action.value='EditView'; this.form.module.value='PurchaseOrder'; this.form.return_module.value='{$MODULE}'; this.form.return_action.value='{$return_modname}'" type="submit" name="button" value="{$APP.LBL_ADD_NEW} {$APP.PurchaseOrder}"></td>
+                        {elseif $header eq 'Emails'}
+                                <input type="hidden" name="email_directing_module">
+                                <input type="hidden" name="record">
+                                <input title="{$APP.LBL_ADD_NEW} {$APP.Email}" accessyKey="F" class="crmbutton small create" onclick="fnvshobj(this,'sendmail_cont');sendmail('{$MODULE}',{$ID});" type="button" name="button" value="{$APP.LBL_ADD_NEW} {$APP.Email}"></td>
+			{elseif $header eq 'Users'}
+                                {if $MODULE eq 'Calendar'}
+				<input title="Change" accessKey="" tabindex="2" type="button" class="crmbutton small edit" value="{$APP.LBL_SELECT_USER_BUTTON_LABEL}" name="button" LANGUAGE=javascript onclick='return window.open("index.php?module=Users&return_module=Calendar&return_action={$return_modname}&activity_mode=Events&action=Popup&popuptype=detailview&form=EditView&form_submit=true&select=enable&return_id={$ID}&recordid={$ID}","test","width=640,height=525,resizable=0,scrollbars=0")';>
+                                {elseif $MODULE eq 'Emails'}
+                                <input title="{$APP.LBL_BULK_MAILS}" accessykey="F" class="crmbutton small create" onclick="this.form.action.value='sendmail';this.form.return_action.value='DetailView';this.form.module.value='Emails';this.form.return_module.value='Emails';" name="button" value="{$APP.LBL_BULK_MAILS}" type="submit">&nbsp;
+                                <input title="Change" accesskey="" tabindex="2" class="crmbutton small edit" value="{$APP.LBL_SELECT_USER_BUTTON_LABEL}" name="Button" language="javascript" onclick='return window.open("index.php?module=Users&return_module=Emails&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=true&return_id={$ID}&recordid={$ID}","test","width=640,height=520,resizable=0,scrollbars=0");' type="button">&nbsp;</td>
+                                {/if}
+                        {elseif $header eq 'Activity History'}
+                                &nbsp;</td>
+                        {/if}
+        </tr>
+</table>
+{if $detail ne ''}
+	{foreach key=header item=detail from=$detail}
+		{if $header eq 'header'}
+			<table border=0 cellspacing=1 cellpadding=3 width=100% style="background-color:#eaeaea;" class="small">
+				<tr style="height:25px" bgcolor=white>
+				{foreach key=header item=headerfields from=$detail}
+					<td class="lvtCol">{$headerfields}</td>
+				{/foreach}
+                                </tr>
+		{elseif $header eq 'entries'}
+			{foreach key=header item=detail from=$detail}
+				<tr bgcolor=white>
+				{foreach key=header item=listfields from=$detail}
+	                                 <td>{$listfields}</td>
+				{/foreach}
+				</tr>
+			{/foreach}
+			</table>
+		{/if}
+	{/foreach}
+{else}
+	<table style="background-color:#eaeaea;color:eeeeee" border="0" cellpadding="3" cellspacing="1" width="100%" class="small">
+		<tr style="height: 25px;" bgcolor="white">
+			<td><i>{$APP.LBL_NONE_INCLUDED}</i></td>
+		</tr>
+	</table>
+{/if}
+<br><br>
+{/foreach}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/SetMenu.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/SetMenu.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/SetMenu.tpl Tue Nov 14 03:16:10 2006
@@ -1,190 +1,192 @@
-{*<!--
-
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
--->*}
-<table border=0 cellspacing=0 cellpadding=20 width=90% class="settingsUI">
-<tr>
-<td valign=top>
-	<table border=0 cellspacing=0 cellpadding=0 width=100%>
-	<tr>
-	<td valign=top>
-		<!--Left Side Navigation Table-->
-		<table border=0 cellspacing=0 cellpadding=0 width=100%>
-		<tr>
-			<td class="settingsTabHeader" nowrap>{$MOD.LBL_USER_MANAGEMENT}</td>
-		</tr>
-
-		{if $smarty.request.action eq 'index' ||  $smarty.request.action eq 'DetailView' || $smarty.request.action eq 'EditView' || $smarty.request.action eq 'ListView' }
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'listroles' ||  $smarty.request.action eq 'RoleDetailView' ||  $smarty.request.action eq 'saverole' ||  $smarty.request.action eq 'createrole' || $smarty.request.action eq 'RoleDeleteStep1'} 		
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listroles&parenttab=Settings">{$MOD.LBL_ROLES}</a></td></tr>
-		{else}	
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listroles&parenttab=Settings">{$MOD.LBL_ROLES}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'ListProfiles' || $smarty.request.action eq 'profilePrivileges' ||  $smarty.request.action eq 'CreateProfile' ||  $smarty.request.action eq 'SaveProfile' || $smarty.request.action eq 'UpdateProfileChanges' }
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$MOD.LBL_PROFILES}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$MOD.LBL_PROFILES}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'listgroups' || $smarty.request.action eq 'GroupDetailView' || $smarty.request.action eq 'createnewgroup' || $smarty.request.action eq 'SaveGroup'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listgroups&parenttab=Settings">{$MOD.USERGROUPLIST}</a></td></tr>   	
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listgroups&parenttab=Settings">{$MOD.USERGROUPLIST}</a></td></tr>
-		{/if}
-
-		{if  $smarty.request.action eq 'OrgSharingEditView' || $smarty.request.action eq 'OrgSharingDetailView' || $smarty.request.action eq 'SaveOrgSharing'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings">{$MOD.LBL_SHARING_ACCESS}</a></td></tr>  	
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings">{$MOD.LBL_SHARING_ACCESS}</a></td></tr>
-		{/if}
-			
-		{if $smarty.request.action eq 'DefaultFieldPermissions' || $smarty.request.action eq 'UpdateDefaultFieldLevelAccess' || $smarty.request.action eq 'EditDefOrgFieldLevelAccess' }
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings">{$MOD.LBL_FIELDS_ACCESS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings">{$MOD.LBL_FIELDS_ACCESS}</a></td></tr>
-		{/if}
-			
-		{if $smarty.request.action eq 'AuditTrailList'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings">{$MOD.LBL_AUDIT_TRAIL}</a></td></tr>
-        {else}
-        <tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings">{$MOD.LBL_AUDIT_TRAIL}</a></td></tr>
-        {/if}
-
-		{if $smarty.request.action eq 'ListLoginHistory'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings">{$MOD.LBL_LOGIN_HISTORY_DETAILS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings">{$MOD.LBL_LOGIN_HISTORY_DETAILS}</a></td></tr>
-		{/if}
-
-		
-		<tr><td class="settingsTabHeader" nowrap>{$MOD.LBL_STUDIO}</td></tr>
-		{if  $smarty.request.action eq 'CustomFieldList' || $smarty.request.action eq 'LeadCustomFieldMapping'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings">{$MOD.LBL_CUSTOM_FIELDS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings">{$MOD.LBL_CUSTOM_FIELDS}</a></td></tr>
-		{/if}
-				
-		{if  $smarty.request.action eq 'PickList' ||  $smarty.request.action eq 'SettingsAjax'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=PickList&parenttab=Settings">{$MOD.LBL_PICKLIST_EDITOR}</a></td></tr>						     {else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=PickList&parenttab=Settings">{$MOD.LBL_PICKLIST_EDITOR}</a></td></tr>
-		{/if}
-	
-		<tr><td class="settingsTabHeader" nowrap>{$MOD.LBL_COMMUNICATION_TEMPLATES}</td></tr>
-
-		{if $smarty.request.action eq 'listemailtemplates' || $smarty.request.action eq 'detailviewemailtemplate' || $smarty.request.action eq 'editemailtemplate' || $smarty.request.action eq 'saveemailtemplate' || $smarty.request.action eq 'deleteemailtemplate' || $smarty.request.action eq 'createemailtemplate'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$MOD.EMAILTEMPLATES}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$MOD.EMAILTEMPLATES}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'listwordtemplates' || $smarty.request.action eq 'add2db' || $smarty.request.action eq 'deletewordtemplate' || $smarty.request.action eq 'upload'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$MOD.WORDINTEGRATION}</a></td></tr>
-		{else}	
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$MOD.WORDINTEGRATION}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'listnotificationschedulers' || $smarty.request.action eq 'UsersAjax'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings">{$MOD.NOTIFICATIONSCHEDULERS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings">{$MOD.NOTIFICATIONSCHEDULERS}</a></td></tr>
-		{/if}
-				
-		{if $smarty.request.action eq 'listinventorynotifications' || $smarty.request.action eq 'UsersAjax'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings">{$MOD.INVENTORYNOTIFICATION}</a></td></tr>
-		{else}	
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings">{$MOD.INVENTORYNOTIFICATION}</a></td></tr>
-		{/if} 	
-
-		{if $smarty.request.action eq 'OrganizationTermsandConditions' || $smarty.request.action eq 'savetermsandconditions'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings">{$MOD.LBL_INVENTORY_TANDC}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings">{$MOD.LBL_INVENTORY_TANDC}</a></td></tr>
-		{/if}
-
-
-		<tr><td class="settingsTabHeader" nowrap>{$MOD.LBL_OTHER_SETTINGS}</td></tr>
-		{if $smarty.request.action eq 'OrganizationConfig' || $smarty.request.action eq 'EditCompanyDetails' || $smarty.request.action eq 'add2db'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=OrganizationConfig&parenttab=Settings">{$MOD.LBL_COMPANY_DETAILS}</a></td></tr>
-		{else}	
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=OrganizationConfig&parenttab=Settings">{$MOD.LBL_COMPANY_DETAILS}</a></td></tr>
-		{/if}
-		
-		{if  $smarty.request.action eq 'EmailConfig' ||  $smarty.request.action eq 'Save' }
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings">{$MOD.LBL_MAIL_SERVER_SETTINGS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings">{$MOD.LBL_MAIL_SERVER_SETTINGS}</a></td></tr>
-		{/if}
-		
-		{if $smarty.request.action eq 'BackupServerConfig' || $smarty.request.action eq 'Save'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings">{$MOD.LBL_BACKUP_SERVER_SETTINGS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings">{$MOD.LBL_BACKUP_SERVER_SETTINGS}</a></td></tr>
-		{/if}
-		
-		{if $smarty.request.action eq 'ListModuleOwners' || $smarty.request.action eq 'SettingsAjax'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings">{$MOD.LBL_MODULE_OWNERS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings">{$MOD.LBL_MODULE_OWNERS}</a></td></tr>
-		{/if}
-		
-		{if $smarty.request.action eq 'CurrencyListView' ||  $smarty.request.action eq 'CurrencyEditView' ||  $smarty.request.action eq 'SaveCurrencyInfo'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings">{$MOD.LBL_CURRENCY_SETTINGS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings">{$MOD.LBL_CURRENCY_SETTINGS}</a></td></tr>
-		{/if}
-		
-		{if $smarty.request.action eq 'TaxConfig'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings">{$MOD.LBL_TAX_SETTINGS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings">{$MOD.LBL_TAX_SETTINGS}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'listsysconfig'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=System&action=listsysconfig&parenttab=Settings">{$MOD.LBL_SYSTEM_INFO}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=System&action=listsysconfig&parenttab=Settings">{$MOD.LBL_SYSTEM_INFO}</a></td></tr>
-		{/if}
-
-		{if $smarty.request.action eq 'ProxyServerConfig'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings">{$MOD.LBL_PROXY_SETTINGS}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings">{$MOD.LBL_PROXY_SETTINGS}</a></td></tr>
-		{/if}
-
-		{if  $smarty.request.action eq 'Announcements' ||  $smarty.request.action eq 'UsersAjax' }
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=Announcements&parenttab=Settings">{$MOD.LBL_ANNOUNCEMENT}</a></td></tr>		
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=Announcements&parenttab=Settings">{$MOD.LBL_ANNOUNCEMENT}</a></td></tr>
-		{/if}
-		
-		{if $smarty.request.action eq 'DefModuleView'}
-		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings">{$MOD.LBL_DEFAULT_MODULE_VIEW}</a></td></tr>
-		{else}
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings">{$MOD.LBL_DEFAULT_MODULE_VIEW}</a></td></tr>
-		{/if}
-	
-		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Migration&action=MigrationStep1&parenttab=Settings">{$MOD.LBL_MIGRATION}</a></td></tr>
-		</table>
-		<!-- Left side navigation table ends -->
-		
-	</td>
-	<td width=90% class="small settingsSelectedUI" valign=top align=left>
-
-
-
-
+{*<!--
+
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+-->*}
+<table border=0 cellspacing=0 cellpadding=20 width=90% class="settingsUI">
+<tr>
+<td valign=top>
+	<table border=0 cellspacing=0 cellpadding=0 width=100%>
+	<tr>
+	<td valign=top>
+		<!--Left Side Navigation Table-->
+		<table border=0 cellspacing=0 cellpadding=0 width=100%>
+		<tr>
+			<td class="settingsTabHeader" nowrap>{$MOD.LBL_USER_MANAGEMENT}</td>
+		</tr>
+
+		{if $smarty.request.action eq 'index' ||  $smarty.request.action eq 'DetailView' || $smarty.request.action eq 'EditView' || $smarty.request.action eq 'ListView' }
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'listroles' ||  $smarty.request.action eq 'RoleDetailView' ||  $smarty.request.action eq 'saverole' ||  $smarty.request.action eq 'createrole' || $smarty.request.action eq 'RoleDeleteStep1'} 		
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listroles&parenttab=Settings">{$MOD.LBL_ROLES}</a></td></tr>
+		{else}	
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listroles&parenttab=Settings">{$MOD.LBL_ROLES}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'ListProfiles' || $smarty.request.action eq 'profilePrivileges' ||  $smarty.request.action eq 'CreateProfile' ||  $smarty.request.action eq 'SaveProfile' || $smarty.request.action eq 'UpdateProfileChanges' }
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$MOD.LBL_PROFILES}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$MOD.LBL_PROFILES}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'listgroups' || $smarty.request.action eq 'GroupDetailView' || $smarty.request.action eq 'createnewgroup' || $smarty.request.action eq 'SaveGroup'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listgroups&parenttab=Settings">{$MOD.USERGROUPLIST}</a></td></tr>   	
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listgroups&parenttab=Settings">{$MOD.USERGROUPLIST}</a></td></tr>
+		{/if}
+
+		{if  $smarty.request.action eq 'OrgSharingEditView' || $smarty.request.action eq 'OrgSharingDetailView' || $smarty.request.action eq 'SaveOrgSharing'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings">{$MOD.LBL_SHARING_ACCESS}</a></td></tr>  	
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings">{$MOD.LBL_SHARING_ACCESS}</a></td></tr>
+		{/if}
+			
+		{if $smarty.request.action eq 'DefaultFieldPermissions' || $smarty.request.action eq 'UpdateDefaultFieldLevelAccess' || $smarty.request.action eq 'EditDefOrgFieldLevelAccess' }
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings">{$MOD.LBL_FIELDS_ACCESS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings">{$MOD.LBL_FIELDS_ACCESS}</a></td></tr>
+		{/if}
+			
+		{if $smarty.request.action eq 'AuditTrailList'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings">{$MOD.LBL_AUDIT_TRAIL}</a></td></tr>
+        {else}
+        <tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings">{$MOD.LBL_AUDIT_TRAIL}</a></td></tr>
+        {/if}
+
+		{if $smarty.request.action eq 'ListLoginHistory'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings">{$MOD.LBL_LOGIN_HISTORY_DETAILS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings">{$MOD.LBL_LOGIN_HISTORY_DETAILS}</a></td></tr>
+		{/if}
+
+		
+		<tr><td class="settingsTabHeader" nowrap>{$MOD.LBL_STUDIO}</td></tr>
+		{if  $smarty.request.action eq 'CustomFieldList' || $smarty.request.action eq 'LeadCustomFieldMapping'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings">{$MOD.LBL_CUSTOM_FIELDS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings">{$MOD.LBL_CUSTOM_FIELDS}</a></td></tr>
+		{/if}
+				
+		{if  $smarty.request.action eq 'PickList' ||  $smarty.request.action eq 'SettingsAjax'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=PickList&parenttab=Settings">{$MOD.LBL_PICKLIST_EDITOR}</a></td></tr>						     {else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=PickList&parenttab=Settings">{$MOD.LBL_PICKLIST_EDITOR}</a></td></tr>
+		{/if}
+	
+		<tr><td class="settingsTabHeader" nowrap>{$MOD.LBL_COMMUNICATION_TEMPLATES}</td></tr>
+
+		{if $smarty.request.action eq 'listemailtemplates' || $smarty.request.action eq 'detailviewemailtemplate' || $smarty.request.action eq 'editemailtemplate' || $smarty.request.action eq 'saveemailtemplate' || $smarty.request.action eq 'deleteemailtemplate' || $smarty.request.action eq 'createemailtemplate'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$MOD.EMAILTEMPLATES}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$MOD.EMAILTEMPLATES}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'listwordtemplates' || $smarty.request.action eq 'add2db' || $smarty.request.action eq 'deletewordtemplate' || $smarty.request.action eq 'upload'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$MOD.WORDINTEGRATION}</a></td></tr>
+		{else}	
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$MOD.WORDINTEGRATION}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'listnotificationschedulers' || $smarty.request.action eq 'UsersAjax'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings">{$MOD.NOTIFICATIONSCHEDULERS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings">{$MOD.NOTIFICATIONSCHEDULERS}</a></td></tr>
+		{/if}
+				
+		{if $smarty.request.action eq 'listinventorynotifications' || $smarty.request.action eq 'UsersAjax'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings">{$MOD.INVENTORYNOTIFICATION}</a></td></tr>
+		{else}	
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings">{$MOD.INVENTORYNOTIFICATION}</a></td></tr>
+		{/if} 	
+
+		
+
+		<tr><td class="settingsTabHeader" nowrap>{$MOD.LBL_OTHER_SETTINGS}</td></tr>
+		{if $smarty.request.action eq 'OrganizationConfig' || $smarty.request.action eq 'EditCompanyDetails' || $smarty.request.action eq 'add2db'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Organization&action=ListView&parenttab=Settings">{$MOD.LBL_COMPANY_DETAILS}</a></td></tr>
+		{else}	
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Organization&action=ListView&parenttab=Settings">{$MOD.LBL_COMPANY_DETAILS}</a></td></tr>
+		{/if}
+		
+		{if  $smarty.request.action eq 'EmailConfig' ||  $smarty.request.action eq 'Save' }
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings">{$MOD.LBL_MAIL_SERVER_SETTINGS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings">{$MOD.LBL_MAIL_SERVER_SETTINGS}</a></td></tr>
+		{/if}
+		
+		{if $smarty.request.action eq 'BackupServerConfig' || $smarty.request.action eq 'Save'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings">{$MOD.LBL_BACKUP_SERVER_SETTINGS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings">{$MOD.LBL_BACKUP_SERVER_SETTINGS}</a></td></tr>
+		{/if}
+		
+		{if $smarty.request.action eq 'ListModuleOwners' || $smarty.request.action eq 'SettingsAjax'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings">{$MOD.LBL_MODULE_OWNERS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings">{$MOD.LBL_MODULE_OWNERS}</a></td></tr>
+		{/if}
+		
+		{if $smarty.request.action eq 'CurrencyListView' ||  $smarty.request.action eq 'CurrencyEditView' ||  $smarty.request.action eq 'SaveCurrencyInfo'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings">{$MOD.LBL_CURRENCY_SETTINGS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings">{$MOD.LBL_CURRENCY_SETTINGS}</a></td></tr>
+		{/if}
+		
+		{if $smarty.request.action eq 'TaxConfig'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings">{$MOD.LBL_TAX_SETTINGS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings">{$MOD.LBL_TAX_SETTINGS}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'listsysconfig'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=System&action=listsysconfig&parenttab=Settings">{$MOD.LBL_SYSTEM_INFO}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=System&action=listsysconfig&parenttab=Settings">{$MOD.LBL_SYSTEM_INFO}</a></td></tr>
+		{/if}
+
+		{if $smarty.request.action eq 'ProxyServerConfig'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings">{$MOD.LBL_PROXY_SETTINGS}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings">{$MOD.LBL_PROXY_SETTINGS}</a></td></tr>
+		{/if}
+
+		{if  $smarty.request.action eq 'Announcements' ||  $smarty.request.action eq 'UsersAjax' }
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=Announcements&parenttab=Settings">{$MOD.LBL_ANNOUNCEMENT}</a></td></tr>		
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=Announcements&parenttab=Settings">{$MOD.LBL_ANNOUNCEMENT}</a></td></tr>
+		{/if}
+		
+		{if $smarty.request.action eq 'DefModuleView'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings">{$MOD.LBL_DEFAULT_MODULE_VIEW}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings">{$MOD.LBL_DEFAULT_MODULE_VIEW}</a></td></tr>
+		{/if}
+	
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Migration&action=MigrationStep1&parenttab=Settings">{$MOD.LBL_MIGRATION}</a></td></tr>
+
+		{if $smarty.request.action eq 'OrganizationTermsandConditions' || $smarty.request.action eq 'savetermsandconditions'}
+		<tr><td class="settingsTabSelected" nowrap><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings">{$MOD.LBL_INVENTORY_TANDC}</a></td></tr>
+		{else}
+		<tr><td class="settingsTabList" nowrap><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings">{$MOD.LBL_INVENTORY_TANDC}</a></td></tr>
+		{/if}
+
+		</table>
+		<!-- Left side navigation table ends -->
+		
+	</td>
+	<td width=90% class="small settingsSelectedUI" valign=top align=left>
+
+
+
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Settings.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Settings.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Settings.tpl Tue Nov 14 03:16:10 2006
@@ -1,566 +1,507 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-
-	{include file="Buttons_List1.tpl"}
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-	<td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-	<br>
-	<div align=center>
-	<table border=0 cellspacing=0 cellpadding=10 width=90% class="settingsUI">
-	<tr>
-		<td>
-		<!-- heading -->
-
-		<span class="heading2">{$MOD.LBL_SETTINGS}</span>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			<!--All Icons table -->
-			<table border=0 cellspacing=0 cellpadding=0 width=100%>
-			<tr>
-
-				<td class="settingsTabHeader">
-				<!-- Users & Access Management -->
-					{$MOD.LBL_USER_MANAGEMENT}	
-				</td>
-			</tr>
-			<tr>
-				<td class="settingsIconDisplay small">
-				<!-- Icons for Users & Access Management -->
-				
-				<table border=0 cellspacing=0 cellpadding=10 width=100%>
-
-				<tr>
-					<td width=25% valign=top>
-					<!-- icon 1-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Administration&action=index&parenttab=Settings"><img src="{$IMAGE_PATH}ico-users.gif" alt="{$MOD.LBL_USERS}" width="48" height="48" border=0 title="{$MOD.LBL_USERS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a></td>
-						</tr>
-
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_USER_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 2-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listroles&parenttab=Settings"><img src="{$IMAGE_PATH}ico-roles.gif" alt="{$MOD.LBL_ROLES}" width="48" height="48" border=0 title="{$MOD.LBL_ROLES}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=listroles&parenttab=Settings">{$MOD.LBL_ROLES}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_ROLE_DESCRIPTION}</td>
-						</tr>
-						</table>
-
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 3-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings"><img src="{$IMAGE_PATH}ico-profile.gif" alt="{$MOD.LBL_PROFILES}" width="48" height="48" border=0 title="{$MOD.LBL_PROFILES}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$MOD.LBL_PROFILES}</a></td>
-						</tr>
-
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_PROFILE_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 4-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listgroups&parenttab=Settings"><img src="{$IMAGE_PATH}ico-groups.gif" alt="{$MOD.USERGROUPLIST}" width="48" height="48" border=0 title="{$MOD.USERGROUPLIST}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=listgroups&parenttab=Settings">{$MOD.USERGROUPLIST}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_GROUP_DESCRIPTION}</td>
-						</tr>
-						</table>
-
-					</td>
-				</tr>
-				<!-- Row 2 -->
-				<tr>
-					<td width=25% valign=top>
-					<!-- icon 5-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings"><img src="{$IMAGE_PATH}shareaccess.gif" alt="{$MOD.LBL_SHARING_ACCESS}" width="48" height="48" border=0 title="{$MOD.LBL_SHARING_ACCESS}"></a></td>
-
-							<td class=big valign=top><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings">{$MOD.LBL_SHARING_ACCESS}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_SHARING_ACCESS_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-
-					<!-- icon 6 -->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings"><img src="{$IMAGE_PATH}orgshar.gif" alt="Fields to be shown" width="48" height="48" border=0 title="Fields to be shown"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings">{$MOD.LBL_FIELDS_ACCESS}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_SHARING_FIELDS_DESCRIPTION}</td>
-
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 7-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}audit.gif" alt="{$MOD.LBL_AUDIT_TRAIL}" title="{$MOD.LBL_AUDIT_TRAIL}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings">{$MOD.LBL_AUDIT_TRAIL}</a></td>
-						</tr>
-
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_AUDIT_DESCRIPTION}</td>
-						</tr>
-						</table>
-
-						
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 8-->	
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings"><img src="{$IMAGE_PATH}set-IcoLoginHistory.gif" alt="{$MOD.LBL_LOGIN_HISTORY_DETAILS}" width="48" height="48" border=0 title="{$MOD.LBL_LOGIN_HISTORY_DETAILS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings">{$MOD.LBL_LOGIN_HISTORY_DETAILS}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_LOGIN_HISTORY_DESCRIPTION}</td>
-						</tr>
-
-						</table>
-					</td>
-					<!-- Row 3 -->
-					<tr>
-					
-				</tr>
-				</table>
-
-
-				</td>
-			</tr>
-
-
-			<tr>
-				<td class="settingsTabHeader">
-
-				<!-- Studio  -->
-					{$MOD.LBL_STUDIO}	
-				</td>
-			</tr>
-			<tr>
-				<td class="settingsIconDisplay small">
-				<!-- Icons for Users & Access Management -->
-				
-				<table border=0 cellspacing=0 cellpadding=10 width=100%>
-				<tr>
-
-					<td width=25% valign=top>
-					<!-- icon 9-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}custom.gif" alt="{$MOD.LBL_CUSTOM_FIELDS}" title="{$MOD.LBL_CUSTOM_FIELDS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings">{$MOD.LBL_CUSTOM_FIELDS}</a></td>
-						</tr>
-						<tr>
-
-							<td class="small" valign=top>{$MOD.LBL_CUSTOM_FIELDS_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 10-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=PickList&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}picklist.gif" alt="{$MOD.LBL_PICKLIST_EDITOR}" title="{$MOD.LBL_PICKLIST_EDITOR}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=PickList&parenttab=Settings">{$MOD.LBL_PICKLIST_EDITOR}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_PICKLIST_DESCRIPTION}</td>	
-						</tr>
-						</table>
-					</td>
-
-					<td width=25% valign=top>
-					<!-- empty-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top>&nbsp;</td>
-							<td class=big valign=top>&nbsp;</td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>&nbsp;</td>
-
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- empty-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top>&nbsp;</td>
-							<td class=big valign=top>&nbsp;</td>
-
-						</tr>
-						<tr>
-							<td class="small" valign=top>&nbsp;</td>
-						</tr>
-						</table>
-					</td>
-				</tr>
-				</table>
-				
-				
-				</td>
-
-			</tr>
-			
-			
-			
-			<tr>
-				<td class="settingsTabHeader">
-				<!-- Communication Templates -->
-					{$MOD.LBL_COMMUNICATION_TEMPLATES}
-				</td>
-			</tr>
-			<tr>
-				<td class="settingsIconDisplay small">
-
-				<!-- Icons for Communication Templates -->
-				
-				<table border=0 cellspacing=0 cellpadding=10 width=100%>
-				<tr>
-					<td width=25% valign=top>
-					<!-- icon 11-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}ViewTemplate.gif" alt="{$MOD.EMAILTEMPLATES}" title="{$MOD.EMAILTEMPLATES}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$MOD.EMAILTEMPLATES}</a></td>
-
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_EMAIL_TEMPLATE_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 12-->
-
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}mailmarge.gif" alt="{$MOD.LBL_MAIL_MERGE}" title="{$MOD.LBL_MAIL_MERGE}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$MOD.WORDINTEGRATION}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_MAIL_MERGE_DESCRIPTION}</td>
-						</tr>
-
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 13-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}notification.gif" alt="{$MOD.NOTIFICATIONSCHEDULERS}" title="{$MOD.NOTIFICATIONSCHEDULERS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings">{$MOD.NOTIFICATIONSCHEDULERS}</a></td>
-
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_NOTIF_SCHED_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 14-->
-
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}inventory.gif" alt="{$MOD.INVENTORYNOTIFICATION}" title="{$MOD.INVENTORYNOTIFICATION}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings">{$MOD.INVENTORYNOTIFICATION}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_INV_NOTIF_DESCRIPTION}</td>
-						</tr>
-
-						</table>
-					</td>
-				</tr>
-				<!-- Row 2 -->
-				<tr>
-					<td width=25% valign=top>
-					<!-- icon 15-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}terms.gif" alt="{$MOD.INVENTORYTERMSANDCONDITIONS}" title="{$MOD.INVENTORYTERMSANDCONDITIONS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings">{$MOD.LBL_INVENTORY_TANDC}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_INV_TANDC_DESCRIPTION}</td>
-						</tr>
-						</table>
-
-					</td>
-					<td width=25% valign=top>
-					<!-- empty -->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top>&nbsp;</td>
-							<td class=big valign=top>&nbsp;</td>
-						</tr>
-						<tr>
-
-							<td class="small" valign=top>&nbsp;</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- empty-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top>&nbsp;</td>
-
-							<td class=big valign=top>&nbsp;</td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>&nbsp;</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- empty-->
-
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top>&nbsp;</td>
-							<td class=big valign=top>&nbsp;</td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>&nbsp;</td>
-						</tr>
-						</table>
-
-					</td>
-				</tr>
-				</table>
-				
-				
-				</td>
-			</tr>
-			<tr>
-				<td class="settingsTabHeader">
-				<!-- Other settings -->
-					{$MOD.LBL_OTHER_SETTINGS}
-				</td>
-
-			</tr>
-			<tr>
-				<td class="settingsIconDisplay small">
-				<!-- Icons for Other Settings-->
-				
-				<table border=0 cellspacing=0 cellpadding=10 width=100%>
-				<tr>
-					<td width=25% valign=top>
-					<!-- icon 16-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=OrganizationConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}company.gif" alt="{$MOD.LBL_COMPANY_DETAILS}" title="{$MOD.LBL_COMPANY_DETAILS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=OrganizationConfig&parenttab=Settings">{$MOD.LBL_COMPANY_DETAILS}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_COMPANY_DESCRIPTION}</td>
-						</tr>
-						</table>
-
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 17-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}ogmailserver.gif" alt="{$MOD.LBL_MAIL_SERVER_SETTINGS}" title="{$MOD.LBL_MAIL_SERVER_SETTINGS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings">{$MOD.LBL_MAIL_SERVER_SETTINGS}</a></td>
-						</tr>
-
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_MAIL_SERVER_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 18-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}backupserver.gif" alt="{$MOD.LBL_BACKUP_SERVER_SETTINGS}" title="{$MOD.LBL_BACKUP_SERVER_SETTINGS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings">{$MOD.LBL_BACKUP_SERVER_SETTINGS}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_BACKUP_SERVER_DESCRIPTION}</td>
-						</tr>
-						</table>
-
-					</td>
-					<td width=25% valign=top>
-					<!-- icon 7-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings"><img src="{$IMAGE_PATH}assign.gif" alt="{$MOD.LBL_ASSIGN_MODULE_OWNERS}" width="48" height="48" border=0 title="{$MOD.LBL_ASSIGN_MODULE_OWNERS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings">{$MOD.LBL_MODULE_OWNERS}</a></td>
-
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_MODULE_OWNERS_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-				</tr>
-				<!-- Row 2 -->
-				<tr>
-
-					<td width=25% valign=top>
-					<!-- icon 19-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}currency.gif" alt="{$MOD.LBL_CURRENCY_SETTINGS}" title="{$MOD.LBL_CURRENCY_SETTINGS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings">{$MOD.LBL_CURRENCY_SETTINGS}</a></td>
-						</tr>
-
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_CURRENCY_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-
-					<td width=25% valign=top>
-					<!-- icon 20-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}taxConfiguration.gif" alt="{$MOD.LBL_TAX_SETTINGS}" title="{$MOD.LBL_TAX_SETTINGS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings">{$MOD.LBL_TAX_SETTINGS}</a></td>
-						</tr>
-						<tr>
-
-							<td class="small" valign=top>{$MOD.LBL_TAX_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-					<!-- empty -->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=System&action=listsysconfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}system.gif" alt="{$MOD.LBL_SYSTEM_INFO}" title="{$MOD.LBL_SYSTEM_INFO}"></a></td>
-							<td class=big valign=top><a href="index.php?module=System&action=listsysconfig&parenttab=Settings">{$MOD.LBL_SYSTEM_INFO}</a></td>
-
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_SYSTEM_DESCRIPTION}</td>
-						</tr>
-						</table>
-					</td>
-					<td width=25% valign=top>
-
-					<!-- empty-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}proxy.gif" alt="{$MOD.LBL_PROXY_SETTINGS}" title="{$MOD.LBL_PROXY_SETTINGS}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings">{$MOD.LBL_PROXY_SETTINGS}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_PROXY_DESCRIPTION}</td>
-						</tr>
-
-						</table>
-					</td>
-				</tr>
-				<tr>
-
-					<td width=25% valign=top>
-					<!-- empty-->
-						<table border=0 cellspacing=0 cellpadding=5 width=100%>
-						<tr>
-							<td rowspan=2 valign=top><a href="index.php?module=Users&action=Announcements&parenttab=Settings"><img src="{$IMAGE_PATH}announ.gif" alt="{$MOD.LBL_ANNOUNCEMENT}" width="48" height="48" border=0 title="{$MOD.LBL_ANNOUNCEMENT}"></a></td>
-							<td class=big valign=top><a href="index.php?module=Users&action=Announcements&parenttab=Settings">{$MOD.LBL_ANNOUNCEMENT}</a></td>
-						</tr>
-						<tr>
-							<td class="small" valign=top>{$MOD.LBL_ANNOUNCEMENT_DESCRIPTION}</td>
-						</tr>
-
-						</table>
-					</td>
-<td width=25% valign=top>
-					<!-- icon 9-->	
-					<table border=0 cellspacing=0 cellpadding=5 width=100%>
-					<tr>
-						<td rowspan=2 valign=top><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings"><img src="{$IMAGE_PATH}set-IcoTwoTabConfig.gif" alt="{$MOD.LBL_DEFAULT_MODULE_VIEW}" width="48" height="48" border=0 title="{$MOD.LBL_DEFAULT_MODULE_VIEW}"></a></td>
-						<td class=big valign=top><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings">{$MOD.LBL_DEFAULT_MODULE_VIEW}</a></td>
-					</tr>
-					<tr>
-						<td class="small" valign=top>{$MOD.LBL_DEFAULT_MODULE_VIEW_DESC}</td>
-					</tr>
-
-					</table>
-					</td>
-				  <td valign=top><table border=0 cellspacing=0 cellpadding=5 width=100%>
-                    <tr>
-                      <td rowspan=2 valign=top><a href="index.php?module=Migration&action=MigrationStep1&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}migrate.gif" alt="{$MOD.LBL_MIGRATION}" title="{$MOD.LBL_MIGRATION}"></a></td>
-                      <td class=big valign=top><a href="index.php?module=Migration&action=MigrationStep1&parenttab=Settings">{$MOD.LBL_MIGRATION}</a></td>
-                    </tr>
-                    <tr>
-                      <td class="small" valign=top>{$MOD.LBL_MIGRATION_INFO}</td>
-                    </tr>
-                  </table></td>
-		  <td width=25% valign=top>&nbsp;
-			
-		  </td>
-				  <td valign=top>&nbsp;</td>
-				  <td valign=top>&nbsp;</td>
-				  <td valign=top>&nbsp;</td>
-				  </tr>
-				</table>
-				
-				
-				</td>
-			</tr>
-
-			</table>
-		
-		</td>
-	</tr>
-	</table>
-		
-	</div>
-
-	</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody></table>
-
-
-
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+
+	{include file="Buttons_List1.tpl"}
+
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+	<td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+	<br>
+	<div align=center>
+	<table border=0 cellspacing=0 cellpadding=20 width=90% class="settingsUI">
+	<tr>
+		<td>
+			<!--All Icons table -->
+			<table border=0 cellspacing=0 cellpadding=0 width=100%>
+			<tr>
+
+				<td class="settingsTabHeader">
+				<!-- Users & Access Management -->
+					{$MOD.LBL_USER_MANAGEMENT}	
+				</td>
+			</tr>
+			<tr>
+				<td class="settingsIconDisplay small">
+				<!-- Icons for Users & Access Management -->
+				
+				<table border=0 cellspacing=0 cellpadding=10 width=100%>
+
+				<tr>
+					<td width=25% valign=top>
+					<!-- icon 1-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Administration&action=index&parenttab=Settings"><img src="{$IMAGE_PATH}ico-users.gif" alt="{$MOD.LBL_USERS}" width="48" height="48" border=0 title="{$MOD.LBL_USERS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a></td>
+						</tr>
+
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_USER_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 2-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listroles&parenttab=Settings"><img src="{$IMAGE_PATH}ico-roles.gif" alt="{$MOD.LBL_ROLES}" width="48" height="48" border=0 title="{$MOD.LBL_ROLES}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=listroles&parenttab=Settings">{$MOD.LBL_ROLES}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_ROLE_DESCRIPTION}</td>
+						</tr>
+						</table>
+
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 3-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings"><img src="{$IMAGE_PATH}ico-profile.gif" alt="{$MOD.LBL_PROFILES}" width="48" height="48" border=0 title="{$MOD.LBL_PROFILES}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=ListProfiles&parenttab=Settings">{$MOD.LBL_PROFILES}</a></td>
+						</tr>
+
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_PROFILE_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 4-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listgroups&parenttab=Settings"><img src="{$IMAGE_PATH}ico-groups.gif" alt="{$MOD.USERGROUPLIST}" width="48" height="48" border=0 title="{$MOD.USERGROUPLIST}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=listgroups&parenttab=Settings">{$MOD.USERGROUPLIST}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_GROUP_DESCRIPTION}</td>
+						</tr>
+						</table>
+
+					</td>
+				</tr>
+				<!-- Row 2 -->
+				<tr>
+					<td width=25% valign=top>
+					<!-- icon 5-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings"><img src="{$IMAGE_PATH}shareaccess.gif" alt="{$MOD.LBL_SHARING_ACCESS}" width="48" height="48" border=0 title="{$MOD.LBL_SHARING_ACCESS}"></a></td>
+
+							<td class=big valign=top><a href="index.php?module=Users&action=OrgSharingDetailView&parenttab=Settings">{$MOD.LBL_SHARING_ACCESS}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_SHARING_ACCESS_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+
+					<!-- icon 6 -->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings"><img src="{$IMAGE_PATH}orgshar.gif" alt="Fields to be shown" width="48" height="48" border=0 title="Fields to be shown"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=DefaultFieldPermissions&parenttab=Settings">{$MOD.LBL_FIELDS_ACCESS}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_SHARING_FIELDS_DESCRIPTION}</td>
+
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 7-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}audit.gif" alt="{$MOD.LBL_AUDIT_TRAIL}" title="{$MOD.LBL_AUDIT_TRAIL}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=AuditTrailList&parenttab=Settings">{$MOD.LBL_AUDIT_TRAIL}</a></td>
+						</tr>
+
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_AUDIT_DESCRIPTION}</td>
+						</tr>
+						</table>
+
+						
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 8-->	
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings"><img src="{$IMAGE_PATH}set-IcoLoginHistory.gif" alt="{$MOD.LBL_LOGIN_HISTORY_DETAILS}" width="48" height="48" border=0 title="{$MOD.LBL_LOGIN_HISTORY_DETAILS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=ListLoginHistory&parenttab=Settings">{$MOD.LBL_LOGIN_HISTORY_DETAILS}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_LOGIN_HISTORY_DESCRIPTION}</td>
+						</tr>
+
+						</table>
+					</td>
+					<!-- Row 3 -->
+					<tr>
+					
+				</tr>
+				</table>
+
+
+				</td>
+			</tr>
+
+
+			<tr>
+				<td class="settingsTabHeader">
+
+				<!-- Studio  -->
+					{$MOD.LBL_STUDIO}	
+				</td>
+			</tr>
+			<tr>
+				<td class="settingsIconDisplay small">
+				<!-- Icons for Users & Access Management -->
+				
+				<table border=0 cellspacing=0 cellpadding=10 width=100%>
+				<tr>
+
+					<td width=25% valign=top>
+					<!-- icon 9-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}custom.gif" alt="{$MOD.LBL_CUSTOM_FIELDS}" title="{$MOD.LBL_CUSTOM_FIELDS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=CustomFieldList&parenttab=Settings">{$MOD.LBL_CUSTOM_FIELDS}</a></td>
+						</tr>
+						<tr>
+
+							<td class="small" valign=top>{$MOD.LBL_CUSTOM_FIELDS_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 10-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=PickList&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}picklist.gif" alt="{$MOD.LBL_PICKLIST_EDITOR}" title="{$MOD.LBL_PICKLIST_EDITOR}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=PickList&parenttab=Settings">{$MOD.LBL_PICKLIST_EDITOR}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_PICKLIST_DESCRIPTION}</td>	
+						</tr>
+						</table>
+					</td>
+
+					<td width=25% valign=top>
+					<!-- empty-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top>&nbsp;</td>
+							<td class=big valign=top>&nbsp;</td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>&nbsp;</td>
+
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- empty-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top>&nbsp;</td>
+							<td class=big valign=top>&nbsp;</td>
+
+						</tr>
+						<tr>
+							<td class="small" valign=top>&nbsp;</td>
+						</tr>
+						</table>
+					</td>
+				</tr>
+				</table>
+				
+				
+				</td>
+
+			</tr>
+			
+			
+			
+			<tr>
+				<td class="settingsTabHeader">
+				<!-- Communication Templates -->
+					{$MOD.LBL_COMMUNICATION_TEMPLATES}
+				</td>
+			</tr>
+			<tr>
+				<td class="settingsIconDisplay small">
+
+				<!-- Icons for Communication Templates -->
+				
+				<table border=0 cellspacing=0 cellpadding=10 width=100%>
+				<tr>
+					<td width=25% valign=top>
+					<!-- icon 11-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}ViewTemplate.gif" alt="{$MOD.EMAILTEMPLATES}" title="{$MOD.EMAILTEMPLATES}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=listemailtemplates&parenttab=Settings">{$MOD.EMAILTEMPLATES}</a></td>
+
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_EMAIL_TEMPLATE_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 12-->
+
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}mailmarge.gif" alt="{$MOD.LBL_MAIL_MERGE}" title="{$MOD.LBL_MAIL_MERGE}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=listwordtemplates&parenttab=Settings">{$MOD.WORDINTEGRATION}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_MAIL_MERGE_DESCRIPTION}</td>
+						</tr>
+
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 13-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}notification.gif" alt="{$MOD.NOTIFICATIONSCHEDULERS}" title="{$MOD.NOTIFICATIONSCHEDULERS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=listnotificationschedulers&parenttab=Settings">{$MOD.NOTIFICATIONSCHEDULERS}</a></td>
+
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_NOTIF_SCHED_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 14-->
+
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}inventory.gif" alt="{$MOD.INVENTORYNOTIFICATION}" title="{$MOD.INVENTORYNOTIFICATION}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=listinventorynotifications&parenttab=Settings">{$MOD.INVENTORYNOTIFICATION}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_INV_NOTIF_DESCRIPTION}</td>
+						</tr>
+
+						</table>
+					</td>
+				</tr>
+				</table>
+				
+				
+				</td>
+			</tr>
+			<tr>
+				<td class="settingsTabHeader">
+				<!-- Other settings -->
+					{$MOD.LBL_OTHER_SETTINGS}
+				</td>
+
+			</tr>
+			<tr>
+				<td class="settingsIconDisplay small">
+				<!-- Icons for Other Settings-->
+				
+				<table border=0 cellspacing=0 cellpadding=10 width=100%>
+				<tr>
+					<td width=25% valign=top>
+					<!-- icon 16-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Organization&action=ListView&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}company.gif" alt="{$MOD.LBL_COMPANY_DETAILS}" title="{$MOD.LBL_COMPANY_DETAILS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Organization&action=ListView&parenttab=Settings">{$MOD.LBL_COMPANY_DETAILS}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_COMPANY_DESCRIPTION}</td>
+						</tr>
+						</table>
+
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 17-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}ogmailserver.gif" alt="{$MOD.LBL_MAIL_SERVER_SETTINGS}" title="{$MOD.LBL_MAIL_SERVER_SETTINGS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=EmailConfig&parenttab=Settings">{$MOD.LBL_MAIL_SERVER_SETTINGS}</a></td>
+						</tr>
+
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_MAIL_SERVER_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 18-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}backupserver.gif" alt="{$MOD.LBL_BACKUP_SERVER_SETTINGS}" title="{$MOD.LBL_BACKUP_SERVER_SETTINGS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=BackupServerConfig&parenttab=Settings">{$MOD.LBL_BACKUP_SERVER_SETTINGS}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_BACKUP_SERVER_DESCRIPTION}</td>
+						</tr>
+						</table>
+
+					</td>
+					<td width=25% valign=top>
+					<!-- icon 7-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings"><img src="{$IMAGE_PATH}assign.gif" alt="{$MOD.LBL_ASSIGN_MODULE_OWNERS}" width="48" height="48" border=0 title="{$MOD.LBL_ASSIGN_MODULE_OWNERS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=ListModuleOwners&parenttab=Settings">{$MOD.LBL_MODULE_OWNERS}</a></td>
+
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_MODULE_OWNERS_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+				</tr>
+				<!-- Row 2 -->
+				<tr>
+
+					<td width=25% valign=top>
+					<!-- icon 19-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}currency.gif" alt="{$MOD.LBL_CURRENCY_SETTINGS}" title="{$MOD.LBL_CURRENCY_SETTINGS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=CurrencyListView&parenttab=Settings">{$MOD.LBL_CURRENCY_SETTINGS}</a></td>
+						</tr>
+
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_CURRENCY_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+
+					<td width=25% valign=top>
+					<!-- icon 20-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}taxConfiguration.gif" alt="{$MOD.LBL_TAX_SETTINGS}" title="{$MOD.LBL_TAX_SETTINGS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings">{$MOD.LBL_TAX_SETTINGS}</a></td>
+						</tr>
+						<tr>
+
+							<td class="small" valign=top>{$MOD.LBL_TAX_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+					<!-- empty -->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=System&action=listsysconfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}system.gif" alt="{$MOD.LBL_SYSTEM_INFO}" title="{$MOD.LBL_SYSTEM_INFO}"></a></td>
+							<td class=big valign=top><a href="index.php?module=System&action=listsysconfig&parenttab=Settings">{$MOD.LBL_SYSTEM_INFO}</a></td>
+
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_SYSTEM_DESCRIPTION}</td>
+						</tr>
+						</table>
+					</td>
+					<td width=25% valign=top>
+
+					<!-- empty-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}proxy.gif" alt="{$MOD.LBL_PROXY_SETTINGS}" title="{$MOD.LBL_PROXY_SETTINGS}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings">{$MOD.LBL_PROXY_SETTINGS}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_PROXY_DESCRIPTION}</td>
+						</tr>
+
+						</table>
+					</td>
+				</tr>
+				<tr>
+
+					<td width=25% valign=top>
+					<!-- empty-->
+						<table border=0 cellspacing=0 cellpadding=5 width=100%>
+						<tr>
+							<td rowspan=2 valign=top><a href="index.php?module=Users&action=Announcements&parenttab=Settings"><img src="{$IMAGE_PATH}announ.gif" alt="{$MOD.LBL_ANNOUNCEMENT}" width="48" height="48" border=0 title="{$MOD.LBL_ANNOUNCEMENT}"></a></td>
+							<td class=big valign=top><a href="index.php?module=Users&action=Announcements&parenttab=Settings">{$MOD.LBL_ANNOUNCEMENT}</a></td>
+						</tr>
+						<tr>
+							<td class="small" valign=top>{$MOD.LBL_ANNOUNCEMENT_DESCRIPTION}</td>
+						</tr>
+
+						</table>
+					</td>
+<td width=25% valign=top>
+					<!-- icon 9-->	
+					<table border=0 cellspacing=0 cellpadding=5 width=100%>
+					<tr>
+						<td rowspan=2 valign=top><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings"><img src="{$IMAGE_PATH}set-IcoTwoTabConfig.gif" alt="{$MOD.LBL_DEFAULT_MODULE_VIEW}" width="48" height="48" border=0 title="{$MOD.LBL_DEFAULT_MODULE_VIEW}"></a></td>
+						<td class=big valign=top><a href="index.php?module=Users&action=DefModuleView&parenttab=Settings">{$MOD.LBL_DEFAULT_MODULE_VIEW}</a></td>
+					</tr>
+					<tr>
+						<td class="small" valign=top>{$MOD.LBL_DEFAULT_MODULE_VIEW_DESC}</td>
+					</tr>
+
+					</table>
+					</td>
+				  <td valign=top><table border=0 cellspacing=0 cellpadding=5 width=100%>
+                    <tr>
+                      <td rowspan=2 valign=top><a href="index.php?module=Migration&action=MigrationStep1&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}migrate.gif" alt="{$MOD.LBL_MIGRATION}" title="{$MOD.LBL_MIGRATION}"></a></td>
+                      <td class=big valign=top><a href="index.php?module=Migration&action=MigrationStep1&parenttab=Settings">{$MOD.LBL_MIGRATION}</a></td>
+                    </tr>
+                    <tr>
+                      <td class="small" valign=top>{$MOD.LBL_MIGRATION_INFO}</td>
+                    </tr>
+                  </table></td>
+		<td width=25% valign=top>
+			<!-- icon 15-->
+			<table border=0 cellspacing=0 cellpadding=5 width=100%>
+			<tr>
+
+			<td rowspan=2 valign=top><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings"><img border=0 src="{$IMAGE_PATH}terms.gif" alt="{$MOD.INVENTORYTERMSANDCONDITIONS}" title="{$MOD.INVENTORYTERMSANDCONDITIONS}"></a></td>
+			<td class=big valign=top><a href="index.php?module=Users&action=OrganizationTermsandConditions&parenttab=Settings">{$MOD.LBL_INVENTORY_TANDC}</a></td>
+			</tr>
+			<tr>
+			<td class="small" valign=top>{$MOD.LBL_INV_TANDC_DESCRIPTION}</td>
+			</tr>
+			</table>
+
+		</td>
+
+		</tr>
+
+		</table>
+		
+		</td>
+	</tr>
+	</table>
+	</td></tr></table>	
+	</div>
+
+	</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody></table>
+
+
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Settings/PickList.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Settings/PickList.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Settings/PickList.tpl Tue Nov 14 03:16:10 2006
@@ -1,234 +1,259 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-<script src="include/scriptaculous/prototype.js" type="text/javascript"></script>
-<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
-<script>
-{literal}
-function splitvalues() {
-	var picklistobj=getobj("listarea")
-	var picklistcontent=picklistobj.value
-	var picklistary=new array()
-	var i=0;
-	
-	//splitting up of values
-	if (picklistcontent.indexof("\n")!=-1) {
-		while(picklistcontent.indexof("\n")!=-1) {
-			if (picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
-				picklistary[i]=picklistcontent.substr(0,picklistcontent.indexof("\n")).replace(/^\s+/g, '').replace(/\s+$/g, '')
-				picklistcontent=picklistcontent.substr(picklistcontent.indexof("\n")+1,picklistcontent.length)
-				i++
-			} else break;
-		}
-	} else if (picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
-		picklistary[0]=picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '')
-	}
-	
-	return picklistary;
-}
-function setdefaultlist() {
-	var picklistary=new array()
-	picklistary=splitvalues()
-	
-	getobj("defaultlist").innerhtml=""
-	
-	for (i=0;i<picklistary.length;i++) {
-		var objoption=document.createelement("option")
-		if (browser_ie) {
-			objoption.innertext=picklistary[i]
-			objoption.value=picklistary[i]
-		} else if (browser_nn4 || browser_nn6) {
-			objoption.text=picklistary[i]
-			objoption.setattribute("value",picklistary[i])
-		}
-	
-		getobj("defaultlist").appendchild(objoption)
-	}
-}
-function validate() {
-	if (emptycheck("listarea","picklist values"))	{
-		var picklistary=new array()
-		picklistary=splitvalues()
-		//empty check validation
-		for (i=0;i<picklistary.length;i++) {
-			if (picklistary[i]=="") {
-				alert("picklist value cannot be empty")
-				picklistobj.focus()
-				return false
-			}
-		}
-
-		//duplicate values' validation
-		for (i=0;i<picklistary.length;i++) {
-			for (j=i+1;j<picklistary.length;j++) {
-				if (picklistary[i]==picklistary[j]) {
-					alert("duplicate values found")
-					picklistobj.focus()
-					return false
-				}
-			}
-		}
-
-		return true;
-	}
-}
-
-{/literal}
-</script>
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-<br>
-	<div align=center>
-	
-			{include file='SetMenu.tpl'}
-				<!-- DISPLAY -->
-				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
-				<tr>
-					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}picklist.gif" width="48" height="48" border=0 ></td>
-					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$MOD.LBL_PICKLIST_EDITOR}</b></td>
-				</tr>
-				<tr>
-					<td valign=top class="small">{$MOD.LBL_PICKLIST_DESCRIPTION}</td>
-				</tr>
-				</table>
-				
-				
-				<table border=0 cellspacing=0 cellpadding=10 width=100% >
-				<tr>
-				<td valign=top>
-				
-					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-					<tr>
-						<td class="big"><strong>1. {$MOD.LBL_SELECT_MODULE}</strong></td>
-						<td class="small" align=right>&nbsp;</td>
-					</tr>
-					</table>
-					<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
-						<tr class="small">
-                        	<td width="35%" class="small cellLabel"><strong>{$MOD.LBL_SELECT_CRM_MODULE}</strong></td>
-	                        <td width="65%" class="cellText" >
-					<select name="pickmodule" class="detailedViewTextBox" onChange="changeModule(this);">
-					{foreach key=tabid item=module from=$MODULE_LISTS}
-						<option value="{$module}">{$APP.$module}</option>
-					{/foreach}
-					</select>
-				</td>
-                      </tr>
-					</table>
-					<br>
-				<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-				<tr>
-				    <td class="big" rowspan="2">
-					<div id="picklist_datas">	
-						{include file='Settings/PickListContents.tpl'}
-					</div>
-				    </td>	
-				</td>
-				</tr>
-			    	</table>
-				<table border=0 cellspacing=0 cellpadding=5 width=100% >
-					<tr><td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
-				</table>
-				
-				</td>
-				</tr>
-				</table>
-			
-			
-			
-			</td>
-			</tr>
-			</table>
-		</td>
-	</tr>
-	</table>
-		
-	</div>
-
-</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody>
-</table>
-<div id="editdiv" style="display:block;position:absolute;width:510px;"></div>
-{literal}
-<script>
-function SavePickList(fieldname,module,uitype)
-{
-	$("status").style.display = "inline";
-	Effect.Puff($('editdiv'),{duration:2});
-	var body = escape($("picklist_values").value);
-
-	new Ajax.Request(
-        	'index.php?action=SettingsAjax&module=Settings&directmode=ajax&file=UpdateComboValues&table_name='+fieldname+'&fld_module='+module+'&listarea='+body+'&uitype='+uitype,
-	        {queue: {position: 'end', scope: 'command'},
-        		method: 'get',
-		        postBody: null,
-		        /* postBody: 'action=SettingsAjax&module=Settings&directmode=ajax&file=UpdateComboValues&table_name='+fieldname+'&fld_module='+module+'&listarea='+body, */
-		        onComplete: function(response) {
-					$("status").style.display="none";
-        				$("picklist_datas").innerHTML=response.responseText;
-	                        }
-        	}
-	);
-}
-function changeModule(pickmodule)
-{
-	$("status").style.display="inline";
-	var module=pickmodule.options[pickmodule.options.selectedIndex].value;
-	new Ajax.Request(
-                'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: 'action=SettingsAjax&module=Settings&directmode=ajax&file=PickList&fld_module='+module,
-                        onComplete: function(response) {
-                                        $("status").style.display="none";
-                                        $("picklist_datas").innerHTML=response.responseText;
-                                }
-                }
-        );
-}
-function fetchEditPickList(module,fieldname,uitype)
-{
-	$("status").style.display="inline";
-	new Ajax.Request(
-                'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: 'action=SettingsAjax&module=Settings&mode=edit&file=EditComboField&fld_module='+module+'&fieldname='+fieldname+'&uitype='+uitype,
-			onComplete: function(response) {
-                                        $("status").style.display="none";
-                                        $("editdiv").innerHTML=response.responseText;
-					Effect.Grow('editdiv');
-                	}
-                }
-        );
-}
-function picklist_validate(mode,fieldname,module,uitype)
-{
-	if(mode == 'edit')
-	{
-		if(trim($("picklist_values").value) == '')
-		{
-			alert("Picklist value cannot be empty");
-			$("picklist_values").focus();	
-			return false;
-		}
-	}
-	SavePickList(fieldname,module,uitype)	
-}
-</script>
-{/literal}
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+<script src="include/scriptaculous/prototype.js" type="text/javascript"></script>
+<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
+<script>
+{literal}
+function splitvalues() {
+	var picklistobj=getobj("listarea")
+	var picklistcontent=picklistobj.value
+	var picklistary=new array()
+	var i=0;
+	
+	//splitting up of values
+	if (picklistcontent.indexof("\n")!=-1) {
+		while(picklistcontent.indexof("\n")!=-1) {
+			if (picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
+				picklistary[i]=picklistcontent.substr(0,picklistcontent.indexof("\n")).replace(/^\s+/g, '').replace(/\s+$/g, '')
+				picklistcontent=picklistcontent.substr(picklistcontent.indexof("\n")+1,picklistcontent.length)
+				i++
+			} else break;
+		}
+	} else if (picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
+		picklistary[0]=picklistcontent.replace(/^\s+/g, '').replace(/\s+$/g, '')
+	}
+	
+	return picklistary;
+}
+function setdefaultlist() {
+	var picklistary=new array()
+	picklistary=splitvalues()
+	
+	getobj("defaultlist").innerhtml=""
+	
+	for (i=0;i<picklistary.length;i++) {
+		var objoption=document.createelement("option")
+		if (browser_ie) {
+			objoption.innertext=picklistary[i]
+			objoption.value=picklistary[i]
+		} else if (browser_nn4 || browser_nn6) {
+			objoption.text=picklistary[i]
+			objoption.setattribute("value",picklistary[i])
+		}
+	
+		getobj("defaultlist").appendchild(objoption)
+	}
+}
+function validate() {
+	if (emptycheck("listarea","picklist values"))	{
+		var picklistary=new array()
+		picklistary=splitvalues()
+		//empty check validation
+		for (i=0;i<picklistary.length;i++) {
+			if (picklistary[i]=="") {
+				alert("picklist value cannot be empty")
+				picklistobj.focus()
+				return false
+			}
+		}
+
+		//duplicate values' validation
+		for (i=0;i<picklistary.length;i++) {
+			for (j=i+1;j<picklistary.length;j++) {
+				if (picklistary[i]==picklistary[j]) {
+					alert("duplicate values found")
+					picklistobj.focus()
+					return false
+				}
+			}
+		}
+
+		return true;
+	}
+}
+
+{/literal}
+</script>
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+<br>
+	<div align=center>
+	
+			{include file='SetMenu.tpl'}
+				<!-- DISPLAY -->
+				<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
+				<tr>
+					<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}picklist.gif" width="48" height="48" border=0 ></td>
+					<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > {$MOD.LBL_PICKLIST_EDITOR}</b></td>
+				</tr>
+				<tr>
+					<td valign=top class="small">{$MOD.LBL_PICKLIST_DESCRIPTION}</td>
+				</tr>
+				</table>
+				
+				
+				<table border=0 cellspacing=0 cellpadding=10 width=100% >
+				<tr>
+				<td valign=top>
+				
+					<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+					<tr>
+						<td class="big"><strong>1. {$MOD.LBL_SELECT_MODULE}</strong></td>
+						<td class="small" align=right>&nbsp;</td>
+					</tr>
+					</table>
+					<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+						<tr class="small">
+                        	<td width="35%" class="small cellLabel"><strong>{$MOD.LBL_SELECT_CRM_MODULE}</strong></td>
+	                        <td width="65%" class="cellText" >
+					<select name="pickmodule" class="detailedViewTextBox" onChange="changeModule(this);">
+					{foreach key=tabid item=module from=$MODULE_LISTS}
+						<option value="{$module}">{$APP.$module}</option>
+					{/foreach}
+					</select>
+				</td>
+                      </tr>
+					</table>
+					<br>
+				<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+				<tr>
+				    <td class="big" rowspan="2">
+					<div id="picklist_datas">	
+						{include file='Settings/PickListContents.tpl'}
+					</div>
+				    </td>	
+				</td>
+				</tr>
+			    	</table>
+				<table border=0 cellspacing=0 cellpadding=5 width=100% >
+					<tr><td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td></tr>
+				</table>
+				
+				</td>
+				</tr>
+				</table>
+			
+			
+			
+			</td>
+			</tr>
+			</table>
+		</td>
+	</tr>
+	</table>
+		
+	</div>
+
+</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody>
+</table>
+<div id="editdiv" style="display:block;position:absolute;width:510px;"></div>
+{literal}
+<script>
+function SavePickList(fieldname,module,uitype)
+{
+	$("status").style.display = "inline";
+	Effect.Puff($('editdiv'),{duration:2});
+	var body = escape($("picklist_values").value);
+
+	new Ajax.Request(
+        	'index.php?action=SettingsAjax&module=Settings&directmode=ajax&file=UpdateComboValues&table_name='+fieldname+'&fld_module='+module+'&listarea='+body+'&uitype='+uitype,
+	        {queue: {position: 'end', scope: 'command'},
+        		method: 'get',
+		        postBody: null,
+		        /* postBody: 'action=SettingsAjax&module=Settings&directmode=ajax&file=UpdateComboValues&table_name='+fieldname+'&fld_module='+module+'&listarea='+body, */
+		        onComplete: function(response) {
+					$("status").style.display="none";
+        				$("picklist_datas").innerHTML=response.responseText;
+	                        }
+        	}
+	);
+}
+function changeModule(pickmodule)
+{
+	$("status").style.display="inline";
+	var module=pickmodule.options[pickmodule.options.selectedIndex].value;
+	new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: 'action=SettingsAjax&module=Settings&directmode=ajax&file=PickList&fld_module='+module,
+                        onComplete: function(response) {
+                                        $("status").style.display="none";
+                                        $("picklist_datas").innerHTML=response.responseText;
+                                }
+                }
+        );
+}
+function fetchEditPickList(module,fieldname,uitype)
+{
+	$("status").style.display="inline";
+	new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: 'action=SettingsAjax&module=Settings&mode=edit&file=EditComboField&fld_module='+module+'&fieldname='+fieldname+'&uitype='+uitype,
+			onComplete: function(response) {
+                                        $("status").style.display="none";
+                                        $("editdiv").innerHTML=response.responseText;
+					Effect.Grow('editdiv');
+                	}
+                }
+        );
+}
+
+function picklist_validate(mode,fieldname,module,uitype)
+{
+	
+	//alert(trim($("picklist_values").value));
+	
+	var pick_arr=new Array();
+	pick_arr=trim($("picklist_values").value).split('\n');	
+	var len=pick_arr.length;
+	for(i=0;i<len;i++)
+	{
+		var valone;
+		curr_iter = i;
+		valone=pick_arr[curr_iter];
+		for(j=curr_iter+1;j<len;j++)
+		{
+			var valnext;
+			valnext=pick_arr[j];
+			if(trim(valone) == trim(valnext))
+			{
+				alert("Duplicate entries found for the value '"+valone+"'");
+				return false;
+			}
+		}
+		i = curr_iter		
+
+	}
+	if(mode == 'edit')
+	{
+		if(trim($("picklist_values").value) == '')
+		{
+			alert("Picklist value cannot be empty");
+			$("picklist_values").focus();	
+			return false;
+		}
+	}
+	SavePickList(fieldname,module,uitype)	
+}
+</script>
+{/literal}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/Settings/TaxConfig.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/Settings/TaxConfig.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/Settings/TaxConfig.tpl Tue Nov 14 03:16:10 2006
@@ -1,244 +1,262 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/Inventory.js"></script>
-{literal}
-<style>
-	
-	.tax_delete{
-		text-decoration:none;
-	}
-	
-	.tax_delete td{
-			
-	}
-	
-</style>
-{/literal}
-<br>
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody>
-   <tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-	<br>
-	<div align=center>
-
-			{include file='SetMenu.tpl'}
-				<!-- DISPLAY -->
-{if $EDIT_MODE eq 'true'}
-	{assign var=formname value='EditTax'}
-	{assign var=shformname value='SHEditTax'}
-{else}
-	{assign var=formname value='ListTax'}
-	{assign var=shformname value='SHListTax'}
-{/if}
-
-
-<!-- This table is used to display the Tax Configuration values-->
-<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
-   <tr>
-	<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}taxConfiguration.gif" alt="Users" width="48" height="48" border=0 title="Users"></td>
-	<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > 
-		{if $EDIT_MODE eq 'true'}
-			<strong>{$MOD.LBL_EDIT} {$MOD.LBL_TAX_SETTINGS} </strong>
-		{else}
-			<strong>{$MOD.LBL_TAX_SETTINGS} </strong>
-		{/if}
-		</b>
-	</td>
-   </tr>
-   <tr>
-	<td valign=top class="small">{$MOD.LBL_TAX_DESC}</td>
-   </tr>
-</table>
-
-<br>
-<table border=0 cellspacing=0 cellpadding=10 width=100%>
-   <tr>
-	<td style="border-right:1px dotted #CCCCCC;" valign="top">
-		<!-- if EDIT_MODE is true then Textbox will be displayed else the value will be displayed-->
-		<form name="{$formname}" method="POST" action="index.php">
-		<input type="hidden" name="module" value="Settings">
-		<input type="hidden" name="action" value="">
-		<input type="hidden" name="parenttab" value="Settings">
-		<input type="hidden" name="save_tax" value="">
-		<input type="hidden" name="edit_tax" value="">
-		<input type="hidden" name="add_tax_type" value="">
-
-		<!-- Table to display the Product Tax Add and Edit Buttons - Starts -->
-		<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-		   <tr>
-			<td class="big" colspan="3"><strong>{$MOD.LBL_PRODUCT_TAX_SETTINGS} </strong></td>
-		   </tr>
-		   <tr>
-			<td>&nbsp;</td>
-			<td id="td_add_tax" class="small" colspan="2" align="right" nowrap>
-				{if $EDIT_MODE neq 'true'}
-					<input title="Add Tax" accessKey="Add Tax" onclick="fnAddTaxConfigRow('');" type="button" name="button" value="  Add Tax  " class="crmButton small edit">
-				{/if}
-			</td>
-			<td class="small" align=right nowrap>
-			{if $EDIT_MODE eq 'true'}	
-				<input class="crmButton small save" title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}"  onclick="this.form.action.value='TaxConfig'; this.form.save_tax.value='true'; this.form.parenttab.value='Settings'; return validateTaxes('tax_count')" type="submit" name="button2" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  ">&nbsp;
-				<input class="crmButton small cancel" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.module.value='Settings'; this.form.save_tax.value='false'; this.form.parenttab.value='Settings';" type="submit" name="button22" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  ">
-			{elseif $TAX_COUNT > 0}
-				<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.edit_tax.value='true'; this.form.parenttab.value='Settings';" type="submit" name="button" value="  {$APP.LBL_EDIT_BUTTON_LABEL}  " class="crmButton small edit">
-			{/if}
-			</td>
-		   </tr>
-		</table>
-		<!-- Table to display the Product Tax Add and Edit Buttons - Ends -->
-
-		<!-- Table to display the List of Product Tax values - Starts -->
-		<table id="add_tax" border=0 cellspacing=0 cellpadding=5 width=100% class="listRow">
-		   {if $TAX_COUNT eq 0}
-			<tr><td>No taxes available. Please Add Tax.</td></tr>
-		   {else}
-			{foreach item=tax key=count from=$TAX_VALUES}
-
-				<!-- To set the color coding for the taxes which are active and inactive-->
-				{if $tax.deleted eq 0}
-				   <tr><!-- set color to taxes which are active now-->
-				{else}
-				   <tr><!-- set color to taxes which are disabled now-->
-				{/if}
-
-				<td width=35% class="cellLabel small">{$tax.taxlabel} </td>
-				<td width=55% class="cellText small">
-					{if $EDIT_MODE eq 'true'}
-						<input name="{$tax.taxname}" id="{$tax.taxname}" type="text" value="{$tax.percentage}" class="detailedViewTextBox small">&nbsp;%
-					{else}
-						{$tax.percentage}&nbsp;%
-					{/if}
-				</td>
-				<td width=10% class="cellText small">
-						{if $tax.deleted eq 0}
-							<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&disable=true&taxname={$tax.taxname}"><img src="{$IMAGE_PATH}enabled.gif" border="0" align="absmiddle" alt="Enable me" title="Disable me"></a>
-						{else}
-							<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&enable=true&taxname={$tax.taxname}"><img src="{$IMAGE_PATH}disabled.gif" border="0" align="absmiddle" alt="Enable me" title="Enable me"></a>
-						{/if}
-				</td>
-			   </tr>
-			{/foreach}
-			{if $EDIT_MODE eq 'true'}
-				<input type="hidden" id="tax_count" value="{$count}">
-			{/if}
-		   {/if}
-		</table>
-		<!-- Table to display the List of Product Tax values - Ends -->
-		</form>
-	</td>
-
-	<!-- Shipping Tax Config Table Starts Here -->
-	<td width="50%" valign="top">
-		<form name="{$shformname}" method="POST" action="index.php">
-		<input type="hidden" name="module" value="Settings">
-		<input type="hidden" name="action" value="">
-		<input type="hidden" name="parenttab" value="Settings">
-		<input type="hidden" name="sh_save_tax" value="">
-		<input type="hidden" name="sh_edit_tax" value="">
-		<input type="hidden" name="sh_add_tax_type" value="">
-
-		<!-- Table to display the S&H Tax Add and Edit Buttons - Starts -->
-		<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
-		   <tr>
-        		<td class="big" colspan="3"><strong>{$MOD.LBL_SHIPPING_HANDLING_TAX_SETTINGS}</strong></td>
-		   </tr>
-		   <tr>
-			<td>&nbsp;</td>
-        		<td id="td_sh_add_tax" class="small" colspan="2" align="right" nowrap>
-				{if $SH_EDIT_MODE neq 'true'}
-					<input title="Add Tax" accessKey="Add Tax" onclick="fnAddTaxConfigRow('sh');" type="button" name="button" value="  Add Tax  " class="crmButton small edit">
-				{/if}
-			</td>
-			<td class="small" align=right nowrap>
-				{if $SH_EDIT_MODE eq 'true'}
-					<input class="crmButton small save" title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}"  onclick="this.form.action.value='TaxConfig'; this.form.sh_save_tax.value='true'; this.form.parenttab.value='Settings'; return validateTaxes('sh_tax_count')" type="submit" name="button2" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  ">
-					&nbsp;
-					<input class="crmButton small cancel" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.module.value='Settings'; this.form.sh_save_tax.value='false'; this.form.parenttab.value='Settings';" type="submit" name="button22" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  ">
-				{elseif $SH_TAX_COUNT > 0}
-					<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.sh_edit_tax.value='true'; this.form.parenttab.value='Settings';" type="submit" name="button" value="  {$APP.LBL_EDIT_BUTTON_LABEL}  " class="crmButton small edit">
-				{/if}
-			</td>
-		   </tr>
-		</table>
-		<!-- Table to display the S&H Tax Add and Edit Buttons - Ends -->
-
-		<!-- Table to display the List of S&H Tax Values - Starts -->
-		<table id="sh_add_tax" border=0 cellspacing=0 cellpadding=5 width=100% class="listRow">
-		   {if $SH_TAX_COUNT eq 0}
-			<tr><td>No taxes available. Please Add Tax.</td></tr>
-		   {else}
-		   	{foreach item=tax key=count from=$SH_TAX_VALUES}
-
-			<!-- To set the color coding for the taxes which are active and inactive-->
-			{if $tax.deleted eq 0}
-			   <tr><!-- set color to taxes which are active now-->
-			{else}
-			   <tr><!-- set color to taxes which are disabled now-->
-			{/if}
-
-			<td width=35% class="cellLabel small">{$tax.taxlabel} </td>
-			<td width=55% class="cellText small">
-				{if $SH_EDIT_MODE eq 'true'}
-					<input name="{$tax.taxname}" id="{$tax.taxname}" type="text" value="{$tax.percentage}" class="detailedViewTextBox small">
-					&nbsp;% 
-				{else} 
-					{$tax.percentage}&nbsp;% 
-				{/if}
-			</td>
-			<td width=10% class="cellText small"> 
-				{if $tax.deleted eq 0}
-						<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&sh_disable=true&sh_taxname={$tax.taxname}"><img src="{$IMAGE_PATH}enabled.gif" border="0" align="absmiddle" alt="Enable me" title="Disable me"></a>
-					{else}
-						<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&sh_enable=true&sh_taxname={$tax.taxname}"><img src="{$IMAGE_PATH}disabled.gif" border="0" align="absmiddle" alt="Enable me" title="Enable me"></a>
-					{/if}
-			</td>
-		   </tr>
-		   {/foreach}
-		   {if $SH_EDIT_MODE eq 'true'}
-			<input type="hidden" id="sh_tax_count" value="{$count}">
-		   {/if}
-		{/if}
-		</table>
-		<!-- Table to display the List of S&H Tax Values - Ends -->
-	        </form>
-	</td>
-	<!-- Shipping Tax Ends Here -->
-   </tr>
-</table>
-
-<table border=0 cellspacing=0 cellpadding=5 width=100% >
-		   <tr>
-			<td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td>
-		   </tr>
-</table>
-
-
-			
-			
-			</td>
-			</tr>
-			</table>
-		</td>
-	</tr>
-	</table>
-	</div>
-
-</td>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
-   </tr>
-</tbody>
-</table>
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/Inventory.js"></script>
+
+{literal}
+<style>
+	
+	.tax_delete{
+		text-decoration:none;
+	}
+	
+	.tax_delete td{
+			
+	}
+	
+</style>
+{/literal}
+<br>
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody>
+   <tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+	<br>
+	<div align=center>
+
+			{include file='SetMenu.tpl'}
+				<!-- DISPLAY -->
+{if $EDIT_MODE eq 'true'}
+	{assign var=formname value='EditTax'}
+	{assign var=shformname value='SHEditTax'}
+{else}
+	{assign var=formname value='ListTax'}
+	{assign var=shformname value='SHListTax'}
+{/if}
+
+
+<!-- This table is used to display the Tax Configuration values-->
+<table border=0 cellspacing=0 cellpadding=5 width=100% class="settingsSelUITopLine">
+   <tr>
+	<td width=50 rowspan=2 valign=top><img src="{$IMAGE_PATH}taxConfiguration.gif" alt="Users" width="48" height="48" border=0 title="Users"></td>
+	<td class=heading2 valign=bottom><b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS}</a> > 
+		{if $EDIT_MODE eq 'true'}
+			<strong>{$MOD.LBL_EDIT} {$MOD.LBL_TAX_SETTINGS} </strong>
+		{else}
+			<strong>{$MOD.LBL_TAX_SETTINGS} </strong>
+		{/if}
+		</b>
+	</td>
+   </tr>
+   <tr>
+	<td valign=top class="small">{$MOD.LBL_TAX_DESC}</td>
+   </tr>
+</table>
+
+<br>
+<table border=0 cellspacing=0 cellpadding=10 width=100%>
+   <tr>
+	<td style="border-right:1px dotted #CCCCCC;" valign="top">
+		<!-- if EDIT_MODE is true then Textbox will be displayed else the value will be displayed-->
+		<form name="{$formname}" method="POST" action="index.php">
+		<input type="hidden" name="module" value="Settings">
+		<input type="hidden" name="action" value="">
+		<input type="hidden" name="parenttab" value="Settings">
+		<input type="hidden" name="save_tax" value="">
+		<input type="hidden" name="edit_tax" value="">
+		<input type="hidden" name="add_tax_type" value="">
+
+		<!-- Table to display the Product Tax Add and Edit Buttons - Starts -->
+		<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+		   <tr>
+			<td class="big" colspan="3"><strong>{$MOD.LBL_PRODUCT_TAX_SETTINGS} </strong></td>
+		   </tr>
+		   <tr>
+			<td>&nbsp;</td>
+			<td id="td_add_tax" class="small" colspan="2" align="right" nowrap>
+				{if $EDIT_MODE neq 'true'}
+					<input title="Add Tax" accessKey="Add Tax" onclick="fnAddTaxConfigRow('');" type="button" name="button" value="{$MOD.LBL_ADD_TAX_BUTTON}" class="crmButton small edit">
+				{/if}
+			</td>
+			<td class="small" align=right nowrap>
+			{if $EDIT_MODE eq 'true'}	
+				<input class="crmButton small save" title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}"  onclick="this.form.action.value='TaxConfig'; this.form.save_tax.value='true'; this.form.parenttab.value='Settings'; return validateTaxes('tax_count');" type="submit" name="button2" value=" {$APP.LBL_SAVE_BUTTON_LABEL}  ">&nbsp;
+				<input class="crmButton small cancel" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.module.value='Settings'; this.form.save_tax.value='false'; this.form.parenttab.value='Settings';" type="submit" name="button22" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  ">
+			{elseif $TAX_COUNT > 0}
+				<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.edit_tax.value='true'; this.form.parenttab.value='Settings';" type="submit" name="button" value="  {$APP.LBL_EDIT_BUTTON_LABEL}  " class="crmButton small edit">
+			{/if}
+			</td>
+		   </tr>
+		</table>
+		<!-- Table to display the Product Tax Add and Edit Buttons - Ends -->
+
+		<!-- Table to display the List of Product Tax values - Starts -->
+		<table id="add_tax" border=0 cellspacing=0 cellpadding=5 width=100% class="listRow">
+		   {if $TAX_COUNT eq 0}
+			<tr><td>No taxes available. Please Add Tax.</td></tr>
+		   {else}
+			{foreach item=tax key=count from=$TAX_VALUES}
+
+				<!-- To set the color coding for the taxes which are active and inactive-->
+				{if $tax.deleted eq 0}
+				   <tr><!-- set color to taxes which are active now-->
+				{else}
+				   <tr><!-- set color to taxes which are disabled now-->
+				{/if}
+				
+				<!--assinging tax label name for javascript validation-->
+				{assign var=tax_label value="taxlabel_"|cat:$tax.taxname} 
+        
+				<td width=35% class="cellLabel small" >
+					{if $EDIT_MODE eq 'true'}
+						<input name="{$tax.taxlabel}" id={$tax_label} type="text" value="{$tax.taxlabel}" class="detailedViewTextBox small">
+					{else}
+						{$tax.taxlabel}
+					{/if}
+				</td>
+				<td width=55% class="cellText small">
+					{if $EDIT_MODE eq 'true'}
+						<input name="{$tax.taxname}" id="{$tax.taxname}" type="text" value="{$tax.percentage}" class="detailedViewTextBox small">&nbsp;%
+					{else}
+						{$tax.percentage}&nbsp;%
+					{/if}
+				</td>
+				<td width=10% class="cellText small">
+						{if $tax.deleted eq 0}
+							<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&disable=true&taxname={$tax.taxname}"><img src="{$IMAGE_PATH}enabled.gif" border="0" align="absmiddle" alt="Enable me" title="Disable me"></a>
+						{else}
+							<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&enable=true&taxname={$tax.taxname}"><img src="{$IMAGE_PATH}disabled.gif" border="0" align="absmiddle" alt="Enable me" title="Enable me"></a>
+						{/if}
+				</td>
+			   </tr>
+			{/foreach}
+			{if $EDIT_MODE eq 'true'}
+				<input type="hidden" id="tax_count" value="{$count}">
+			{/if}
+		   {/if}
+		</table>
+		<!-- Table to display the List of Product Tax values - Ends -->
+		</form>
+	</td>
+
+	<!-- Shipping Tax Config Table Starts Here -->
+	<td width="50%" valign="top">
+		<form name="{$shformname}" method="POST" action="index.php">
+		<input type="hidden" name="module" value="Settings">
+		<input type="hidden" name="action" value="">
+		<input type="hidden" name="parenttab" value="Settings">
+		<input type="hidden" name="sh_save_tax" value="">
+		<input type="hidden" name="sh_edit_tax" value="">
+		<input type="hidden" name="sh_add_tax_type" value="">
+
+		<!-- Table to display the S&H Tax Add and Edit Buttons - Starts -->
+		<table border=0 cellspacing=0 cellpadding=5 width=100% class="tableHeading">
+		   <tr>
+        		<td class="big" colspan="3"><strong>{$MOD.LBL_SHIPPING_HANDLING_TAX_SETTINGS}</strong></td>
+		   </tr>
+		   <tr>
+			<td>&nbsp;</td>
+        		<td id="td_sh_add_tax" class="small" colspan="2" align="right" nowrap>
+				{if $SH_EDIT_MODE neq 'true'}
+					<input title="Add Tax" accessKey="Add Tax" onclick="fnAddTaxConfigRow('sh');" type="button" name="button" value="  Add Tax  " class="crmButton small edit">
+				{/if}
+			</td>
+			<td class="small" align=right nowrap>
+				{if $SH_EDIT_MODE eq 'true'}
+					<input class="crmButton small save" title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}"  onclick="this.form.action.value='TaxConfig'; this.form.sh_save_tax.value='true'; this.form.parenttab.value='Settings'; return validateTaxes('sh_tax_count');" type="submit" name="button2" value=" {$APP.LBL_SAVE_BUTTON_LABEL}  ">
+					&nbsp;
+					<input class="crmButton small cancel" title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.module.value='Settings'; this.form.sh_save_tax.value='false'; this.form.parenttab.value='Settings';" type="submit" name="button22" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  ">
+				{elseif $SH_TAX_COUNT > 0}
+					<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="this.form.action.value='TaxConfig'; this.form.sh_edit_tax.value='true'; this.form.parenttab.value='Settings';" type="submit" name="button" value="  {$APP.LBL_EDIT_BUTTON_LABEL}  " class="crmButton small edit">
+				{/if}
+			</td>
+		   </tr>
+		</table>
+		<!-- Table to display the S&H Tax Add and Edit Buttons - Ends -->
+
+		<!-- Table to display the List of S&H Tax Values - Starts -->
+		<table id="sh_add_tax" border=0 cellspacing=0 cellpadding=5 width=100% class="listRow">
+		   {if $SH_TAX_COUNT eq 0}
+			<tr><td>No taxes available. Please Add Tax.</td></tr>
+		   {else}
+		   	{foreach item=tax key=count from=$SH_TAX_VALUES}
+
+			<!-- To set the color coding for the taxes which are active and inactive-->
+			{if $tax.deleted eq 0}
+			   <tr><!-- set color to taxes which are active now-->
+			{else}
+			   <tr><!-- set color to taxes which are disabled now-->
+			{/if}
+
+			{assign var=tax_label value="taxlabel_"|cat:$tax.taxname} 
+			<td width=35% class="cellLabel small">
+			 	{if $SH_EDIT_MODE eq 'true'}
+			 	
+					<input name="{$tax.taxlabel}" id="{$tax_label}" type="text" value="{$tax.taxlabel}" class="detailedViewTextBox small">
+			 	{else} 
+					{$tax.taxlabel}
+				{/if}
+			</td>
+			<td width=55% class="cellText small">
+				{if $SH_EDIT_MODE eq 'true'}
+					<input name="{$tax.taxname}" id="{$tax.taxname}" type="text" value="{$tax.percentage}" class="detailedViewTextBox small">
+					&nbsp;% 
+				{else} 
+					{$tax.percentage}&nbsp;% 
+				{/if}
+			</td>
+			<td width=10% class="cellText small"> 
+				{if $tax.deleted eq 0}
+						<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&sh_disable=true&sh_taxname={$tax.taxname}"><img src="{$IMAGE_PATH}enabled.gif" border="0" align="absmiddle" alt="Enable me" title="Disable me"></a>
+					{else}
+						<a href="index.php?module=Settings&action=TaxConfig&parenttab=Settings&sh_enable=true&sh_taxname={$tax.taxname}"><img src="{$IMAGE_PATH}disabled.gif" border="0" align="absmiddle" alt="Enable me" title="Enable me"></a>
+					{/if}
+			</td>
+		   </tr>
+		   {/foreach}
+		   {if $SH_EDIT_MODE eq 'true'}
+			<input type="hidden" id="sh_tax_count" value="{$count}">
+		   {/if}
+		{/if}
+		</table>
+		<!-- Table to display the List of S&H Tax Values - Ends -->
+	        </form>
+	</td>
+	<!-- Shipping Tax Ends Here -->
+   </tr>
+</table>
+
+<table border=0 cellspacing=0 cellpadding=5 width=100% >
+		   <tr>
+			<td class="small" nowrap align=right><a href="#top">{$MOD.LBL_SCROLL}</a></td>
+		   </tr>
+</table>
+
+
+			
+			
+			</td>
+			</tr>
+			</table>
+		</td>
+	</tr>
+	</table>
+	</div>
+
+</td>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>
+   </tr>
+</tbody>
+</table>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/TagCloudDisplay.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/TagCloudDisplay.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/TagCloudDisplay.tpl Tue Nov 14 03:16:10 2006
@@ -19,6 +19,9 @@
 		<td class="tagCloudTopBg"><img src="{$IMAGE_PATH}tagCloudName.gif" border=0></td>
 	</tr>
 	<tr>
+                      	<td><div id="tagdiv" style="display:visible;"><input class="textbox"  type="text" id="txtbox_tagfields" name="textbox_First Name" value="" style="width:100px;margin-left:5px;"></input>&nbsp;&nbsp;<input name="button_tagfileds" type="button" class="crmbutton small save" value="{$APP.LBL_TAG_IT}" onclick="return tagvalidate()"/></div></td>
+        </tr>
+	<tr>
 		<td class="tagCloudDisplay" valign=top> <span id="tagfields">{$ALL_TAG}</span></td>
 	</tr>
 	</table>

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/UserDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/UserDetailView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/UserDetailView.tpl Tue Nov 14 03:16:10 2006
@@ -1,357 +1,359 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/ColorPicker2.js"></script>
-<script language="javascript" type="text/javascript" src="include/js/general.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
-<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
-   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
-</span>
-
-<br>
-<!-- Shadow table -->
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tr>
-    <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-    <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-    <br>
-    <div align=center>
-		{if $CATEGORY eq 'Settings'}
-			{include file='SetMenu.tpl'}
-		{/if}
-				<table width="100%"  border="0" cellspacing="0" cellpadding="0">
-				<tr>
-					<td class="padTab" align="left">
-						<form name="DetailView" method="POST" action="index.php" ENCTYPE="multipart/form-data" id="form" style="margin:0px">
-							<input type="hidden" name="module" value="Users" style="margin:0px">
-							<input type="hidden" name="record" id="userid" value="{$ID}" style="margin:0px">
-							<input type="hidden" name="isDuplicate" value=false style="margin:0px">
-							<input type="hidden" name="action" style="margin:0px">
-							<input type="hidden" name="changepassword" style="margin:0px">
-							{if $CATEGORY neq 'Settings'}
-								<input type="hidden" name="modechk" value="prefview" style="margin:0px">
-							{/if}
-							<input type="hidden" name="old_password" style="margin:0px">
-							<input type="hidden" name="new_password" style="margin:0px">
-							<input type="hidden" name="return_module" value="Users" style="margin:0px">
-							<input type="hidden" name="return_action" value="ListView"  style="margin:0px">
-							<input type="hidden" name="return_id" style="margin:0px">
-							<input type="hidden" name="forumDisplay" style="margin:0px">
-							{if $CATEGORY eq 'Settings'}
-							<input type="hidden" name="parenttab" value="{$PARENTTAB}" style="margin:0px">
-							{/if}	
-							<table width="100%" border="0" cellpadding="0" cellspacing="0" >
-							<tr>
-								<td colspan=2>
-									<!-- Heading and Icons -->
-									<table width="100%" cellpadding="5" cellspacing="0" border="0" class="settingsSelUITopLine">
-									<tr>
-										<td width=50 rowspan="2"><img src="{$IMAGE_PATH}ico-users.gif" align="absmiddle"></td>	
-										<td>
-											{if $CATEGORY eq 'Settings'}
-											<span class="heading2">
-											<b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS} </a> &gt; <a href="index.php?module=Administration&action=index&parenttab=Settings"> {$MOD.LBL_USERS} </a>&gt;"{$USERNAME}" </b></span>
-											{else}
-											<span class="heading2">	
-											<b>{$APP.LBL_MY_PREFERENCES}</b>
-											</span>
-											{/if}
-											<span id="vtbusy_info" style="display:none;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span>					
-										</td>
-										
-									</tr>
-									<tr>
-										<td>{$UMOD.LBL_USERDETAIL_INFO} "{$USERNAME}"</td>
-									</tr>
-									</table>
-								</td>
-							</tr>
-							<tr><td colspan="2">&nbsp;</td></tr>
-							<tr>
-								<td colspan="2" nowrap align="right">
-									{if $IS_ADMIN eq 'true'}
-									<input type="button" onclick="showAuditTrail();" value="{$MOD.LBL_VIEW_AUDIT_TRAIL}" class="crmButton small save"></input>
-									{/if}
-									{if $CATEGORY eq 'Settings'}
-														{$DUPLICATE_BUTTON}
-												{/if}
-									{$EDIT_BUTTON}
-									{if $CATEGORY eq 'Settings' && $ID neq 1 && $ID neq 2 & $ID neq $CURRENT_USERID}
-									<input type="button" onclick="deleteUser({$ID});" class="crmButton small cancel" value="{$UMOD.LBL_DELETE}"></input>
-									{/if}
-								</td>
-							</tr>
-							<tr>
-								<td colspan="2" align=left>
-								<!-- User detail blocks -->
-								<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
-								<tr>
-								<td align="left" valign="top">
-									{foreach key=header name=blockforeach item=detail from=$BLOCKS}
-									<br>
-									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
-									<tr>
-										{strip}
-										 <td class="big">	
-										<strong>{$smarty.foreach.blockforeach.iteration}. {$header}</strong>
-										 </td>
-										 <td class="small" align="right">&nbsp;</td>	
-										{/strip}
-									</tr>
-									</table>
-									
-									<table border="0" cellpadding="5" cellspacing="0" width="100%">
-									{foreach item=detail from=$detail}
-									<tr >
-										{foreach key=label item=data from=$detail}
-										   {assign var=keyid value=$data.ui}
-										   {assign var=keyval value=$data.value}
-										   {assign var=keytblname value=$data.tablename}
-										   {assign var=keyfldname value=$data.fldname}
-										   {assign var=keyoptions value=$data.options}
-										   {assign var=keysecid value=$data.secid}
-										   {assign var=keyseclink value=$data.link}
-										   {assign var=keycursymb value=$data.cursymb}
-										   {assign var=keysalut value=$data.salut}
-										   {assign var=keycntimage value=$data.cntimage}
-										   {assign var=keyadmin value=$data.isadmin}
-										   
-										   {if $label ne ''}
-										   <td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label}</td>
-											{include file="DetailViewUI.tpl"}
-										   {else}
-										   <td class="dvtCellLabel" align=right>&nbsp;</td>
-										   <td class="dvtCellInfo" align=left >&nbsp;</td>
-										   {/if}	
-										{/foreach}
-									</tr>
-									{/foreach}
-									</table>
-									{/foreach}
-									
-									<br>
-									<!-- Home page components -->
-									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
-									<tr>
-										 <td class="big">	
-										<strong>5. {$UMOD.LBL_HOME_PAGE_COMP}</strong>
-										 </td>
-										 <td class="small" align="right"><img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onClick="ShowHidefn('home_comp');"></td>	
-									</tr>
-									</table>
-									
-									<div style="float: none; display: none;" id="home_comp">	
-									<table border="0" cellpadding="5" cellspacing="0" width="100%">
-									{foreach item=homeitems key=values from=$HOMEORDER}
-										<tr><td class="dvtCellLabel" align="right" width="30%">{$UMOD.$values}</td>
-											{if $homeitems neq ''}
-												<td class="dvtCellInfo" align="center" width="5%">
-												<img src="{$IMAGE_PATH}prvPrfSelectedTick.gif" alt="{$UMOD.LBL_SHOWN}" height="12" width="12"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_SHOWN}</td> 		
-												{else}	
-												<td class="dvtCellInfo" align="center" width="5%">
-												<img src="{$IMAGE_PATH}no.gif" alt="{$UMOD.LBL_HIDDEN}" height="12" width="12"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_HIDDEN}</td> 		
-											{/if}	
-										</tr>			
-									{/foreach}
-									</table>	
-									</div>
-								
-									<br>
-									<!-- My Groups -->
-									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
-									<tr>
-										<td class="big">	
-										<strong>6. {$UMOD.LBL_MY_GROUPS}</strong>
-										 </td>
-										 <td class="small" align="right">
-										{if $GROUP_COUNT > 0}
-										<img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onClick="fetchGroups_js({$ID});">
-										{else}
-											&nbsp;
-										{/if}
-										</td>	
-									</tr>
-									</table>
-									
-									<table border="0" cellpadding="5" cellspacing="0" width="100%">
-									<tr><td align="left"><div id="user_group_cont" style="display:none;"></div></td></tr>	
-									</table>	
-									<br>
-									<!-- Login History -->
-									{if $IS_ADMIN eq 'true'}
-									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
-										<tr>
-										 <td class="big">	
-										<strong>7. {$UMOD.LBL_LOGIN_HISTORY}</strong>
-										 </td>
-										 <td class="small" align="right"><img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onClick="fetchlogin_js({$ID});"></td>	
-										</tr>
-									</table>
-
-									<table border="0" cellpadding="5" cellspacing="0" width="100%">
-									<tr><td align="left"><div id="login_history_cont" style="display:none;"></div></td></tr>	
-									</table>	
-									<br>	
-									{/if}	
-								</td>
-								</tr>
-								</table>
-								<!-- User detail blocks ends -->
-								
-								</td>
-							</tr>
-							<tr>
-								<td colspan=2 class="small"><div align="right"><a href="#top">{$MOD.LBL_SCROLL}</a></div></td>
-							</tr>
-							</table>
-							
-						</form>
-			
-					</td>
-				</tr>
-				</table>
-
-		
-	</div>
-	</td>
-	
-</tr>
-</table>
-			
-			</td>
-			</tr>
-			</table>
-			
-			</td>
-			<td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>			
-			</tr>
-			</table>
-			
-
-
-
-<br>
-{$JAVASCRIPT}
-<div id="tempdiv" style="display:block;position:absolute;left:350px;top:200px;"></div>
-<!-- added for validation -->
-<script language="javascript">
-  var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
-  var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
-  var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
-function ShowHidefn(divid)
-{ldelim}
-	if($(divid).style.display != 'none')
-		Effect.Fade(divid);
-	else
-		Effect.Appear(divid);
-{rdelim}
-{literal}
-function fetchlogin_js(id)
-{
-	if($('login_history_cont').style.display != 'none')
-		Effect.Fade('login_history_cont');
-	else
-		fetchLoginHistory(id);
-
-}
-function fetchLoginHistory(id)
-{
-        $("status").style.display="inline";
-        new Ajax.Request(
-                'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: 'module=Users&action=UsersAjax&file=ShowHistory&ajax=true&record='+id,
-                        onComplete: function(response) {
-                                $("status").style.display="none";
-                                $("login_history_cont").innerHTML= response.responseText;
-				Effect.Appear('login_history_cont');
-                        }
-                }
-        );
-
-}
-function fetchGroups_js(id)
-{
-	if($('user_group_cont').style.display != 'none')
-		Effect.Fade('user_group_cont');
-	else
-		fetchUserGroups(id);
-}
-function fetchUserGroups(id)
-{
-        $("status").style.display="inline";
-        new Ajax.Request(
-                'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: 'module=Users&action=UsersAjax&file=UserGroups&ajax=true&record='+id,
-                        onComplete: function(response) {
-                                $("status").style.display="none";
-                                $("user_group_cont").innerHTML= response.responseText;
-				Effect.Appear('user_group_cont');
-                        }
-                }
-        );
-
-}
-
-function showAuditTrail()
-{
-	var userid =  document.getElementById('userid').value;
-	window.open("index.php?module=Users&action=UsersAjax&file=ShowAuditTrail&userid="+userid,"","width=650,height=800,resizable=0,scrollbars=1,left=100");
-}
-
-function deleteUser(userid)
-{
-        $("status").style.display="inline";
-        new Ajax.Request(
-                'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: 'action=UsersAjax&file=UserDeleteStep1&return_action=ListView&return_module=Users&module=Users&parenttab=Settings&record='+userid,
-                        onComplete: function(response) {
-                                $("status").style.display="none";
-                                $("tempdiv").innerHTML= response.responseText;
-                        }
-                }
-        );
-}
-function transferUser(del_userid)
-{
-        $("status").style.display="inline";
-        $("DeleteLay").style.display="none";
-        var trans_userid=$('transfer_user_id').options[$('transfer_user_id').options.selectedIndex].value;
-	window.document.location.href = 'index.php?module=Users&action=DeleteUser&ajax_delete=false&delete_user_id='+del_userid+'&transfer_user_id='+trans_userid;
-}
-{/literal}
-</script>
-<script>
-function getListViewEntries_js(module,url)
-{ldelim}
-	$("status").style.display="inline";
-        new Ajax.Request(
-        	'index.php',
-                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                	method: 'post',
-                        postBody:"module="+module+"&action="+module+"Ajax&file=ShowHistory&record={$ID}&ajax=true&"+url,
-			onComplete: function(response) {ldelim}
-                        	$("status").style.display="none";
-                                $("login_history_cont").innerHTML= response.responseText;
-                  	{rdelim}
-                {rdelim}
-        );
-{rdelim}
-</script>
-
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/ColorPicker2.js"></script>
+<script language="javascript" type="text/javascript" src="include/js/general.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
+<script src="include/scriptaculous/scriptaculous.js" type="text/javascript"></script>
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
+   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
+</span>
+
+<br>
+<!-- Shadow table -->
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tr>
+    <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+    <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+    <br>
+    <div align=center>
+		{if $CATEGORY eq 'Settings'}
+			{include file='SetMenu.tpl'}
+		{/if}
+				<table width="100%"  border="0" cellspacing="0" cellpadding="0">
+				<tr>
+					<td class="padTab" align="left">
+						<form name="DetailView" method="POST" action="index.php" ENCTYPE="multipart/form-data" id="form" style="margin:0px">
+							<input type="hidden" name="module" value="Users" style="margin:0px">
+							<input type="hidden" name="record" id="userid" value="{$ID}" style="margin:0px">
+							<input type="hidden" name="isDuplicate" value=false style="margin:0px">
+							<input type="hidden" name="action" style="margin:0px">
+							<input type="hidden" name="changepassword" style="margin:0px">
+							{if $CATEGORY neq 'Settings'}
+								<input type="hidden" name="modechk" value="prefview" style="margin:0px">
+							{/if}
+							<input type="hidden" name="old_password" style="margin:0px">
+							<input type="hidden" name="new_password" style="margin:0px">
+							<input type="hidden" name="return_module" value="Users" style="margin:0px">
+							<input type="hidden" name="return_action" value="ListView"  style="margin:0px">
+							<input type="hidden" name="return_id" style="margin:0px">
+							<input type="hidden" name="forumDisplay" style="margin:0px">
+							{if $CATEGORY eq 'Settings'}
+							<input type="hidden" name="parenttab" value="{$PARENTTAB}" style="margin:0px">
+							{/if}	
+							<table width="100%" border="0" cellpadding="0" cellspacing="0" >
+							<tr>
+								<td colspan=2>
+									<!-- Heading and Icons -->
+									<table width="100%" cellpadding="5" cellspacing="0" border="0" class="settingsSelUITopLine">
+									<tr>
+										<td width=50 rowspan="2"><img src="{$IMAGE_PATH}ico-users.gif" align="absmiddle"></td>	
+										<td>
+											{if $CATEGORY eq 'Settings'}
+											<span class="heading2">
+											<b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS} </a> &gt; <a href="index.php?module=Administration&action=index&parenttab=Settings"> {$MOD.LBL_USERS} </a>&gt;"{$USERNAME}" </b></span>
+											{else}
+											<span class="heading2">	
+											<b>{$APP.LBL_MY_PREFERENCES}</b>
+											</span>
+											{/if}
+											<span id="vtbusy_info" style="display:none;" valign="bottom"><img src="{$IMAGE_PATH}vtbusy.gif" border="0"></span>					
+										</td>
+										
+									</tr>
+									<tr>
+										<td>{$UMOD.LBL_USERDETAIL_INFO} "{$USERNAME}"</td>
+									</tr>
+									</table>
+								</td>
+							</tr>
+							<tr><td colspan="2">&nbsp;</td></tr>
+							<tr>
+								<td colspan="2" nowrap align="right">
+									{if $IS_ADMIN eq 'true'}
+									<input type="button" onclick="showAuditTrail();" value="{$MOD.LBL_VIEW_AUDIT_TRAIL}" class="crmButton small save"></input>
+									{/if}
+									{if $CATEGORY eq 'Settings'}
+														{$DUPLICATE_BUTTON}
+												{/if}
+									{$EDIT_BUTTON}
+									{if $CATEGORY eq 'Settings' && $ID neq 1 && $ID neq 2 & $ID neq $CURRENT_USERID}
+									<input type="button" onclick="deleteUser({$ID});" class="crmButton small cancel" value="{$UMOD.LBL_DELETE}"></input>
+									{/if}
+								</td>
+							</tr>
+							<tr>
+								<td colspan="2" align=left>
+								<!-- User detail blocks -->
+								<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
+								<tr>
+								<td align="left" valign="top">
+									{foreach key=header name=blockforeach item=detail from=$BLOCKS}
+									<br>
+									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
+									<tr>
+										{strip}
+										 <td class="big">	
+										<strong>{$smarty.foreach.blockforeach.iteration}. {$header}</strong>
+										 </td>
+										 <td class="small" align="right">&nbsp;</td>	
+										{/strip}
+									</tr>
+									</table>
+									
+									<table border="0" cellpadding="5" cellspacing="0" width="100%">
+									{foreach item=detail from=$detail}
+									<tr >
+										{foreach key=label item=data from=$detail}
+										   {assign var=keyid value=$data.ui}
+										   {assign var=keyval value=$data.value}
+										   {assign var=keytblname value=$data.tablename}
+										   {assign var=keyfldname value=$data.fldname}
+										   {assign var=keyoptions value=$data.options}
+										   {assign var=keysecid value=$data.secid}
+										   {assign var=keyseclink value=$data.link}
+										   {assign var=keycursymb value=$data.cursymb}
+										   {assign var=keysalut value=$data.salut}
+										   {assign var=keycntimage value=$data.cntimage}
+										   {assign var=keyadmin value=$data.isadmin}
+										   
+										   {if $label ne ''}
+										   <td class="dvtCellLabel" align=right width=25%><input type="hidden" id="hdtxt_IsAdmin" value={$keyadmin}></input>{$label}</td>
+											{include file="DetailViewUI.tpl"}
+										   {else}
+										   <td class="dvtCellLabel" align=right>&nbsp;</td>
+										   <td class="dvtCellInfo" align=left >&nbsp;</td>
+										   {/if}	
+										{/foreach}
+									</tr>
+									{/foreach}
+									</table>
+									{/foreach}
+									
+									{include file="UserDetailOrg.tpl"}
+									
+									<br>
+									<!-- Home page components -->
+									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
+									<tr>
+										 <td class="big">	
+										<strong>6. {$UMOD.LBL_HOME_PAGE_COMP}</strong>
+										 </td>
+										 <td class="small" align="right"><img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onClick="ShowHidefn('home_comp');"></td>	
+									</tr>
+									</table>
+									
+									<div style="float: none; display: none;" id="home_comp">	
+									<table border="0" cellpadding="5" cellspacing="0" width="100%">
+									{foreach item=homeitems key=values from=$HOMEORDER}
+										<tr><td class="dvtCellLabel" align="right" width="30%">{$UMOD.$values}</td>
+											{if $homeitems neq ''}
+												<td class="dvtCellInfo" align="center" width="5%">
+												<img src="{$IMAGE_PATH}prvPrfSelectedTick.gif" alt="{$UMOD.LBL_SHOWN}" height="12" width="12"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_SHOWN}</td> 		
+												{else}	
+												<td class="dvtCellInfo" align="center" width="5%">
+												<img src="{$IMAGE_PATH}no.gif" alt="{$UMOD.LBL_HIDDEN}" height="12" width="12"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_HIDDEN}</td> 		
+											{/if}	
+										</tr>			
+									{/foreach}
+									</table>	
+									</div>
+								
+									<br>
+									<!-- My Groups -->
+									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
+									<tr>
+										<td class="big">	
+										<strong>7. {$UMOD.LBL_MY_GROUPS}</strong>
+										 </td>
+										 <td class="small" align="right">
+										{if $GROUP_COUNT > 0}
+										<img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onClick="fetchGroups_js({$ID});">
+										{else}
+											&nbsp;
+										{/if}
+										</td>	
+									</tr>
+									</table>
+									
+									<table border="0" cellpadding="5" cellspacing="0" width="100%">
+									<tr><td align="left"><div id="user_group_cont" style="display:none;"></div></td></tr>	
+									</table>	
+									<br>
+									<!-- Login History -->
+									{if $IS_ADMIN eq 'true'}
+									<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
+										<tr>
+										 <td class="big">	
+										<strong>8. {$UMOD.LBL_LOGIN_HISTORY}</strong>
+										 </td>
+										 <td class="small" align="right"><img src="{$IMAGE_PATH}showDown.gif" alt="{$APP.LBL_EXPAND_COLLAPSE}" title="{$APP.LBL_EXPAND_COLLAPSE}" onClick="fetchlogin_js({$ID});"></td>	
+										</tr>
+									</table>
+
+									<table border="0" cellpadding="5" cellspacing="0" width="100%">
+									<tr><td align="left"><div id="login_history_cont" style="display:none;"></div></td></tr>	
+									</table>	
+									<br>	
+									{/if}	
+								</td>
+								</tr>
+								</table>
+								<!-- User detail blocks ends -->
+								
+								</td>
+							</tr>
+							<tr>
+								<td colspan=2 class="small"><div align="right"><a href="#top">{$MOD.LBL_SCROLL}</a></div></td>
+							</tr>
+							</table>
+							
+						</form>
+			
+					</td>
+				</tr>
+				</table>
+
+		
+	</div>
+	</td>
+	
+</tr>
+</table>
+			
+			</td>
+			</tr>
+			</table>
+			
+			</td>
+			<td valign="top"><img src="{$IMAGE_PATH}showPanelTopRight.gif"></td>			
+			</tr>
+			</table>
+			
+
+
+
+<br>
+{$JAVASCRIPT}
+<div id="tempdiv" style="display:block;position:absolute;left:350px;top:200px;"></div>
+<!-- added for validation -->
+<script language="javascript">
+  var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
+  var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
+  var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
+function ShowHidefn(divid)
+{ldelim}
+	if($(divid).style.display != 'none')
+		Effect.Fade(divid);
+	else
+		Effect.Appear(divid);
+{rdelim}
+{literal}
+function fetchlogin_js(id)
+{
+	if($('login_history_cont').style.display != 'none')
+		Effect.Fade('login_history_cont');
+	else
+		fetchLoginHistory(id);
+
+}
+function fetchLoginHistory(id)
+{
+        $("status").style.display="inline";
+        new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: 'module=Users&action=UsersAjax&file=ShowHistory&ajax=true&record='+id,
+                        onComplete: function(response) {
+                                $("status").style.display="none";
+                                $("login_history_cont").innerHTML= response.responseText;
+				Effect.Appear('login_history_cont');
+                        }
+                }
+        );
+
+}
+function fetchGroups_js(id)
+{
+	if($('user_group_cont').style.display != 'none')
+		Effect.Fade('user_group_cont');
+	else
+		fetchUserGroups(id);
+}
+function fetchUserGroups(id)
+{
+        $("status").style.display="inline";
+        new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: 'module=Users&action=UsersAjax&file=UserGroups&ajax=true&record='+id,
+                        onComplete: function(response) {
+                                $("status").style.display="none";
+                                $("user_group_cont").innerHTML= response.responseText;
+				Effect.Appear('user_group_cont');
+                        }
+                }
+        );
+
+}
+
+function showAuditTrail()
+{
+	var userid =  document.getElementById('userid').value;
+	window.open("index.php?module=Users&action=UsersAjax&file=ShowAuditTrail&userid="+userid,"","width=650,height=800,resizable=0,scrollbars=1,left=100");
+}
+
+function deleteUser(userid)
+{
+        $("status").style.display="inline";
+        new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: 'action=UsersAjax&file=UserDeleteStep1&return_action=ListView&return_module=Users&module=Users&parenttab=Settings&record='+userid,
+                        onComplete: function(response) {
+                                $("status").style.display="none";
+                                $("tempdiv").innerHTML= response.responseText;
+                        }
+                }
+        );
+}
+function transferUser(del_userid)
+{
+        $("status").style.display="inline";
+        $("DeleteLay").style.display="none";
+        var trans_userid=$('transfer_user_id').options[$('transfer_user_id').options.selectedIndex].value;
+	window.document.location.href = 'index.php?module=Users&action=DeleteUser&ajax_delete=false&delete_user_id='+del_userid+'&transfer_user_id='+trans_userid;
+}
+{/literal}
+</script>
+<script>
+function getListViewEntries_js(module,url)
+{ldelim}
+	$("status").style.display="inline";
+        new Ajax.Request(
+        	'index.php',
+                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                	method: 'post',
+                        postBody:"module="+module+"&action="+module+"Ajax&file=ShowHistory&record={$ID}&ajax=true&"+url,
+			onComplete: function(response) {ldelim}
+                        	$("status").style.display="none";
+                                $("login_history_cont").innerHTML= response.responseText;
+                  	{rdelim}
+                {rdelim}
+        );
+{rdelim}
+</script>
+

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/UserEditView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/UserEditView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/UserEditView.tpl Tue Nov 14 03:16:10 2006
@@ -1,203 +1,206 @@
-{*<!--
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
--->*}
-<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
-<script language="JavaScript" type="text/javascript" src="include/js/ColorPicker2.js"></script>
-<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
-
-<script language="JavaScript" type="text/javascript">
-
- 	var cp2 = new ColorPicker('window');
-	
-function pickColor(color)
-{ldelim}
-	ColorPicker_targetInput.value = color;
-        ColorPicker_targetInput.style.backgroundColor = color;
-{rdelim}	
-
-function openPopup(){ldelim}
-		window.open("index.php?module=Users&action=UsersAjax&file=RolePopup&parenttab=Settings","roles_popup_window","height=425,width=640,toolbar=no,menubar=no,dependent=yes,resizable =no");
-	{rdelim}	
-</script>	
-
-<script language="javascript">
-function check_duplicate()
-{ldelim}
-	var user_name = window.document.EditView.user_name.value;
-	new Ajax.Request(
-                'index.php',
-                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
-                        method: 'post',
-                        postBody: 'module=Users&action=UsersAjax&file=Save&ajax=true&dup_check=true&userName='+user_name,
-                        onComplete: function(response) {ldelim}
-				if(response.responseText == 'SUCCESS')
-			                document.EditView.submit();
-       				else
-			                alert(response.responseText);
-                        {rdelim}
-                {rdelim}
-        );
-
-{rdelim}
-
-</script>
-
-
-<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
-<tbody><tr>
-        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
-        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
-        <br>
-
-	<div align=center>
-	{if $PARENTTAB eq 'Settings'}
-		{include file='SetMenu.tpl'}
-	{/if}
-
-		<form name="EditView" method="POST" action="index.php" ENCTYPE="multipart/form-data">
-		<input type="hidden" name="module" value="Users">
-		<input type="hidden" name="record" value="{$ID}">
-		<input type="hidden" name="mode" value="{$MODE}">
-		<input type='hidden' name='parenttab' value='{$PARENTTAB}'>
-		<input type="hidden" name="activity_mode" value="{$ACTIVITYMODE}">
-		<input type="hidden" name="action">
-		<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
-		<input type="hidden" name="return_id" value="{$RETURN_ID}">
-		<input type="hidden" name="return_action" value="{$RETURN_ACTION}">			
-		<input type="hidden" name="tz" value="Europe/Berlin">			
-		<input type="hidden" name="holidays" value="de,en_uk,fr,it,us,">			
-		<input type="hidden" name="workdays" value="0,1,2,3,4,5,6,">			
-		<input type="hidden" name="namedays" value="">			
-		<input type="hidden" name="weekstart" value="1">
-
-	<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="settingsSelUITopLine">
-	<tr><td align="left">
-		<table class="settingsSelUITopLine" border="0" cellpadding="5" cellspacing="0" width="100%">
-		<tr>
-			<td rowspan="2"><img src="{$IMAGE_PATH}ico-users.gif" align="absmiddle"></td>
-			<td>	
-				<span class="lvtHeaderText">
-				{if $PARENTTAB neq ''}	
-				<b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS} </a> &gt; <a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a> &gt; 
-					{if $MODE eq 'edit'}
-						{$UMOD.LBL_EDITING} "{$USERNAME}" 
-					{else}
-						{$UMOD.LBL_CREATE_NEW_USER}
-					{/if}
-					</b></span>
-				{else}
-                                <span class="lvtHeaderText">
-                                <b>{$APP.LBL_MY_PREFERENCES}</b>
-                                </span>
-                                {/if}
-			</td>
-			<td rowspan="2" nowrap>&nbsp;
-			</td>
-	 	</tr>
-		<tr>
-			{if $MODE eq 'edit'}
-				<td><b class="small">{$UMOD.LBL_EDIT_VIEW} "{$USERNAME}"</b>
-			{else}
-				<td><b class="small">{$UMOD.LBL_CREATE_NEW_USER}</b>
-			{/if}
-			</td>
-                </tr>
-		</table>
-	</td>
-	</tr>
-	<tr><td>&nbsp;</td></tr>
-	<tr>
-		<td nowrap align="right">
-				<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{$APP.LBL_SAVE_BUTTON_KEY}" class="small crmbutton save"  name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  "  onclick="this.form.action.value='Save'; return verify_data(EditView)" style="width: 70px;" type="button" />
-				<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accesskey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="small crmbutton cancel" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " onclick="window.history.back()" style="width: 70px;" type="button" />
-						
-		</td>
-	</tr>
-	<tr><td class="padTab" align="left">
-				<table width="100%" border="0" cellpadding="0" cellspacing="0">
-
-		<tr><td colspan="2">
-			<table align="center" border="0" cellpadding="0" cellspacing="0" width="99%">
-			<tr>
-			    <td align="left" valign="top">
-			             <table border="0" cellpadding="0" cellspacing="0" width="100%">
-					<tr><td align="left">
-						{foreach key=header name=blockforeach item=data from=$BLOCKS}
-						<br>
-		                                <table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
-                		                <tr>
-                                		    {strip}
-		                                     <td class="big">
-                		                        <strong>{$smarty.foreach.blockforeach.iteration}. {$header}</strong>
-                                		     </td>
-		                                     <td class="small" align="right">&nbsp;</td>
-		                                  {/strip}
-                		              	</tr>
-                                		</table>
-		                                <table border="0" cellpadding="5" cellspacing="0" width="100%">
-						<!-- Handle the ui types display -->
-							{include file="DisplayFields.tpl"}
-						</table>
-					   	{/foreach}
-				<br>
-			    	<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
-			    	<tr>
-				     <td class="big">	
-					<strong>5. {$UMOD.LBL_HOME_PAGE_COMP}</strong>
-				     </td>
-				     <td class="small" align="right">&nbsp;</td>	
-			        </tr>
-			    	</table>
-			    	<table border="0" cellpadding="5" cellspacing="0" width="100%">
-				{foreach item=homeitems key=values from=$HOMEORDER}
-					<tr><td class="dvtCellLabel" align="right" width="30%">{$UMOD.$values}</td>
-					    {if $homeitems neq ''}
-					    	<td class="dvtCellInfo" align="center" width="5%">
-					   	<input name="{$values}" value="{$values}" checked type="radio"></td><td class="dvtCellInfo" align="left" width="20%">{$UMOD.LBL_SHOW}</td> 		
-					    	<td class="dvtCellInfo" align="center" width="5%">
-					   	<input name="{$values}" value="" type="radio"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_HIDE}</td> 		
-					    {else}	
-					    	<td class="dvtCellInfo" align="center" width="5%">
-					   	<input name="{$values}" value="{$values}" type="radio"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_SHOW}</td> 		
-					    	<td class="dvtCellInfo" align="center" width="5%">
-					   	<input name="{$values}" value="" checked type="radio"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_HIDE}</td> 		
-					    {/if}	
-					</tr>			
-				{/foreach}
-			    	</table>	
-				<br>
-				<tr><td colspan=4>&nbsp;</td></tr>
-							
-					        <tr>
-					       		<td colspan=4 align="right">
-							<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{$APP.LBL_SAVE_BUTTON_KEY}" class="small crmbutton save"  name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  "  onclick="this.form.action.value='Save'; return verify_data(EditView)" style="width: 70px;" type="button" />
-							<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accesskey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="small crmbutton cancel" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " onclick="window.history.back()" style="width: 70px;" type="button" />
-							</td>
-						</tr>
-					    </table>
-					 </td></tr>
-					</table>
-			  	   </td></tr>
-				   </table>
-				 <br>
-				  </td></tr>
-				<tr><td class="small"><div align="right"><a href="#top">{$MOD.LBL_SCROLL}</a></div></td></tr>
-				</table>
-			</td>
-			</tr>
-			</table>
-			</form>	
-</td>
-</tr>
-</table>
-</td></tr></table>
-<br>
-{$JAVASCRIPT}
+{*<!--
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+-->*}
+<script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+<script language="JavaScript" type="text/javascript" src="include/js/ColorPicker2.js"></script>
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+
+<script language="JavaScript" type="text/javascript">
+
+ 	var cp2 = new ColorPicker('window');
+	
+function pickColor(color)
+{ldelim}
+	ColorPicker_targetInput.value = color;
+        ColorPicker_targetInput.style.backgroundColor = color;
+{rdelim}	
+
+function openPopup(){ldelim}
+		window.open("index.php?module=Users&action=UsersAjax&file=RolePopup&parenttab=Settings","roles_popup_window","height=425,width=640,toolbar=no,menubar=no,dependent=yes,resizable =no");
+	{rdelim}	
+</script>	
+
+<script language="javascript">
+function check_duplicate()
+{ldelim}
+	var user_name = window.document.EditView.user_name.value;
+	new Ajax.Request(
+                'index.php',
+                {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
+                        method: 'post',
+                        postBody: 'module=Users&action=UsersAjax&file=Save&ajax=true&dup_check=true&userName='+user_name,
+                        onComplete: function(response) {ldelim}
+				if(response.responseText == 'SUCCESS')
+			                document.EditView.submit();
+       				else
+			                alert(response.responseText);
+                        {rdelim}
+                {rdelim}
+        );
+
+{rdelim}
+
+</script>
+
+
+<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
+<tbody><tr>
+        <td valign="top"><img src="{$IMAGE_PATH}showPanelTopLeft.gif"></td>
+        <td class="showPanelBg" style="padding: 10px;" valign="top" width="100%">
+        <br>
+
+	<div align=center>
+	{if $PARENTTAB eq 'Settings'}
+		{include file='SetMenu.tpl'}
+	{/if}
+
+		<form name="EditView" method="POST" action="index.php" ENCTYPE="multipart/form-data">
+		<input type="hidden" name="module" value="Users">
+		<input type="hidden" name="record" value="{$ID}">
+		<input type="hidden" name="mode" value="{$MODE}">
+		<input type='hidden' name='parenttab' value='{$PARENTTAB}'>
+		<input type="hidden" name="activity_mode" value="{$ACTIVITYMODE}">
+		<input type="hidden" name="action">
+		<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
+		<input type="hidden" name="return_id" value="{$RETURN_ID}">
+		<input type="hidden" name="return_action" value="{$RETURN_ACTION}">			
+		<input type="hidden" name="tz" value="Europe/Berlin">			
+		<input type="hidden" name="holidays" value="de,en_uk,fr,it,us,">			
+		<input type="hidden" name="workdays" value="0,1,2,3,4,5,6,">			
+		<input type="hidden" name="namedays" value="">			
+		<input type="hidden" name="weekstart" value="1">
+
+	<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="settingsSelUITopLine">
+	<tr><td align="left">
+		<table class="settingsSelUITopLine" border="0" cellpadding="5" cellspacing="0" width="100%">
+		<tr>
+			<td rowspan="2"><img src="{$IMAGE_PATH}ico-users.gif" align="absmiddle"></td>
+			<td>	
+				<span class="lvtHeaderText">
+				{if $PARENTTAB neq ''}	
+				<b><a href="index.php?module=Settings&action=index&parenttab=Settings">{$MOD.LBL_SETTINGS} </a> &gt; <a href="index.php?module=Administration&action=index&parenttab=Settings">{$MOD.LBL_USERS}</a> &gt; 
+					{if $MODE eq 'edit'}
+						{$UMOD.LBL_EDITING} "{$USERNAME}" 
+					{else}
+						{$UMOD.LBL_CREATE_NEW_USER}
+					{/if}
+					</b></span>
+				{else}
+                                <span class="lvtHeaderText">
+                                <b>{$APP.LBL_MY_PREFERENCES}</b>
+                                </span>
+                                {/if}
+			</td>
+			<td rowspan="2" nowrap>&nbsp;
+			</td>
+	 	</tr>
+		<tr>
+			{if $MODE eq 'edit'}
+				<td><b class="small">{$UMOD.LBL_EDIT_VIEW} "{$USERNAME}"</b>
+			{else}
+				<td><b class="small">{$UMOD.LBL_CREATE_NEW_USER}</b>
+			{/if}
+			</td>
+                </tr>
+		</table>
+	</td>
+	</tr>
+	<tr><td>&nbsp;</td></tr>
+	<tr>
+		<td nowrap align="right">
+				<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{$APP.LBL_SAVE_BUTTON_KEY}" class="small crmbutton save"  name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  "  onclick="this.form.action.value='Save'; return verify_data(EditView)" style="width: 70px;" type="button" />
+				<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accesskey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="small crmbutton cancel" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " onclick="window.history.back()" style="width: 70px;" type="button" />
+						
+		</td>
+	</tr>
+	<tr><td class="padTab" align="left">
+				<table width="100%" border="0" cellpadding="0" cellspacing="0">
+
+		<tr><td colspan="2">
+			<table align="center" border="0" cellpadding="0" cellspacing="0" width="99%">
+			<tr>
+			    <td align="left" valign="top">
+			             <table border="0" cellpadding="0" cellspacing="0" width="100%">
+					<tr><td align="left">
+						{foreach key=header name=blockforeach item=data from=$BLOCKS}
+						<br>
+		                                <table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
+                		                <tr>
+                                		    {strip}
+		                                     <td class="big">
+                		                        <strong>{$smarty.foreach.blockforeach.iteration}. {$header}</strong>
+                                		     </td>
+		                                     <td class="small" align="right">&nbsp;</td>
+		                                  {/strip}
+                		              	</tr>
+                                		</table>
+		                                <table border="0" cellpadding="5" cellspacing="0" width="100%">
+						<!-- Handle the ui types display -->
+							{include file="DisplayFields.tpl"}
+						</table>
+					   	{/foreach}
+				
+				{include file="UserEditOrg.tpl"}
+				
+				<br>
+			    	<table class="tableHeading" border="0" cellpadding="5" cellspacing="0" width="100%">
+			    	<tr>
+				     <td class="big">	
+					<strong>6. {$UMOD.LBL_HOME_PAGE_COMP}</strong>
+				     </td>
+				     <td class="small" align="right">&nbsp;</td>	
+			        </tr>
+			    	</table>
+			    	<table border="0" cellpadding="5" cellspacing="0" width="100%">
+				{foreach item=homeitems key=values from=$HOMEORDER}
+					<tr><td class="dvtCellLabel" align="right" width="30%">{$UMOD.$values}</td>
+					    {if $homeitems neq ''}
+					    	<td class="dvtCellInfo" align="center" width="5%">
+					   	<input name="{$values}" value="{$values}" checked type="radio"></td><td class="dvtCellInfo" align="left" width="20%">{$UMOD.LBL_SHOW}</td> 		
+					    	<td class="dvtCellInfo" align="center" width="5%">
+					   	<input name="{$values}" value="" type="radio"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_HIDE}</td> 		
+					    {else}	
+					    	<td class="dvtCellInfo" align="center" width="5%">
+					   	<input name="{$values}" value="{$values}" type="radio"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_SHOW}</td> 		
+					    	<td class="dvtCellInfo" align="center" width="5%">
+					   	<input name="{$values}" value="" checked type="radio"></td><td class="dvtCellInfo" align="left">{$UMOD.LBL_HIDE}</td> 		
+					    {/if}	
+					</tr>			
+				{/foreach}
+			    	</table>	
+				<br>
+				<tr><td colspan=4>&nbsp;</td></tr>
+							
+					        <tr>
+					       		<td colspan=4 align="right">
+							<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{$APP.LBL_SAVE_BUTTON_KEY}" class="small crmbutton save"  name="button" value="  {$APP.LBL_SAVE_BUTTON_LABEL}  "  onclick="this.form.action.value='Save'; return verify_data(EditView)" style="width: 70px;" type="button" />
+							<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accesskey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="small crmbutton cancel" name="button" value="  {$APP.LBL_CANCEL_BUTTON_LABEL}  " onclick="window.history.back()" style="width: 70px;" type="button" />
+							</td>
+						</tr>
+					    </table>
+					 </td></tr>
+					</table>
+			  	   </td></tr>
+				   </table>
+				 <br>
+				  </td></tr>
+				<tr><td class="small"><div align="right"><a href="#top">{$MOD.LBL_SCROLL}</a></div></td></tr>
+				</table>
+			</td>
+			</tr>
+			</table>
+			</form>	
+</td>
+</tr>
+</table>
+</td></tr></table>
+<br>
+{$JAVASCRIPT}

Modified: vtigercrm/branches/5.1_jens/Smarty/templates/salesEditView.tpl
==============================================================================
--- vtigercrm/branches/5.1_jens/Smarty/templates/salesEditView.tpl (original)
+++ vtigercrm/branches/5.1_jens/Smarty/templates/salesEditView.tpl Tue Nov 14 03:16:10 2006
@@ -115,7 +115,7 @@
 
 
 							<!-- This is added to display the existing comments -->
-							{if $header eq 'Comments' || $header eq 'Comment Information'}
+							{if $header eq $MOD.LBL_COMMENTS || $header eq $MOD.LBL_COMMENT_INFORMATION}
 							   <tr><td>&nbsp;</td></tr>
 							   <tr>
 								<td colspan=4 class="dvInnerHeader">
@@ -131,14 +131,14 @@
 
 
 									      <tr>
-										{if $header== 'Address Information' && ($MODULE == 'Accounts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
+										{if $header== $MOD.LBL_ADDRESS_INFORMATION && ($MODULE == 'Accounts' || $MODULE == 'Quotes' || $MODULE == 'PurchaseOrder' || $MODULE == 'SalesOrder'|| $MODULE == 'Invoice')}
                                                                                 <td colspan=2 class="detailedViewHeader">
                                                                                 <b>{$header}</b></td>
                                                                                 <td class="detailedViewHeader">
                                                                                 <input name="cpy" onclick="return copyAddressLeft(EditView)" type="radio"><b>{$APP.LBL_RCPY_ADDRESS}</b></td>
                                                                                 <td class="detailedViewHeader">
                                                                                 <input name="cpy" onclick="return copyAddressRight(EditView)" type="radio"><b>{$APP.LBL_LCPY_ADDRESS}</b></td>
-										{elseif $header== 'Address Information' && $MODULE == 'Contacts'}
+										{elseif $header== $MOD.LBL_ADDRESS_INFORMATION && $MODULE == 'Contacts'}
 										<td colspan=2 class="detailedViewHeader">
                                                                                 <b>{$header}</b></td>
                                                                                 <td class="detailedViewHeader">
@@ -154,15 +154,25 @@
 
 										<!-- Handle the ui types display -->
 										{include file="DisplayFields.tpl"}
+									       
+									       <tr><td colspan=4><br><br></td></tr>
 
 									   {/foreach}
-
 
 									   <!-- Added to display the Product Details in Inventory-->
 									   {if $MODULE eq 'PurchaseOrder' || $MODULE eq 'SalesOrder' || $MODULE eq 'Quotes' || $MODULE eq 'Invoice'}
 							   		   <tr>
 										<td colspan=4>
 											{include file="ProductDetailsEditView.tpl"}
+										</td>
+							   		   </tr>
+									   {/if}
+
+									   <!-- Added to display the Organization Units --> 
+									   {if $MODULE eq "Organization"}
+							   		   <tr>
+										<td colspan=4>
+										       {include file="DetailsViewOrgUnit.tpl"}
 										</td>
 							   		   </tr>
 									   {/if}

Modified: vtigercrm/branches/5.1_jens/connection.php
==============================================================================
--- vtigercrm/branches/5.1_jens/connection.php (original)
+++ vtigercrm/branches/5.1_jens/connection.php Tue Nov 14 03:16:10 2006
@@ -1,4 +1,4 @@
-<?
+<?php
 /*********************************************************************************
 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
  * ("License"); You may not use this file except in compliance with the License

Modified: vtigercrm/branches/5.1_jens/cron/intimateTaskStatus.php
==============================================================================
--- vtigercrm/branches/5.1_jens/cron/intimateTaskStatus.php (original)
+++ vtigercrm/branches/5.1_jens/cron/intimateTaskStatus.php Tue Nov 14 03:16:10 2006
@@ -1,4 +1,4 @@
-<?
+<?php
 ini_set("include_path", "../:.");
 
 require('send_mail.php');

Modified: vtigercrm/branches/5.1_jens/data/CRMEntity.php
==============================================================================
--- vtigercrm/branches/5.1_jens/data/CRMEntity.php (original)
+++ vtigercrm/branches/5.1_jens/data/CRMEntity.php Tue Nov 14 03:16:10 2006
@@ -1,1496 +1,1171 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the 
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/vtigercrm/data/CRMEntity.php,v 1.16 2005/04/29 04:21:31 mickie Exp $
- * Description:  Defines the base class for all data entities used throughout the 
- * application.  The base class including its methods and variables is designed to 
- * be overloaded with module-specific methods and variables particular to the 
- * module's base entity class. 
- ********************************************************************************/
-
-include_once('config.php');
-require_once('include/logging.php');
-require_once('data/Tracker.php');
-require_once('include/utils/utils.php');
-require_once('include/utils/UserInfoUtil.php');
-
-class CRMEntity
-{
-  /**
-   * This method implements a generic insert and update logic for any SugarBean
-   * This method only works for subclasses that implement the same variable names.
-   * This method uses the presence of an id vtiger_field that is not null to signify and update.
-   * The id vtiger_field should not be set otherwise.
-   * todo - Add support for vtiger_field type validation and encoding of parameters.
-   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
-   * All Rights Reserved.
-   * Contributor(s): ______________________________________..
-   */
-
-	
-  function saveentity($module)
-  {
-	global $current_user, $adb;//$adb added by raju for mass mailing
-	$insertion_mode = $this->mode;
-
-	$this->db->println("TRANS saveentity starts $module");
-	$this->db->startTransaction();
-	
-	// Code included by Jaguar - starts    
-	if(isset($this->column_fields['recurringtype']) && $this->column_fields['recurringtype']!='')
-		$recur_type = trim($this->column_fields['recurringtype']);
-	else
-    		$recur_type='';	
-	// Code included by Jaguar - Ends
-
-	//Code included by Minnie - Starts
-	if(isset($_REQUEST['inviteesid']) && $_REQUEST['inviteesid']!='')
-	{
-		$selected_users_string =  $_REQUEST['inviteesid'];
-		$invitees_array = explode(';',$selected_users_string);
-
-	}
-	else
-		$invitees_array='';
-	//Code included by Minnie - Ends	
-
-	foreach($this->tab_name as $table_name)
-	{
-		if($table_name == "vtiger_crmentity")
-		{
-			$this->insertIntoCrmEntity($module);
-		}
-		elseif($table_name == "vtiger_salesmanactivityrel")
-		{
-			$this->insertIntoSmActivityRel($module);
-		}
-		//added by raju
-		elseif($table_name=="vtiger_seactivityrel" )
-		{
-		  //modified by Richie as raju's implementation broke the feature for addition of webmail to vtiger_crmentity.need to be more careful in future while integrating code
-			if($module=="Emails" && $_REQUEST['smodule']!='webmails' && (!$this->plugin_save))
-		  {
-				if($_REQUEST['currentid']!='')
-				{
-					$actid=$_REQUEST['currentid'];
-				}
-				else 
-				{
-					$actid=$_REQUEST['record'];
-				}
-				$parentid=$_REQUEST['parent_id'];
-				if($_REQUEST['module'] != 'Emails' && $_REQUEST['module'] != 'Webmails')
-				{
-					if(!$parentid) {
-						$parentid = $adb->getUniqueID('vtiger_seactivityrel');
-					}
-					$mysql='insert into vtiger_seactivityrel values('.$parentid.','.$actid.')';
-					$adb->query($mysql);
-				}
-				else
-				{	  
-					$myids=explode("|",$parentid);  //2 at 71|
-					for ($i=0;$i<(count($myids)-1);$i++)
-					{
-						$realid=explode("@",$myids[$i]);
-						$mycrmid=$realid[0];
-						//added to handle the relationship of emails with vtiger_users
-						if($realid[1] == -1)
-							$mysql='insert into vtiger_salesmanactivityrel values('.$mycrmid.','.$actid.')';
-						else	
-							$mysql='insert into vtiger_seactivityrel values('.$mycrmid.','.$actid.')';
-						$adb->query($mysql);
-					}
-				}
-			}
-			else
-			{
-				if(isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '')
-				{
-					$this->insertIntoEntityTable($table_name, $module);
-				}
-				elseif($this->column_fields['parent_id']=='' && $insertion_mode=="edit")
-				{
-					$this->deleteRelation($table_name);
-				}
-			}			
-		}
-		elseif($table_name == "vtiger_seticketsrel" || $table_name ==  "vtiger_seproductsrel" || $table_name ==  "vtiger_senotesrel")
-		{
-			if(isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '')//raju - mass mailing ends
-			{
-				$this->insertIntoEntityTable($table_name, $module);
-			}
-			elseif($this->column_fields['parent_id']=='' && $insertion_mode=="edit")
-			{
-				$this->deleteRelation($table_name);
-			}
-		}
-		elseif($table_name ==  "vtiger_cntactivityrel")
-		{
-			if(isset($this->column_fields['contact_id']) && $this->column_fields['contact_id'] != '')
-			{
-				$this->insertIntoEntityTable($table_name, $module);
-			}
-			elseif($this->column_fields['contact_id'] =='' && $insertion_mode=="edit")
-			{
-				$this->deleteRelation($table_name);
-			}
-
-		}
-		elseif($table_name ==  "vtiger_ticketcomments")
-		{
-                	$this->insertIntoTicketCommentTable($table_name, $module);
-		}
-		elseif($table_name ==  "vtiger_faqcomments")
-		{
-                	$this->insertIntoFAQCommentTable($table_name, $module);
-		}
-		elseif($table_name == "vtiger_activity_reminder")
-		{
-			if($recur_type == "--None--")
-			{
-				$this->insertIntoReminderTable($table_name,$module,"");
-			}
-		}
-		elseif($table_name == "vtiger_recurringevents") // Code included by Jaguar -  starts
-		{
-			$recur_type = trim($this->column_fields['recurringtype']);
-			if($recur_type != "--None--"  && $recur_type != '')
-		      	{		   
-				//Modified by Minnie
-				$recur_data = getrecurringObjValue();
-				if(is_object($recur_data))
-	      				$this->insertIntoRecurringTable($recur_data);
-			}		
-		}// Code included by Jaguar - Ends
-		// Code included by Minnie  -  starts	
-		elseif($table_name == "vtiger_invitees") 
-		{
-			if($invitees_array != '')
-			{
-				$this->insertIntoInviteeTable($table_name,$module,$invitees_array);
-			}
-		}
-		// Code included by Minnie  -  Ends
-		elseif($table_name == 'vtiger_producttaxrel')
-		{
-			//avoid call this function when we use ajax edit -> save
-			if($_REQUEST['ajxaction'] != 'DETAILVIEW')
-				$this->insertTaxInformation($table_name, $module);
-		}
-		elseif($table_name == 'vtiger_attachments')
-		{
-			$this->insertIntoAttachment($this->id,$module);
-		}
-		else
-		{
-			$this->insertIntoEntityTable($table_name, $module);			
-		}
-	}
-
-	$this->db->completeTransaction();
-        $this->db->println("TRANS saveentity ends");
-  }
-
-
-	function insertIntoAttachment1($id,$module,$filedata,$filename,$filesize,$filetype,$user_id)
-	{
-		$date_var = date('YmdHis');
-		global $current_user;
-		global $adb;
-		//global $root_directory;
-		global $log;
-
-		$ownerid = $user_id;
-		
-		if($filesize != 0)
-		{
-			$data = base64_encode(fread(fopen($filedata, "r"), $filesize));
-		}
-		
-		$current_id = $adb->getUniqueID("vtiger_crmentity");
-
-		if($module=='Emails') 
-		{ 
-			$log->info("module is ".$module);
-			$idname='emailid';      $tablename='emails';    $descname='description';
-		}
-		else     
-		{ 
-			$idname='notesid';      $tablename='notes';     $descname='notecontent';
-		}
-
-		$sql="update ".$tablename." set filename='".$filename."' where ".$idname."=".$id;
-		$adb->query($sql);
-
-		$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','"."',".$adb->formatString("vtiger_crmentity","createdtime",$date_var).",".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var).")";
-		$adb->query($sql1);
-
-		$sql2="insert into vtiger_attachments(attachmentsid, name, description, type) values(".$current_id.",'".$filename."','"."','".$filetype."')";
-		$result=$adb->query($sql2);
-
-		//TODO -- instead of put contents in db now we should store the file in harddisk
-
-		$sql3='insert into vtiger_seattachmentsrel values('.$id.','.$current_id.')';
-		$adb->query($sql3);
-	}
-
-
-	/**
-	 *      This function is used to add the vtiger_attachments. This will call the function uploadAndSaveFile which will upload the attachment into the server and save that attachment information in the database.
-	 *      @param int $id  - entity id to which the vtiger_files to be uploaded
-	 *      @param string $module  - the current module name
-	*/
-	function insertIntoAttachment($id,$module)
-	{
-		global $log, $adb;
-		$log->debug("Entering into insertIntoAttachment($id,$module) method.");
-		
-		$file_saved = false;
-
-		//This is to added to store the existing attachment id of the contact where we should delete this when we give new image
-		if($module == 'Contacts')
-			$old_attachmentid = $adb->query_result($adb->query("select * from vtiger_seattachmentsrel where crmid=$id"),0,'attachmentsid');
-
-		foreach($_FILES as $fileindex => $files)
-		{
-			if($files['name'] != '' && $files['size'] > 0)
-			{
-				$file_saved = $this->uploadAndSaveFile($id,$module,$files);
-			}
-		}
-
-		//This is to handle the delete image for contacts
-		if($module == 'Contacts' && $file_saved)
-		{
-			$del_res1 = $adb->query("delete from vtiger_attachments where attachmentsid=$old_attachmentid");
-			$del_res2 = $adb->query("delete from vtiger_seattachmentsrel where attachmentsid=$old_attachmentid");
-		}
-
-
-		//Remove the deleted vtiger_attachments from db - Products
-		if($module == 'Products' && $_REQUEST['del_file_list'] != '')
-		{
-			$del_file_list = explode("###",trim($_REQUEST['del_file_list'],"###"));
-			foreach($del_file_list as $del_file_name)
-			{
-				$attach_res = $adb->query("select vtiger_attachments.attachmentsid from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where crmid=$id and name=\"$del_file_name\"");
-				$attachments_id = $adb->query_result($attach_res,0,'attachmentsid');
-				
-				$del_res1 = $adb->query("delete from vtiger_attachments where attachmentsid=$attachments_id");
-				$del_res2 = $adb->query("delete from vtiger_seattachmentsrel where attachmentsid=$attachments_id");
-			}
-		}
-
-		$log->debug("Exiting from insertIntoAttachment($id,$module) method.");
-	}
-
-	/**
-	 *      This function is used to upload the attachment in the server and save that attachment information in db.
-	 *      @param int $id  - entity id to which the file to be uploaded
-	 *      @param string $module  - the current module name
-	 *      @param array $file_details  - array which contains the file information(name, type, size, tmp_name and error)
-	 *      return void
-	*/
-	function uploadAndSaveFile($id,$module,$file_details)
-	{
-		global $log;
-		$log->debug("Entering into uploadAndSaveFile($id,$module,$file_details) method.");
-
-		global $adb, $current_user;
-		global $upload_badext;
-
-		$date_var = date('YmdHis');
-
-		//to get the owner id
-		$ownerid = $this->column_fields['assigned_user_id'];
-		if(!isset($ownerid) || $ownerid=='')
-			$ownerid = $current_user->id;
-
-	
-		// Arbitrary File Upload Vulnerability fix - Philip
-		$binFile = $file_details['name'];
-		$ext_pos = strrpos($binFile, ".");
-
-		$ext = substr($binFile, $ext_pos + 1);
-
-		if (in_array($ext, $upload_badext))
-		{
-			$binFile .= ".txt";
-		}
-		// Vulnerability fix ends
-
-		$current_id = $adb->getUniqueID("vtiger_crmentity");
-
-		$filename = basename($binFile);
-		$filetype= $file_details['type'];
-		$filesize = $file_details['size'];
-		$filetmp_name = $file_details['tmp_name'];
-
-		//get the file path inwhich folder we want to upload the file
-		$upload_file_path = decideFilePath();
-
-		//upload the file in server
-		$upload_status = move_uploaded_file($filetmp_name,$upload_file_path.$current_id."_".$binFile);
-
-		$save_file = 'true';
-		//only images are allowed for these modules
-		if($module == 'Contacts' || $module == 'Products')
-		{
-			$save_file = validateImageFile(&$file_details);
-		}
-
-		if($save_file == 'true' && $upload_status == 'true')
-		{
-			//This is only to update the attached filename in the vtiger_notes vtiger_table for the Notes module
-			if($module=='Notes')
-			{
-				$sql="update vtiger_notes set filename='".$filename."' where notesid = ".$id;
-				$adb->query($sql);
-			}
-
-			$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$adb->formatString("vtiger_crmentity","createdtime",$date_var).",".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var).")";
-			$adb->query($sql1);
-
-			$sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(".$current_id.",'".$filename."','".$this->column_fields['description']."','".$filetype."','".$upload_file_path."')";
-			$result=$adb->query($sql2);
-
-			if($_REQUEST['mode'] == 'edit')
-			{
-				if($id != '' && $_REQUEST['fileid'] != '')
-				{
-					$delquery = 'delete from vtiger_seattachmentsrel where crmid = '.$id.' and attachmentsid = '.$_REQUEST['fileid'];
-					$adb->query($delquery);
-				}
-			}
-			if($module == 'Notes')
-			{
-				$query = "delete from vtiger_seattachmentsrel where crmid = ".$id;
-				$adb->query($query);
-			}
-			$sql3='insert into vtiger_seattachmentsrel values('.$id.','.$current_id.')';
-			$adb->query($sql3);
-
-			return true;
-		}
-		else
-		{
-			$log->debug("Skip the save attachment process.");
-			return false;
-		}
-	}
-
-	/** Function to insert values in the vtiger_crmentity for the specified module
-  	  * @param $module -- module:: Type varchar
- 	 */	
-
-  function insertIntoCrmEntity($module)
-  {
-	global $adb;
-	global $current_user;
-	global $log;
-                
-	$date_var = date('YmdHis');
-	if($_REQUEST['assigntype'] == 'T')
-	{
-		$ownerid= 0;
-	}
-	else
-	{
-		$ownerid = $this->column_fields['assigned_user_id'];
-	}
-                
-	if($module == 'Products' || $module == 'Notes' || $module =='Faq' || $module == 'Vendors' || $module == 'PriceBooks')
-	{
-		$log->info("module is =".$module);
-		$ownerid = $current_user->id;
-	}
-	if($module == 'Events')
-	{
-		$module = 'Calendar';
-	}
-	if($this->mode == 'edit')
-	{
-		$description_val = from_html($adb->formatString("vtiger_crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
-
-		require('user_privileges/user_privileges_'.$current_user->id.'.php');
-		$tabid = getTabid($module);
-		if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0)
-		{
-			$sql = "update vtiger_crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.",description=".$description_val.", modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
-		}
-		else
-		{
-			$profileList = getCurrentUserProfileList();
-			$perm_qry = "SELECT columnname FROM vtiger_field INNER JOIN vtiger_profile2field ON vtiger_profile2field.fieldid = vtiger_field.fieldid INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid = vtiger_field.fieldid WHERE vtiger_field.tabid = ".$tabid." AND vtiger_profile2field.visible = 0 AND vtiger_profile2field.profileid IN ".$profileList." AND vtiger_def_org_field.visible = 0 and vtiger_field.tablename='vtiger_crmentity' and vtiger_field.displaytype in (1,3);";
-			$perm_result = $adb->query($perm_qry);
-			$perm_rows = $adb->num_rows($perm_result);
-			for($i=0; $i<$perm_rows; $i++)
-			{
-				$columname[]=$adb->query_result($perm_result,$i,"columnname");
-			}
-			if(is_array($columname) && in_array("description",$columname))
-			{
-				$sql = "update vtiger_crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.",description=".$description_val.", modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
-			}
-			else
-			{
-				$sql = "update vtiger_crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.", modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
-			}
-		}
-		$adb->query($sql);
-		$sql1 ="delete from vtiger_ownernotify where crmid=".$this->id;
-		$adb->query($sql1);
-		if($ownerid != $current_user->id)
-		{
-			$sql1 = "insert into vtiger_ownernotify values(".$this->id.",".$ownerid.",null)";
-			$adb->query($sql1);
-		}
-	}
-	else
-	{
-		//if this is the create mode and the group allocation is chosen, then do the following
-		$current_id = $adb->getUniqueID("vtiger_crmentity");
-		$_REQUEST['currentid']=$current_id;
-
-		$description_val = from_html($adb->formatString("vtiger_crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
-		$sql = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values('".$current_id."','".$current_user->id."','".$ownerid."','".$module."',".$description_val.",".$adb->formatDate($date_var).",".$adb->formatDate($date_var).")";
-		$adb->query($sql);
-		$this->id = $current_id;
-	}
-
-    }
-
-
-	/** Function to insert values in vtiger_salesmanactivityrel table for the specified module
-  	  * @param $module -- module:: Type varchar
- 	 */
-
-  function insertIntoSmActivityRel($module)
-  {
-    global $adb;
-    global $current_user;
-    if($this->mode == 'edit')
-    {
-
-      $sql = "delete from vtiger_salesmanactivityrel where activityid=".$this->id." and smid = ".$this->column_fields['assigned_user_id']."";
-      $adb->query($sql);
-
-    }
-	$sql_qry = "insert into vtiger_salesmanactivityrel (smid,activityid) values(".$this->column_fields['assigned_user_id'].",".$this->id.")";
-    $adb->query($sql_qry);
-
-  }
-
-	/** Function to insert values in the specifed table for the specified module
-  	  * @param $table_name -- table name:: Type varchar
-  	  * @param $module -- module:: Type varchar
- 	 */
-  function insertIntoEntityTable($table_name, $module)
-  {
-	  global $log;
-  	  global $current_user;	  
-	   $log->info("function insertIntoEntityTable ".$module.' vtiger_table name ' .$table_name);
-	  global $adb;
-	  $insertion_mode = $this->mode;
-
-	  //Checkin whether an entry is already is present in the vtiger_table to update
-	  if($insertion_mode == 'edit')
-	  {
-		  $check_query = "select * from ".$table_name." where ".$this->tab_name_index[$table_name]."=".$this->id;
-		  $check_result=$adb->query($check_query);
-
-		  $num_rows = $adb->num_rows($check_result);
-
-		  if($num_rows <= 0)
-		  {
-			  $insertion_mode = '';
-		  }	 
-	  }
-
-	  if($insertion_mode == 'edit')
-	  {
-		  $update = '';
-		  $tabid= getTabid($module);	
-		  require('user_privileges/user_privileges_'.$current_user->id.'.php');
-		  if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0)
-		  {
-
-			  $sql = "select * from vtiger_field where tabid=".$tabid." and tablename='".$table_name."' and displaytype in (1,3)"; 
-		  }
-		  else
-		  {
-			  $profileList = getCurrentUserProfileList();
-			  $sql = "SELECT *
-			  FROM vtiger_field
-			  INNER JOIN vtiger_profile2field
-			  ON vtiger_profile2field.fieldid = vtiger_field.fieldid
-			  INNER JOIN vtiger_def_org_field
-			  ON vtiger_def_org_field.fieldid = vtiger_field.fieldid
-			  WHERE vtiger_field.tabid = ".$tabid."
-			  AND vtiger_profile2field.visible = 0 
-			  AND vtiger_profile2field.profileid IN ".$profileList."
-			  AND vtiger_def_org_field.visible = 0 and vtiger_field.tablename='".$table_name."' and vtiger_field.displaytype in (1,3)";
-		  }	   
-
-	  }
-	  else
-	  {
-		  $column = $this->tab_name_index[$table_name];
-		  if($column == 'id' && $table_name == 'vtiger_users')
-		  {
-		 	$currentuser_id = $adb->getUniqueID("vtiger_users");
-			$this->id = $currentuser_id;
-		  }
-		  $value = $this->id;
-	  	  $tabid= getTabid($module);	
-		  $sql = "select * from vtiger_field where tabid=".$tabid." and tablename='".$table_name."' and displaytype in (1,3,4)"; 
-	  }
-
-	  $result = $adb->query($sql);
-	  $noofrows = $adb->num_rows($result);
-	  for($i=0; $i<$noofrows; $i++)
-	  {
-		  $fieldname=$adb->query_result($result,$i,"fieldname");
-		  $columname=$adb->query_result($result,$i,"columnname");
-		  $uitype=$adb->query_result($result,$i,"uitype");
-		  if(isset($this->column_fields[$fieldname]))
-		  {
-			  if($uitype == 56)
-			  {
-				  if($this->column_fields[$fieldname] == 'on' || $this->column_fields[$fieldname] == 1)
-				  {
-					  $fldvalue = 1;
-				  }
-				  else
-				  {
-					  $fldvalue = 0;
-				  }
-
-			  }
-			  elseif($uitype == 33)
-			  {
-  				if(is_array($this->column_fields[$fieldname]))
-  				{
-  				  $field_list = implode(' |##| ',$this->column_fields[$fieldname]);
-  				}else
-  				{
-  				  $field_list = $this->column_fields[$fieldname];
-          		}
-  				$fldvalue = $field_list;
-			  }
-			  elseif($uitype == 5 || $uitype == 6 || $uitype ==23)
-			  {
-				  if($_REQUEST['action'] == 'Import')
-				  {
-					  $fldvalue = $this->column_fields[$fieldname];
-				  }
-				  else
-				  {
-					  $fldvalue = getDBInsertDateValue($this->column_fields[$fieldname]);
-				  }
-			  }
-			  elseif($uitype == 7)
-			  {
-				  //strip out the spaces and commas in numbers if given ie., in amounts there may be ,
-				  $fldvalue = str_replace(",","",$this->column_fields[$fieldname]);//trim($this->column_fields[$fieldname],",");
-
-			  }
-			  else
-			  {
-				  $fldvalue = $this->column_fields[$fieldname]; 
-				  $fldvalue = stripslashes($fldvalue);
-			  }
-			  $fldvalue = from_html($adb->formatString($table_name,$columname,$fldvalue),($insertion_mode == 'edit')?true:false);
-
-
-
-		  }
-		  else
-		  {
-			  $fldvalue = '';
-		  }
-		  if($fldvalue=='') $fldvalue ="NULL";
-		  if($insertion_mode == 'edit')
-		  {
-			  if($table_name == 'vtiger_notes' && $columname == 'filename' && $_FILES['filename']['name'] == '')
-			  {
-				  $fldvalue = $this->getOldFileName($this->id);
-			  }
-			  if($table_name == 'vtiger_products' && $columname == 'imagename')
-			  {
-					  
-
-			  }
-			  if($table_name != 'vtiger_ticketcomments')
-			  {
-				  if($i == 0)
-				  {
-					  $update = $columname."=".$fldvalue."";
-				  }
-				  else
-				  {
-					  $update .= ', '.$columname."=".$fldvalue."";
-				  }
-			  }
-		  }
-		  else
-		  {
-			  $column .= ", ".$columname;
-			  $value .= ", ".$fldvalue."";
-		  }
-
-	  }
-
-
-
-
-
-	  if($insertion_mode == 'edit')
-	  {
-		  if($_REQUEST['module'] == 'Potentials')
-		  {
-			  $dbquery = 'select sales_stage from vtiger_potential where potentialid = '.$this->id;
-			  $sales_stage = $adb->query_result($adb->query($dbquery),0,'sales_stage');
-			  if($sales_stage != $_REQUEST['sales_stage'] && $_REQUEST['sales_stage'] != '')
-			  {
-				  $date_var = date('YmdHis');
-				  $closingdate = getDBInsertDateValue($this->column_fields['closingdate']);
-				  $sql = "insert into vtiger_potstagehistory values('',".$this->id.",'".$this->column_fields['amount']."','".$sales_stage."','".$this->column_fields['probability']."',0,".$adb->formatString("vtiger_potstagehistory","closedate",$closingdate).",".$adb->formatString("vtiger_potstagehistory","lastmodified",$date_var).")";
-				  $adb->query($sql);
-			  }
-		  }
-		  elseif($_REQUEST['module'] == 'PurchaseOrder' || $_REQUEST['module'] == 'SalesOrder' || $_REQUEST['module'] == 'Quotes' || $_REQUEST['module'] == 'Invoice')
-		  {
-			  //added to update the history for PO, SO, Quotes and Invoice
-			  $history_field_array = Array(
-				  			"PurchaseOrder"=>"postatus",
-							"SalesOrder"=>"sostatus",
-							"Quotes"=>"quotestage",
-							"Invoice"=>"invoicestatus"
-						      );
-
-			  $inventory_module = $_REQUEST['module'];
-
-			  if($_REQUEST['ajxaction'] == 'DETAILVIEW')//if we use ajax edit
-			  {
-				  if($inventory_module == "PurchaseOrder")
-					  $relatedname = getVendorName($this->column_fields['vendor_id']);
-				  else
-				  	$relatedname = getAccountName($this->column_fields['account_id']);
-
-				  $total = $this->column_fields['hdnGrandTotal'];
-			  }
-			  else//using edit button and save
-			  {
-			  	if($inventory_module == "PurchaseOrder")
-			  		$relatedname = $_REQUEST["vendor_name"];
-			  	else
-			  		$relatedname = $_REQUEST["account_name"];
-
-				$total = $_REQUEST['total'];
-			  }
-
-			  $oldvalue = getSingleFieldValue($this->table_name,$history_field_array[$inventory_module],$this->module_id,$this->id);
-			  if($oldvalue != $this->column_fields["$history_field_array[$inventory_module]"])
-			  {
-				  addInventoryHistory($inventory_module, $this->id,$relatedname,$total,$this->column_fields["$history_field_array[$inventory_module]"]);
-			  }
-		  }
-
-		  //Check done by Don. If update is empty the the query fails
-		  if(trim($update) != '')
-        	  {
-		  	$sql1 = "update ".$table_name." set ".$update." where ".$this->tab_name_index[$table_name]."=".$this->id;
-
-		  	$adb->query($sql1); 
-		  }
-		  //to disable the update of groupentity relation in ajax edit for the fields except assigned_user_id field
-		  if($_REQUEST['ajxaction'] != 'DETAILVIEW' || ($_REQUEST['ajxaction'] == 'DETAILVIEW' && $_REQUEST['fldName'] == 'assigned_user_id'))
-		  {	  
-			  if($_REQUEST['assigntype'] == 'T')
-			  {
-				  $groupname = $_REQUEST['assigned_group_name'];
-				  //echo 'about to update lead group relation';
-				  if($module == 'Leads' && $table_name == 'vtiger_leaddetails')
-				  {
-					  updateLeadGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'Accounts' && $table_name == 'vtiger_account')
-				  {
-					  updateAccountGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'Contacts' && $table_name == 'vtiger_contactdetails')
-				  {
-					  updateContactGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'Potentials' && $table_name == 'vtiger_potential')
-				  {
-					  updatePotentialGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'Quotes' && $table_name == 'vtiger_quotes')
-				  {
-					  updateQuoteGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'SalesOrder' && $table_name == 'vtiger_salesorder')
-				  {
-					  updateSoGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'Invoice' && $table_name == 'vtiger_invoice')
-				  {
-					  updateInvoiceGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'PurchaseOrder' && $table_name == 'vtiger_purchaseorder')
-				  {
-					  updatePoGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'HelpDesk' && $table_name == 'vtiger_troubletickets')
-				  {
-					  updateTicketGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module == 'Campaigns' && $table_name == 'vtiger_campaign')
-				  {
-					  updateCampaignGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module =='Calendar' || $module =='Events' || $module == 'Emails')
-				  {
-					  if($table_name == 'vtiger_activity')
-					  {
-						  updateActivityGroupRelation($this->id,$groupname);
-					  }
-				  }
-
-
-			  }
-			  else
-			  {
-				  //echo 'about to update lead group relation again!';
-				  if($module == 'Leads' && $table_name == 'vtiger_leaddetails')
-				  {
-					  updateLeadGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'Accounts' && $table_name == 'vtiger_account')
-				  {
-					  updateAccountGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'Contacts' && $table_name == 'vtiger_contactdetails')
-				  {
-					  updateContactGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'Potentials' && $table_name == 'vtiger_potential')
-				  {
-					  updatePotentialGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'Quotes' && $table_name == 'vtiger_quotes')
-				  {
-					  updateQuoteGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'SalesOrder' && $table_name == 'vtiger_salesorder')
-				  {
-					  updateSoGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'Invoice' && $table_name == 'vtiger_invoice')
-				  {
-					  updateInvoiceGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'PurchaseOrder' && $table_name == 'vtiger_purchaseorder')
-				  {
-					  updatePoGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'HelpDesk' && $table_name == 'vtiger_troubletickets')
-				  {
-					  updateTicketGroupRelation($this->id,'');
-				  }
-				  elseif($module == 'Campaigns' && $table_name == 'vtiger_campaign')
-				  {
-					  updateCampaignGroupRelation($this->id,$groupname);
-				  }
-				  elseif($module =='Calendar' || $module =='Events' || $module == 'Emails')
-				  {
-					  if($table_name == 'vtiger_activity')
-					  {
-						  updateActivityGroupRelation($this->id,$groupname);
-					  }
-				  }
-
-
-			  }
-		  }
-
-	  }
-	  else
-	  {	
-		  $sql1 = "insert into ".$table_name." (".$column.") values(".$value.")";
-		  $adb->query($sql1); 
-		  $groupname = $_REQUEST['assigned_group_name'];
-		  if($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_leaddetails')
-		  {
-			  insert2LeadGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_account')
-		  {
-			  insert2AccountGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_contactdetails')
-		  {
-			  insert2ContactGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_potential')
-		  {
-			  insert2PotentialGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_quotes')
-		  {
-			  insert2QuoteGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_salesorder')
-		  {
-			  insert2SoGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_invoice')
-		  {
-			  insert2InvoiceGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_purchaseorder')
-		  {
-			  insert2PoGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_activity') 
-		  {
-			  insert2ActivityGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_troubletickets') 
-		  {
-			  insert2TicketGroupRelation($this->id,$groupname);
-		  }
-		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_campaign')
-		  {
-			  insert2CampaignGroupRelation($this->id,$groupname);
-		  }
-
-	  }
-
-  }
-	/** Function to delete a record in the specifed table 
-  	  * @param $table_name -- table name:: Type varchar
-	  * The function will delete a record .The id is obtained from the class variable $this->id and the columnname got from $this->tab_name_index[$table_name]
- 	 */
-function deleteRelation($table_name)
-{
-         global $adb;
-         $check_query = "select * from ".$table_name." where ".$this->tab_name_index[$table_name]."=".$this->id;
-         $check_result=$adb->query($check_query);
-         $num_rows = $adb->num_rows($check_result);
-
-         if($num_rows == 1)
-         {
-                $del_query = "DELETE from ".$table_name." where ".$this->tab_name_index[$table_name]."=".$this->id;
-                $adb->query($del_query);
-         }
-
-}
-	/** Function to attachment filename of the given entity 
-  	  * @param $notesid -- crmid:: Type Integer
-	  * The function will get the attachmentsid for the given entityid from vtiger_seattachmentsrel table and get the attachmentsname from vtiger_attachments table 
-	  * returns the 'filename'
- 	 */
-function getOldFileName($notesid)
-{
-	   global $log;
-$log->info("in getOldFileName  ".$notesid);
-	global $adb;
-	$query1 = "select * from vtiger_seattachmentsrel where crmid=".$notesid;
-	$result = $adb->query($query1);
-	$noofrows = $adb->num_rows($result);
-	if($noofrows != 0)
-		$attachmentid = $adb->query_result($result,0,'attachmentsid');
-	if($attachmentid != '')
-	{
-		$query2 = "select * from vtiger_attachments where attachmentsid=".$attachmentid;
-		$filename = $adb->query_result($adb->query($query2),0,'name');
-	}
-	return "'".$filename."'";
-}
-	/** Function to insert values in vtiger_ticketcomments  for the specified tablename and  module
-  	  * @param $table_name -- table name:: Type varchar
-  	  * @param $module -- module:: Type varchar
- 	 */	
-function insertIntoTicketCommentTable($table_name, $module)
-{
-	global $log;
-	$log->info("in insertIntoTicketCommentTable  ".$table_name."    module is  ".$module);
-        global $adb;
-	global $current_user;
-
-        $current_time = $adb->formatDate(date('YmdHis'));
-	if($this->column_fields['assigned_user_id'] != '')
-		$ownertype = 'user';
-	else
-		$ownertype = 'customer';
-
-	if($this->column_fields['comments'] != '')
-		$comment = $this->column_fields['comments'];
-	else
-		$comment = $_REQUEST['comments'];
-
-	if($comment != '')
-	{
-		$comment = addslashes($comment);
-		$sql = "insert into vtiger_ticketcomments values('',".$this->id.",'".$comment."','".$current_user->id."','".$ownertype."',".$current_time.")";	
-	        $adb->query($sql);
-	}
-}
-	/** Function to insert values in vtiger_faqcomments table for the specified module,
-  	  * @param $table_name -- table name:: Type varchar
-  	  * @param $module -- module:: Type varchar
- 	 */	
-function insertIntoFAQCommentTable($table_name, $module)
-{
-	global $log;
-	$log->info("in insertIntoFAQCommentTable  ".$table_name."    module is  ".$module);
-        global $adb;
-
-        $current_time = $adb->formatDate(date('YmdHis'));
-
-	if($this->column_fields['comments'] != '')
-		$comment = $this->column_fields['comments'];
-	else
-		$comment = $_REQUEST['comments'];
-
-	if($comment != '')
-	{
-		$comment = addslashes($comment);
-		$sql = "insert into vtiger_faqcomments values('',".$this->id.",'".$comment."',".$current_time.")";	
-		$adb->query($sql);
-	}
-}
-	/** Function to insert values in vtiger_faqcomments table for the specified module,
-  	  * @param $table_name -- table name:: Type varchar
-  	  * @param $module -- module:: Type varchar
- 	 */
-function insertIntoReminderTable($table_name,$module,$recurid)
-{
-	 global $log;
-$log->info("in insertIntoReminderTable  ".$table_name."    module is  ".$module);
-	if($_REQUEST['set_reminder'] == 'Yes')
-	{
-$log->debug("set reminder is set");
-		$rem_days = $_REQUEST['remdays'];
-$log->debug("rem_days is ".$rem_days);
-		$rem_hrs = $_REQUEST['remhrs'];
-$log->debug("rem_hrs is ".$rem_hrs);
-		$rem_min = $_REQUEST['remmin'];
-$log->debug("rem_minutes is ".$rem_min);
-		$reminder_time = $rem_days * 24 * 60 + $rem_hrs * 60 + $rem_min;
-$log->debug("reminder_time is ".$reminder_time);
-		if ($recurid == "")
-		{
-			if($_REQUEST['mode'] == 'edit')
-			{
-				$this->activity_reminder($this->id,$reminder_time,0,$recurid,'edit');
-			}
-			else
-			{
-				$this->activity_reminder($this->id,$reminder_time,0,$recurid,'');
-			}
-		}
-		else
-		{
-			$this->activity_reminder($this->id,$reminder_time,0,$recurid,'');
-		}
-	}
-	elseif($_REQUEST['set_reminder'] == 'No')
-	{
-		$this->activity_reminder($this->id,'0',0,$recurid,'delete');
-	}
-}
-
-// Code included by Minnie - starts
-	/** Function to insert values in vtiger_invitees table for the specified module,tablename ,invitees_array
-  	  * @param $table_name -- table name:: Type varchar
-  	  * @param $module -- module:: Type varchar
-	  * @param $invitees_array Array
- 	 */
-function insertIntoInviteeTable($table_name,$module,$invitees_array)
-{
-	global $log,$adb;
-	$log->debug("Entering insertIntoInviteeTable(".$table_name.",".$module.",".$invitees_array.") method ...");
-	foreach($invitees_array as $inviteeid)
-	{
-		if($inviteeid != '')
-		{
-			$query="insert into vtiger_invitees values(".$this->id.",".$inviteeid.")";
-			$adb->query($query);
-		}
-	}
-	$log->debug("Exiting insertIntoInviteeTable method ...");
-
-}
-// Code included by Minnie - Ends
-
-// Code included by Jaguar - starts
-	/** Function to insert values in vtiger_recurringevents table for the specified tablename,module
-  	  * @param $recurObj -- Recurring Object:: Type varchar
- 	 */	
-function insertIntoRecurringTable(& $recurObj)
-{
-	global $log,$adb;
-	$log->info("in insertIntoRecurringTable  ");
-	$st_date = $recurObj->startdate->get_formatted_date();
-	$log->debug("st_date ".$st_date);
-	$end_date = $recurObj->enddate->get_formatted_date();
-	$log->debug("end_date is set ".$end_date);
-	$type = $recurObj->recur_type;
-	$log->debug("type is ".$type);
-        $flag="true";
-
-	if($_REQUEST['mode'] == 'edit')
-	{
-		$activity_id=$this->id;
-
-		$sql='select min(recurringdate) AS min_date,max(recurringdate) AS max_date, recurringtype, activityid from vtiger_recurringevents where activityid='. $activity_id.' group by activityid, recurringtype';
-		
-		$result = $adb->query($sql);
-		$noofrows = $adb->num_rows($result);
-		for($i=0; $i<$noofrows; $i++)
-		{
-			$recur_type_b4_edit = $adb->query_result($result,$i,"recurringtype");
-			$date_start_b4edit = $adb->query_result($result,$i,"min_date");
-			$end_date_b4edit = $adb->query_result($result,$i,"max_date");
-		}
-		if(($st_date == $date_start_b4edit) && ($end_date==$end_date_b4edit) && ($type == $recur_type_b4_edit))
-		{
-			if($_REQUEST['set_reminder'] == 'Yes')
-			{
-				$sql = 'delete from vtiger_activity_reminder where activity_id='.$activity_id;
-				$adb->query($sql);
-				$sql = 'delete  from vtiger_recurringevents where activityid='.$activity_id;
-				$adb->query($sql);
-				$flag="true";
-			}
-			elseif($_REQUEST['set_reminder'] == 'No')
-			{
-				$sql = 'delete  from vtiger_activity_reminder where activity_id='.$activity_id;
-				$adb->query($sql);
-				$flag="false";
-			}
-			else
-				$flag="false";
-		}
-		else
-		{
-			$sql = 'delete from vtiger_activity_reminder where activity_id='.$activity_id;
-			$adb->query($sql);
-			$sql = 'delete  from vtiger_recurringevents where activityid='.$activity_id;
-			$adb->query($sql);
-		}
-	}
-	$date_array = $recurObj->recurringdates;
-	if(isset($recurObj->recur_freq) && $recurObj->recur_freq != null)
-		$recur_freq = $recurObj->recur_freq;
-	else
-		$recur_freq = 1;
-	if($recurObj->recur_type == 'Daily' || $recurObj->recur_type == 'Yearly')
-		$recurringinfo = $recurObj->recur_type;
-	elseif($recurObj->recur_type == 'Weekly')
-	{
-		$recurringinfo = $recurObj->recur_type;
-		if($recurObj->dayofweek_to_rpt != null)
-			$recurringinfo = $recurringinfo.'::'.implode('::',$recurObj->dayofweek_to_rpt);
-	}
-	elseif($recurObj->recur_type == 'Monthly')
-	{
-		$recurringinfo =  $recurObj->recur_type.'::'.$recurObj->repeat_monthby;
-		if($recurObj->repeat_monthby == 'date')
-			$recurringinfo = $recurringinfo.'::'.$recurObj->rptmonth_datevalue;
-		else
-			$recurringinfo = $recurringinfo.'::'.$recurObj->rptmonth_daytype.'::'.$recurObj->dayofweek_to_rpt[0];
-	}
-	else
-	{
-		$recurringinfo = '';
-	}
-	if($flag=="true")
-	{
-		for($k=0; $k< count($date_array); $k++)
-		{
-			$tdate=$date_array[$k];
-			if($tdate <= $end_date)
-			{
-				$max_recurid_qry = 'select max(recurringid) AS recurid from vtiger_recurringevents;';
-				$result = $adb->query($max_recurid_qry);
-				$noofrows = $adb->num_rows($result);
-				for($i=0; $i<$noofrows; $i++)
-				{
-					$recur_id = $adb->query_result($result,$i,"recurid");
-				}
-				$current_id =$recur_id+1;
-				$recurring_insert = "insert into vtiger_recurringevents values ('".$current_id."','".$this->id."','".$tdate."','".$type."','".$recur_freq."','".$recurringinfo."')";
-				$adb->query($recurring_insert);
-				if($_REQUEST['set_reminder'] == 'Yes')
-				{
-					$this->insertIntoReminderTable("activity_reminder",$module,$current_id,'');
-				}
-			}
-		}
-	}
-}
-
-// Code included by Jaguar - Ends 
-
-	/** Function to retrive the information of the given recordid ,module 
-  	  * @param $record -- Id:: Type Integer
-  	  * @param $module -- module:: Type varchar
-	  * This function retrives the information from the database and sets the value in the class columnfields array
- 	 */
-  function retrieve_entity_info($record, $module)
-  {
-    global $adb,$log,$app_strings;
-    $result = Array();
-    foreach($this->tab_name_index as $table_name=>$index)
-    {
-	    $result[$table_name] = $adb->query("select * from ".$table_name." where ".$index."=".$record);
-	    if($adb->query_result($result["vtiger_crmentity"],0,"deleted") == 1)
-	    die("<br><br><center>".$app_strings['LBL_RECORD_DELETE']." <a href='javascript:window.history.back()'>".$app_strings['LBL_GO_BACK'].".</a></center>");
-    }
-    $tabid = getTabid($module);
-    $sql1 =  "select * from vtiger_field where tabid=".$tabid;
-    $result1 = $adb->query($sql1);
-    $noofrows = $adb->num_rows($result1);
-    for($i=0; $i<$noofrows; $i++)
-    {
-      $fieldcolname = $adb->query_result($result1,$i,"columnname");
-      $tablename = $adb->query_result($result1,$i,"tablename");
-      $fieldname = $adb->query_result($result1,$i,"fieldname");
-
-      $fld_value = $adb->query_result($result[$tablename],0,$fieldcolname);
-      $this->column_fields[$fieldname] = $fld_value;
-				
-    }
-	if($module == 'Users')
-	{
-		for($i=0; $i<$noofrows; $i++)
-		{
-			$fieldcolname = $adb->query_result($result1,$i,"columnname");
-			$tablename = $adb->query_result($result1,$i,"tablename");
-			$fieldname = $adb->query_result($result1,$i,"fieldname");
-			$fld_value = $adb->query_result($result[$tablename],0,$fieldcolname);
-			$this->$fieldname = $fld_value;
-
-		}
-	}
-		
-    $this->column_fields["record_id"] = $record;
-    $this->column_fields["record_module"] = $module;
-  }
-
-	/** Function to saves the values in all the tables mentioned in the class variable $tab_name for the specified module
-  	  * @param $module -- module:: Type varchar
- 	 */
-	function save($module_name) 
-	{
-		global $log;
-	        $log->debug("module name is ".$module_name);
-		//GS Save entity being called with the modulename as parameter
-		$this->saveentity($module_name);
-	}
-  
-	function process_list_query($query, $row_offset, $limit= -1, $max_per_page = -1)
-	{
-		global $list_max_entries_per_page;
-		$this->log->debug("process_list_query: ".$query);
-		if(!empty($limit) && $limit != -1){
-			$result =& $this->db->limitQuery($query, $row_offset + 0, $limit,true,"Error retrieving $this->object_name list: ");
-		}else{
-			$result =& $this->db->query($query,true,"Error retrieving $this->object_name list: ");
-		}
-
-		$list = Array();
-		if($max_per_page == -1){
-			$max_per_page 	= $list_max_entries_per_page;
-		}
-		$rows_found =  $this->db->getRowCount($result);
-
-		$this->log->debug("Found $rows_found ".$this->object_name."s");
-                
-		$previous_offset = $row_offset - $max_per_page;
-		$next_offset = $row_offset + $max_per_page;
-
-		if($rows_found != 0)
-		{
-
-			// We have some data.
-
-			for($index = $row_offset , $row = $this->db->fetchByAssoc($result, $index); $row && ($index < $row_offset + $max_per_page || $max_per_page == -99) ;$index++, $row = $this->db->fetchByAssoc($result, $index)){
-
-				
-				foreach($this->list_fields as $entry)
-				{
-
-					foreach($entry as $key=>$field) // this will be cycled only once
-					{						
-						if (isset($row[$field])) {
-							$this->column_fields[$this->list_fields_names[$key]] = $row[$field];
-						
-						
-							$this->log->debug("$this->object_name({$row['id']}): ".$field." = ".$this->$field);
-						}
-						else 
-						{
-							$this->column_fields[$this->list_fields_names[$key]] = "";
-						}
-					}
-				}
-
-
-				//$this->db->println("here is the bug");
-				
-
-				$list[] = clone($this);//added by Richie to support PHP5
-			}
-		}
-
-		$response = Array();
-		$response['list'] = $list;
-		$response['row_count'] = $rows_found;
-		$response['next_offset'] = $next_offset;
-		$response['previous_offset'] = $previous_offset;
-
-		return $response;
-	}
-
-	function process_full_list_query($query)
-	{
-		$this->log->debug("CRMEntity:process_full_list_query");
-		$result =& $this->db->query($query, false);
-		$this->log->debug("CRMEntity:process_full_list_query: result is ".$result);
-
-
-		if($this->db->getRowCount($result) > 0){
-		
-		//	$this->db->println("process_full mid=".$this->module_id." mname=".$this->module_name);
-			// We have some data.
-			while ($row = $this->db->fetchByAssoc($result)) {				
-				$rowid=$row[$this->module_id];
-
-				if(isset($rowid))
-			       		$this->retrieve_entity_info($rowid,$this->module_name);
-				else
-					$this->db->println("rowid not set unable to retrieve");
-				 
-				 
-				
-		//clone function added to resolvoe PHP5 compatibility issue in Dashboards
-		//If we do not use clone, while using PHP5, the memory address remains fixed but the
-	//data gets overridden hence all the rows that come in bear the same value. This in turn
-//provides a wrong display of the Dashboard graphs. The data is erroneously shown for a specific month alone
-//Added by Richie
-				$list[] = clone($this);//added by Richie to support PHP5
-			}
-		}
-
-		if (isset($list)) return $list;
-		else return null;
-	}
-	
-	/** This function should be overridden in each module.  It marks an item as deleted.
-	* If it is not overridden, then marking this type of item is not allowed
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	*/
-	function mark_deleted($id)
-	{
-		$query = "UPDATE vtiger_crmentity set deleted=1 where crmid='$id'";
-		$this->db->query($query, true,"Error marking record deleted: ");
-
-
-	}
-
-
-	function retrieve_by_string_fields($fields_array, $encode=true) 
-	{ 
-		$where_clause = $this->get_where($fields_array);
-		
-		$query = "SELECT * FROM $this->table_name $where_clause";
-		$this->log->debug("Retrieve $this->object_name: ".$query);
-		$result =& $this->db->requireSingleResult($query, true, "Retrieving record $where_clause:");
-		if( empty($result)) 
-		{ 
-		 	return null; 
-		} 
-
-		 $row = $this->db->fetchByAssoc($result,-1, $encode);
-
-		foreach($this->column_fields as $field) 
-		{ 
-			if(isset($row[$field])) 
-			{ 
-				$this->$field = $row[$field];
-			}
-		} 
-		return $this;
-	}
-
-	// this method is called during an import before inserting a bean
-	// define an associative array called $special_fields
-	// the keys are user defined, and don't directly map to the bean's vtiger_fields
-	// the value is the method name within that bean that will do extra
-	// processing for that vtiger_field. example: 'full_name'=>'get_names_from_full_name'
-
-	function process_special_fields() 
-	{ 
-		foreach ($this->special_functions as $func_name) 
-		{ 
-			if ( method_exists($this,$func_name) ) 
-			{ 
-				$this->$func_name(); 
-			} 
-		} 
-	}
-
-	/**
-         * Function to check if the custom vtiger_field vtiger_table exists
-         * return true or false
-         */
-        function checkIfCustomTableExists($tablename)
-        {
-                $query = "select * from ".$tablename;
-                $result = $this->db->query($query);
-                $testrow = $this->db->num_fields($result);
-                if($testrow > 1)
-                {
-                        $exists=true;
-                }
-                else
-                {
-                        $exists=false;
-                }
-                return $exists;
-        }
-
-	/**
-	 * function to construct the query to fetch the custom vtiger_fields
-	 * return the query to fetch the custom vtiger_fields
-         */
-        function constructCustomQueryAddendum($tablename,$module)
-        {
-                global $adb;
-		$tabid=getTabid($module);		
-                $sql1 = "select columnname,fieldlabel from vtiger_field where generatedtype=2 and tabid=".$tabid;
-                $result = $adb->query($sql1);
-                $numRows = $adb->num_rows($result);
-                $sql3 = "select ";
-                for($i=0; $i < $numRows;$i++)
-                {
-                        $columnName = $adb->query_result($result,$i,"columnname");
-                        $fieldlable = $adb->query_result($result,$i,"fieldlabel");
-                        //construct query as below
-                        if($i == 0)
-                        {
-                                $sql3 .= $tablename.".".$columnName. " '" .$fieldlable."'";
-                        }
-                        else
-                        {
-                                $sql3 .= ", ".$tablename.".".$columnName. " '" .$fieldlable."'";
-                        }
-
-                }
-                if($numRows>0)
-                {
-                        $sql3=$sql3.',';
-                }
-                return $sql3;
-
-        }
-
-
-	/**	function to save the product tax information in producttarel vtiger_table
-	 *	@param string $tablename - vtiger_tablename to save the product tax relationship (producttaxrel)
-	 *	@param string $module	 - current module name
-	 *	$return void
-	*/
-	function insertTaxInformation($tablename, $module)
-	{
-		global $adb, $log;
-		$log->debug("Entering into insertTaxInformation($tablename, $module) method ...");
-		$tax_details = getAllTaxes();
-
-		$tax_per = '';
-		//Save the Product - tax relationship if corresponding tax check box is enabled
-		//Delete the existing tax if any
-		if($this->mode == 'edit')
-		{
-			for($i=0;$i<count($tax_details);$i++)
-			{
-				$taxid = getTaxId($tax_details[$i]['taxname']);
-				$sql = "delete from vtiger_producttaxrel where productid=$this->id and taxid=$taxid";
-				$adb->query($sql);
-			}
-		}
-		for($i=0;$i<count($tax_details);$i++)
-		{
-			$tax_name = $tax_details[$i]['taxname'];
-			$tax_checkname = $tax_details[$i]['taxname']."_check";
-			if($_REQUEST[$tax_checkname] == 'on' || $_REQUEST[$tax_checkname] == 1)
-			{
-				$taxid = getTaxId($tax_name);
-				$tax_per = $_REQUEST[$tax_name];
-				if($tax_per == '')
-				{
-					$log->debug("Tax selected but value not given so default value will be saved.");
-					$tax_per = getTaxPercentage($tax_name);
-				}
-				
-				$log->debug("Going to save the Product - $tax_name tax relationship");
-
-				$query = "insert into vtiger_producttaxrel values($this->id,$taxid,$tax_per)";
-				$adb->query($query);
-			}
-		}
-
-		$log->debug("Exiting from insertTaxInformation($tablename, $module) method ...");
-	}	
-
-	/**
-	 * This function returns a full (ie non-paged) list of the current object type.  
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function get_full_list($order_by = "", $where = "") {
-		$this->log->debug("get_full_list:  order_by = '$order_by' and where = '$where'");
-		$query = $this->create_list_query($order_by, $where);
-		return $this->process_full_list_query($query);
-	}
-
-	/**
-	 * Track the viewing of a detail record.  This leverages get_summary_text() which is object specific
-	 * params $user_id - The user that is viewing the record.
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function track_view($user_id, $current_module,$id='')
-	{
-		$this->log->debug("About to call vtiger_tracker (user_id, module_name, item_id)($user_id, $current_module, $this->id)");
-
-		$tracker = new Tracker();
-		$tracker->track_view($user_id, $current_module, $id, '');
-	}
-
-}
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the 
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/vtigercrm/data/CRMEntity.php,v 1.16 2005/04/29 04:21:31 mickie Exp $
+ * Description:  Defines the base class for all data entities used throughout the 
+ * application.  The base class including its methods and variables is designed to 
+ * be overloaded with module-specific methods and variables particular to the 
+ * module's base entity class. 
+ ********************************************************************************/
+
+include_once('config.php');
+require_once('include/logging.php');
+require_once('data/Tracker.php');
+require_once('include/utils/utils.php');
+require_once('include/utils/UserInfoUtil.php');
+
+class CRMEntity
+{
+  /**
+   * This method implements a generic insert and update logic for any SugarBean
+   * This method only works for subclasses that implement the same variable names.
+   * This method uses the presence of an id vtiger_field that is not null to signify and update.
+   * The id vtiger_field should not be set otherwise.
+   * todo - Add support for vtiger_field type validation and encoding of parameters.
+   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+   * All Rights Reserved.
+   * Contributor(s): ______________________________________..
+   */
+
+	
+  function saveentity($module)
+  {
+	global $current_user, $adb;//$adb added by raju for mass mailing
+	$insertion_mode = $this->mode;
+
+	$this->db->println("TRANS saveentity starts $module");
+	$this->db->startTransaction();
+	
+
+	foreach($this->tab_name as $table_name)
+	{
+			
+		if($table_name == "vtiger_crmentity")
+		{
+			$this->insertIntoCrmEntity($module);
+		}
+		elseif($table_name == 'vtiger_entity2org')
+		{
+			$this->insertIntoEntity2Org($this->id,$module);
+		}
+		else
+		{
+			$this->insertIntoEntityTable($table_name, $module);			
+		}
+	}
+
+	//Calling the Module specific save code
+	$this->save_module($module);
+	
+	$this->db->completeTransaction();
+        $this->db->println("TRANS saveentity ends");
+  }
+
+
+	
+	function insertIntoAttachment1($id,$module,$filedata,$filename,$filesize,$filetype,$user_id)
+	{
+		$date_var = date('YmdHis');
+		global $current_user;
+		global $adb;
+		//global $root_directory;
+		global $log;
+
+		$ownerid = $user_id;
+		
+		if($filesize != 0)
+		{
+			$data = base64_encode(fread(fopen($filedata, "r"), $filesize));
+		}
+		
+		$current_id = $adb->getUniqueID("vtiger_crmentity");
+
+		if($module=='Emails') 
+		{ 
+			$log->info("module is ".$module);
+			$idname='emailid';      $tablename='emails';    $descname='description';
+		}
+		else     
+		{ 
+			$idname='notesid';      $tablename='notes';     $descname='notecontent';
+		}
+
+		$sql="update ".$tablename." set filename='".$filename."' where ".$idname."=".$id;
+		$adb->query($sql);
+
+		$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','"."',".$adb->formatString("vtiger_crmentity","createdtime",$date_var).",".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var).")";
+		$adb->query($sql1);
+
+		$sql2="insert into vtiger_attachments(attachmentsid, name, description, type) values(".$current_id.",'".$filename."','"."','".$filetype."')";
+		$result=$adb->query($sql2);
+
+		//TODO -- instead of put contents in db now we should store the file in harddisk
+
+		$sql3='insert into vtiger_seattachmentsrel values('.$id.','.$current_id.')';
+		$adb->query($sql3);
+	}
+	
+
+
+	/**
+	 *      This function is used to upload the attachment in the server and save that attachment information in db.
+	 *      @param int $id  - entity id to which the file to be uploaded
+	 *      @param string $module  - the current module name
+	 *      @param array $file_details  - array which contains the file information(name, type, size, tmp_name and error)
+	 *      return void
+	*/
+	function uploadAndSaveFile($id,$module,$file_details)
+	{
+		global $log;
+		$log->debug("Entering into uploadAndSaveFile($id,$module,$file_details) method.");
+
+		global $adb, $current_user;
+		global $upload_badext;
+
+		$date_var = date('YmdHis');
+
+		//to get the owner id
+		$ownerid = $this->column_fields['assigned_user_id'];
+		if(!isset($ownerid) || $ownerid=='')
+			$ownerid = $current_user->id;
+
+	
+		// Arbitrary File Upload Vulnerability fix - Philip
+		$binFile = $file_details['name'];
+		$ext_pos = strrpos($binFile, ".");
+
+		$ext = substr($binFile, $ext_pos + 1);
+
+		if (in_array($ext, $upload_badext))
+		{
+			$binFile .= ".txt";
+		}
+		// Vulnerability fix ends
+
+		$current_id = $adb->getUniqueID("vtiger_crmentity");
+
+		$filename = basename($binFile);
+		$filetype= $file_details['type'];
+		$filesize = $file_details['size'];
+		$filetmp_name = $file_details['tmp_name'];
+
+		//get the file path inwhich folder we want to upload the file
+		$upload_file_path = decideFilePath();
+
+		//upload the file in server
+		$upload_status = move_uploaded_file($filetmp_name,$upload_file_path.$current_id."_".$binFile);
+
+		$save_file = 'true';
+		//only images are allowed for these modules
+		if($module == 'Contacts' || $module == 'Products')
+		{
+			$save_file = validateImageFile(&$file_details);
+		}
+
+		if($save_file == 'true' && $upload_status == 'true')
+		{
+			//This is only to update the attached filename in the vtiger_notes vtiger_table for the Notes module
+			if($module=='Notes')
+			{
+				$sql="update vtiger_notes set filename='".$filename."' where notesid = ".$id;
+				$adb->query($sql);
+			}
+
+			$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$adb->formatString("vtiger_crmentity","createdtime",$date_var).",".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var).")";
+			$adb->query($sql1);
+
+			$sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(".$current_id.",'".$filename."','".$this->column_fields['description']."','".$filetype."','".$upload_file_path."')";
+			$result=$adb->query($sql2);
+
+			if($_REQUEST['mode'] == 'edit')
+			{
+				if($id != '' && $_REQUEST['fileid'] != '')
+				{
+					$delquery = 'delete from vtiger_seattachmentsrel where crmid = '.$id.' and attachmentsid = '.$_REQUEST['fileid'];
+					$adb->query($delquery);
+				}
+			}
+			if($module == 'Notes')
+			{
+				$query = "delete from vtiger_seattachmentsrel where crmid = ".$id;
+				$adb->query($query);
+			}
+			$sql3='insert into vtiger_seattachmentsrel values('.$id.','.$current_id.')';
+			$adb->query($sql3);
+
+			return true;
+		}
+		else
+		{
+			$log->debug("Skip the save attachment process.");
+			return false;
+		}
+	}
+
+	/** Function to insert values in the vtiger_crmentity for the specified module
+  	  * @param $module -- module:: Type varchar
+ 	 */	
+
+  function insertIntoCrmEntity($module)
+  {
+	global $adb;
+	global $current_user;
+	global $log;
+                
+	$date_var = date('YmdHis');
+	if($_REQUEST['assigntype'] == 'T')
+	{
+		$ownerid= 0;
+	}
+	else
+	{
+		$ownerid = $this->column_fields['assigned_user_id'];
+	}
+                
+	if($module == 'Products' || $module == 'Notes' || $module =='Faq' || $module == 'Vendors' || $module == 'PriceBooks')
+	{
+		$log->info("module is =".$module);
+		$ownerid = $current_user->id;
+	}
+	if($module == 'Events')
+	{
+		$module = 'Calendar';
+	}
+	if($this->mode == 'edit')
+	{
+		$description_val = from_html($adb->formatString("vtiger_crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
+
+		require('user_privileges/user_privileges_'.$current_user->id.'.php');
+		$tabid = getTabid($module);
+		if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0)
+		{
+			$sql = "update vtiger_crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.",description=".$description_val.", modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
+		}
+		else
+		{
+			$profileList = getCurrentUserProfileList();
+			$perm_qry = "SELECT columnname FROM vtiger_field INNER JOIN vtiger_profile2field ON vtiger_profile2field.fieldid = vtiger_field.fieldid INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid = vtiger_field.fieldid WHERE vtiger_field.tabid = ".$tabid." AND vtiger_profile2field.visible = 0 AND vtiger_profile2field.profileid IN ".$profileList." AND vtiger_def_org_field.visible = 0 and vtiger_field.tablename='vtiger_crmentity' and vtiger_field.displaytype in (1,3);";
+			$perm_result = $adb->query($perm_qry);
+			$perm_rows = $adb->num_rows($perm_result);
+			for($i=0; $i<$perm_rows; $i++)
+			{
+				$columname[]=$adb->query_result($perm_result,$i,"columnname");
+			}
+			if(is_array($columname) && in_array("description",$columname))
+			{
+				$sql = "update vtiger_crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.",description=".$description_val.", modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
+			}
+			else
+			{
+				$sql = "update vtiger_crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.", modifiedtime=".$adb->formatString("vtiger_crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
+			}
+		}
+		$adb->query($sql);
+		$sql1 ="delete from vtiger_ownernotify where crmid=".$this->id;
+		$adb->query($sql1);
+		if($ownerid != $current_user->id)
+		{
+			$sql1 = "insert into vtiger_ownernotify values(".$this->id.",".$ownerid.",null)";
+			$adb->query($sql1);
+		}
+	}
+	else
+	{
+		//if this is the create mode and the group allocation is chosen, then do the following
+		$current_id = $adb->getUniqueID("vtiger_crmentity");
+		$_REQUEST['currentid']=$current_id;
+
+		$description_val = from_html($adb->formatString("vtiger_crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
+		$sql = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values('".$current_id."','".$current_user->id."','".$ownerid."','".$module."',".$description_val.",".$adb->formatDate($date_var).",".$adb->formatDate($date_var).")";
+		$adb->query($sql);
+		$this->id = $current_id;
+
+		//set the organization relation for this entity
+		//default value: The current selected organization
+		$orglist = array();
+		if( isset($_SESSION['authenticated_user_current_organization']) && $_SESSION['authenticated_user_current_organization'] != '') {
+		    $orglist[0] = $_SESSION['authenticated_user_current_organization'];
+		} else {
+		    global $current_organization;
+		    $orglist[0] = $current_organization;
+		}
+
+		//if we still have not got some organization
+		if( count( $orglist) < 0) {
+		    $log->info("crmid ".$this->id." is not explizitely related to any organization");
+		    $sql = "select organizationname from vtiger_organizationdetails where deleted=0";
+		    $result = $adb->query($sql);
+		    $orglist[0]=$adb->query_result($result,$i,"organizationname");
+		}
+		if( count( $orglist) < 0) {
+		    $log->fatal("crmid ".$this->id." is not related to any organization");
+		}
+
+		//set up the relations in the database
+		foreach($orglist as $org) {
+		    $sql = "insert into vtiger_entity2org (crmid,organizationname,primarytag) values (".$this->id.",'".$org."',1)";
+		    $adb->query($sql);
+		}
+	}
+
+    }
+
+	/** Function to insert values in the vtiger_entity2org relation
+	 *  @param $crmid -- CRM id
+	 *  @param $module -- module object
+	 */
+	function insertIntoEntity2Org($crmid,$module)
+	{
+	    global $current_organization;
+	    global $log;
+
+	    $log->debug( "Entering insertIntoEntity2Org for crmid=".$crmid." module=".$module);
+
+	    // parameters
+	    if( isset( $crmid) && $crmid != '' &&
+		isset( $this->column_fields["otherorgs"]) && $this->column_fields["otherorgs"] != '') {
+
+		// the organization list is the current users organization plus
+		// the other organizations stored in the modules parameters
+		if( is_array( $this->column_fields["otherorgs"])) {
+		    // As array when enetered in EditView
+		    $orglist = array();
+		    foreach( array_keys( $this->column_fields["otherorgs"]) as $key)
+			$orglist[] = $this->column_fields["otherorgs"][$key];
+		} else {
+		    // As string when entered in DetailView
+		    $orglist = explode( ' |##| ', $this->column_fields["otherorgs"]);
+		}
+		$orglist[] = $current_organization;
+
+		// get the current list of assignments
+		$sql = "SELECT organizationname,primarytag FROM vtiger_entity2org WHERE crmid='".$crmid."'";
+		$result = $this->db->query($sql);
+		$delete = array();
+		$noofrows = $this->db->num_rows($result);
+
+		for( $i=0; $i<$noofrows; $i++) {
+		    $organizationname = $this->db->query_result($result,$i,"organizationname");
+		    // If this organization is part of the $orglist array we'll
+		    // just keept it.
+		    for( $j=0; $j<count($orglist); $j++) {
+			if( $orglist[$j] == $organizationname) {
+			    array_splice( $orglist, $j, 1);
+			    continue 2;
+			}
+		    }
+
+		    // So the relation defined in the database is to be removed
+		    // Do not remove primary organizations
+		    $primary = $this->db->query_result($result,$i,"primarytag");
+		    if( $primary == 0)
+			$delete[] = $organizationname;
+		}
+
+		// Now we have two arrays $delete and $orglist defining the 
+		// required database modification
+		$delstr = "";
+		foreach( $delete as $org) {
+		    if( $delstr == "") 
+			$delstr = "'".$org."'";
+		    else
+			$delstr .= ",'".$org."'";
+		}
+		if( $delstr != '') {
+		    $sql = "DELETE from vtiger_entity2org WHERE crmid='".$crmid."'
+			       AND organizationname IN (".$delstr.")";
+		    $result = $this->db->query($sql);
+		}
+
+		foreach( $orglist as $org) {
+		    $sql = "INSERT INTO vtiger_entity2org (crmid,organizationname,primarytag)
+			       VALUES ('".$crmid."','".$org."',0)";
+		    $result = $this->db->query($sql);
+		}
+	    }
+
+	    $log->debug( "Exit from insertIntoEntity2Org for crmid=".$crmid." module=".$module);
+	}
+
+
+	/** Function to insert values in the specifed table for the specified module
+  	  * @param $table_name -- table name:: Type varchar
+  	  * @param $module -- module:: Type varchar
+ 	 */
+  function insertIntoEntityTable($table_name, $module)
+  {
+	  global $log;
+  	  global $current_user;	  
+	   $log->info("function insertIntoEntityTable ".$module.' vtiger_table name ' .$table_name);
+	  global $adb;
+	  $insertion_mode = $this->mode;
+
+	  //Checkin whether an entry is already is present in the vtiger_table to update
+	  if($insertion_mode == 'edit')
+	  {
+		  $check_query = "select * from ".$table_name." where ".$this->tab_name_index[$table_name]."=".$this->id;
+		  $check_result=$adb->query($check_query);
+
+		  $num_rows = $adb->num_rows($check_result);
+
+		  if($num_rows <= 0)
+		  {
+			  $insertion_mode = '';
+		  }	 
+	  }
+
+	  if($insertion_mode == 'edit')
+	  {
+		  $update = '';
+		  $tabid= getTabid($module);	
+		  require('user_privileges/user_privileges_'.$current_user->id.'.php');
+		  if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0)
+		  {
+
+			  $sql = "select * from vtiger_field where tabid=".$tabid." and tablename='".$table_name."' and displaytype in (1,3)"; 
+		  }
+		  else
+		  {
+			  $profileList = getCurrentUserProfileList();
+			  $sql = "SELECT *
+			  FROM vtiger_field
+			  INNER JOIN vtiger_profile2field
+			  ON vtiger_profile2field.fieldid = vtiger_field.fieldid
+			  INNER JOIN vtiger_def_org_field
+			  ON vtiger_def_org_field.fieldid = vtiger_field.fieldid
+			  WHERE vtiger_field.tabid = ".$tabid."
+			  AND vtiger_profile2field.visible = 0 
+			  AND vtiger_profile2field.profileid IN ".$profileList."
+			  AND vtiger_def_org_field.visible = 0 and vtiger_field.tablename='".$table_name."' and vtiger_field.displaytype in (1,3)";
+		  }	   
+
+	  }
+	  else
+	  {
+		  $column = $this->tab_name_index[$table_name];
+		  if($column == 'id' && $table_name == 'vtiger_users')
+		  {
+		 	$currentuser_id = $adb->getUniqueID("vtiger_users");
+			$this->id = $currentuser_id;
+		  } elseif( $column == 'orgunitid' && $table_name == 'vtiger_orgunit') {
+			$this->id = $adb->getUniqueID("vtiger_orgunit");
+		  }
+		  $value = $this->id;
+	  	  $tabid= getTabid($module);	
+		  $sql = "select * from vtiger_field where tabid=".$tabid." and tablename='".$table_name."' and displaytype in (1,3,4)"; 
+	  }
+
+	  $result = $adb->query($sql);
+	  $noofrows = $adb->num_rows($result);
+	  for($i=0; $i<$noofrows; $i++)
+	  {
+		  $fieldname=$adb->query_result($result,$i,"fieldname");
+		  $columname=$adb->query_result($result,$i,"columnname");
+		  $uitype=$adb->query_result($result,$i,"uitype");
+
+		  if(isset($this->column_fields[$fieldname]))
+		  {
+			  if($uitype == 56)
+			  {
+				  if($this->column_fields[$fieldname] == 'on' || $this->column_fields[$fieldname] == 1)
+				  {
+					  $fldvalue = 1;
+				  }
+				  else
+				  {
+					  $fldvalue = 0;
+				  }
+
+			  }
+			  // Added for inheritance and extensions fields
+			  elseif( $uitype == '3' || $uitype == '4' || $uitype == '18' ||
+			      $uitype == '31' || $uitype == '32') {
+			      $fldvalue = $this->column_fields[$fieldname];
+			      if( isset( $this->column_fields[$fieldname."@##@"]) &&
+				  $this->column_fields[$fieldname."@##@"] == 1) 
+				  $fldvalue = "@##@".$fldvalue;
+			  }
+			  elseif($uitype == 33)
+			  {
+  				if(is_array($this->column_fields[$fieldname]))
+  				{
+  				  $field_list = implode(' |##| ',$this->column_fields[$fieldname]);
+  				}else
+  				{
+  				  $field_list = $this->column_fields[$fieldname];
+          		}
+  				$fldvalue = $field_list;
+			  }
+			  elseif($uitype == 5 || $uitype == 6 || $uitype ==23)
+			  {
+				  if($_REQUEST['action'] == 'Import' ||
+				     ereg("^".$module."Ajax",$_REQUEST['action']))
+				  {
+					  $fldvalue = $this->column_fields[$fieldname];
+				  }
+				  else
+				  {
+					  $fldvalue = getDBInsertDateValue($this->column_fields[$fieldname]);
+				  }
+			  }
+			  elseif($uitype == 7)
+			  {
+				  //strip out the spaces and commas in numbers if given ie., in amounts there may be ,
+				  $fldvalue = str_replace(",","",$this->column_fields[$fieldname]);//trim($this->column_fields[$fieldname],",");
+
+			  }
+			  else
+			  {
+				  $fldvalue = $this->column_fields[$fieldname]; 
+				  $fldvalue = stripslashes($fldvalue);
+			  }
+			  $fldvalue = from_html($adb->formatString($table_name,$columname,$fldvalue),($insertion_mode == 'edit')?true:false);
+		  }
+		  else
+		  {
+			  $fldvalue = '';
+		  }
+		  if($fldvalue=='') $fldvalue ="NULL";
+		  if($insertion_mode == 'edit')
+		  {
+			  if($table_name == 'vtiger_notes' && $columname == 'filename' && $_FILES['filename']['name'] == '')
+			  {
+				  $fldvalue = $this->getOldFileName($this->id);
+			  }
+			  if($table_name != 'vtiger_ticketcomments')
+			  {
+				  if($i == 0)
+				  {
+					  $update = $columname."=".$fldvalue."";
+				  }
+				  else
+				  {
+					  $update .= ', '.$columname."=".$fldvalue."";
+				  }
+			  }
+		  }
+		  else
+		  {
+			  $column .= ", ".$columname;
+			  $value .= ", ".$fldvalue."";
+		  }
+
+	  }
+
+
+
+
+
+	  if($insertion_mode == 'edit')
+	  {
+		  if($_REQUEST['module'] == 'Potentials')
+		  {
+			  $dbquery = 'select sales_stage from vtiger_potential where potentialid = '.$this->id;
+			  $sales_stage = $adb->query_result($adb->query($dbquery),0,'sales_stage');
+			  if($sales_stage != $_REQUEST['sales_stage'] && $_REQUEST['sales_stage'] != '')
+			  {
+				  $date_var = date('YmdHis');
+				  $closingdate = getDBInsertDateValue($this->column_fields['closingdate']);
+				  $sql = "insert into vtiger_potstagehistory values('',".$this->id.",'".$this->column_fields['amount']."','".$sales_stage."','".$this->column_fields['probability']."',0,".$adb->formatString("vtiger_potstagehistory","closedate",$closingdate).",".$adb->formatString("vtiger_potstagehistory","lastmodified",$date_var).")";
+				  $adb->query($sql);
+			  }
+		  }
+		  elseif($_REQUEST['module'] == 'PurchaseOrder' || $_REQUEST['module'] == 'SalesOrder' || $_REQUEST['module'] == 'Quotes' || $_REQUEST['module'] == 'Invoice')
+		  {
+			  //added to update the history for PO, SO, Quotes and Invoice
+			  $history_field_array = Array(
+				  			"PurchaseOrder"=>"postatus",
+							"SalesOrder"=>"sostatus",
+							"Quotes"=>"quotestage",
+							"Invoice"=>"invoicestatus"
+						      );
+
+			  $inventory_module = $_REQUEST['module'];
+
+			  if($_REQUEST['ajxaction'] == 'DETAILVIEW')//if we use ajax edit
+			  {
+				  if($inventory_module == "PurchaseOrder")
+					  $relatedname = getVendorName($this->column_fields['vendor_id']);
+				  else
+				  	$relatedname = getAccountName($this->column_fields['account_id']);
+
+				  $total = $this->column_fields['hdnGrandTotal'];
+			  }
+			  else//using edit button and save
+			  {
+			  	if($inventory_module == "PurchaseOrder")
+			  		$relatedname = $_REQUEST["vendor_name"];
+			  	else
+			  		$relatedname = $_REQUEST["account_name"];
+
+				$total = $_REQUEST['total'];
+			  }
+
+			  $oldvalue = getSingleFieldValue($this->table_name,$history_field_array[$inventory_module],$this->module_id,$this->id);
+			  if($oldvalue != $this->column_fields["$history_field_array[$inventory_module]"])
+			  {
+				  addInventoryHistory($inventory_module, $this->id,$relatedname,$total,$this->column_fields["$history_field_array[$inventory_module]"]);
+			  }
+		  }
+
+		  //Check done by Don. If update is empty the the query fails
+		  if(trim($update) != '')
+        	  {
+		  	$sql1 = "update ".$table_name." set ".$update." where ".$this->tab_name_index[$table_name]."=".$this->id;
+
+		  	$adb->query($sql1); 
+		  }
+		  //to disable the update of groupentity relation in ajax edit for the fields except assigned_user_id field
+		  if($_REQUEST['ajxaction'] != 'DETAILVIEW' || ($_REQUEST['ajxaction'] == 'DETAILVIEW' && $_REQUEST['fldName'] == 'assigned_user_id'))
+		  {	  
+			  if($_REQUEST['assigntype'] == 'T')
+			  {
+				  $groupname = $_REQUEST['assigned_group_name'];
+				  //echo 'about to update lead group relation';
+				  if($module == 'Leads' && $table_name == 'vtiger_leaddetails')
+				  {
+					  updateLeadGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'Accounts' && $table_name == 'vtiger_account')
+				  {
+					  updateAccountGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'Contacts' && $table_name == 'vtiger_contactdetails')
+				  {
+					  updateContactGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'Potentials' && $table_name == 'vtiger_potential')
+				  {
+					  updatePotentialGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'Quotes' && $table_name == 'vtiger_quotes')
+				  {
+					  updateQuoteGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'SalesOrder' && $table_name == 'vtiger_salesorder')
+				  {
+					  updateSoGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'Invoice' && $table_name == 'vtiger_invoice')
+				  {
+					  updateInvoiceGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'PurchaseOrder' && $table_name == 'vtiger_purchaseorder')
+				  {
+					  updatePoGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'HelpDesk' && $table_name == 'vtiger_troubletickets')
+				  {
+					  updateTicketGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module == 'Campaigns' && $table_name == 'vtiger_campaign')
+				  {
+					  updateCampaignGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module =='Calendar' || $module =='Events' || $module == 'Emails')
+				  {
+					  if($table_name == 'vtiger_activity')
+					  {
+						  updateActivityGroupRelation($this->id,$groupname);
+					  }
+				  }
+
+
+			  }
+			  else
+			  {
+				  //echo 'about to update lead group relation again!';
+				  if($module == 'Leads' && $table_name == 'vtiger_leaddetails')
+				  {
+					  updateLeadGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'Accounts' && $table_name == 'vtiger_account')
+				  {
+					  updateAccountGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'Contacts' && $table_name == 'vtiger_contactdetails')
+				  {
+					  updateContactGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'Potentials' && $table_name == 'vtiger_potential')
+				  {
+					  updatePotentialGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'Quotes' && $table_name == 'vtiger_quotes')
+				  {
+					  updateQuoteGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'SalesOrder' && $table_name == 'vtiger_salesorder')
+				  {
+					  updateSoGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'Invoice' && $table_name == 'vtiger_invoice')
+				  {
+					  updateInvoiceGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'PurchaseOrder' && $table_name == 'vtiger_purchaseorder')
+				  {
+					  updatePoGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'HelpDesk' && $table_name == 'vtiger_troubletickets')
+				  {
+					  updateTicketGroupRelation($this->id,'');
+				  }
+				  elseif($module == 'Campaigns' && $table_name == 'vtiger_campaign')
+				  {
+					  updateCampaignGroupRelation($this->id,$groupname);
+				  }
+				  elseif($module =='Calendar' || $module =='Events' || $module == 'Emails')
+				  {
+					  if($table_name == 'vtiger_activity')
+					  {
+						  updateActivityGroupRelation($this->id,$groupname);
+					  }
+				  }
+
+
+			  }
+		  }
+
+	  }
+	  else
+	  {	
+		  $sql1 = "insert into ".$table_name." (".$column.") values(".$value.")";
+		  $adb->query($sql1); 
+		  $groupname = $_REQUEST['assigned_group_name'];
+		  if($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_leaddetails')
+		  {
+			  insert2LeadGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_account')
+		  {
+			  insert2AccountGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_contactdetails')
+		  {
+			  insert2ContactGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_potential')
+		  {
+			  insert2PotentialGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_quotes')
+		  {
+			  insert2QuoteGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_salesorder')
+		  {
+			  insert2SoGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_invoice')
+		  {
+			  insert2InvoiceGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_purchaseorder')
+		  {
+			  insert2PoGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_activity') 
+		  {
+			  insert2ActivityGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_troubletickets') 
+		  {
+			  insert2TicketGroupRelation($this->id,$groupname);
+		  }
+		  elseif($_REQUEST['assigntype'] == 'T' && $table_name == 'vtiger_campaign')
+		  {
+			  insert2CampaignGroupRelation($this->id,$groupname);
+		  }
+
+	  }
+
+  }
+	/** Function to delete a record in the specifed table 
+  	  * @param $table_name -- table name:: Type varchar
+	  * The function will delete a record .The id is obtained from the class variable $this->id and the columnname got from $this->tab_name_index[$table_name]
+ 	 */
+function deleteRelation($table_name)
+{
+         global $adb;
+         $check_query = "select * from ".$table_name." where ".$this->tab_name_index[$table_name]."=".$this->id;
+         $check_result=$adb->query($check_query);
+         $num_rows = $adb->num_rows($check_result);
+
+         if($num_rows == 1)
+         {
+                $del_query = "DELETE from ".$table_name." where ".$this->tab_name_index[$table_name]."=".$this->id;
+                $adb->query($del_query);
+         }
+
+}
+	/** Function to attachment filename of the given entity 
+  	  * @param $notesid -- crmid:: Type Integer
+	  * The function will get the attachmentsid for the given entityid from vtiger_seattachmentsrel table and get the attachmentsname from vtiger_attachments table 
+	  * returns the 'filename'
+ 	 */
+function getOldFileName($notesid)
+{
+	   global $log;
+$log->info("in getOldFileName  ".$notesid);
+	global $adb;
+	$query1 = "select * from vtiger_seattachmentsrel where crmid=".$notesid;
+	$result = $adb->query($query1);
+	$noofrows = $adb->num_rows($result);
+	if($noofrows != 0)
+		$attachmentid = $adb->query_result($result,0,'attachmentsid');
+	if($attachmentid != '')
+	{
+		$query2 = "select * from vtiger_attachments where attachmentsid=".$attachmentid;
+		$filename = $adb->query_result($adb->query($query2),0,'name');
+	}
+	return "'".$filename."'";
+}
+	
+	
+	
+
+
+
+
+
+// Code included by Jaguar - Ends 
+
+	/** Function to retrive the information of the given recordid ,module 
+  	  * @param $record -- Id:: Type Integer
+  	  * @param $module -- module:: Type varchar
+	  * This function retrives the information from the database and sets the value in the class columnfields array
+ 	 */
+  function retrieve_entity_info($record, $module)
+  {
+    global $adb,$log,$app_strings;
+    $result = Array();
+    foreach($this->tab_name_index as $table_name=>$index)
+    {
+	if( $module == 'Organization') {
+	    $result[$table_name] = $adb->query("select * from ".$table_name." where ".$index."='".$record."'");
+	} elseif( $module == 'OrgUnit' ) {
+	    $result[$table_name] = $adb->query("select * from ".$table_name." where ".$index."=".$record);
+	} else {
+	    $result[$table_name] = $adb->query("select * from ".$table_name." where ".$index."=".$record);
+	    if($adb->query_result($result["vtiger_crmentity"],0,"deleted") == 1)
+	    die("<br><br><center>".$app_strings['LBL_RECORD_DELETE']." <a href='javascript:window.history.back()'>".$app_strings['LBL_GO_BACK'].".</a></center>");
+	}
+    }
+    $tabid = getTabid($module);
+    $sql1 =  "select * from vtiger_field where tabid=".$tabid;
+    $result1 = $adb->query($sql1);
+    $noofrows = $adb->num_rows($result1);
+    for($i=0; $i<$noofrows; $i++)
+    {
+      $fieldcolname = $adb->query_result($result1,$i,"columnname");
+      $tablename = $adb->query_result($result1,$i,"tablename");
+      $fieldname = $adb->query_result($result1,$i,"fieldname");
+      $uitype = $adb->query_result($result1,$i,"uitype");
+
+      // vtiger_entity2org results in a list value
+      if( $tablename == 'vtiger_entity2org') {
+	  $fld_value = array();
+	  $nooforgs = $adb->num_rows( $result[$tablename]);
+	  for($o=0; $o<$nooforgs; $o++) {
+	      $fld_value[$adb->query_result($result[$tablename],$o,'organizationname')] = 
+		  $adb->query_result($result[$tablename],$o,'primarytag');
+	  }
+      } else {
+	  $fld_value = $adb->query_result($result[$tablename],0,$fieldcolname);
+      }
+
+      // Added for inheritance and extensions fields
+      if( $uitype == '3' || $uitype == '4' || $uitype == '18' ||
+	  $uitype == '31' || $uitype == '32') {
+	  if( substr( $fld_value, 0, 4) == "@##@") {
+	      $this->column_fields[$fieldname."@##@"] = 1;
+	      $fld_value = substr( $fld_value, 4, strlen( $fld_value)-4);
+	  } else {
+	      $this->column_fields[$fieldname."@##@"] = 0;
+	  }
+      }
+      $this->column_fields[$fieldname] = $fld_value;
+				
+    }
+	if($module == 'Users')
+	{
+		for($i=0; $i<$noofrows; $i++)
+		{
+			$fieldcolname = $adb->query_result($result1,$i,"columnname");
+			$tablename = $adb->query_result($result1,$i,"tablename");
+			$fieldname = $adb->query_result($result1,$i,"fieldname");
+			$fld_value = $adb->query_result($result[$tablename],0,$fieldcolname);
+			$this->$fieldname = $fld_value;
+
+		}
+	}
+		
+    $this->column_fields["record_id"] = $record;
+    $this->column_fields["record_module"] = $module;
+  }
+
+	/** Function to saves the values in all the tables mentioned in the class variable $tab_name for the specified module
+  	  * @param $module -- module:: Type varchar
+ 	 */
+	function save($module_name) 
+	{
+		global $log;
+	        $log->debug("module name is ".$module_name);
+		//GS Save entity being called with the modulename as parameter
+		$this->saveentity($module_name);
+	}
+  
+	function process_list_query($query, $row_offset, $limit= -1, $max_per_page = -1)
+	{
+		global $list_max_entries_per_page;
+		$this->log->debug("process_list_query: ".$query);
+		if(!empty($limit) && $limit != -1){
+			$result =& $this->db->limitQuery($query, $row_offset + 0, $limit,true,"Error retrieving $this->object_name list: ");
+		}else{
+			$result =& $this->db->query($query,true,"Error retrieving $this->object_name list: ");
+		}
+
+		$list = Array();
+		if($max_per_page == -1){
+			$max_per_page 	= $list_max_entries_per_page;
+		}
+		$rows_found =  $this->db->getRowCount($result);
+
+		$this->log->debug("Found $rows_found ".$this->object_name."s");
+                
+		$previous_offset = $row_offset - $max_per_page;
+		$next_offset = $row_offset + $max_per_page;
+
+		if($rows_found != 0)
+		{
+
+			// We have some data.
+
+			for($index = $row_offset , $row = $this->db->fetchByAssoc($result, $index); $row && ($index < $row_offset + $max_per_page || $max_per_page == -99) ;$index++, $row = $this->db->fetchByAssoc($result, $index)){
+
+				
+				foreach($this->list_fields as $entry)
+				{
+
+					foreach($entry as $key=>$field) // this will be cycled only once
+					{						
+						if (isset($row[$field])) {
+							$this->column_fields[$this->list_fields_names[$key]] = $row[$field];
+						
+						
+							$this->log->debug("$this->object_name({$row['id']}): ".$field." = ".$this->$field);
+						}
+						else 
+						{
+							$this->column_fields[$this->list_fields_names[$key]] = "";
+						}
+					}
+				}
+
+
+				//$this->db->println("here is the bug");
+				
+
+				$list[] = clone($this);//added by Richie to support PHP5
+			}
+		}
+
+		$response = Array();
+		$response['list'] = $list;
+		$response['row_count'] = $rows_found;
+		$response['next_offset'] = $next_offset;
+		$response['previous_offset'] = $previous_offset;
+
+		return $response;
+	}
+
+	function process_full_list_query($query)
+	{
+		$this->log->debug("CRMEntity:process_full_list_query");
+		$result =& $this->db->query($query, false);
+		$this->log->debug("CRMEntity:process_full_list_query: result is ".$result);
+
+
+		if($this->db->getRowCount($result) > 0){
+		
+		//	$this->db->println("process_full mid=".$this->module_id." mname=".$this->module_name);
+			// We have some data.
+			while ($row = $this->db->fetchByAssoc($result)) {				
+				$rowid=$row[$this->module_id];
+
+				if(isset($rowid))
+			       		$this->retrieve_entity_info($rowid,$this->module_name);
+				else
+					$this->db->println("rowid not set unable to retrieve");
+				 
+				 
+				
+		//clone function added to resolvoe PHP5 compatibility issue in Dashboards
+		//If we do not use clone, while using PHP5, the memory address remains fixed but the
+	//data gets overridden hence all the rows that come in bear the same value. This in turn
+//provides a wrong display of the Dashboard graphs. The data is erroneously shown for a specific month alone
+//Added by Richie
+				$list[] = clone($this);//added by Richie to support PHP5
+			}
+		}
+
+		if (isset($list)) return $list;
+		else return null;
+	}
+	
+	/** This function should be overridden in each module.  It marks an item as deleted.
+	* If it is not overridden, then marking this type of item is not allowed
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	*/
+	function mark_deleted($id)
+	{
+		$query = "UPDATE vtiger_crmentity set deleted=1 where crmid='$id'";
+		$this->db->query($query, true,"Error marking record deleted: ");
+
+
+	}
+
+
+	function retrieve_by_string_fields($fields_array, $encode=true) 
+	{ 
+		$where_clause = $this->get_where($fields_array);
+		
+		$query = "SELECT * FROM $this->table_name $where_clause";
+		$this->log->debug("Retrieve $this->object_name: ".$query);
+		$result =& $this->db->requireSingleResult($query, true, "Retrieving record $where_clause:");
+		if( empty($result)) 
+		{ 
+		 	return null; 
+		} 
+
+		 $row = $this->db->fetchByAssoc($result,-1, $encode);
+
+		foreach($this->column_fields as $field) 
+		{ 
+			if(isset($row[$field])) 
+			{ 
+				$this->$field = $row[$field];
+			}
+		} 
+		return $this;
+	}
+
+	// this method is called during an import before inserting a bean
+	// define an associative array called $special_fields
+	// the keys are user defined, and don't directly map to the bean's vtiger_fields
+	// the value is the method name within that bean that will do extra
+	// processing for that vtiger_field. example: 'full_name'=>'get_names_from_full_name'
+
+	function process_special_fields() 
+	{ 
+		foreach ($this->special_functions as $func_name) 
+		{ 
+			if ( method_exists($this,$func_name) ) 
+			{ 
+				$this->$func_name(); 
+			} 
+		} 
+	}
+
+	/**
+         * Function to check if the custom vtiger_field vtiger_table exists
+         * return true or false
+         */
+        function checkIfCustomTableExists($tablename)
+        {
+                $query = "select * from ".$tablename;
+                $result = $this->db->query($query);
+                $testrow = $this->db->num_fields($result);
+                if($testrow > 1)
+                {
+                        $exists=true;
+                }
+                else
+                {
+                        $exists=false;
+                }
+                return $exists;
+        }
+
+	/**
+	 * function to construct the query to fetch the custom vtiger_fields
+	 * return the query to fetch the custom vtiger_fields
+         */
+        function constructCustomQueryAddendum($tablename,$module)
+        {
+                global $adb;
+		$tabid=getTabid($module);		
+                $sql1 = "select columnname,fieldlabel from vtiger_field where generatedtype=2 and tabid=".$tabid;
+                $result = $adb->query($sql1);
+                $numRows = $adb->num_rows($result);
+                $sql3 = "select ";
+                for($i=0; $i < $numRows;$i++)
+                {
+                        $columnName = $adb->query_result($result,$i,"columnname");
+                        $fieldlable = $adb->query_result($result,$i,"fieldlabel");
+                        //construct query as below
+                        if($i == 0)
+                        {
+                                $sql3 .= $tablename.".".$columnName. " '" .$fieldlable."'";
+                        }
+                        else
+                        {
+                                $sql3 .= ", ".$tablename.".".$columnName. " '" .$fieldlable."'";
+                        }
+
+                }
+                if($numRows>0)
+                {
+                        $sql3=$sql3.',';
+                }
+                return $sql3;
+
+        }
+
+
+	/**
+	 * This function returns a full (ie non-paged) list of the current object type.  
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function get_full_list($order_by = "", $where = "") {
+		$this->log->debug("get_full_list:  order_by = '$order_by' and where = '$where'");
+		$query = $this->create_list_query($order_by, $where);
+		return $this->process_full_list_query($query);
+	}
+
+	/**
+	 * Track the viewing of a detail record.  This leverages get_summary_text() which is object specific
+	 * params $user_id - The user that is viewing the record.
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function track_view($user_id, $current_module,$id='')
+	{
+		$this->log->debug("About to call vtiger_tracker (user_id, module_name, item_id)($user_id, $current_module, $this->id)");
+
+		$tracker = new Tracker();
+		$tracker->track_view($user_id, $current_module, $id, '');
+	}
+
+	
+
+}
+?>

Modified: vtigercrm/branches/5.1_jens/data/SugarBean.php
==============================================================================
--- vtigercrm/branches/5.1_jens/data/SugarBean.php (original)
+++ vtigercrm/branches/5.1_jens/data/SugarBean.php Tue Nov 14 03:16:10 2006
@@ -1,451 +1,451 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the 
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/data/SugarBean.php,v 1.70 2005/03/16 10:25:16 shaw Exp $
- * Description:  Defines the base class for all data entities used throughout the 
- * application.  The base class including its methods and variables is designed to 
- * be overloaded with module-specific methods and variables particular to the 
- * module's base entity class. 
- ********************************************************************************/
-
-include_once('config.php');
-require_once('include/logging.php');
-require_once('data/Tracker.php');
-require_once('include/utils/utils.php');
-require_once('include/utils/UserInfoUtil.php');
-require_once('include/database/PearDatabase.php');
-
-class SugarBean
-{
-    /**
-     * This method implements a generic insert and update logic for any SugarBean
-     * This method only works for subclasses that implement the same variable names.
-     * This method uses the presence of an id vtiger_field that is not null to signify and update.
-     * The id vtiger_field should not be set otherwise.
-     * todo - Add support for vtiger_field type validation and encoding of parameters.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
-     */
-	
-
-	function save($module_name= '') 
-	{
-         global $adb; 
-          global $current_user;
-		$isUpdate = true;
-
-		if(!isset($this->id) || $this->id == "")
-		{
-			$isUpdate = false;
-		}
-
-		if ( $this->new_with_id == true )
-		{
-			$isUpdate = false;
-		}
-
-		//$this->date_modified = $this->db->formatDate(date('YmdHis'));
-		$this->date_modified = $this->db->formatDate(date('YmdHis'));	
-		if (isset($current_user)) $this->modified_user_id = $current_user->id;
-		
-		if($isUpdate)
-		{
-    			$query = "Update ".$this->table_name." set ";
-		}
-		else
-		{
-    			//$this->date_entered = $this->db->formatDate(date('YmdHis'));
-			$this->date_entered = $this->db->formatDate(date('YmdHis'));
-
-			if($this->new_schema && 
-				$this->new_with_id == false)
-			{
-                          $this->id = $this->db->getUniqueID("vtiger_users");
-			}
-                        
-			$query = "INSERT into ".$this->table_name;
-		}
-		// todo - add date modified to the list.
-
-		// write out the SQL statement.
-		//$query .= $this->table_name." set ";
-
-		$firstPass = 0;
-		$insKeys = '(';
-		$insValues = '(';
-		$updKeyValues='';
-		foreach($this->column_fields as $field)
-		{
-			// Do not write out the id vtiger_field on the update statement.
-			// We are not allowed to change ids.
-			if($isUpdate && ('id' == $field))
-				continue;
-
-			// Only assign variables that have been set.
-			if(isset($this->$field))
-			{				
-				// Try comparing this element with the head element.
-				if(0 == $firstPass)
-				{
-					$firstPass = 1;
-				}
-				else
-				{
-					if($isUpdate)
-					{
-						$updKeyValues = $updKeyValues.", ";
-					}
-					else
-					{
-						$insKeys = $insKeys.", ";
-						$insValues = $insValues.", ";
-					}
-				}
-				/*else
-					$query = $query.", ";
-	
-				$query = $query.$field."='".$adb->quote(from_html($this->$field,$isUpdate))."'";
-				*/
-				if($isUpdate)
-				{
-					$updKeyValues = $updKeyValues.$field."=".$this->db->formatString($this->table_name,$field,from_html($this->$field,$isUpdate));
-				}
-				else
-				{
-					$insKeys = $insKeys.$field;
-					$insValues = $insValues.$this->db->formatString($this->table_name,$field,from_html($this->$field,$isUpdate));
-				}
-			}
-		}
-
-		if($isUpdate)
-		{
-			$query = $query.$updKeyValues." WHERE ID = '$this->id'";
-			$this->log->info("Update $this->object_name: ".$query);
-		}
-		else
-		{
-			$query = $query.$insKeys.") VALUES ".$insValues.")";
-	        	$this->log->info("Insert: ".$query);
-		}
-
-		$this->db->query($query, true);
-
-		// If this is not an update then store the id for later.
-		if(!$isUpdate && !$this->new_schema && !$this->new_with_id)
-		{
-			$this->db->println("Illegal Access - SugarBean");
-			//this is mysql specific
-	        	$this->id = $this->db->getOne("SELECT LAST_INSERT_ID()" );
-		}
-	        
-		return $this->id;
-	}
-
-    
-    /**
-     * This function retrieves a record of the appropriate type from the DB.
-     * It fills in all of the vtiger_fields from the DB into the object it was called on.
-     * param $id - If ID is specified, it overrides the current value of $this->id.  If not specified the current value of $this->id will be used.
-     * returns this - The object that it was called apon or null if exactly 1 record was not found.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
-	 function retrieve($id = -1, $encodeThis=true) {
-		if ($id == -1) {
-			$id = $this->id;
-		}
-		if($id == '') {
-			return null;
-		}
-// GS porting vtiger_crmentity
-$query = "SELECT * FROM $this->table_name WHERE $this->module_id = '$id'";
-//		$query = "SELECT * FROM $this->table_name WHERE ID = '$id'";
-		$this->log->debug("Retrieve $this->object_name: ".$query);
-
-		$result =& $this->db->requireSingleResult($query, true, "Retrieving record by id $this->table_name:$id found ");
-
-		if(empty($result))
-		{
-			return null;
-		}
-				
-		$row = $this->db->fetchByAssoc($result, -1, $encodeThis);
-
-		foreach($this->column_fields as $field)
-		{
-			if(isset($row[$field]))
-			{
-				$this->$field = $row[$field];
-			}
-		}
-		return $this;
-	}
-     */
-
-	function get_list($order_by = "", $where = "", $row_offset = 0, $limit=-1, $max=-1) {
-		$this->log->debug("get_list:  order_by = '$order_by' and where = '$where' and limit = '$limit'");
-		
-		$query = $this->create_list_query($order_by, $where);
-		
-		return $this->process_list_query($query, $row_offset, $limit, $max);
-	}
-
-	/**
-	 * This function returns a full (ie non-paged) list of the current object type.  
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function get_full_list($order_by = "", $where = "") {
-		$this->log->debug("get_full_list:  order_by = '$order_by' and where = '$where'");
-		$query = "SELECT * FROM $this->table_name ";
-		
-		if($where != "")
-			$query .= "where ($where) AND deleted=0";
-		else
-			$query .= "where deleted=0";
-
-		if(!empty($order_by))
-			$query .= " ORDER BY $order_by";
-
-		$result =& $this->db->query($query, false);
-
-		if($this->db->getRowCount($result) > 0){
-		
-			// We have some data.
-			while ($row = $this->db->fetchByAssoc($result)) {
-				foreach($this->list_fields as $field)
-				{
-					if (isset($row[$field])) {
-						$this->$field = $row[$field];
-						
-						$this->log->debug("process_full_list: $this->object_name({$row['id']}): ".$field." = ".$this->$field);
-					}
-					else {
- 	                                                $this->$field = '';   
-					}
-				}
-
-
-				$list[] = clone($this);         //added clone tosupport PHP5
-			}
-		}
-
-		if (isset($list)) return $list;
-		else return null;
-
-	}
-
-	function create_list_query($order_by, $where)
-	{
-		$query = "SELECT * FROM $this->table_name ";
-		
-		if($where != "")
-			$query .= "where ($where) AND deleted=0";
-		else
-			$query .= "where deleted=0";
-
-		if(!empty($order_by))
-			$query .= " ORDER BY $order_by";
-
-		return $query;
-	}
-	
-
-	function process_list_query($query, $row_offset, $limit= -1, $max_per_page = -1)
-	{
-		global $list_max_entries_per_page;
-		$this->log->debug("process_list_query: ".$query);
-		if(!empty($limit) && $limit != -1){
-			$result =& $this->db->limitQuery($query, $row_offset + 0, $limit,true,"Error retrieving $this->object_name list: ");
-		}else{
-			$result =& $this->db->query($query,true,"Error retrieving $this->object_name list: ");
-		}
-
-		$list = Array();
-		if($max_per_page == -1){
-			$max_per_page 	= $list_max_entries_per_page;
-		}
-		$rows_found =  $this->db->getRowCount($result);
-
-		$this->log->debug("Found $rows_found ".$this->object_name."s");
-                
-		$previous_offset = $row_offset - $max_per_page;
-		$next_offset = $row_offset + $max_per_page;
-
-		if($rows_found != 0)
-		{
-
-			// We have some data.
-
-			for($index = $row_offset , $row = $this->db->fetchByAssoc($result, $index); $row && ($index < $row_offset + $max_per_page || $max_per_page == -99) ;$index++, $row = $this->db->fetchByAssoc($result, $index)){
-				foreach($this->list_fields as $field)
-				{
-					if (isset($row[$field])) {
-						$this->$field = $row[$field];
-						
-						
-						$this->log->debug("$this->object_name({$row['id']}): ".$field." = ".$this->$field);
-					}
-					else 
-					{
-						$this->$field = "";
-					}
-				}
-
-
-				$list[] = clone($this);   //added clone to support PHP5
-			}
-		}
-
-		$response = Array();
-		$response['list'] = $list;
-		$response['row_count'] = $rows_found;
-		$response['next_offset'] = $next_offset;
-		$response['previous_offset'] = $previous_offset;
-
-		return $response;
-	}
-
-	
-	/**
-	 * Track the viewing of a detail record.  This leverages get_summary_text() which is object specific
-	 * params $user_id - The user that is viewing the record.
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function track_view($user_id, $current_module,$id='')
-	{
-		$this->log->debug("About to call vtiger_tracker (user_id, module_name, item_id)($user_id, $current_module, $this->id)");
-
-		$tracker = new Tracker();
-		$tracker->track_view($user_id, $current_module, $id, '');
-	}
-
-
-	/** This function should be overridden in each module.  It marks an item as deleted.
-	* If it is not overridden, then marking this type of item is not allowed
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	*/
-	function mark_deleted($id)
-	{
-		$query = "UPDATE $this->table_name set deleted=1 where id='$id'";
-		$this->db->query($query, true,"Error marking record deleted: ");
-
-		$this->mark_relationships_deleted($id);
-
-		// Take the item off of the recently viewed lists.
-		$tracker = new Tracker();
-		$tracker->delete_item_history($id);
-
-	}
-
-
-	/* This is to allow subclasses to fill in row specific columns of a list view form 
-	function list_view_parse_additional_sections(&$list_form)
-	{
-	}
-	*/
-	/* This function assigns all of the values into the template for the list view 
-	function get_list_view_array(){
-		$return_array = Array();
-		
-		foreach($this->list_fields as $field)
-		{
-			$return_array[strtoupper($field)] = $this->$field;
-		}
-		
-		return $return_array;	
-	}
-	function get_list_view_data()
-	{
-		
-		return $this->get_list_view_array();
-	}
-
-	function get_where(&$fields_array)
-	{ 
-		$where_clause = "WHERE "; 
-		$first = 1; 
-		foreach ($fields_array as $name=>$value) 
-		{ 
-			if ($first) 
-			{ 
-				$first = 0;
-			} 
-			else 
-			{ 
-				$where_clause .= " AND ";
-			} 
-
-			$where_clause .= "$name = ".$adb->quote($value)."";
-		} 
-
-		$where_clause .= " AND deleted=0";
-		return $where_clause;
-	}
-
-
-	function retrieve_by_string_fields($fields_array, $encode=true) 
-	{ 
-		$where_clause = $this->get_where($fields_array);
-		
-		$query = "SELECT * FROM $this->table_name $where_clause";
-		$this->log->debug("Retrieve $this->object_name: ".$query);
-		$result =& $this->db->requireSingleResult($query, true, "Retrieving record $where_clause:");
-		if( empty($result)) 
-		{ 
-		 	return null; 
-		} 
-
-		 $row = $this->db->fetchByAssoc($result,-1, $encode);
-
-		foreach($this->column_fields as $field) 
-		{ 
-			if(isset($row[$field])) 
-			{ 
-				$this->$field = $row[$field];
-			}
-		} 
-		return $this;
-	}
-
-	// this method is called during an import before inserting a bean
-	// define an associative array called $special_fields
-	// the keys are user defined, and don't directly map to the bean's vtiger_fields
-	// the value is the method name within that bean that will do extra
-	// processing for that vtiger_field. example: 'full_name'=>'get_names_from_full_name'
-
-	function process_special_fields() 
-	{ 
-		foreach ($this->special_functions as $func_name) 
-		{ 
-			if ( method_exists($this,$func_name) ) 
-			{ 
-				$this->$func_name(); 
-			} 
-		} 
-	}
-
-	*/
-}
-
-
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the 
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/data/SugarBean.php,v 1.70 2005/03/16 10:25:16 shaw Exp $
+ * Description:  Defines the base class for all data entities used throughout the 
+ * application.  The base class including its methods and variables is designed to 
+ * be overloaded with module-specific methods and variables particular to the 
+ * module's base entity class. 
+ ********************************************************************************/
+
+include_once('config.php');
+require_once('include/logging.php');
+require_once('data/Tracker.php');
+require_once('include/utils/utils.php');
+require_once('include/utils/UserInfoUtil.php');
+require_once('include/database/PearDatabase.php');
+
+class SugarBean
+{
+    /**
+     * This method implements a generic insert and update logic for any SugarBean
+     * This method only works for subclasses that implement the same variable names.
+     * This method uses the presence of an id vtiger_field that is not null to signify and update.
+     * The id vtiger_field should not be set otherwise.
+     * todo - Add support for vtiger_field type validation and encoding of parameters.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+     */
+	
+
+	function save($module_name= '') 
+	{
+         global $adb; 
+          global $current_user;
+		$isUpdate = true;
+
+		if(!isset($this->id) || $this->id == "")
+		{
+			$isUpdate = false;
+		}
+
+		if ( $this->new_with_id == true )
+		{
+			$isUpdate = false;
+		}
+
+		//$this->date_modified = $this->db->formatDate(date('YmdHis'));
+		$this->date_modified = date('YmdHis');
+		if (isset($current_user)) $this->modified_user_id = $current_user->id;
+		
+		if($isUpdate)
+		{
+    			$query = "Update ".$this->table_name." set ";
+		}
+		else
+		{
+    			//$this->date_entered = $this->db->formatDate(date('YmdHis'));
+			$this->date_entered = date('YmdHis');
+
+			if($this->new_schema && 
+				$this->new_with_id == false)
+			{
+                          $this->id = $this->db->getUniqueID("vtiger_users");
+			}
+                        
+			$query = "INSERT into ".$this->table_name;
+		}
+		// todo - add date modified to the list.
+
+		// write out the SQL statement.
+		//$query .= $this->table_name." set ";
+
+		$firstPass = 0;
+		$insKeys = '(';
+		$insValues = '(';
+		$updKeyValues='';
+		foreach($this->column_fields as $field)
+		{
+			// Do not write out the id vtiger_field on the update statement.
+			// We are not allowed to change ids.
+			if($isUpdate && ('id' == $field))
+				continue;
+
+			// Only assign variables that have been set.
+			if(isset($this->$field))
+			{				
+				// Try comparing this element with the head element.
+				if(0 == $firstPass)
+				{
+					$firstPass = 1;
+				}
+				else
+				{
+					if($isUpdate)
+					{
+						$updKeyValues = $updKeyValues.", ";
+					}
+					else
+					{
+						$insKeys = $insKeys.", ";
+						$insValues = $insValues.", ";
+					}
+				}
+				/*else
+					$query = $query.", ";
+	
+				$query = $query.$field."='".$adb->quote(from_html($this->$field,$isUpdate))."'";
+				*/
+				if($isUpdate)
+				{
+					$updKeyValues = $updKeyValues.$field."=".$this->db->formatString($this->table_name,$field,from_html($this->$field,$isUpdate));
+				}
+				else
+				{
+					$insKeys = $insKeys.$field;
+					$insValues = $insValues.$this->db->formatString($this->table_name,$field,from_html($this->$field,$isUpdate));
+				}
+			}
+		}
+
+		if($isUpdate)
+		{
+			$query = $query.$updKeyValues." WHERE ID = '$this->id'";
+			$this->log->info("Update $this->object_name: ".$query);
+		}
+		else
+		{
+			$query = $query.$insKeys.") VALUES ".$insValues.")";
+	        	$this->log->info("Insert: ".$query);
+		}
+
+		$this->db->query($query, true);
+
+		// If this is not an update then store the id for later.
+		if(!$isUpdate && !$this->new_schema && !$this->new_with_id)
+		{
+			$this->db->println("Illegal Access - SugarBean");
+			//this is mysql specific
+	        	$this->id = $this->db->getOne("SELECT LAST_INSERT_ID()" );
+		}
+	        
+		return $this->id;
+	}
+
+    
+    /**
+     * This function retrieves a record of the appropriate type from the DB.
+     * It fills in all of the vtiger_fields from the DB into the object it was called on.
+     * param $id - If ID is specified, it overrides the current value of $this->id.  If not specified the current value of $this->id will be used.
+     * returns this - The object that it was called apon or null if exactly 1 record was not found.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+	 function retrieve($id = -1, $encodeThis=true) {
+		if ($id == -1) {
+			$id = $this->id;
+		}
+		if($id == '') {
+			return null;
+		}
+// GS porting vtiger_crmentity
+$query = "SELECT * FROM $this->table_name WHERE $this->module_id = '$id'";
+//		$query = "SELECT * FROM $this->table_name WHERE ID = '$id'";
+		$this->log->debug("Retrieve $this->object_name: ".$query);
+
+		$result =& $this->db->requireSingleResult($query, true, "Retrieving record by id $this->table_name:$id found ");
+
+		if(empty($result))
+		{
+			return null;
+		}
+				
+		$row = $this->db->fetchByAssoc($result, -1, $encodeThis);
+
+		foreach($this->column_fields as $field)
+		{
+			if(isset($row[$field]))
+			{
+				$this->$field = $row[$field];
+			}
+		}
+		return $this;
+	}
+     */
+
+	function get_list($order_by = "", $where = "", $row_offset = 0, $limit=-1, $max=-1) {
+		$this->log->debug("get_list:  order_by = '$order_by' and where = '$where' and limit = '$limit'");
+		
+		$query = $this->create_list_query($order_by, $where);
+		
+		return $this->process_list_query($query, $row_offset, $limit, $max);
+	}
+
+	/**
+	 * This function returns a full (ie non-paged) list of the current object type.  
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function get_full_list($order_by = "", $where = "") {
+		$this->log->debug("get_full_list:  order_by = '$order_by' and where = '$where'");
+		$query = "SELECT * FROM $this->table_name ";
+		
+		if($where != "")
+			$query .= "where ($where) AND deleted=0";
+		else
+			$query .= "where deleted=0";
+
+		if(!empty($order_by))
+			$query .= " ORDER BY $order_by";
+
+		$result =& $this->db->query($query, false);
+
+		if($this->db->getRowCount($result) > 0){
+		
+			// We have some data.
+			while ($row = $this->db->fetchByAssoc($result)) {
+				foreach($this->list_fields as $field)
+				{
+					if (isset($row[$field])) {
+						$this->$field = $row[$field];
+						
+						$this->log->debug("process_full_list: $this->object_name({$row['id']}): ".$field." = ".$this->$field);
+					}
+					else {
+ 	                                                $this->$field = '';   
+					}
+				}
+
+
+				$list[] = clone($this);         //added clone tosupport PHP5
+			}
+		}
+
+		if (isset($list)) return $list;
+		else return null;
+
+	}
+
+	function create_list_query($order_by, $where)
+	{
+		$query = "SELECT * FROM $this->table_name ";
+		
+		if($where != "")
+			$query .= "where ($where) AND deleted=0";
+		else
+			$query .= "where deleted=0";
+
+		if(!empty($order_by))
+			$query .= " ORDER BY $order_by";
+
+		return $query;
+	}
+	
+
+	function process_list_query($query, $row_offset, $limit= -1, $max_per_page = -1)
+	{
+		global $list_max_entries_per_page;
+		$this->log->debug("process_list_query: ".$query);
+		if(!empty($limit) && $limit != -1){
+			$result =& $this->db->limitQuery($query, $row_offset + 0, $limit,true,"Error retrieving $this->object_name list: ");
+		}else{
+			$result =& $this->db->query($query,true,"Error retrieving $this->object_name list: ");
+		}
+
+		$list = Array();
+		if($max_per_page == -1){
+			$max_per_page 	= $list_max_entries_per_page;
+		}
+		$rows_found =  $this->db->getRowCount($result);
+
+		$this->log->debug("Found $rows_found ".$this->object_name."s");
+                
+		$previous_offset = $row_offset - $max_per_page;
+		$next_offset = $row_offset + $max_per_page;
+
+		if($rows_found != 0)
+		{
+
+			// We have some data.
+
+			for($index = $row_offset , $row = $this->db->fetchByAssoc($result, $index); $row && ($index < $row_offset + $max_per_page || $max_per_page == -99) ;$index++, $row = $this->db->fetchByAssoc($result, $index)){
+				foreach($this->list_fields as $field)
+				{
+					if (isset($row[$field])) {
+						$this->$field = $row[$field];
+						
+						
+						$this->log->debug("$this->object_name({$row['id']}): ".$field." = ".$this->$field);
+					}
+					else 
+					{
+						$this->$field = "";
+					}
+				}
+
+
+				$list[] = clone($this);   //added clone to support PHP5
+			}
+		}
+
+		$response = Array();
+		$response['list'] = $list;
+		$response['row_count'] = $rows_found;
+		$response['next_offset'] = $next_offset;
+		$response['previous_offset'] = $previous_offset;
+
+		return $response;
+	}
+
+	
+	/**
+	 * Track the viewing of a detail record.  This leverages get_summary_text() which is object specific
+	 * params $user_id - The user that is viewing the record.
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function track_view($user_id, $current_module,$id='')
+	{
+		$this->log->debug("About to call vtiger_tracker (user_id, module_name, item_id)($user_id, $current_module, $this->id)");
+
+		$tracker = new Tracker();
+		$tracker->track_view($user_id, $current_module, $id, '');
+	}
+
+
+	/** This function should be overridden in each module.  It marks an item as deleted.
+	* If it is not overridden, then marking this type of item is not allowed
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	*/
+	function mark_deleted($id)
+	{
+		$query = "UPDATE $this->table_name set deleted=1 where id='$id'";
+		$this->db->query($query, true,"Error marking record deleted: ");
+
+		$this->mark_relationships_deleted($id);
+
+		// Take the item off of the recently viewed lists.
+		$tracker = new Tracker();
+		$tracker->delete_item_history($id);
+
+	}
+
+
+	/* This is to allow subclasses to fill in row specific columns of a list view form 
+	function list_view_parse_additional_sections(&$list_form)
+	{
+	}
+	*/
+	/* This function assigns all of the values into the template for the list view 
+	function get_list_view_array(){
+		$return_array = Array();
+		
+		foreach($this->list_fields as $field)
+		{
+			$return_array[strtoupper($field)] = $this->$field;
+		}
+		
+		return $return_array;	
+	}
+	function get_list_view_data()
+	{
+		
+		return $this->get_list_view_array();
+	}
+
+	function get_where(&$fields_array)
+	{ 
+		$where_clause = "WHERE "; 
+		$first = 1; 
+		foreach ($fields_array as $name=>$value) 
+		{ 
+			if ($first) 
+			{ 
+				$first = 0;
+			} 
+			else 
+			{ 
+				$where_clause .= " AND ";
+			} 
+
+			$where_clause .= "$name = ".$adb->quote($value)."";
+		} 
+
+		$where_clause .= " AND deleted=0";
+		return $where_clause;
+	}
+
+
+	function retrieve_by_string_fields($fields_array, $encode=true) 
+	{ 
+		$where_clause = $this->get_where($fields_array);
+		
+		$query = "SELECT * FROM $this->table_name $where_clause";
+		$this->log->debug("Retrieve $this->object_name: ".$query);
+		$result =& $this->db->requireSingleResult($query, true, "Retrieving record $where_clause:");
+		if( empty($result)) 
+		{ 
+		 	return null; 
+		} 
+
+		 $row = $this->db->fetchByAssoc($result,-1, $encode);
+
+		foreach($this->column_fields as $field) 
+		{ 
+			if(isset($row[$field])) 
+			{ 
+				$this->$field = $row[$field];
+			}
+		} 
+		return $this;
+	}
+
+	// this method is called during an import before inserting a bean
+	// define an associative array called $special_fields
+	// the keys are user defined, and don't directly map to the bean's vtiger_fields
+	// the value is the method name within that bean that will do extra
+	// processing for that vtiger_field. example: 'full_name'=>'get_names_from_full_name'
+
+	function process_special_fields() 
+	{ 
+		foreach ($this->special_functions as $func_name) 
+		{ 
+			if ( method_exists($this,$func_name) ) 
+			{ 
+				$this->$func_name(); 
+			} 
+		} 
+	}
+
+	*/
+}
+
+
+?>

Modified: vtigercrm/branches/5.1_jens/data/Tracker.php
==============================================================================
--- vtigercrm/branches/5.1_jens/data/Tracker.php (original)
+++ vtigercrm/branches/5.1_jens/data/Tracker.php Tue Nov 14 03:16:10 2006
@@ -66,151 +66,39 @@
       global $adb;
       $this->delete_history($user_id, $item_id);
       global $log;
-$log->info("in  track view method ".$current_module);
+      $log->info("in  track view method ".$current_module);
         // Add a new item to the user's list
 
         $esc_item_id = addslashes($item_id);
         
 //No genius required. Just add an if case and change the query so that it puts the tracker entry whenever you touch on the DetailView of the required entity
          //get the first name and last name from the respective modules
-          if($current_module =='Leads')
-          {
-            $query = 'select firstname,lastname from vtiger_leaddetails where leadid=' .$item_id;
-            $result = $this->db->query($query);
-            $firstname = $adb->query_result($result,0,'firstname');
-            $lastname =  $adb->query_result($result,0,'lastname');
-            $item_summary = $lastname.' '.$firstname;
-          }
-          elseif ($current_module =='Accounts')
-          {
-            $query = 'select accountname from vtiger_account where accountid=' .$item_id;
-            $result = $this->db->query($query);
-            $accountname = $adb->query_result($result,0,'accountname');
-            $item_summary = $accountname;
-            
-          }
-          elseif($current_module =='Contacts')
-          {
-            $query = 'select firstname,lastname from vtiger_contactdetails where contactid=' .$item_id;
-            $result = $this->db->query($query);
-            $firstname = $adb->query_result($result,0,'firstname');
-            $lastname =  $adb->query_result($result,0,'lastname');
-            $item_summary = $lastname.' '.$firstname;
-            
-          }
-          elseif($current_module =='Potentials')
-          {
-            $query = 'select potentialname from vtiger_potential where potentialid=' .$item_id;
-            $result = $this->db->query($query);
-            $potentialname =  $adb->query_result($result,0,'potentialname');
-            $item_summary = $potentialname;
-          }
-          elseif($current_module =='Notes')
-          {
-            $query = 'select title from vtiger_notes where notesid=' .$item_id;
-            $result = $this->db->query($query);
-            $title = $adb->query_result($result,0,'title');
-            $item_summary = $title;
-            
-          }
-          elseif($current_module =='HelpDesk')
-          {
-            $query = 'select title from vtiger_troubletickets where ticketid=' .$item_id;
-            $result = $this->db->query($query);
-            $title = $adb->query_result($result,0,'title');
-            $item_summary = $title;
-          }
-          elseif($current_module =='Calendar')
-          {
-            //$query = 'select name from calls where callid=' .$item_id;
-	    $query = 'select subject from vtiger_activity where activityid=' .$item_id;
-            $result = $this->db->query($query);
-            $name = $adb->query_result($result,0,'subject');
-            $item_summary = $name;
-          }
-          elseif($current_module =='Emails')
-          {
-            //$query = 'select name from emails where emailid=' .$item_id;
-	    $query = 'select subject from vtiger_activity where activityid=' .$item_id;
-            $result = $this->db->query($query);
-            $name = $adb->query_result($result,0,'subject');
-            $item_summary = $name;
-          }
-          elseif($current_module =='Products')
-          {
-            $query = 'select productname from vtiger_products where productid=' .$item_id;
-            $result = $this->db->query($query);
-            $productname = $adb->query_result($result,0,'productname');
-            $item_summary = $productname;
-          }
-          elseif($current_module =='Users')
-          {
-            $query = 'select first_name,last_name from vtiger_users where id=' .$item_id;
-            $result = $this->db->query($query);
-            $firstname = $adb->query_result($result,0,'first_name');
-            $lastname = $adb->query_result($result,0,'last_name');
-            $item_summary = $lastname.' '.$firstname;
-          }
-	  elseif($current_module =='Invoice')
-          {
-            $query = 'select subject from vtiger_invoice where invoiceid=' .$item_id;
-            $result = $this->db->query($query);
-            $invoice = $adb->query_result($result,0,'subject');
-            $item_summary = $invoice;
-          }
-          elseif($current_module =='Quotes')
-          {
-            $query = 'select subject from vtiger_quotes where quoteid=' .$item_id;
-            $result = $this->db->query($query);
-            $quote = $adb->query_result($result,0,'subject');
-            $item_summary = $quote;
-          }
-	  elseif($current_module =='PurchaseOrder')
-          {
-            $query = 'select subject from vtiger_purchaseorder where purchaseorderid=' .$item_id;
-            $result = $this->db->query($query);
-            $po = $adb->query_result($result,0,'subject');
-            $item_summary = $po;
-          }
-	  elseif($current_module =='SalesOrder')
-          {
-            $query = 'select subject from vtiger_salesorder where salesorderid=' .$item_id;
-            $result = $this->db->query($query);
-            $so = $adb->query_result($result,0,'subject');
-            $item_summary = $so;
-          }
-	  elseif($current_module =='Vendors')
-          {
-            $query = 'select vendorname from vtiger_vendor where vendorid=' .$item_id;
-            $result = $this->db->query($query);
-            $vendor = $adb->query_result($result,0,'vendorname');
-            $item_summary = $vendor;
-          }
-	  elseif($current_module =='PriceBooks')
-          {
-            $query = 'select bookname from vtiger_pricebook where pricebookid=' .$item_id;
-            $result = $this->db->query($query);
-            $pb = $adb->query_result($result,0,'bookname');
-            $item_summary = $pb;
-          }	
-  	  elseif($current_module =='Campaigns')
-          {
-            $query = 'select campaignname from vtiger_campaign where campaignid=' .$item_id;
-            $result = $this->db->query($query);
-            $pb = $adb->query_result($result,0,'campaignname');
-            $item_summary = $pb;
-          }
-  	  elseif($current_module =='Faq')
-          {
-            $query = 'select question from vtiger_faq where id=' .$item_id;
-            $result = $this->db->query($query);
-            $pb = $adb->query_result($result,0,'question');
-	    if(strlen($pb) > 30)
-	    {
-		    $pb=substr($pb,0,30).'...';
-	    } 	    
-            $item_summary = $pb;
-          }		  
+	 if($current_module != '')
+	 {
+		 $query = "select fieldname,tablename,entityidfield from vtiger_entityname where modulename = '$current_module'";
+		 $result = $adb->query($query);
+		 $fieldsname = $adb->query_result($result,0,'fieldname');
+		 $tablename = $adb->query_result($result,0,'tablename'); 
+		 $entityidfield = $adb->query_result($result,0,'entityidfield'); 
+		 if(!(strpos($fieldsname,',') === false))
+		 {
+			 $fieldlists = explode(',',$fieldsname);
+			 $fieldsname = "concat(";
+			 $fieldsname = $fieldsname.implode(",' ',",$fieldlists);
+			 $fieldsname = $fieldsname.")";
+		 }	
+  	         if($current_module =='Organization') {
+		     $query1 = "select $fieldsname as entityname from $tablename where $entityidfield='".$item_id."'"; 
+		 } else {
+		     $query1 = "select $fieldsname as entityname from $tablename where $entityidfield=" .$item_id; 
+		 }
+		 $result = $adb->query($query1);
+		 $item_summary = $adb->query_result($result,0,'entityname');
+		 if(strlen($item_summary) > 30)
+	     {
+		    $item_summary=substr($item_summary,0,30).'...';
+	     }
+	 }
 	 
 	 #if condition added to skip vtiger_faq in last viewed history
           $query = "INSERT into $this->table_name (user_id, module_name, item_id, item_summary) values ('$user_id', '$current_module', '$esc_item_id', ".$this->db->formatString($this->table_name,'item_summary',$item_summary).")";
@@ -238,7 +126,13 @@
     	}
 
 //        $query = "SELECT * from $this->table_name WHERE user_id='$user_id' ORDER BY id DESC";
-	$query = "SELECT * from $this->table_name inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_tracker.item_id WHERE user_id='$user_id' and vtiger_crmentity.deleted=0 ORDER BY id DESC";
+	$query = "SELECT * from $this->table_name";
+	if( $module_name != 'Organization') {
+	    $query .= " inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_tracker.item_id WHERE vtiger_crmentity.deleted=0 AND ";
+	} else {
+	    $query .= " WHERE ";
+	}
+	$query .= "user_id='$user_id' ORDER BY id DESC";
         $this->log->debug("About to retrieve list: $query");
         $result = $this->db->query($query, true);
         $list = Array();

Modified: vtigercrm/branches/5.1_jens/include/CustomFieldUtil.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/CustomFieldUtil.php (original)
+++ vtigercrm/branches/5.1_jens/include/CustomFieldUtil.php Tue Nov 14 03:16:10 2006
@@ -73,6 +73,10 @@
 	{
 		$fldname = 'Multi-Select Combo Box';
 	}
+	elseif($uitype == 85)
+	{
+		$fldname = 'Skype';
+	}
 $log->debug("Exiting getCustomFieldTypeName method ...");
 	return $fldname;
 }
@@ -216,6 +220,10 @@
         {
                 $fieldtype = '11';
         }
+	elseif($label == 'Skype')
+	{
+		$fieldtype = '12';
+	}
 	$log->debug("Exiting getFldTypeandLengthValue method ...");
 	return $fieldtype;
 }

Modified: vtigercrm/branches/5.1_jens/include/RelatedListView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/RelatedListView.php (original)
+++ vtigercrm/branches/5.1_jens/include/RelatedListView.php Tue Nov 14 03:16:10 2006
@@ -1,646 +1,518 @@
-<?php
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
- *
- ********************************************************************************/
-
-
-require_once('include/utils/UserInfoUtil.php');
-require_once("include/utils/utils.php");
-require_once("include/ListView/ListViewSession.php");
-
-/** Function to get related list entries in detailed array format
-  * @param $module -- modulename:: Type string
-  * @param $relatedmodule -- relatedmodule:: Type string
-  * @param $focus -- focus:: Type object
-  * @param $query -- query:: Type string
-  * @param $button -- buttons:: Type string
-  * @param $returnset -- returnset:: Type string
-  * @param $id -- id:: Type string
-  * @param $edit_val -- edit value:: Type string
-  * @param $del_val -- delete value:: Type string
-  * @returns $related_entries -- related entires:: Type string array
-  *
-  */
-
-function GetRelatedList($module,$relatedmodule,$focus,$query,$button,$returnset,$id='',$edit_val='',$del_val='')
-{
-	$log = LoggerManager::getLogger('account_list');
-	$log->debug("Entering GetRelatedList(".$module.",".$relatedmodule.",".$focus.",".$query.",".$button.",".$returnset.",".$edit_val.",".$del_val.") method ...");
-
-	require_once('Smarty_setup.php');
-	require_once("data/Tracker.php");
-	require_once('include/database/PearDatabase.php');
-
-	global $adb;
-	global $app_strings;
-	global $current_language;
-
-	$current_module_strings = return_module_language($current_language, $module);
-
-	global $list_max_entries_per_page;
-	global $urlPrefix;
-
-
-	global $currentModule;
-	global $theme;
-	global $theme_path;
-	global $theme_path;
-	global $mod_strings;
-	// focus_list is the means of passing data to a ListView.
-	global $focus_list;
-	$smarty = new vtigerCRM_Smarty;
-	if (!isset($where)) $where = "";
-	
-	
-	$button = '<table cellspacing=0 cellpadding=2><tr><td>'.$button.'</td></tr></table>';
-
-	// Added to have Purchase Order as form Title
-	if($relatedmodule == 'Orders') 
-	{
-		$smarty->assign('ADDBUTTON',get_form_header($app_strings['PurchaseOrder'],$button, false));
-	}
-	else
-	{
-		$smarty->assign('ADDBUTTON',get_form_header($app_strings[$relatedmodule],$button, false));
-	}
-
-	require_once('themes/'.$theme.'/layout_utils.php');
-	$theme_path="themes/".$theme."/";
-	$image_path=$theme_path."images/";
-	$smarty->assign("MOD", $mod_strings);
-	$smarty->assign("APP", $app_strings);
-	$smarty->assign("IMAGE_PATH",$image_path);
-	$smarty->assign("MODULE",$relatedmodule);
-
-
-	//Retreive the list from Database
-	//$query = getListQuery("Accounts");
-
-		//echo '<BR>*****************'.$relatedmodule.' ***************';
-	//Appending the security parameter
-	if($relatedmodule != 'Notes' && $relatedmodule != 'Products' && $relatedmodule != 'Faq' && $relatedmodule != 'PriceBook' && $relatedmodule != 'Vendors') //Security fix by Don
-	{
-		global $current_user;
-		require('user_privileges/user_privileges_'.$current_user->id.'.php');
-        	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-		$tab_id=getTabid($relatedmodule);
-		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
-        	{
-        		$sec_parameter=getListViewSecurityParameter($relatedmodule);
-                	$query .= ' '.$sec_parameter;
-
-        	}
-	}
-	
-
-	if(isset($where) && $where != '')
-	{
-		$query .= ' and '.$where;
-	}
-	
-	if(!$_SESSION['rlvs'][$module][$relatedmodule])
-	{
-		$modObj = new ListViewSession();
-		$modObj->sortby = $focus->default_order_by;
-		$modObj->sorder = $focus->default_sort_order;
-		$_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
-	}
-	if(isset($_REQUEST['relmodule']) && ($_REQUEST['relmodule'] == $relatedmodule))
-	{	
-		if(method_exists($focus,getSortOrder))
-		$sorder = $focus->getSortOrder();
-		if(method_exists($focus,getOrderBy))
-		$order_by = $focus->getOrderBy();
-
-		if(isset($order_by) && $order_by != '')
-		{
-			$_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
-			$_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
-		}
-
-	}
-	elseif($_SESSION['rlvs'][$module][$relatedmodule])
-	{
-		$sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
-		$order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
-	}
-	else
-	{
-		$order_by = $focus->default_order_by;
-		$sorder = $focus->default_sort_order;
-	}
-		
-	$query .= ' ORDER BY '.$order_by.' '.$sorder;
-	$url_qry .="&order_by=".$order_by;
-	//Added for PHP version less than 5
-	if (!function_exists("stripos"))
-	{
-		function stripos($query,$needle)
-		{
-			return strpos(strtolower($query),strtolower($needle));
-		}
-	}
-	
-	//Retreiving the no of rows
-	$count_query = "select count(*) as count ".substr($query, stripos($query,'from'),strlen($query));
-	$count_result = $adb->query(substr($count_query, stripos($count_query,'select'),stripos($count_query,'ORDER BY')));
-	$noofrows = $adb->query_result($count_result,0,"count");
-	
-	//Setting Listview session object while sorting/pagination
-	if(isset($_REQUEST['relmodule']) && $_REQUEST['relmodule']!='' && $_REQUEST['relmodule'] == $relatedmodule)
-	{
-		$relmodule = $_REQUEST['relmodule'];
-		if($_SESSION['rlvs'][$module][$relmodule])
-		{
-			setSessionVar($_SESSION['rlvs'][$module][$relmodule],$noofrows,$list_max_entries_per_page,$module,$relmodule);
-		}
-	}
-	$start = $_SESSION['rlvs'][$module][$relatedmodule]['start'];
-
-	$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
-	
-	$start_rec = $navigation_array['start'];
-	$end_rec = $navigation_array['end_val'];
-
-	//limiting the query
-	if ($start_rec ==0) 
-		$limit_start_rec = 0;
-	else
-		$limit_start_rec = $start_rec -1;
-
-	if( $adb->dbType == "pgsql")
- 	    $list_result = $adb->query($query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
- 	else
- 	    $list_result = $adb->query($query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);	
-
-	//Retreive the List View Table Header
-	if($noofrows == 0)
-	{
-		$smarty->assign('NOENTRIES',$app_strings['LBL_NONE_SCHEDULED']);
-	}
-	else
-	{
-		$id = $_REQUEST['record'];
-		$listview_header = getListViewHeader($focus,$relatedmodule,'',$sorder,$order_by,$id,'',$module);//"Accounts");
-		if ($noofrows > 15)
-		{
-			$smarty->assign('SCROLLSTART','<div style="overflow:auto;height:315px;width:100%;">');
-			$smarty->assign('SCROLLSTOP','</div>');
-		}
-		$smarty->assign("LISTHEADER", $listview_header);
-															
-		if($module == 'PriceBook' && $relatedmodule == 'Products')
-		{
-			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,$edit_val,$del_val);
-		}
-		if($module == 'Products' && $relatedmodule == 'PriceBook')
-		{
-			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,'EditListPrice','DeletePriceBookProductRel');
-		}
-		elseif($relatedmodule == 'SalesOrder')
-		{
-			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,'SalesOrderEditView','DeleteSalesOrder');
-		}else
-		{
-			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset);
-		}
-
-		$navigationOutput = Array();
-		$navigationOutput[] = $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
-		$module_rel = $module.'&relmodule='.$relatedmodule.'&record='.$id;
-		$navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry,$module_rel);
-		$related_entries = array('header'=>$listview_header,'entries'=>$listview_entries,'navigation'=>$navigationOutput);
-		$log->debug("Exiting GetRelatedList method ...");
-		return $related_entries;
-	}
-}
-
-/** Function to get related list entries in detailed array format
-  * @param $parentmodule -- parentmodulename:: Type string
-  * @param $query -- query:: Type string
-  * @param $id -- id:: Type string
-  * @returns $entries_list -- entries list:: Type string array
-  *
-  */
-
-function getAttachmentsAndNotes($parentmodule,$query,$id,$sid='')
-{
-	global $log;
-	$log->debug("Entering getAttachmentsAndNotes(".$parentmodule.",".$query.",".$id.",".$sid.") method ...");
-	global $theme;
-
-	$list = '<script>
-		function confirmdelete(url)
-		{
-			if(confirm("Are you sure?"))
-			{
-				document.location.href=url;
-			}
-		}
-	</script>';
-	echo $list;
-
-	$theme_path="themes/".$theme."/";
-	$image_path=$theme_path."images/";
-	require_once ($theme_path."layout_utils.php");
-
-	global $adb;
-	global $mod_strings;
-	global $app_strings;
-
-	$result=$adb->query($query);
-	$noofrows = $adb->num_rows($result);
-
-	$header[] = $app_strings['LBL_CREATED'];
-	$header[] = $app_strings['LBL_SUBJECT'];
-	$header[] = $app_strings['LBL_DESCRIPTION'];
-	$header[] = $app_strings['LBL_ATTACHMENTS'];
-	$header[] = $app_strings['LBL_TYPE'];		
-	$header[] = $app_strings['LBL_ACTION'];	
-
-	while($row = $adb->fetch_array($result))
-	{
-		$entries = Array();
-		if(trim($row['activitytype']) == 'Notes')
-		{
-			$module = 'Notes';
-			$editaction = 'EditView';
-			$deleteaction = 'Delete';
-		}
-		elseif($row['activitytype'] == 'Attachments')
-		{
-			$module = 'uploads';
-			$editaction = 'upload';
-			$deleteaction = 'deleteattachments';
-		}
-		if($row['createdtime'] != '0000-00-00 00:00:00')
-		{
-			$created_arr = explode(" ",getDisplayDate($row['createdtime']));
-			$created_date = $created_arr[0];
-			$created_time = substr($created_arr[1],0,5);
-		}
-		else
-		{
-			$created_date = '';
-			$created_time = '';
-		}
-
-		$entries[] = $created_date;
-		if($module == 'Notes')
-		{
-			$entries[] = '<a href="index.php?module='.$module.'&action=DetailView&return_module='.$parentmodule.'&return_action='.$return_action.'&record='.$row["crmid"].'&filename='.$row['filename'].'&fileid='.$row['attachmentsid'].'&return_id='.$_REQUEST["record"].'">'.$row['title'].'</a>';
-		}
-		elseif($module == 'uploads')
-		{
-			$entries[] = "";
-		}
-		
-		if(strlen($row['description']) > 40)
-		{
-			$row['description'] = substr($row['description'],0,40).'...';
-		}
-		$entries[] = nl2br($row['description']); 
-		$attachmentname = ltrim($row['filename'],$row['attachmentsid'].'_');//explode('_',$row['filename'],2);
-
-		$entries[] = '<a href="index.php?module=uploads&action=downloadfile&entityid='.$id.'&fileid='.$row['attachmentsid'].'">'.$attachmentname.'</a>';
-
-		$entries[] = $row['activitytype'];	
-
-		$del_param = 'index.php?module='.$module.'&action='.$deleteaction.'&return_module='.$parentmodule.'&return_action='.$_REQUEST['action'].'&record='.$row["crmid"].'&return_id='.$_REQUEST["record"];
-
-		if($module == 'Notes')
-		{
-			$edit_param = 'index.php?module='.$module.'&action='.$editaction.'&return_module='.$parentmodule.'&return_action='.$_REQUEST['action'].'&record='.$row["crmid"].'&filename='.$row['filename'].'&fileid='.$row['attachmentsid'].'&return_id='.$_REQUEST["record"];
-
-			$entries[] .= '<a href="'.$edit_param.'">'.$app_strings['LNK_EDIT'].'</a> | <a href=\'javascript:confirmdelete("'.$del_param.'")\'>'.$app_strings['LNK_DELETE'].'</a>';
-		}
-		else
-		{
-			$entries[] = '<a href=\'javascript:confirmdelete("'.$del_param.'")\'>'.$app_strings['LNK_DELETE'].'</a>';
-		}
-		$entries_list[] = $entries;
-	}
-
-	if($entries_list !='')
-		$return_data = array('header'=>$header,'entries'=>$entries_list);
-	$log->debug("Exiting getAttachmentsAndNotes method ...");
-	return $return_data;
-
-}
-
-/** Function to get related list entries in detailed array format
-  * @param $parentmodule -- parentmodulename:: Type string
-  * @param $query -- query:: Type string
-  * @param $id -- id:: Type string
-  * @returns $return_data -- return data:: Type string array
-  *
-  */
-
-function getHistory($parentmodule,$query,$id)
-{
-	global $log;
-	$log->debug("Entering getHistory(".$parentmodule.",".$query.",".$id.") method ...");
-	$parentaction = $_REQUEST['action'];
-	global $theme;
-	$theme_path="themes/".$theme."/";
-	$image_path=$theme_path."images/";
-	require_once ($theme_path."layout_utils.php");
-
-	global $adb;
-	global $mod_strings;
-	global $app_strings;
-
-	//Appending the security parameter
-	global $current_user;
-	$rel_tab_id = getTabid("Calendar");
-
-	global $current_user;
-        require('user_privileges/user_privileges_'.$current_user->id.'.php');
-        require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-        $tab_id=getTabid('Calendar');
-       if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
-       {
-       		$sec_parameter=getListViewSecurityParameter('Calendar');
-                $query .= ' '.$sec_parameter;
-
-        }
-	$result=$adb->query($query);
-	$noofrows = $adb->num_rows($result);
-	
-	$button .= '<table cellspacing=0 cellpadding=2><tr><td>';
-	$button .= '</td></tr></table>';
-
-	if($noofrows == 0)
-	{
-	}
-	else
-	{
-		$list .= '<table border="0" cellpadding="0" cellspacing="0" class="FormBorder" width="100%" >';
-		$list .= '<tr class="ModuleListTitle" height=20>';
-
-// Armando Lüscher 15.07.2005 -> §scrollableTables
-// Desc: class="blackLine" deleted because of vertical line in title <tr>
-
-		$class_black="";
-		if($noofrows<=15)
-		{
-			$class_black='class="blackLine"';	
-			$colspan = 'colspan=2';
-		}
-
-		$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-		$list .= '<td width="90" '.$colspan.' class="moduleListTitle" style="padding:0px 3px 0px 3px;" noWrap>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 25% to 90, inserted noWrap
-
-		$colspan = ($noofrows<=15)?'colspan="3"':''; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Inserted
-		$list .= $app_strings['LBL_CREATED'].'</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed LBL_SUBJECT to LBL_CREATED
-		$header[] = $app_strings['LBL_CREATED'];
-		$list .= '<td WIDTH="1" '.$class_black.'><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-		$list .= '<td '.$colspan.' width="30%" class="moduleListTitle" style="padding:0px 3px 0px 3px;" noWrap>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 10% to 30%, inserted '.$colspan.' noWrap
-	
-		$list .= $app_strings['LBL_SUBJECT'].'</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed LBL_STATUS to LBL_SUBJECT
-		$header[] = $app_strings['LBL_SUBJECT'];
-		$list .= '<td WIDTH="1" '.$class_black.'><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-		$list .= '<td width="70%" class="moduleListTitle" style="padding:0px 3px 0px 3px;" noWrap>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 18% to 70%, inserted noWrap
-
-		$list .= $app_strings['LBL_DESCRIPTION'].'</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed LBL_LIST_CONTACT_NAME to LBL_DESCRIPTION
-		$header[] = $app_strings['LBL_DESCRIPTION'];
-		$list .= '<td WIDTH="1" '.$class_black.'><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-		$list .= '<td width="80" class="moduleListTitle" style="padding:0px 3px 0px 3px;" noWrap>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 18% to 80, inserted noWrap
-
-		$list .= $app_strings['LBL_ACTION'].'</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed LBL_RELATED_TO to LBL_ACTION
-		$header[] = $app_strings['LBL_TIME'];
-		$header[] = $app_strings['LBL_ACTION'];
-		$header[] = $app_strings['LBL_RELATED_TO'];
-		$header[] = $app_strings['LBL_ASSIGNED_TO'];
-		$list .= '<td WIDTH="1" '.$class_black.'><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-/* // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Commented out because this is not used for the title row
-*/
-		$list .= '</td>';
-		$colspan = 9;
-		if($noofrows>15)
-		{
-			$list .= '<td style="width:20px">&nbsp;&nbsp&nbsp;&nbsp;</td>';
-			$colspan = 11;
-		}
-		$list .= '</tr>';
-	
-		$list .= '<tr><td COLSPAN="'.$colspan.'" class="blackLine"><IMG SRC="themes/'.$theme.'/images//blank.gif"></td></tr>';
-
-// begin: Armando Lüscher 14.07.2005 -> §scrollableTables
-// Desc: 'X'
-//			 Insert new vtiger_table with 1 cell where all entries are in a new vtiger_table.
-//			 This cell will be scrollable when too many entries exist
-		$list .= ($noofrows>15) ? '<tr><td colspan="'.$colspan.'"><div style="overflow:auto;height:315px;width:100%;"><table cellspacing="0" cellpadding="0" border="0" width="100%">':'';
-// end: Armando Lüscher 14.07.2005 -> §scrollableTables
-
-		$i=1;
-		while($row = $adb->fetch_array($result))
-		{
-			$entries = Array();
-			if($row['activitytype'] == 'Task')
-			{
-				$activitymode = 'Task';
-				$icon = 'Tasks.gif';
-				$status = $row['status'];
-			}
-			elseif($row['activitytype'] == 'Call' || $row['activitytype'] == 'Meeting')
-			{
-				$activitymode = 'Events';
-				$icon = 'Activities.gif';
-				$status = $row['eventstatus'];
-			}
-			if ($i%2==0)
-				$trowclass = 'evenListRow';
-			else
-				$trowclass = 'oddListRow';
-	
-			$created_arr = explode(" ",getDisplayDate($row['createdtime']));
-			$created_date = $created_arr[0];
-			$created_time = substr($created_arr[1],0,5);
-
-			$list .= '<tr class="'. $trowclass.'">';
-			$entries[] = $created_date;	
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			$list .= '<td colspan="2" valign="top" class="visibleDescriptionLink" width="90" style="padding:0px 3px 0px 3px;" noWrap>'.$created_date.'</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 4% to 90, inserted colspan="2" align="right" valign="top" class="visibleDescriptionLink" style="padding:0px 3px 0px 3px;" noWrap, replaced <IMG SRC="'.$image_path.'/'.$icon.'"> with $created_date
-
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			$list .= '<td valign="top" colspan="3" width="30%" height="21" class="visibleDescriptionLink" style="padding:0px 3px 0px 3px;">'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 25% to 30%, inserted colspan="3" valign="top" class="visibleDescriptionLink"
-			$activity = '<a href="index.php?module=Calendar&action=DetailView&return_module='.$parentmodule.'&return_action=DetailView&record='.$row["activityid"] .'&activity_mode='.$activitymode.'&return_id='.$_REQUEST['record'].'" title="'.$row['description'].'">'.$row['subject'].'</a></td>';
-			$entries[] = $activity;
-			$list .= '</td>';
-	
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			$list .= '<td valign="top" rowspan="2" width="70%" height="21" class="visibleDescription" style="padding:0px 3px 0px 3px;">'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 10% to 70%, inserted rowspan="2" valign="top" class="visibleDescription"
-			$entries[] = nl2br($row['description']);
-			$list .= nl2br($row['description']); // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Replaced $status with nl2br($row['description'])
-			$list .= '</td>';
-
-			if($row['firstname'] != 'NULL')	
-				$contactname = $row['firstname'].' ';
-			if($ros['lastname'] != 'NULL')
-				$contactname .= $row['lastname'];
-
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif">';
-			$list .= '<td valign="top" width="80" height="21" style="padding:0px 3px 0px 3px;" noWrap>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 18% to 80, inserted valign="top" noWrap
-			// Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: This if-statement replaces the line above
-			if(isPermitted("Calendar",1,$row["activityid"]) == 'yes')
-			{
-				$list .= '<a href="index.php?module=Calendar&action=EditView&return_module='.$parentmodule.'&return_action='.$parentaction.'&activity_mode='.$activitymode.'&record='.$row["activityid"].'&return_id='.$_REQUEST["record"].'">'.$app_strings['LNK_EDIT'].'</a>';
-			
-			}
-			$list .= '</td>';
-
-			// begin: Armando Lüscher 26.09.2005 -> §visibleDescription
-			// Desc: Inserted because entries are displayed on 2 rows
-			$list .= '</tr><tr class="'.$trowclass.'">';
-			// end: Armando Lüscher 26.09.2005 -> §visibleDescription 
-
-			$parentname = getRelatedTo('Calendar',$result,$i-1);
-
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			
-			// begin: Armando Lüscher 26.09.2005 -> §visibleDescription
-			// Desc: Added
-			$list .= '<td valign="top" width="20" style="padding:0px 0px 0px 10px;">';
-			$list .= '<IMG SRC="'.$image_path.'/'.$icon.'">';
-			$list .= '</td>';
-			// end: Armando Lüscher 26.09.2005 -> §visibleDescription
-	
-			$list .= '<td align="right" valign="top" width="70" style="padding:0px 3px 0px 3px;">'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 18% to 70, inserted align="right" valign="top"
-			$list .= $created_time; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Replaced $parentname with $created_time
-			$list .= '</td>';	
-			$entries[] = $created_time;
-	
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			$list .= '<td valign="top" width="8%" style="padding:0px 3px 0px 3px;">'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 15% to 8%, inserted valign="top"
-			$list .= $status; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Replaced $modifiedtime with $status
-			$entries[] = $status;
-			$list .= '</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Inserted
-
-//			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif">';
-			$list .= '<td valign="top" width="18%" style="padding:0px 3px 0px 3px;">'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Changed width from 10% to 18%, inserted valign="top"
-			$entries[] = $parentname;
-			$list .= $parentname; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Inserted
-			$list .= '</td>'; // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Inserted
-			
-			// begin: Armando Lüscher 26.09.2005 -> §visibleDescription
-			// Desc: Added
-			$list .= '<td valign="top" width="4%" style="padding:0px 3px 0px 3px;">';
-			if($row['user_name']==NULL && $row['groupname']!=NULL)
-			{
-				$list .= $row['groupname'];
-				$entries[] = $row['groupname'];
-			}
-			else
-			{
-				$list .= $row['user_name'];
- 				$entries[] = $row['user_name'];
-				
-			}
-			$list .= '</td>';
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			
-			// the description is in this space
-			
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td>';
-			$list .= '<td valign="top" width="80" style="padding:0px 3px 0px 3px;">';
-			if(isPermitted("Calendar",2,$row["activityid"]) == 'yes')
-			{
-				$list .= '<a href="index.php?module=Calendar&action=Delete&return_module='.$parentmodule.'&return_action='.$parentaction.'&record='.$row["activityid"].'&return_id='.$_REQUEST["record"].'">'.$app_strings['LNK_DELETE'].'</a>';
-			}
-			$list .= '</td>';
-			
-			$list .= '<td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif">';
-
-			$list .= '</tr>';
-
-			$list .= '<tr width="'.$colspan.'"><td WIDTH="1" class="blackLine"><IMG SRC="themes/'.$theme.'/images/blank.gif"></td></tr>';
-
-			$i++;
-			$entries_list[] = $entries;
-		}
-
-// begin: Armando Lüscher 14.07.2005 -> §scrollableTables
-// Desc: Close vtiger_table from 
-		$list .= ($noofrows>15) ? '</table></div></td></tr>':'';
-// end: Armando Lüscher 14.07.2005 -> §scrollableTables
-
-		$list .= '<tr><td colspan="14" class="blackLine"></td></tr>';
-
-		$list .= '</table>';
-		$return_data = array('header'=>$header,'entries'=>$entries_list);
-		$log->debug("Exiting getHistory method ...");
-		return $return_data; 
-	}
-}
-
-/**	Function to display the Products which are related to the PriceBook
- *	@param string $query - query to get the list of products which are related to the current PriceBook
- *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
- *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
- *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Product entries
- */
-function getPriceBookRelatedProducts($query,$focus,$returnset='')
-{
-	global $log;
-	$log->debug("Entering getPriceBookRelatedProducts(".$query.",".$focus.",".$returnset.") method ...");
-
-	global $adb;
-	global $app_strings;
-	global $mod_strings;
-	global $current_language;
-	$current_module_strings = return_module_language($current_language, 'PriceBook');
-
-	global $list_max_entries_per_page;
-	global $urlPrefix;
-
-	global $theme;
-	$pricebook_id = $_REQUEST['record'];
-	$theme_path="themes/".$theme."/";
-	$image_path=$theme_path."images/";
-	require_once($theme_path.'layout_utils.php');
-
-	//Retreive the list from Database
-	$list_result = $adb->query($query);
-	$num_rows = $adb->num_rows($list_result);
-
-	$header=array();
-	$header[]=$mod_strings['LBL_LIST_PRODUCT_NAME'];
-	$header[]=$mod_strings['LBL_PRODUCT_CODE'];
-	$header[]=$mod_strings['LBL_PRODUCT_UNIT_PRICE'];
-	$header[]=$mod_strings['LBL_PB_LIST_PRICE'];
-	$header[]=$mod_strings['LBL_ACTION'];
-
-	for($i=0; $i<$num_rows; $i++)
-	{
-		$entity_id = $adb->query_result($list_result,$i,"crmid");
-
-		$unit_price = 	$adb->query_result($list_result,$i,"unit_price");
-		$listprice = $adb->query_result($list_result,$i,"listprice");
-		$field_name=$entity_id."_listprice";
-		
-		$entries = Array();
-		$entries[] = $adb->query_result($list_result,$i,"productname");
-		$entries[] = $adb->query_result($list_result,$i,"productcode");
-		$entries[] = $unit_price;
-		$entries[] = $listprice;
-		$entries[] = '<img style="cursor:pointer;" src="'.$image_path.'editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\''.$entity_id.'\',\''.$pricebook_id.'\',\''.$listprice.'\')" alt="'.$app_strings["LBL_EDIT_BUTTON"].'" title="'.$app_strings["LBL_EDIT_BUTTON"].'"/><!--a href="index.php?module=Products&action=EditListPrice&record='.$entity_id.'&pricebook_id='.$pricebook_id.'&listprice='.$listprice.'">edit</a-->&nbsp;|&nbsp;<img src="'.$image_path.'delete.gif" onclick="if(confirm(\'Are you sure?\')) deletePriceBookProductRel('.$entity_id.','.$pricebook_id.');" alt="'.$app_strings["LBL_DELETE"].'" title="'.$app_strings["LBL_DELETE"].'" style="cursor:pointer;" border="0">';
-
-		$entries_list[] = $entries;
-	}
-	if($num_rows>0)
-	{
-		$return_data = array('header'=>$header,'entries'=>$entries_list);
-
-		$log->debug("Exiting getPriceBookRelatedProducts method ...");
-		return $return_data; 
-	}
-}
-
-?>
+<?php
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ *
+ ********************************************************************************/
+
+
+require_once('include/utils/UserInfoUtil.php');
+require_once("include/utils/utils.php");
+require_once("include/ListView/ListViewSession.php");
+
+/** Function to get related list entries in detailed array format
+  * @param $module -- modulename:: Type string
+  * @param $relatedmodule -- relatedmodule:: Type string
+  * @param $focus -- focus:: Type object
+  * @param $query -- query:: Type string
+  * @param $button -- buttons:: Type string
+  * @param $returnset -- returnset:: Type string
+  * @param $id -- id:: Type string
+  * @param $edit_val -- edit value:: Type string
+  * @param $del_val -- delete value:: Type string
+  * @returns $related_entries -- related entires:: Type string array
+  *
+  */
+
+function GetRelatedList($module,$relatedmodule,$focus,$query,$button,$returnset,$id='',$edit_val='',$del_val='')
+{
+	$log = LoggerManager::getLogger('account_list');
+	$log->debug("Entering GetRelatedList(".$module.",".$relatedmodule.",".$focus.",".$query.",".$button.",".$returnset.",".$edit_val.",".$del_val.") method ...");
+
+	require_once('Smarty_setup.php');
+	require_once("data/Tracker.php");
+	require_once('include/database/PearDatabase.php');
+
+	global $adb;
+	global $app_strings;
+	global $current_language;
+
+	$current_module_strings = return_module_language($current_language, $module);
+
+	global $list_max_entries_per_page;
+	global $urlPrefix;
+
+
+	global $currentModule;
+	global $theme;
+	global $theme_path;
+	global $theme_path;
+	global $mod_strings;
+	// focus_list is the means of passing data to a ListView.
+	global $focus_list;
+	$smarty = new vtigerCRM_Smarty;
+	if (!isset($where)) $where = "";
+	
+	
+	$button = '<table cellspacing=0 cellpadding=2><tr><td>'.$button.'</td></tr></table>';
+
+	// Added to have Purchase Order as form Title
+	if($relatedmodule == 'Orders') 
+	{
+		$smarty->assign('ADDBUTTON',get_form_header($app_strings['PurchaseOrder'],$button, false));
+	}
+	else
+	{
+		$smarty->assign('ADDBUTTON',get_form_header($app_strings[$relatedmodule],$button, false));
+	}
+
+	require_once('themes/'.$theme.'/layout_utils.php');
+	$theme_path="themes/".$theme."/";
+	$image_path=$theme_path."images/";
+	$smarty->assign("MOD", $mod_strings);
+	$smarty->assign("APP", $app_strings);
+	$smarty->assign("IMAGE_PATH",$image_path);
+	$smarty->assign("MODULE",$relatedmodule);
+
+
+	//Retreive the list from Database
+	//$query = getListQuery("Accounts");
+
+		//echo '<BR>*****************'.$relatedmodule.' ***************';
+	//Appending the security parameter
+	if($relatedmodule != 'Notes' && $relatedmodule != 'Products' && $relatedmodule != 'Faq' && $relatedmodule != 'PriceBook' && $relatedmodule != 'Vendors') //Security fix by Don
+	{
+		global $current_user;
+		require('user_privileges/user_privileges_'.$current_user->id.'.php');
+        	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+		$tab_id=getTabid($relatedmodule);
+		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
+        	{
+        		$sec_parameter=getListViewSecurityParameter($relatedmodule);
+                	$query .= ' '.$sec_parameter;
+
+        	}
+	}
+	
+
+	if(isset($where) && $where != '')
+	{
+		$query .= ' and '.$where;
+	}
+	
+	if(!$_SESSION['rlvs'][$module][$relatedmodule])
+	{
+		$modObj = new ListViewSession();
+		$modObj->sortby = $focus->default_order_by;
+		$modObj->sorder = $focus->default_sort_order;
+		$_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
+	}
+	if(isset($_REQUEST['relmodule']) && ($_REQUEST['relmodule'] == $relatedmodule))
+	{	
+		if(method_exists($focus,getSortOrder))
+		$sorder = $focus->getSortOrder();
+		if(method_exists($focus,getOrderBy))
+		$order_by = $focus->getOrderBy();
+
+		if(isset($order_by) && $order_by != '')
+		{
+			$_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
+			$_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
+		}
+
+	}
+	elseif($_SESSION['rlvs'][$module][$relatedmodule])
+	{
+		$sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
+		$order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
+	}
+	else
+	{
+		$order_by = $focus->default_order_by;
+		$sorder = $focus->default_sort_order;
+	}
+		
+	$query .= ' ORDER BY '.$order_by.' '.$sorder;
+	$url_qry .="&order_by=".$order_by;
+	//Added for PHP version less than 5
+	if (!function_exists("stripos"))
+	{
+		function stripos($query,$needle)
+		{
+			return strpos(strtolower($query),strtolower($needle));
+		}
+	}
+	
+	//Retreiving the no of rows
+	$count_query = "select count(*) as count ".substr($query, stripos($query,'from'),strlen($query));
+	$count_result = $adb->query(substr($count_query, stripos($count_query,'select'),stripos($count_query,'ORDER BY')));
+	$noofrows = $adb->query_result($count_result,0,"count");
+	
+	//Setting Listview session object while sorting/pagination
+	if(isset($_REQUEST['relmodule']) && $_REQUEST['relmodule']!='' && $_REQUEST['relmodule'] == $relatedmodule)
+	{
+		$relmodule = $_REQUEST['relmodule'];
+		if($_SESSION['rlvs'][$module][$relmodule])
+		{
+			setSessionVar($_SESSION['rlvs'][$module][$relmodule],$noofrows,$list_max_entries_per_page,$module,$relmodule);
+		}
+	}
+	$start = $_SESSION['rlvs'][$module][$relatedmodule]['start'];
+
+	$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+	
+	$start_rec = $navigation_array['start'];
+	$end_rec = $navigation_array['end_val'];
+
+	//limiting the query
+	if ($start_rec ==0) 
+		$limit_start_rec = 0;
+	else
+		$limit_start_rec = $start_rec -1;
+
+	if( $adb->dbType == "pgsql")
+ 	    $list_result = $adb->query($query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
+ 	else
+ 	    $list_result = $adb->query($query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);	
+
+	//Retreive the List View Table Header
+	if($noofrows == 0)
+	{
+		$smarty->assign('NOENTRIES',$app_strings['LBL_NONE_SCHEDULED']);
+	}
+	else
+	{
+		$id = $_REQUEST['record'];
+		$listview_header = getListViewHeader($focus,$relatedmodule,'',$sorder,$order_by,$id,'',$module);//"Accounts");
+		if ($noofrows > 15)
+		{
+			$smarty->assign('SCROLLSTART','<div style="overflow:auto;height:315px;width:100%;">');
+			$smarty->assign('SCROLLSTOP','</div>');
+		}
+		$smarty->assign("LISTHEADER", $listview_header);
+															
+		if($module == 'PriceBook' && $relatedmodule == 'Products')
+		{
+			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,$edit_val,$del_val);
+		}
+		if($module == 'Products' && $relatedmodule == 'PriceBook')
+		{
+			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,'EditListPrice','DeletePriceBookProductRel');
+		}
+		elseif($relatedmodule == 'SalesOrder')
+		{
+			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset,'SalesOrderEditView','DeleteSalesOrder');
+		}else
+		{
+			$listview_entries = getListViewEntries($focus,$relatedmodule,$list_result,$navigation_array,'relatedlist',$returnset);
+		}
+
+		$navigationOutput = Array();
+		$navigationOutput[] = $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
+		$module_rel = $module.'&relmodule='.$relatedmodule.'&record='.$id;
+		$navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry,$module_rel);
+		$related_entries = array('header'=>$listview_header,'entries'=>$listview_entries,'navigation'=>$navigationOutput);
+		$log->debug("Exiting GetRelatedList method ...");
+		return $related_entries;
+	}
+}
+
+/** Function to get related list entries in detailed array format
+  * @param $parentmodule -- parentmodulename:: Type string
+  * @param $query -- query:: Type string
+  * @param $id -- id:: Type string
+  * @returns $entries_list -- entries list:: Type string array
+  *
+  */
+
+function getAttachmentsAndNotes($parentmodule,$query,$id,$sid='')
+{
+	global $log;
+	$log->debug("Entering getAttachmentsAndNotes(".$parentmodule.",".$query.",".$id.",".$sid.") method ...");
+	global $theme;
+
+	$list = '<script>
+		function confirmdelete(url)
+		{
+			if(confirm("Are you sure?"))
+			{
+				document.location.href=url;
+			}
+		}
+	</script>';
+	echo $list;
+
+	$theme_path="themes/".$theme."/";
+	$image_path=$theme_path."images/";
+	require_once ($theme_path."layout_utils.php");
+
+	global $adb;
+	global $mod_strings;
+	global $app_strings;
+
+	$result=$adb->query($query);
+	$noofrows = $adb->num_rows($result);
+
+	$header[] = $app_strings['LBL_CREATED'];
+	$header[] = $app_strings['LBL_SUBJECT'];
+	$header[] = $app_strings['LBL_DESCRIPTION'];
+	$header[] = $app_strings['LBL_ATTACHMENTS'];
+	$header[] = $app_strings['LBL_TYPE'];		
+	$header[] = $app_strings['LBL_ACTION'];	
+
+	while($row = $adb->fetch_array($result))
+	{
+		$entries = Array();
+		if(trim($row['activitytype']) == 'Notes')
+		{
+			$module = 'Notes';
+			$editaction = 'EditView';
+			$deleteaction = 'Delete';
+		}
+		elseif($row['activitytype'] == 'Attachments')
+		{
+			$module = 'uploads';
+			$editaction = 'upload';
+			$deleteaction = 'deleteattachments';
+		}
+		if($row['createdtime'] != '0000-00-00 00:00:00')
+		{
+			$created_arr = explode(" ",getDisplayDate($row['createdtime']));
+			$created_date = $created_arr[0];
+			$created_time = substr($created_arr[1],0,5);
+		}
+		else
+		{
+			$created_date = '';
+			$created_time = '';
+		}
+
+		$entries[] = $created_date;
+		if($module == 'Notes')
+		{
+			$entries[] = '<a href="index.php?module='.$module.'&action=DetailView&return_module='.$parentmodule.'&return_action='.$return_action.'&record='.$row["crmid"].'&filename='.$row['filename'].'&fileid='.$row['attachmentsid'].'&return_id='.$_REQUEST["record"].'">'.$row['title'].'</a>';
+		}
+		elseif($module == 'uploads')
+		{
+			$entries[] = "";
+		}
+		
+		if(strlen($row['description']) > 40)
+		{
+			$row['description'] = substr($row['description'],0,40).'...';
+		}
+		$entries[] = nl2br($row['description']); 
+		$attachmentname = ltrim($row['filename'],$row['attachmentsid'].'_');//explode('_',$row['filename'],2);
+
+		$entries[] = '<a href="index.php?module=uploads&action=downloadfile&entityid='.$id.'&fileid='.$row['attachmentsid'].'">'.$attachmentname.'</a>';
+
+		$entries[] = $row['activitytype'];	
+
+		$del_param = 'index.php?module='.$module.'&action='.$deleteaction.'&return_module='.$parentmodule.'&return_action='.$_REQUEST['action'].'&record='.$row["crmid"].'&return_id='.$_REQUEST["record"];
+
+		if($module == 'Notes')
+		{
+			$edit_param = 'index.php?module='.$module.'&action='.$editaction.'&return_module='.$parentmodule.'&return_action='.$_REQUEST['action'].'&record='.$row["crmid"].'&filename='.$row['filename'].'&fileid='.$row['attachmentsid'].'&return_id='.$_REQUEST["record"];
+
+			$entries[] .= '<a href="'.$edit_param.'">'.$app_strings['LNK_EDIT'].'</a> | <a href=\'javascript:confirmdelete("'.$del_param.'")\'>'.$app_strings['LNK_DELETE'].'</a>';
+		}
+		else
+		{
+			$entries[] = '<a href=\'javascript:confirmdelete("'.$del_param.'")\'>'.$app_strings['LNK_DELETE'].'</a>';
+		}
+		$entries_list[] = $entries;
+	}
+
+	if($entries_list !='')
+		$return_data = array('header'=>$header,'entries'=>$entries_list);
+	$log->debug("Exiting getAttachmentsAndNotes method ...");
+	return $return_data;
+
+}
+
+/** Function to get related list entries in detailed array format
+  * @param $parentmodule -- parentmodulename:: Type string
+  * @param $query -- query:: Type string
+  * @param $id -- id:: Type string
+  * @returns $return_data -- return data:: Type string array
+  *
+  */
+
+function getHistory($parentmodule,$query,$id)
+{
+	global $log;
+	$log->debug("Entering getHistory(".$parentmodule.",".$query.",".$id.") method ...");
+	$parentaction = $_REQUEST['action'];
+	global $theme;
+	$theme_path="themes/".$theme."/";
+	$image_path=$theme_path."images/";
+	require_once ($theme_path."layout_utils.php");
+
+	global $adb;
+	global $mod_strings;
+	global $app_strings;
+
+	//Appending the security parameter
+	global $current_user;
+	$rel_tab_id = getTabid("Calendar");
+
+	global $current_user;
+        require('user_privileges/user_privileges_'.$current_user->id.'.php');
+        require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+        $tab_id=getTabid('Calendar');
+       if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
+       {
+       		$sec_parameter=getListViewSecurityParameter('Calendar');
+                $query .= ' '.$sec_parameter;
+
+        }
+	$result=$adb->query($query);
+	$noofrows = $adb->num_rows($result);
+
+	if($noofrows == 0)
+	{
+		//There is no entries for history
+	}
+	else
+	{
+		//Form the header columns
+		$header[] = $app_strings['LBL_TYPE'];
+		$header[] = $app_strings['LBL_SUBJECT'];
+		$header[] = $app_strings['LBL_RELATED_TO'];
+		$header[] = $app_strings['LBL_START_DATE'];
+		$header[] = $app_strings['LBL_END_DATE'];
+		//$header[] = $app_strings['LBL_DESCRIPTION'];
+		$header[] = $app_strings['LBL_ACTION'];
+		$header[] = $app_strings['LBL_ASSIGNED_TO'];
+
+		$i=1;
+		while($row = $adb->fetch_array($result))
+		{
+			$entries = Array();
+			if($row['activitytype'] == 'Task')
+			{
+				$activitymode = 'Task';
+				$icon = 'Tasks.gif';
+				$status = $row['status'];
+			}
+			elseif($row['activitytype'] == 'Call' || $row['activitytype'] == 'Meeting')
+			{
+				$activitymode = 'Events';
+				$icon = 'Activities.gif';
+				$status = $row['eventstatus'];
+			}
+
+			$entries[] = $row['activitytype'];
+
+			$activity = '<a href="index.php?module=Calendar&action=DetailView&return_module='.$parentmodule.'&return_action=DetailView&record='.$row["activityid"] .'&activity_mode='.$activitymode.'&return_id='.$_REQUEST['record'].'" title="'.$row['description'].'">'.$row['subject'].'</a></td>';
+			$entries[] = $activity;
+	
+			$parentname = getRelatedTo('Calendar',$result,$i-1);
+			$entries[] = $parentname;
+
+			$entries[] = $row['date_start'];
+			$entries[] = $row['due_date'];
+
+			//$entries[] = nl2br($row['description']);
+
+			if(isPermitted("Calendar",1,$row["activityid"]) == 'yes')
+			{
+				$list .= '<a href="index.php?module=Calendar&action=EditView&return_module='.$parentmodule.'&return_action='.$parentaction.'&activity_mode='.$activitymode.'&record='.$row["activityid"].'&return_id='.$_REQUEST["record"].'">'.$app_strings['LNK_EDIT'].'</a>';
+			
+			}
+
+			$entries[] = $status;
+
+			if($row['user_name']==NULL && $row['groupname']!=NULL)
+			{
+				$entries[] = $row['groupname'];
+			}
+			else
+			{
+ 				$entries[] = $row['user_name'];
+				
+			}
+			
+			if(isPermitted("Calendar",2,$row["activityid"]) == 'yes')
+			{
+				$list .= '<a href="index.php?module=Calendar&action=Delete&return_module='.$parentmodule.'&return_action='.$parentaction.'&record='.$row["activityid"].'&return_id='.$_REQUEST["record"].'">'.$app_strings['LNK_DELETE'].'</a>';
+			}
+
+			$i++;
+			$entries_list[] = $entries;
+		}
+
+		$return_data = array('header'=>$header,'entries'=>$entries_list);
+		$log->debug("Exiting getHistory method ...");
+		return $return_data; 
+	}
+}
+
+/**	Function to display the Products which are related to the PriceBook
+ *	@param string $query - query to get the list of products which are related to the current PriceBook
+ *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
+ *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
+ *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Product entries
+ */
+function getPriceBookRelatedProducts($query,$focus,$returnset='')
+{
+	global $log;
+	$log->debug("Entering getPriceBookRelatedProducts(".$query.",".$focus.",".$returnset.") method ...");
+
+	global $adb;
+	global $app_strings;
+	global $mod_strings;
+	global $current_language;
+	$current_module_strings = return_module_language($current_language, 'PriceBook');
+
+	global $list_max_entries_per_page;
+	global $urlPrefix;
+
+	global $theme;
+	$pricebook_id = $_REQUEST['record'];
+	$theme_path="themes/".$theme."/";
+	$image_path=$theme_path."images/";
+	require_once($theme_path.'layout_utils.php');
+
+	//Retreive the list from Database
+	$list_result = $adb->query($query);
+	$num_rows = $adb->num_rows($list_result);
+
+	$header=array();
+	$header[]=$mod_strings['LBL_LIST_PRODUCT_NAME'];
+	$header[]=$mod_strings['LBL_PRODUCT_CODE'];
+	$header[]=$mod_strings['LBL_PRODUCT_UNIT_PRICE'];
+	$header[]=$mod_strings['LBL_PB_LIST_PRICE'];
+	$header[]=$mod_strings['LBL_ACTION'];
+
+	for($i=0; $i<$num_rows; $i++)
+	{
+		$entity_id = $adb->query_result($list_result,$i,"crmid");
+
+		$unit_price = 	$adb->query_result($list_result,$i,"unit_price");
+		$listprice = $adb->query_result($list_result,$i,"listprice");
+		$field_name=$entity_id."_listprice";
+		
+		$entries = Array();
+		$entries[] = $adb->query_result($list_result,$i,"productname");
+		$entries[] = $adb->query_result($list_result,$i,"productcode");
+		$entries[] = $unit_price;
+		$entries[] = $listprice;
+		$entries[] = '<img style="cursor:pointer;" src="'.$image_path.'editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\''.$entity_id.'\',\''.$pricebook_id.'\',\''.$listprice.'\')" alt="'.$app_strings["LBL_EDIT_BUTTON"].'" title="'.$app_strings["LBL_EDIT_BUTTON"].'"/><!--a href="index.php?module=Products&action=EditListPrice&record='.$entity_id.'&pricebook_id='.$pricebook_id.'&listprice='.$listprice.'">edit</a-->&nbsp;|&nbsp;<img src="'.$image_path.'delete.gif" onclick="if(confirm(\'Are you sure?\')) deletePriceBookProductRel('.$entity_id.','.$pricebook_id.');" alt="'.$app_strings["LBL_DELETE"].'" title="'.$app_strings["LBL_DELETE"].'" style="cursor:pointer;" border="0">';
+
+		$entries_list[] = $entries;
+	}
+	if($num_rows>0)
+	{
+		$return_data = array('header'=>$header,'entries'=>$entries_list);
+
+		$log->debug("Exiting getPriceBookRelatedProducts method ...");
+		return $return_data; 
+	}
+}
+
+?>

Modified: vtigercrm/branches/5.1_jens/include/database/PearDatabase.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/database/PearDatabase.php (original)
+++ vtigercrm/branches/5.1_jens/include/database/PearDatabase.php Tue Nov 14 03:16:10 2006
@@ -930,9 +930,20 @@
 
     function getUniqueID($seqname)
     {
-	$this->checkConnection();
+	global $log;
+	$this->checkConnection();
+	if( $this->dbType == "pgsql") {
+	    $keytab = $this->database->MetaPrimaryKeys($seqname);
+	    if( count( $keytab) > 0) {
+		$log->info("PearDatabase: Postgres getUniqueID hack: ".$seqname."_".$keytab[0]."_seq");
+		return $this->database->GenID($seqname."_".$keytab[0]."_seq",1);
+	    } else {
+		$log->info("PearDatabase: Problem: getUniqueID but no key for '$seqname'");
+	    }
+	}
 	return $this->database->GenID($seqname."_seq",1);
     }
+
     function get_tables()
     {
 	$this->checkConnection();

Modified: vtigercrm/branches/5.1_jens/include/database/Postgres8.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/database/Postgres8.php (original)
+++ vtigercrm/branches/5.1_jens/include/database/Postgres8.php Tue Nov 14 03:16:10 2006
@@ -1,176 +1,144 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-
-//Fix postgres queries
-function fixPostgresQuery($query,$log,$debug)
-{
-    // First select the query fields from the remaining query
-    $queryFields = substr($query, strlen('select'), strpos($query,'FROM')-strlen('select'));
-    $queryRecord = substr($query, strpos($query,'FROM'), strlen($query));
-    $groupClause = "";
-    $orderClause = "";
-
-    if( $debug)
-	$log->info( "fixPostgresQuery: ".$query);
-
-    // If we already have an order or group cluase separate ist for later use
-    if( strpos($queryRecord,'GROUP') > 0)
-    {
-	$groupClause = substr($queryRecord, strpos($queryRecord,'GROUP')+strlen('GROUP BY'), strlen($queryRecord));
-	if( strpos($groupClause,'ORDER') > 0)
-	{
-	    $orderClause = substr($groupClause, strpos($groupClause,'ORDER'), strlen($groupClause));
-	    $groupClause = substr($groupClause, 0, strpos($groupClause,'ORDER'));
-	}
-	$queryRecord = substr($queryRecord, 0, strpos($queryRecord,'GROUP'));
-    }
-
-    if( strpos($queryRecord,'ORDER') > 0)
-    {
-	$orderClause = substr($queryRecord, strpos($queryRecord,'ORDER'), strlen($queryRecord));
-	$queryRecord = substr($queryRecord, 0, strpos($queryRecord,'ORDER'));
-    }
-
-    // Construkt the privateGroupList from the filed list by separating combined
-    // record.field entries
-    $privateGroupList = array();
-    $token = strtok( $queryFields, ", ()	");
-    while( $token !== false) {
-	if( strpos( $token, ".") !== false) {
-	    array_push( $privateGroupList, $token);
-	}
-	$token = strtok( ", ()	");
-    }
-    sort( $privateGroupList);
-    $groupFields = "";
-    $last = "";
-    for( $i = 0; $i < count($privateGroupList); $i++) {
-	if( $last != $privateGroupList[$i]) {
-	    if( $groupFields == "")
-		$groupFields = $privateGroupList[$i];
-	    else
-		$groupFields .= ",".$privateGroupList[$i];
-	}
-	$last = $privateGroupList[$i];
-    }
-
-    // Rebuild the query
-    $query = "SELECT ".$queryFields.$queryRecord." GROUP BY ";
-    if( $groupClause != "" )
-	$groupClause = $groupClause.",".$groupFields;
-    else
-	$groupClause = $groupFields;
-    $query .= expandStar($groupClause,$log)." ".$orderClause;
-
-    if( $debug)
-	$log->info( "fixPostgresQuery result: ".$query);
-
-    return( $query);
-}
-
-// Postgres8 will not accept a "tablename.*" entry in the GROUP BY clause
-function expandStar($fieldlist,$log)
-{
-    $expanded="";
-    $field = strtok( $fieldlist, ",");
-    while( $field != "")
-    {
-	//remove leading and trailing spaces
-	$field = trim( $field);
-
-	//still spaces in the field indicate a complex structure
-	if( strpos( $field, " ") == 0)
-	{
-
-	    //locate table- and fieldname
-	    $pos = strpos( $field, ".");
-	    if( $pos > 0)
-	    {
-		$table = substr( $field, 0, $pos);
-		$subfield = substr( $field, $pos+1, strlen($field)-$pos);
-
-		//do we need to expand?
-		if( $subfield == "*") 
-		    $field = expandRecord($table,$log);
-	    }
-
-	    //add the propably expanded field to the querylist
-	    if( $expanded == "")
-		$expanded = $field;
-	    else
-		$expanded .= ",".$field;
-	}
-
-	//next field
-	$field = strtok(",");
-    }
-
-    //return the expanded fieldlist
-    return( $expanded);
-}
-
-//return an expanded table field list
-function expandRecord($table,$log)
-{
-    $result = "";
-    $log->info( "Debug: expandRecord");
-    $subfields = array();
-
-    //vtiger_products table
-    if( $table == "vtiger_products" )
-	$subfields = array ( "productid", "productname", "productcode", "productcategory", "manufacturer", "product_description", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "handler", "contactid", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename" );
-
-    //vtiger_activity table
-    elseif( $table == "vtiger_activity") 
-	$subfields = array ( "activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility" );
-
-    //vtiger_notes table
-    elseif( $table == "vtiger_notes")
-	$subfields = array ( "notesid", "contact_id", "title", "filename", "notecontent");
-
-    //vtiger_faq table
-    elseif( $table == "vtiger_faq")
-	$subfields = array ( "id", "product_id", "question", "answer", "category", "status");
-
-    //vtiger_profile2field 
-    elseif( $table == "vtiger_profile2field")
-	$subfields = array ( "profileid", "tabid", "fieldid", "visible", "readonly");
-
-    //vtiger_field 
-    elseif( $table == "vtiger_field")
-	$subfields = array ( "tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type");
-
-    //vtiger_activity
-    elseif( $table == "vtiger_activity")
-	$subfields = array ( "activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility");
-
-    //fields of the requested array still undefined
-    else
-	$log->info("function expandRecord: please add structural information for table '".$table."'");
-
-    //construct an entity string
-    for( $i=0; $i<count($subfields); $i++)
-    {
-	$result .= $table.".".$subfields[$i].",";
-    }
-
-    //remove the trailiung ,
-    if( strlen( $result) > 0)
-	$result = substr( $result, 0, strlen( $result) -1);
-    
-    //return out new string
-    return( $result);
-}
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+
+//Fix postgres queries
+function fixPostgresQuery($query,$log,$debug)
+{
+    // First select the query fields from the remaining query
+    $queryFields = substr($query, strlen('select'), strpos($query,'FROM')-strlen('select'));
+    $queryRecord = substr($query, strpos($query,'FROM'), strlen($query));
+    $groupClause = "";
+    $orderClause = "";
+
+    if( $debug)
+	$log->info( "fixPostgresQuery: ".$query);
+
+    // If we already have an order or group cluase separate ist for later use
+    if( strpos($queryRecord,'GROUP') > 0)
+    {
+	$groupClause = substr($queryRecord, strpos($queryRecord,'GROUP')+strlen('GROUP BY'), strlen($queryRecord));
+	if( strpos($groupClause,'ORDER') > 0)
+	{
+	    $orderClause = substr($groupClause, strpos($groupClause,'ORDER'), strlen($groupClause));
+	    $groupClause = substr($groupClause, 0, strpos($groupClause,'ORDER'));
+	}
+	$queryRecord = substr($queryRecord, 0, strpos($queryRecord,'GROUP'));
+    }
+
+    if( strpos($queryRecord,'ORDER') > 0)
+    {
+	$orderClause = substr($queryRecord, strpos($queryRecord,'ORDER'), strlen($queryRecord));
+	$queryRecord = substr($queryRecord, 0, strpos($queryRecord,'ORDER'));
+    }
+
+    // Construkt the privateGroupList from the filed list by separating combined
+    // record.field entries
+    $privateGroupList = array();
+    $token = strtok( $queryFields, ", ()	");
+    while( $token !== false) {
+	if( strpos( $token, ".") !== false) {
+	    array_push( $privateGroupList, $token);
+	}
+	$token = strtok( ", ()	");
+    }
+    sort( $privateGroupList);
+    $groupFields = "";
+    $last = "";
+    for( $i = 0; $i < count($privateGroupList); $i++) {
+	if( $last != $privateGroupList[$i]) {
+	    if( $groupFields == "")
+		$groupFields = $privateGroupList[$i];
+	    else
+		$groupFields .= ",".$privateGroupList[$i];
+	}
+	$last = $privateGroupList[$i];
+    }
+
+    // Rebuild the query
+    $query = "SELECT ".$queryFields.$queryRecord." GROUP BY ";
+    if( $groupClause != "" )
+	$groupClause = $groupClause.",".$groupFields;
+    else
+	$groupClause = $groupFields;
+    $query .= expandStar($groupClause,$log)." ".$orderClause;
+
+    if( $debug)
+	$log->info( "fixPostgresQuery result: ".$query);
+
+    return( $query);
+}
+
+// Postgres8 will not accept a "tablename.*" entry in the GROUP BY clause
+function expandStar($fieldlist,$log)
+{
+    $expanded="";
+    $field = strtok( $fieldlist, ",");
+    while( $field != "")
+    {
+	//remove leading and trailing spaces
+	$field = trim( $field);
+
+	//still spaces in the field indicate a complex structure
+	if( strpos( $field, " ") == 0)
+	{
+
+	    //locate table- and fieldname
+	    $pos = strpos( $field, ".");
+	    if( $pos > 0)
+	    {
+		$table = substr( $field, 0, $pos);
+		$subfield = substr( $field, $pos+1, strlen($field)-$pos);
+
+		//do we need to expand?
+		if( $subfield == "*") 
+		    $field = expandRecord($table,$log);
+	    }
+
+	    //add the propably expanded field to the querylist
+	    if( $expanded == "")
+		$expanded = $field;
+	    else
+		$expanded .= ",".$field;
+	}
+
+	//next field
+	$field = strtok(",");
+    }
+
+    //return the expanded fieldlist
+    return( $expanded);
+}
+
+//return an expanded table field list
+function expandRecord($table,$log)
+{
+    global $adb;
+    $result = "";
+    $subfields = $adb->getColumnNames($table);
+
+    //construct an entity string
+    for( $i=0; $i<count($subfields); $i++)
+    {
+	$result .= $table.".".$subfields[$i].",";
+    }
+
+    //remove the trailiung ,
+    if( strlen( $result) > 0)
+	$result = substr( $result, 0, strlen( $result) -1);
+    
+    //return out new string
+    return( $result);
+}
+?>

Modified: vtigercrm/branches/5.1_jens/include/js/Inventory.js
==============================================================================
--- vtigercrm/branches/5.1_jens/include/js/Inventory.js (original)
+++ vtigercrm/branches/5.1_jens/include/js/Inventory.js Tue Nov 14 03:16:10 2006
@@ -414,13 +414,29 @@
 	taxcount = eval(document.getElementById(countname).value)+1;
 
 	if(countname == 'tax_count')
+	{
 		taxprefix = 'tax';
+		taxLabelPrefix = 'taxlabel_tax';
+	}
 	else
+	{
 		taxprefix = 'shtax';
+		taxLabelPrefix = 'taxlabel_shtax';
+	}
 
 	for(var i=1;i<=taxcount;i++)
 	{
 		taxval = document.getElementById(taxprefix+i).value;
+		taxLabelVal = document.getElementById(taxLabelPrefix+i).value;
+		document.getElementById(taxLabelPrefix+i).value = taxLabelVal.replace(/^\s*|\s*$/g,'').replace(/\s+/g,'');
+
+		if(document.getElementById(taxLabelPrefix+i).value.length == 0)
+		{
+			alert("The tax label name should not be empty");
+			return false
+		} 
+
+		//Tax value - numeric validation	
 		var temp = /^(0|[1-9]{1}\d{0,})(\.(\d{1}\d{0,}))?$/.test(taxval);
 		if(!temp)
 		{
@@ -430,6 +446,7 @@
 	}
 	return true;
 }
+
 
 
 //Function used to add a new product row in PO, SO, Quotes and Invoice
@@ -501,12 +518,18 @@
 function decideTaxDiv()
 {
 	var taxtype = document.getElementById("taxtype").value
+
+	calcTotal();
+
 	if(taxtype == 'group')
+	{
+		//if group tax selected then we have to hide the individual taxes and also calculate the group tax
 		hideIndividualTaxes()
+		calcGroupTax();
+	}
 	else if(taxtype == 'individual')
 		hideGroupTax()
 
-	calcTotal();
 }
 
 function hideIndividualTaxes()

Modified: vtigercrm/branches/5.1_jens/include/js/ListView.js
==============================================================================
--- vtigercrm/branches/5.1_jens/include/js/ListView.js (original)
+++ vtigercrm/branches/5.1_jens/include/js/ListView.js Tue Nov 14 03:16:10 2006
@@ -1,147 +1,151 @@
-/*********************************************************************************
-
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
- ********************************************************************************/
-function change(obj,divid)
-{
-	var select_options  =  document.getElementsByName('selected_id');
-	var x = select_options.length;
-	var viewid =getviewId();		
-	idstring = "";
-
-	xx = 0;
-	for(i = 0; i < x ; i++)
-	{
-		if(select_options[i].checked)
-		{
-			idstring = select_options[i].value +";"+idstring
-				xx++
-		}
-	}
-	if (xx != 0)
-	{
-		document.getElementById('idlist').value=idstring;
-	}
-	else
-	{
-		alert("Please select at least one entity");
-		return false;
-	}
-	fnvshobj(obj,divid);
-}
-function getviewId()
-{
-	if(typeof(document.getElementById("viewname")) != 'undefined')
-	{
-		var oViewname = document.getElementById("viewname");
-		var viewid = oViewname.options[oViewname.selectedIndex].value;
-	}
-	else
-	{
-		var viewid ='';		
-	}
-	return viewid;	
-}
-function massDelete(module)
-{
-		var select_options  =  document.getElementsByName('selected_id');
-		var x = select_options.length;
-		var viewid =getviewId();		
-		idstring = "";
-
-        xx = 0;
-        for(i = 0; i < x ; i++)
-        {
-        	if(select_options[i].checked)
-            {
-            	idstring = select_options[i].value +";"+idstring
-                xx++
-            }
-        }
-        if (xx != 0)
-        {
-            document.getElementById('idlist').value=idstring;
-        }
-        else
-        {
-            alert("Please select at least one entity");
-            return false;
-        }
-		if(confirm("Are you sure you want to delete the selected "+xx+" records ?"))
-		{
-			
-			$("status").style.display="inline";
-			new Ajax.Request(
-          	  	      'index.php',
-			      	{queue: {position: 'end', scope: 'command'},
-		                        method: 'post',
-                		        postBody:"module=Users&action=massdelete&return_module="+module+"&viewname="+viewid+"&idlist="+idstring,
-		                        onComplete: function(response) {
-        	        	                $("status").style.display="none";
-                	        	        result = response.responseText.split('&#&#&#');
-                        	        	$("ListViewContents").innerHTML= result[2];
-	                        	        if(result[1] != '')
-                                        		alert(result[1]);
-		                        }
-              			 }
-       			);
-		}
-		else
-		{
-			return false;
-		}
-
-}
-
-function showDefaultCustomView(selectView,module)
-{
-	$("status").style.display="inline";
-	var viewName = selectView.options[selectView.options.selectedIndex].value;
-	new Ajax.Request(
-               	'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                       	method: 'post',
-                        postBody:"module="+module+"&action="+module+"Ajax&file=ListView&ajax=true&start=1&viewname="+viewName,
-                        onComplete: function(response) {
-                        $("status").style.display="none";
-                        result = response.responseText.split('&#&#&#');
-                        $("ListViewContents").innerHTML= result[2];
-                        if(result[1] != '')
-                               	alert(result[1]);
-			$('basicsearchcolumns_real').innerHTML = $('basicsearchcolumns').innerHTML
-			$('basicsearchcolumns').innerHTML = '';
-			document.basicSearch.search_text.value = '';
-                        }
-                }
-	);
-}
-
-
-function getListViewEntries_js(module,url)
-{
-	$("status").style.display="inline";
-	if($('search_url').value!='')
-                urlstring = $('search_url').value;
-	else
-		urlstring = '';
-        new Ajax.Request(
-        	'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                	method: 'post',
-                        postBody:"module="+module+"&action="+module+"Ajax&file=ListView&ajax=true&"+url+urlstring,
-			onComplete: function(response) {
-                        	$("status").style.display="none";
-                                result = response.responseText.split('&#&#&#');
-                                $("ListViewContents").innerHTML= result[2];
-                                if(result[1] != '')
-                                        alert(result[1]);
-                  	}
-                }
-        );
-}
-
+/*********************************************************************************
+
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ********************************************************************************/
+function change(obj,divid)
+{
+	var select_options  =  document.getElementsByName('selected_id');
+	var x = select_options.length;
+	var viewid =getviewId();		
+	idstring = "";
+
+	xx = 0;
+	for(i = 0; i < x ; i++)
+	{
+		if(select_options[i].checked)
+		{
+			idstring = select_options[i].value +";"+idstring
+				xx++
+		}
+	}
+	if (xx != 0)
+	{
+		document.getElementById('idlist').value=idstring;
+	}
+	else
+	{
+		alert("Please select at least one entity");
+		return false;
+	}
+	fnvshobj(obj,divid);
+}
+function getviewId()
+{
+	if(typeof(document.getElementById("viewname")) != 'undefined')
+	{
+		var oViewname = document.getElementById("viewname");
+		if( oViewname.selectedIndex >= 0) {
+		    var viewid = oViewname.options[oViewname.selectedIndex].value;
+		} else {
+		    var viewid ='';		
+		}
+	}
+	else
+	{
+		var viewid ='';		
+	}
+	return viewid;	
+}
+function massDelete(module)
+{
+		var select_options  =  document.getElementsByName('selected_id');
+		var x = select_options.length;
+		var viewid =getviewId();		
+		idstring = "";
+
+        xx = 0;
+        for(i = 0; i < x ; i++)
+        {
+        	if(select_options[i].checked)
+            {
+            	idstring = select_options[i].value +";"+idstring
+                xx++
+            }
+        }
+        if (xx != 0)
+        {
+            document.getElementById('idlist').value=idstring;
+        }
+        else
+        {
+            alert("Please select at least one entity");
+            return false;
+        }
+		if(confirm("Are you sure you want to delete the selected "+xx+" records ?"))
+		{
+			
+			$("status").style.display="inline";
+			new Ajax.Request(
+          	  	      'index.php',
+			      	{queue: {position: 'end', scope: 'command'},
+		                        method: 'post',
+                		        postBody:"module=Users&action=massdelete&return_module="+module+"&viewname="+viewid+"&idlist="+idstring,
+		                        onComplete: function(response) {
+        	        	                $("status").style.display="none";
+                	        	        result = response.responseText.split('&#&#&#');
+                        	        	$("ListViewContents").innerHTML= result[2];
+	                        	        if(result[1] != '')
+                                        		alert(result[1]);
+		                        }
+              			 }
+       			);
+		}
+		else
+		{
+			return false;
+		}
+
+}
+
+function showDefaultCustomView(selectView,module)
+{
+	$("status").style.display="inline";
+	var viewName = selectView.options[selectView.options.selectedIndex].value;
+	new Ajax.Request(
+               	'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                       	method: 'post',
+                        postBody:"module="+module+"&action="+module+"Ajax&file=ListView&ajax=true&start=1&viewname="+viewName,
+                        onComplete: function(response) {
+                        $("status").style.display="none";
+                        result = response.responseText.split('&#&#&#');
+                        $("ListViewContents").innerHTML= result[2];
+                        if(result[1] != '')
+                               	alert(result[1]);
+			$('basicsearchcolumns_real').innerHTML = $('basicsearchcolumns').innerHTML
+			$('basicsearchcolumns').innerHTML = '';
+			document.basicSearch.search_text.value = '';
+                        }
+                }
+	);
+}
+
+
+function getListViewEntries_js(module,url)
+{
+	$("status").style.display="inline";
+	if($('search_url').value!='')
+                urlstring = $('search_url').value;
+	else
+		urlstring = '';
+        new Ajax.Request(
+        	'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                	method: 'post',
+                        postBody:"module="+module+"&action="+module+"Ajax&file=ListView&ajax=true&"+url+urlstring,
+			onComplete: function(response) {
+                        	$("status").style.display="none";
+                                result = response.responseText.split('&#&#&#');
+                                $("ListViewContents").innerHTML= result[2];
+                                if(result[1] != '')
+                                        alert(result[1]);
+                  	}
+                }
+        );
+}
+

Modified: vtigercrm/branches/5.1_jens/include/js/customview.js
==============================================================================
--- vtigercrm/branches/5.1_jens/include/js/customview.js (original)
+++ vtigercrm/branches/5.1_jens/include/js/customview.js Tue Nov 14 03:16:10 2006
@@ -1,392 +1,392 @@
-/*********************************************************************************
-  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-   * ("License"); You may not use this file except in compliance with the License
-   * The Original Code is:  vtiger CRM Open Source
-   * The Initial Developer of the Original Code is vtiger.
-   * Portions created by vtiger are Copyright (C) vtiger.
-   * All Rights Reserved.
-  *
- ********************************************************************************/
-
-function splitValues() {
-        var picklistObj=getObj("fldPickList")
-        var pickListContent=picklistObj.value
-        var pickListAry=new Array()
-        var i=0;
-
-        //Splitting up of Values
-        if (pickListContent.indexOf("\n")!=-1) {
-                while(pickListContent.length>0) {
-                        if(pickListContent.indexOf("\n")!=-1) {
-                                if (pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
-                                        pickListAry[i]=pickListContent.substr(0,pickListContent.indexOf("\n")).replace(/^\s+/g, '').replace(/\s+$/g, '')
-                                        pickListContent=pickListContent.substr(pickListContent.indexOf("\n")+1,pickListContent.length)
-                                        i++
-                                } else break;
-                        } else {
-                                pickListAry[i]=pickListContent.substr(0,pickListContent.length)
-                                break;
-                        }
-                }
-        } else if (pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
-                pickListAry[0]=pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '')
-        }
-
-        return pickListAry;
-}
-
-
-function validate() {
-	var nummaxlength = 255;
-        var fieldtype = document.getElementById('selectedfieldtype').value;
-	var mode = document.getElementById('cfedit_mode').value;
-        if(fieldtype == "" && mode != 'edit')
-	{
-		alert("Field Type is not selected");
-		return false;
-	}
-	lengthLayer=getObj("lengthdetails")
-        decimalLayer=getObj("decimaldetails")
-        pickListLayer=getObj("picklist")
-        var str = getObj("fldLabel").value;
-        if (!emptyCheck("fldLabel","Label"))
-                return false
-
-        var re1=/^[a-z\d\_ ]+$/i
-        if (!re1.test(str))
-        {
-                alert("Special characters are not allowed in Label field")
-                return false;
-        }
-
-        if (lengthLayer.style.visibility=="visible") {
-                if (!emptyCheck("fldLength","Length"))
-                        return false
-
-                if (!intValidate("fldLength","Length"))
-                        return false
-
-                if (!numConstComp("fldLength","Length","GT",0))
-                        return false
-
-        }
-
-        if (decimalLayer.style.visibility=="visible") {
-                if (getObj("fldDecimal").value.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0)
-                        if (!intValidate("fldDecimal","Decimal"))
-                                return false
-                if (!numConstComp("fldDecimal","Decimal","GE",0))
-                        return false
-
-                if (!numConstComp("fldDecimal","Decimal","LE",30))
-                        return false
-        }
-	var decimallength = document.addtodb.fldDecimal.value;
-        if(fieldtype == 'Percent' || fieldtype == 'Currency' || fieldtype == 'Number')
-        {
-                if(decimallength == '')
-                        decimallength = 0;
-                nummaxlength = 65 - (eval(decimallength) + 1);
-        }
-        if (!numConstComp("fldLength","Length","LE",nummaxlength))
-                return false
-var picklistObj=getObj("fldPickList")
-        if (pickListLayer.style.visibility=="visible") {
-                if (emptyCheck("fldPickList","Picklist values"))        {
-                        var pickListAry=new Array()
-                        pickListAry=splitValues()
-
-                        //Empty Check validation
-                        for (i=0;i<pickListAry.length;i++) {
-                                if (pickListAry[i]=="") {
-                                        alert("Picklist value cannot be empty")
-                                        picklistObj.focus()
-                                        return false
-                                }
-                        }
-
-                        //Duplicate Values' Validation
-                        for (i=0;i<pickListAry.length;i++) {
-                                for (j=i+1;j<pickListAry.length;j++) {
-                                        if (pickListAry[i]==pickListAry[j]) {
-                                                alert("Duplicate Values found")
-                                                picklistObj.focus()
-                                                return false
-                                        }
-                                }
-                        }
-
-                        return true
-                } else return false
-        }
-}
-var fieldValueArr=new Array('Text','Number','Percent','Currency','Date','Email','Phone','Picklist','URL','Checkbox','TextArea','MultiSelectCombo');
-var fieldTypeArr=new Array('text','number','percent','currency','date','email','phone','picklist','url','checkbox','textarea','multiselectcombo');
-var currFieldIdx=0,totFieldType;
-var focusFieldType;
-
-function init() {
-        lengthLayer=getObj("lengthdetails")
-        decimalLayer=getObj("decimaldetails")
-        pickListLayer=getObj("picklist")
-        totFieldType=fieldTypeArr.length-1
-}
-
-
-function setVisible() {
-        if (focusFieldType==true) {
-                var selFieldType=fieldLayer.getObj("field"+currFieldIdx)
-                var height=findPosY(selFieldType)+selFieldType.offsetHeight
-
-                if (currFieldIdx==0) {
-                        fieldLayer.document.body.scrollTop=0
-                } else if (height>220) {
-                        fieldLayer.document.body.scrollTop+=height-220
-                } else {
-                        fieldLayer.document.body.scrollTop-=220-height
-                }
-
-                if (window.navigator.appName.toUpperCase()=="OPERA") {
-                                var newDiv=fieldLayer.document.createElement("DIV")
-                                newDiv.style.zIndex="-1"
-                                newDiv.style.position="absolute"
-                                newDiv.style.top=findPosY(selFieldType)+"px"
-                                newDiv.style.left="25px"
-
-                                var newObj=fieldLayer.document.createElement("INPUT")
-                                newObj.type="text"
-
-                                fieldLayer.document.body.appendChild(newDiv)
-                                newDiv.appendChild(newObj)
-                                newObj.focus()
-
-                                fieldLayer.document.body.removeChild(newDiv)
-                }
-        }
-}
-
-function selFieldType(id,scrollLayer,bool) {
-        currFieldIdx=id
-        var type=fieldTypeArr[id]
-	var lengthLayer=getObj("lengthdetails");
-	var decimalLayer=getObj("decimaldetails");
-	var pickListLayer=getObj("picklist");
-        if (type=='text') {
-                lengthLayer.style.visibility="visible"
-                decimalLayer.style.visibility="hidden"
-                pickListLayer.style.visibility="hidden"
-        } else if (type=='date' || type=='email' || type=='phone' || type=='url' || type=='checkbox' || type=='textarea') {
-                getObj("lengthdetails").style.visibility="hidden"
-                decimalLayer.style.visibility="hidden"
-                pickListLayer.style.visibility="hidden"
-        } else if (type=='number' || type=='percent' || type=='currency') {
-                lengthLayer.style.visibility="visible"
-                decimalLayer.style.visibility="visible"
-                pickListLayer.style.visibility="hidden"
-        } else if (type=='picklist' || type=='multiselectcombo') {
-                lengthLayer.style.visibility="hidden"
-                decimalLayer.style.visibility="hidden"
-                pickListLayer.style.visibility="visible"
-        }
-
-
-        parent.getObj("fieldType").value = fieldValueArr[id];
-}
-
-function srchFieldType(ev) {
-        if (browser_ie) {
-                var keyCode=window.fieldLayer.event.keyCode
-                var currElement=window.fieldLayer.event.srcElement
-                if (currElement.id.indexOf("field")>=0) var doSearch=true
-                else var doSearch=false
-                window.fieldLayer.event.cancelBubble=true
-        } else if (browser_nn4 || browser_nn6) {
-                var keyCode=ev.which
-                var currElement=ev.target
-                if (currElement.type) doSearch=false
-                else doSearch=true
-        }
-
-        if (doSearch==true) {
-                switch (keyCode) {
-                        case 9  : //Reset Field Type
-                                                resetFieldTypeHilite();break;
-                        case 33 : //Page Up
-                        case 36 : //Home
-                                                selFieldType(0);break;
-                        case 34 : //Page Down
-                        case 35 : //End
-                                                selFieldType(totFieldType);break;
-                        case 38 : //Up
-                                                if (currFieldIdx!=0)
-                                                        selFieldType(currFieldIdx-1);
-                                                else
-                                                        selFieldType(totFieldType,"yes");
-                                                break;
-                        case 40 : //Down
-                                                if (currFieldIdx!=totFieldType)
-                                                        selFieldType(currFieldIdx+1);
-                                                else
-                                                        selFieldType(0,"yes");
-default : //Character Search
-                                                if (keyCode>=65 && keyCode<=90) {
-                                                        var srchChar=String.fromCharCode(keyCode)
-                                                        if (currFieldIdx==totFieldType) var startIdx=0
-                                                        else var startIdx=currFieldIdx+1
-
-                                                        var loop=1
-                                                        for (i=startIdx;i<=totFieldType;) {
-                                                                currFieldStr=fieldLayer.getObj("field"+i).innerHTML
-                                                                currFieldStr=currFieldStr.replace(/^\s+/g, '').replace(/\s+$/g, '').substr(0,1)
-                                                                if (currFieldStr==srchChar) {
-                                                                        selFieldType(i,"yes")
-                                                                        i++
-                                                                } else if (i==totFieldType && loop<=2) {
-                                                                        i=0
-                                                                        loop++
-                                                                } else i++
-                                                        }
-                                           }
-                }
-        }
-}
-function resetFieldTypeHilite() {
-        fieldLayer.getObj("field"+currFieldIdx).className="fieldType sel"
-}
-function validateCustomFieldAccounts()
-        {
-                var obj=document.getElementsByTagName("SELECT");
-                var i,j=0,k=0,l=0;
-                var n=obj.length;
-                account = new Array;
-                contact =  new Array;
-                potential = new Array;
-                for( i = 0; i < n; i++)
-                {
-                        if(obj[i].name.indexOf("_account")>0)
-                        {
-                                account[j]=obj[i].value;
-                                j++;
-                        }
-                        if(obj[i].name.indexOf("_contact")>0)
-                        {
-                                contact[k]=obj[i].value;
-                                k++;
-                        }
-                        if(obj[i].name.indexOf("_potential")>0)
-                        {
-                                potential[l]=obj[i].value;
-                                l++;
-                        }
-                }
-                for( i = 0; i < account.length; i++)
-                {
-                        for(j=i+1; j<account.length; j++)
-                        {
-                                if( account[i] == account[j] && account[i]!="None" && account[j] !="None")
-                                {
-                                        alert("Duplicate mapping for accounts!!");
-                                        return false;
-                                }
-                        }
-                }
-for( i = 0; i < contact.length; i++)
-                {
-                        for(k=i+1; k< contact.length; k++)
-                        {
-                                if( contact[i] == contact[k] && contact[i]!="None" && contact[k]!="None")
-                                {
-                                        alert("Duplicate mapping for Contacts!!");
-                                        return false;
-                                }
-                        }
-                }
-                for( i = 0; i < potential.length; i++)
-                {
-                        for(l=i+1; l<potential.length; l++)
-                        {
-                                if( potential[i] == potential[l] && potential[i]!="None" && potential[l]!="None")
-                                {
-                                        alert("Duplicate mapping for Potential!!");
-                                        return false;
-                                }
-                        }
-
-                }
-        }
-
-
-function gotourl(url)
-{
-                document.location.href=url;
-}
-
-function validateTypeforCFMapping(leadtype,leadtypeofdata,field_name,cf_form)
-{
-	var combo_val = cf_form.options[cf_form.selectedIndex].value;
-	if(combo_val != 'None')
-	{
-		var type = document.getElementById(combo_val+"_type").value;
-		var typeofdata = document.getElementById(combo_val+"_typeofdata").value;
-		if(leadtype == type)
-		{
-			if(leadtypeofdata == typeofdata)
-			{
-				return true;
-			}
-			else
-			{
-				var lead_tod = leadtypeofdata.split("~");
-				var tod = typeofdata.split("~");
-				switch (lead_tod[0]) {
-                	                case "V"  :
-						if(lead_tod[3] <= tod[3])
-							return true;
-						else
-						{
-							alert(alertmessage[3]);
-							document.getElementById(field_name).value = 'None';
-							return false;
-						}
-						break;
-					case "N"  :
-						if(lead_tod[2].indexOf(",")>0)
-						{
-							var lead_dec = lead_tod[2].split(",");
-							var dec = tod[2].split(",");
-						
-						}
-						else
-						{
-							var lead_dec = lead_tod[2].split("~");
-                	                                var dec = tod[2].split("~");
-						}
-						if(lead_dec[0] <= dec[0])
-						{
-							if(lead_dec[1] <= dec[1])
-								return true;
-							else
-							{
-								alert(alertmessage[4]);
-								document.getElementById(field_name).value = 'None';
-								return false;
-							}
-						}
-						else
-						{
-							alert(alertmessage[3]);
-							document.getElementById(field_name).value = 'None';
-							return false;
-						}
-						break;
-				}	
-			}
-		}
-		else
-		{
-			alert(alertmessage[0]+" "+leadtype+" "+alertmessage[1]+" "+type+" "+alertmessage[2]);
-			document.getElementById(field_name).value = 'None';
-			return false;
-		}
-	}
-}
+/*********************************************************************************
+  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+   * ("License"); You may not use this file except in compliance with the License
+   * The Original Code is:  vtiger CRM Open Source
+   * The Initial Developer of the Original Code is vtiger.
+   * Portions created by vtiger are Copyright (C) vtiger.
+   * All Rights Reserved.
+  *
+ ********************************************************************************/
+
+function splitValues() {
+        var picklistObj=getObj("fldPickList")
+        var pickListContent=picklistObj.value
+        var pickListAry=new Array()
+        var i=0;
+
+        //Splitting up of Values
+        if (pickListContent.indexOf("\n")!=-1) {
+                while(pickListContent.length>0) {
+                        if(pickListContent.indexOf("\n")!=-1) {
+                                if (pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
+                                        pickListAry[i]=pickListContent.substr(0,pickListContent.indexOf("\n")).replace(/^\s+/g, '').replace(/\s+$/g, '')
+                                        pickListContent=pickListContent.substr(pickListContent.indexOf("\n")+1,pickListContent.length)
+                                        i++
+                                } else break;
+                        } else {
+                                pickListAry[i]=pickListContent.substr(0,pickListContent.length)
+                                break;
+                        }
+                }
+        } else if (pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
+                pickListAry[0]=pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '')
+        }
+
+        return pickListAry;
+}
+
+
+function validate() {
+	var nummaxlength = 255;
+        var fieldtype = document.getElementById('selectedfieldtype').value;
+	var mode = document.getElementById('cfedit_mode').value;
+        if(fieldtype == "" && mode != 'edit')
+	{
+		alert("Field Type is not selected");
+		return false;
+	}
+	lengthLayer=getObj("lengthdetails")
+        decimalLayer=getObj("decimaldetails")
+        pickListLayer=getObj("picklist")
+        var str = getObj("fldLabel").value;
+        if (!emptyCheck("fldLabel","Label"))
+                return false
+
+        var re1=/^[a-z\d\_ ]+$/i
+        if (!re1.test(str))
+        {
+                alert("Special characters are not allowed in Label field")
+                return false;
+        }
+
+        if (lengthLayer.style.visibility=="visible") {
+                if (!emptyCheck("fldLength","Length"))
+                        return false
+
+                if (!intValidate("fldLength","Length"))
+                        return false
+
+                if (!numConstComp("fldLength","Length","GT",0))
+                        return false
+
+        }
+
+        if (decimalLayer.style.visibility=="visible") {
+                if (getObj("fldDecimal").value.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0)
+                        if (!intValidate("fldDecimal","Decimal"))
+                                return false
+                if (!numConstComp("fldDecimal","Decimal","GE",0))
+                        return false
+
+                if (!numConstComp("fldDecimal","Decimal","LE",30))
+                        return false
+        }
+	var decimallength = document.addtodb.fldDecimal.value;
+        if(fieldtype == 'Percent' || fieldtype == 'Currency' || fieldtype == 'Number')
+        {
+                if(decimallength == '')
+                        decimallength = 0;
+                nummaxlength = 65 - (eval(decimallength) + 1);
+        }
+        if (!numConstComp("fldLength","Length","LE",nummaxlength))
+                return false
+var picklistObj=getObj("fldPickList")
+        if (pickListLayer.style.visibility=="visible") {
+                if (emptyCheck("fldPickList","Picklist values"))        {
+                        var pickListAry=new Array()
+                        pickListAry=splitValues()
+
+                        //Empty Check validation
+                        for (i=0;i<pickListAry.length;i++) {
+                                if (pickListAry[i]=="") {
+                                        alert("Picklist value cannot be empty")
+                                        picklistObj.focus()
+                                        return false
+                                }
+                        }
+
+                        //Duplicate Values' Validation
+                        for (i=0;i<pickListAry.length;i++) {
+                                for (j=i+1;j<pickListAry.length;j++) {
+                                        if (pickListAry[i]==pickListAry[j]) {
+                                                alert("Duplicate Values found")
+                                                picklistObj.focus()
+                                                return false
+                                        }
+                                }
+                        }
+
+                        return true
+                } else return false
+        }
+}
+var fieldValueArr=new Array('Text','Number','Percent','Currency','Date','Email','Phone','Picklist','URL','Checkbox','TextArea','MultiSelectCombo','Skype');
+var fieldTypeArr=new Array('text','number','percent','currency','date','email','phone','picklist','url','checkbox','textarea','multiselectcombo','skype');
+var currFieldIdx=0,totFieldType;
+var focusFieldType;
+
+function init() {
+        lengthLayer=getObj("lengthdetails")
+        decimalLayer=getObj("decimaldetails")
+        pickListLayer=getObj("picklist")
+        totFieldType=fieldTypeArr.length-1
+}
+
+
+function setVisible() {
+        if (focusFieldType==true) {
+                var selFieldType=fieldLayer.getObj("field"+currFieldIdx)
+                var height=findPosY(selFieldType)+selFieldType.offsetHeight
+
+                if (currFieldIdx==0) {
+                        fieldLayer.document.body.scrollTop=0
+                } else if (height>220) {
+                        fieldLayer.document.body.scrollTop+=height-220
+                } else {
+                        fieldLayer.document.body.scrollTop-=220-height
+                }
+
+                if (window.navigator.appName.toUpperCase()=="OPERA") {
+                                var newDiv=fieldLayer.document.createElement("DIV")
+                                newDiv.style.zIndex="-1"
+                                newDiv.style.position="absolute"
+                                newDiv.style.top=findPosY(selFieldType)+"px"
+                                newDiv.style.left="25px"
+
+                                var newObj=fieldLayer.document.createElement("INPUT")
+                                newObj.type="text"
+
+                                fieldLayer.document.body.appendChild(newDiv)
+                                newDiv.appendChild(newObj)
+                                newObj.focus()
+
+                                fieldLayer.document.body.removeChild(newDiv)
+                }
+        }
+}
+
+function selFieldType(id,scrollLayer,bool) {
+        currFieldIdx=id
+        var type=fieldTypeArr[id]
+	var lengthLayer=getObj("lengthdetails");
+	var decimalLayer=getObj("decimaldetails");
+	var pickListLayer=getObj("picklist");
+        if (type=='text') {
+                lengthLayer.style.visibility="visible"
+                decimalLayer.style.visibility="hidden"
+                pickListLayer.style.visibility="hidden"
+        } else if (type=='date' || type=='email' || type=='phone' || type=='url' || type=='checkbox' || type=='textarea' || type=='skype') {
+                getObj("lengthdetails").style.visibility="hidden"
+                decimalLayer.style.visibility="hidden"
+                pickListLayer.style.visibility="hidden"
+        } else if (type=='number' || type=='percent' || type=='currency') {
+                lengthLayer.style.visibility="visible"
+                decimalLayer.style.visibility="visible"
+                pickListLayer.style.visibility="hidden"
+        } else if (type=='picklist' || type=='multiselectcombo') {
+                lengthLayer.style.visibility="hidden"
+                decimalLayer.style.visibility="hidden"
+                pickListLayer.style.visibility="visible"
+        }
+
+
+        parent.getObj("fieldType").value = fieldValueArr[id];
+}
+
+function srchFieldType(ev) {
+        if (browser_ie) {
+                var keyCode=window.fieldLayer.event.keyCode
+                var currElement=window.fieldLayer.event.srcElement
+                if (currElement.id.indexOf("field")>=0) var doSearch=true
+                else var doSearch=false
+                window.fieldLayer.event.cancelBubble=true
+        } else if (browser_nn4 || browser_nn6) {
+                var keyCode=ev.which
+                var currElement=ev.target
+                if (currElement.type) doSearch=false
+                else doSearch=true
+        }
+
+        if (doSearch==true) {
+                switch (keyCode) {
+                        case 9  : //Reset Field Type
+                                                resetFieldTypeHilite();break;
+                        case 33 : //Page Up
+                        case 36 : //Home
+                                                selFieldType(0);break;
+                        case 34 : //Page Down
+                        case 35 : //End
+                                                selFieldType(totFieldType);break;
+                        case 38 : //Up
+                                                if (currFieldIdx!=0)
+                                                        selFieldType(currFieldIdx-1);
+                                                else
+                                                        selFieldType(totFieldType,"yes");
+                                                break;
+                        case 40 : //Down
+                                                if (currFieldIdx!=totFieldType)
+                                                        selFieldType(currFieldIdx+1);
+                                                else
+                                                        selFieldType(0,"yes");
+default : //Character Search
+                                                if (keyCode>=65 && keyCode<=90) {
+                                                        var srchChar=String.fromCharCode(keyCode)
+                                                        if (currFieldIdx==totFieldType) var startIdx=0
+                                                        else var startIdx=currFieldIdx+1
+
+                                                        var loop=1
+                                                        for (i=startIdx;i<=totFieldType;) {
+                                                                currFieldStr=fieldLayer.getObj("field"+i).innerHTML
+                                                                currFieldStr=currFieldStr.replace(/^\s+/g, '').replace(/\s+$/g, '').substr(0,1)
+                                                                if (currFieldStr==srchChar) {
+                                                                        selFieldType(i,"yes")
+                                                                        i++
+                                                                } else if (i==totFieldType && loop<=2) {
+                                                                        i=0
+                                                                        loop++
+                                                                } else i++
+                                                        }
+                                           }
+                }
+        }
+}
+function resetFieldTypeHilite() {
+        fieldLayer.getObj("field"+currFieldIdx).className="fieldType sel"
+}
+function validateCustomFieldAccounts()
+        {
+                var obj=document.getElementsByTagName("SELECT");
+                var i,j=0,k=0,l=0;
+                var n=obj.length;
+                account = new Array;
+                contact =  new Array;
+                potential = new Array;
+                for( i = 0; i < n; i++)
+                {
+                        if(obj[i].name.indexOf("_account")>0)
+                        {
+                                account[j]=obj[i].value;
+                                j++;
+                        }
+                        if(obj[i].name.indexOf("_contact")>0)
+                        {
+                                contact[k]=obj[i].value;
+                                k++;
+                        }
+                        if(obj[i].name.indexOf("_potential")>0)
+                        {
+                                potential[l]=obj[i].value;
+                                l++;
+                        }
+                }
+                for( i = 0; i < account.length; i++)
+                {
+                        for(j=i+1; j<account.length; j++)
+                        {
+                                if( account[i] == account[j] && account[i]!="None" && account[j] !="None")
+                                {
+                                        alert("Duplicate mapping for accounts!!");
+                                        return false;
+                                }
+                        }
+                }
+for( i = 0; i < contact.length; i++)
+                {
+                        for(k=i+1; k< contact.length; k++)
+                        {
+                                if( contact[i] == contact[k] && contact[i]!="None" && contact[k]!="None")
+                                {
+                                        alert("Duplicate mapping for Contacts!!");
+                                        return false;
+                                }
+                        }
+                }
+                for( i = 0; i < potential.length; i++)
+                {
+                        for(l=i+1; l<potential.length; l++)
+                        {
+                                if( potential[i] == potential[l] && potential[i]!="None" && potential[l]!="None")
+                                {
+                                        alert("Duplicate mapping for Potential!!");
+                                        return false;
+                                }
+                        }
+
+                }
+        }
+
+
+function gotourl(url)
+{
+                document.location.href=url;
+}
+
+function validateTypeforCFMapping(leadtype,leadtypeofdata,field_name,cf_form)
+{
+	var combo_val = cf_form.options[cf_form.selectedIndex].value;
+	if(combo_val != 'None')
+	{
+		var type = document.getElementById(combo_val+"_type").value;
+		var typeofdata = document.getElementById(combo_val+"_typeofdata").value;
+		if(leadtype == type)
+		{
+			if(leadtypeofdata == typeofdata)
+			{
+				return true;
+			}
+			else
+			{
+				var lead_tod = leadtypeofdata.split("~");
+				var tod = typeofdata.split("~");
+				switch (lead_tod[0]) {
+                	                case "V"  :
+						if(lead_tod[3] <= tod[3])
+							return true;
+						else
+						{
+							alert(alertmessage[3]);
+							document.getElementById(field_name).value = 'None';
+							return false;
+						}
+						break;
+					case "N"  :
+						if(lead_tod[2].indexOf(",")>0)
+						{
+							var lead_dec = lead_tod[2].split(",");
+							var dec = tod[2].split(",");
+						
+						}
+						else
+						{
+							var lead_dec = lead_tod[2].split("~");
+                	                                var dec = tod[2].split("~");
+						}
+						if(lead_dec[0] <= dec[0])
+						{
+							if(lead_dec[1] <= dec[1])
+								return true;
+							else
+							{
+								alert(alertmessage[4]);
+								document.getElementById(field_name).value = 'None';
+								return false;
+							}
+						}
+						else
+						{
+							alert(alertmessage[3]);
+							document.getElementById(field_name).value = 'None';
+							return false;
+						}
+						break;
+				}	
+			}
+		}
+		else
+		{
+			alert(alertmessage[0]+" "+leadtype+" "+alertmessage[1]+" "+type+" "+alertmessage[2]);
+			document.getElementById(field_name).value = 'None';
+			return false;
+		}
+	}
+}

Modified: vtigercrm/branches/5.1_jens/include/js/dtlviewajax.js
==============================================================================
--- vtigercrm/branches/5.1_jens/include/js/dtlviewajax.js (original)
+++ vtigercrm/branches/5.1_jens/include/js/dtlviewajax.js Tue Nov 14 03:16:10 2006
@@ -1,367 +1,420 @@
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-var globaldtlviewspanid = "";
-var globaleditareaspanid = ""; 
-var globaltxtboxid = "";
-var itsonview=false;
-// to retain the old value if we cancel the ajax edit
-var globaltempvalue = '';
-var globaluitype = '';
-function showHide(showId, hideId)
-{
-	show(showId);
-	fnhide(hideId);
-}
-
-function hndCancel(valuespanid,textareapanid,fieldlabel)
-{
-
-  showHide(valuespanid,textareapanid);
-  if(globaluitype == '56')
-  {	  
-	  if(globaltempvalue == 1)
-	  	getObj(globaltxtboxid).checked = true; 
-	  else		
-	  	getObj(globaltxtboxid).checked = false; 
-  }
-  else if(globaluitype != '53')	  
-	  getObj(globaltxtboxid).value = globaltempvalue; 
-  globaltempvalue = '';
-  itsonview=false;
-  return false;
-}
-
-function hndMouseOver(uitype,fieldLabel)
-{
-      var mouseArea="";
-      mouseArea="mouseArea_"+ fieldLabel;
-      if(itsonview)
-      {
-            return;
-      }
-      
-      show("crmspanid");
-	  globaluitype = uitype;
-      globaldtlviewspanid= "dtlview_"+ fieldLabel;//valuespanid;
-      globaleditareaspanid="editarea_"+ fieldLabel;//textareapanid;
-	  globalfieldlabel = fieldLabel;
-	  if(globaluitype == 53)
-	  {
-		  if(typeof(document.DetailView.assigntype[0]) != 'undefined')
-		  {
-			  var assign_type_U = document.DetailView.assigntype[0].checked;
-			  var assign_type_G = document.DetailView.assigntype[1].checked;
-			  if(assign_type_U == true)
-				  globaltxtboxid= 'txtbox_U'+fieldLabel;
-			  else if(assign_type_G == true)
-				  globaltxtboxid= 'txtbox_G'+fieldLabel;
-		  }else
-		  {
-			  globaltxtboxid= 'txtbox_U'+fieldLabel;
-		  }
-	  }else
-	  {
-      	  globaltxtboxid="txtbox_"+ fieldLabel;//textboxpanid;
-	  }
-      divObj = getObj('crmspanid'); 
-      crmy = findPosY(getObj(mouseArea));
-      crmx = findPosX(getObj(mouseArea));
-      if(document.all)
-      {
-          divObj.onclick=handleEdit;
-      }
-      else
-      {
-          divObj.setAttribute('onclick','handleEdit();');
-      }
-      divObj.style.left=(crmx+getObj(mouseArea).offsetWidth -divObj.offsetWidth)+"px";
-      divObj.style.top=crmy+"px";
-}
-
-function handleEdit()
-{
-     show(globaleditareaspanid) ;
-     fnhide(globaldtlviewspanid);
-	 if(globaluitype != 53)
-	 {
-		globaltempvalue = getObj(globaltxtboxid).value;
-		if(getObj(globaltxtboxid).type != 'hidden')
-	     	 	getObj(globaltxtboxid).focus();
-	 }
-     fnhide('crmspanid');
-     itsonview=true;
-     return false;
-}
-
-function trim(str)
-{
-	return(str.replace(/\s+$/,''));
-}
-
-var genUiType = "";
-var genFldValue = "";
-
-function dtlViewAjaxSave(fieldLabel,module,uitype,tableName,fieldName,crmId)
-{
-	var dtlView = "dtlview_"+ fieldLabel;
-	var editArea = "editarea_"+ fieldLabel;
-	var groupurl = "";
-	
-	if(globaluitype == 53)
-	{
-		if(typeof(document.DetailView.assigntype[0]) != 'undefined')
-		{
-			var assign_type_U = document.DetailView.assigntype[0].checked;
-			var assign_type_G = document.DetailView.assigntype[1].checked;
-		}else
-		{
-			var assign_type_U = document.DetailView.assigntype.checked;
-		}
-		if(assign_type_U == true)
-		{
-			var txtBox= 'txtbox_U'+fieldLabel;
-		}
-		else if(assign_type_G == true)
-		{
-			var txtBox= 'txtbox_G'+fieldLabel;
-			var group_name = $(txtBox).options[$(txtBox).selectedIndex].text; 
-			var groupurl = "&assigned_group_name="+group_name+"&assigntype=T"
-		}
-
-	}else if(globaluitype == 33)
-	{
-	  var txtBox= "txtbox_"+ fieldLabel;
-	  var oMulSelect = $(txtBox);
-	  var r = new Array();
-	  for (iter=0;iter < oMulSelect.options.length ; iter++)
-	  {
-      if (oMulSelect.options[iter].selected)
-        r[r.length] = oMulSelect.options[iter].value;
-      }
-	}else
-	{
-		var txtBox= "txtbox_"+ fieldLabel;
-	}
-	
-	var popupTxt= "popuptxt_"+ fieldLabel;      
-	var hdTxt = "hdtxt_"+ fieldLabel;
-
-	if(formValidate() == false)
-	{
-		return false;
-	}
-
-
-	$("vtbusy_info").style.display="inline";
-	var isAdmin = document.getElementById("hdtxt_IsAdmin").value; 
-
-
-	//overriden the tagValue based on UI Type for checkbox 
-	if(uitype == '56')
-	{
-		if(document.getElementById(txtBox).checked == true)
-		{
-			tagValue = "1";
-		}else
-		{
-			tagValue = "0";
-		}
-	}else	if(uitype == '156')
-	{
-		if(document.getElementById(txtBox).checked == true)
-		{
-			tagValue = "on";
-		}else
-		{
-			tagValue = "off";
-		}
-	}else if(uitype == '33')
-	{
-		tagValue = r.join(" |##| ");
-  	}else
-	{
-		tagValue = trim(document.getElementById(txtBox).value);
-	}
-
-
-	var data = "file=DetailViewAjax&module=" + module + "&action=" + module + "Ajax&record=" + crmId+"&recordid=" + crmId ;
-	data = data + "&fldName=" + fieldName + "&fieldValue=" + escape(tagValue) + "&ajxaction=DETAILVIEW"+groupurl;
-	new Ajax.Request(
-		'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: data,
-                        onComplete: function(response) {
-                  				if(response.responseText.indexOf(":#:FAILURE")>-1)
-                  				{
-                  					alert("Error while Editing");
-                  				}
-                  				else if(response.responseText.indexOf(":#:SUCCESS")>-1)
-                       		{
-                  					$("vtbusy_info").style.display="none";
-                       		}
-                        }
-                }
-            );
-	if(uitype == '13' || uitype == '104')
-	{
-		getObj(dtlView).innerHTML = "<a href=\"mailto:"+ tagValue+"\" target=\"_blank\">"+tagValue+"&nbsp;</a>";
-	}else if(uitype == '17')
-	{
-		getObj(dtlView).innerHTML = "<a href=\"http://"+ tagValue+"\" target=\"_blank\">"+tagValue+"&nbsp;</a>";
-	}else if(uitype == '53')
-	{
-		var hdObj = getObj(hdTxt);
-		if(typeof(document.DetailView.assigntype[0]) != 'undefined')
-        {
-			var assign_type_U = document.DetailView.assigntype[0].checked;
-			var assign_type_G = document.DetailView.assigntype[1].checked;
-		}else
-		{
-			var assign_type_U = document.DetailView.assigntype.checked;
-		}
-		if(isAdmin == "0")
-		{
-			getObj(dtlView).innerHTML = hdObj.value;
-		}else if(isAdmin == "1" && assign_type_U == true)
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Users&action=DetailView&record="+tagValue+"\">"+hdObj.value+"&nbsp;</a>";
-		}else if(isAdmin == "1" && assign_type_G == true)
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Users&action=GroupDetailView&groupId="+tagValue+"\">"+hdObj.value+"&nbsp;</a>";
-		}
-	}else if(uitype == '56')
-	{
-		if(tagValue == '1')
-		{
-			getObj(dtlView).innerHTML = "yes";
-		}else
-		{
-			getObj(dtlView).innerHTML = "";
-		}
-
-	}else if(uitype == 116)
-	{
-			getObj(dtlView).innerHTML = document.getElementById(txtBox).options[document.getElementById(txtBox).selectedIndex].text; 
-	}
-	else if(getObj(popupTxt))
-	{
-		var popObj = getObj(popupTxt);
-		if(uitype == '50' || uitype == '73' || uitype == '51')
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Accounts&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-		}
-		else if(uitype == '57')
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Contacts&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-		}
-		else if(uitype == '59')
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Products&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-		}
-		else if(uitype == '75' || uitype == '81' )
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Vendors&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-
-		}
-		else if(uitype == '76')
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Potentials&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-		}
-		else if(uitype == '78')
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Quotes&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-		}
-		else if(uitype == '80')
-		{
-			getObj(dtlView).innerHTML = "<a href=\"index.php?module=SalesOrder&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
-		}
-		else if(uitype == '53')
-		{
-			var hdObj = getObj(hdTxt);
-			if(isAdmin == "0")
-			{
-				getObj(dtlView).innerHTML = hdObj.value;
-			}else if(isAdmin == "1")
-			{
-				getObj(dtlView).innerHTML = "<a href=\"index.php?module=Users&action=DetailView&record="+tagValue+"\">"+hdObj.value+"&nbsp;</a>";;
-			}
-		}
-		else if(uitype == '56')
-		{
-			if(tagValue == '1')
-			{
-				getObj(dtlView).innerHTML = "yes";
-			}else
-			{
-				getObj(dtlView).innerHTML = "";
-			}
-
-		}
-		else
-		{
-			getObj(dtlView).innerHTML = popObj.value;
-		}
-	}else if(uitype == '33')
-  	{
-       		getObj(dtlView).innerHTML = r.join(", ");
-	}else
-	{
-		getObj(dtlView).innerHTML = tagValue;
-	}
-	showHide(dtlView,editArea);  //show,hide
-	itsonview=false;
-}
-
-function SaveTag(txtBox,crmId,module)
-{
-	var tagValue = document.getElementById(txtBox).value;
-	document.getElementById(txtBox).value ='';
-	$("vtbusy_info").style.display="inline";
-	new Ajax.Request(
-		'index.php',
-                {queue: {position: 'end', scope: 'command'},
-                        method: 'post',
-                        postBody: "file=TagCloud&module=" + module + "&action=" + module + "Ajax&recordid=" + crmId + "&ajxaction=SAVETAG&tagfields=" +tagValue,
-                        onComplete: function(response) {
-				        getObj('tagfields').innerHTML = response.responseText;
-					$("vtbusy_info").style.display="none";
-                        }
-                }
-        );
-    
-}
-function setSelectValue(fieldLabel)
-{
-	if(globaluitype == 53)
-	{
-		if(typeof(document.DetailView.assigntype[0]) != 'undefined')
-		{
-			var assign_type_U = document.DetailView.assigntype[0].checked;
-			var assign_type_G = document.DetailView.assigntype[1].checked;
-			if(assign_type_U == true)
-				var selCombo= 'txtbox_U'+fieldLabel;
-			else if(assign_type_G == true)	
-				var selCombo= 'txtbox_G'+fieldLabel;
-		}else
-		{
-			var selCombo= 'txtbox_U'+fieldLabel;
-		}
-	}else
-	{
-			var selCombo= 'txtbox_'+fieldLabel;
-	}
-	var hdTxtBox = 'hdtxt_'+fieldLabel;
-	var oHdTxtBox = document.getElementById(hdTxtBox);
-	var oSelCombo = document.getElementById(selCombo);
-
-	oHdTxtBox.value = oSelCombo.options[oSelCombo.selectedIndex].text;
-}
-
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is:  vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+var globaldtlviewspanid = "";
+var globaleditareaspanid = ""; 
+var globaltxtboxid = "";
+var itsonview=false;
+// to retain the old value if we cancel the ajax edit
+var globaltempvalue = '';
+var globaluitype = '';
+function showHide(showId, hideId)
+{
+	show(showId);
+	fnhide(hideId);
+}
+
+function hndCancel(valuespanid,textareapanid,fieldlabel)
+{
+
+  showHide(valuespanid,textareapanid);
+  if(globaluitype == '56')
+  {	  
+	  if(globaltempvalue == 1)
+	  	getObj(globaltxtboxid).checked = true; 
+	  else		
+	  	getObj(globaltxtboxid).checked = false; 
+  }
+  else if(globaluitype != '53')	  
+	  getObj(globaltxtboxid).value = globaltempvalue; 
+  globaltempvalue = '';
+  itsonview=false;
+  return false;
+}
+
+function hndMouseOver(uitype,fieldLabel)
+{
+      var mouseArea="";
+      mouseArea="mouseArea_"+ fieldLabel;
+      if(itsonview)
+      {
+            return;
+      }
+      
+      show("crmspanid");
+	  globaluitype = uitype;
+      globaldtlviewspanid= "dtlview_"+ fieldLabel;//valuespanid;
+      globaleditareaspanid="editarea_"+ fieldLabel;//textareapanid;
+	  globalfieldlabel = fieldLabel;
+	  if(globaluitype == 53)
+	  {
+		  if(typeof(document.DetailView.assigntype[0]) != 'undefined')
+		  {
+			  var assign_type_U = document.DetailView.assigntype[0].checked;
+			  var assign_type_G = document.DetailView.assigntype[1].checked;
+			  if(assign_type_U == true)
+				  globaltxtboxid= 'txtbox_U'+fieldLabel;
+			  else if(assign_type_G == true)
+				  globaltxtboxid= 'txtbox_G'+fieldLabel;
+		  }else
+		  {
+			  globaltxtboxid= 'txtbox_U'+fieldLabel;
+		  }
+	  }else
+	  {
+      	  globaltxtboxid="txtbox_"+ fieldLabel;//textboxpanid;
+	  }
+      divObj = getObj('crmspanid'); 
+      crmy = findPosY(getObj(mouseArea));
+      crmx = findPosX(getObj(mouseArea));
+      if(document.all)
+      {
+          divObj.onclick=handleEdit;
+      }
+      else
+      {
+          divObj.setAttribute('onclick','handleEdit();');
+      }
+      divObj.style.left=(crmx+getObj(mouseArea).offsetWidth -divObj.offsetWidth)+"px";
+      divObj.style.top=crmy+"px";
+}
+
+function handleEdit()
+{
+     show(globaleditareaspanid) ;
+     fnhide(globaldtlviewspanid);
+	 if(globaluitype != 53)
+	 {
+		globaltempvalue = getObj(globaltxtboxid).value;
+		if(getObj(globaltxtboxid).type != 'hidden')
+	     	 	getObj(globaltxtboxid).focus();
+	 }
+     fnhide('crmspanid');
+     itsonview=true;
+     return false;
+}
+
+function trim(str)
+{
+	return(str.replace(/\s+$/,''));
+}
+
+var genUiType = "";
+var genFldValue = "";
+
+function dtlViewAjaxSave(fieldLabel,module,uitype,tableName,fieldName,crmId)
+{
+	var dtlView = "dtlview_"+ fieldLabel;
+	var editArea = "editarea_"+ fieldLabel;
+	var groupurl = "";
+	
+	if(globaluitype == 53)
+	{
+		if(typeof(document.DetailView.assigntype[0]) != 'undefined')
+		{
+			var assign_type_U = document.DetailView.assigntype[0].checked;
+			var assign_type_G = document.DetailView.assigntype[1].checked;
+		}else
+		{
+			var assign_type_U = document.DetailView.assigntype.checked;
+		}
+		if(assign_type_U == true)
+		{
+			var txtBox= 'txtbox_U'+fieldLabel;
+		}
+		else if(assign_type_G == true)
+		{
+			var txtBox= 'txtbox_G'+fieldLabel;
+			var group_name = $(txtBox).options[$(txtBox).selectedIndex].text; 
+			var groupurl = "&assigned_group_name="+group_name+"&assigntype=T"
+		}
+
+	}else if(globaluitype == 14 || globaluitype == 33 || globaluitype == 34)
+	{
+	  var txtBox= "txtbox_"+ fieldLabel;
+	  var oMulSelect = $(txtBox);
+	  var r = new Array();
+	  for (iter=0;iter < oMulSelect.options.length ; iter++)
+	  {
+      if (oMulSelect.options[iter].selected)
+        r[r.length] = oMulSelect.options[iter].value;
+      }
+	}else
+	{
+		var txtBox= "txtbox_"+ fieldLabel;
+	}
+	
+	var popupTxt= "popuptxt_"+ fieldLabel;      
+	var hdTxt = "hdtxt_"+ fieldLabel;
+
+	if(formValidate() == false)
+	{
+		return false;
+	}
+
+
+	$("vtbusy_info").style.display="inline";
+	var isAdmin = document.getElementById("hdtxt_IsAdmin").value; 
+
+
+	//overriden the tagValue based on UI Type for checkbox 
+	if(uitype == '56')
+	{
+		if(document.getElementById(txtBox).checked == true)
+		{
+			tagValue = "1";
+		}else
+		{
+			tagValue = "0";
+		}
+	}else	if(uitype == '156')
+	{
+		if(document.getElementById(txtBox).checked == true)
+		{
+			tagValue = "on";
+		}else
+		{
+			tagValue = "off";
+		}
+	}else if(uitype == 14 || uitype == '33' || uitype == '34')
+	{
+		tagValue = r.join(" |##| ");
+  	}else
+	{
+		tagValue = trim(document.getElementById(txtBox).value);
+	}
+
+	if(uitype == '3' || uitype == '4' || uitype == '18' || uitype == '31' || uitype == '32') {
+	    if(document.getElementById(txtBox+"_inh").checked) {
+		tagValue = "@##@" + tagValue;
+	    }
+	}
+
+	var data = "file=DetailViewAjax&module=" + module + "&action=" + module + "Ajax&record=" + crmId+"&recordid=" + crmId ;
+	data = data + "&fldName=" + fieldName + "&fieldValue=" + escape(tagValue) + "&ajxaction=DETAILVIEW"+groupurl;
+	data = data + "&tableName=" + tableName;
+	new Ajax.Request(
+		'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: data,
+                        onComplete: function(response) {
+                  				if(response.responseText.indexOf(":#:FAILURE")>-1)
+                  				{
+                  					alert("Error while Editing");
+                  				}
+                  				else if(response.responseText.indexOf(":#:SUCCESS")>-1)
+                       		{
+                  					$("vtbusy_info").style.display="none";
+                       		}
+                        }
+                }
+            );
+	if(uitype == '13' || uitype == '104')
+	{
+		getObj(dtlView).innerHTML = "<a href=\"mailto:"+ tagValue+"\" target=\"_blank\">"+tagValue+"&nbsp;</a>";
+	}else if(uitype == '17')
+	{
+		getObj(dtlView).innerHTML = "<a href=\"http://"+ tagValue+"\" target=\"_blank\">"+tagValue+"&nbsp;</a>";
+	}else if(uitype == '34' || (uitype == '115' && fieldName == 'primary_org'))
+	{
+	    var data = "file=UpdateUserOrg&module=" + module + "&action=" + module + "Ajax&recordid=" + crmId;
+	    new Ajax.Request(
+		'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: data,
+                        onComplete: function(response) {
+			    $("dvtUserOrg").innerHTML = response.responseText;
+                        }
+                }
+            );
+	}else if(uitype == '85')
+        {
+                getObj(dtlView).innerHTML = "<a href=\"skype://"+ tagValue+"?call\">"+tagValue+"&nbsp;</a>";
+        }else if(uitype == '53')
+	{
+		var hdObj = getObj(hdTxt);
+		if(typeof(document.DetailView.assigntype[0]) != 'undefined')
+        {
+			var assign_type_U = document.DetailView.assigntype[0].checked;
+			var assign_type_G = document.DetailView.assigntype[1].checked;
+		}else
+		{
+			var assign_type_U = document.DetailView.assigntype.checked;
+		}
+		if(isAdmin == "0")
+		{
+			getObj(dtlView).innerHTML = hdObj.value;
+		}else if(isAdmin == "1" && assign_type_U == true)
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Users&action=DetailView&record="+tagValue+"\">"+hdObj.value+"&nbsp;</a>";
+		}else if(isAdmin == "1" && assign_type_G == true)
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Users&action=GroupDetailView&groupId="+tagValue+"\">"+hdObj.value+"&nbsp;</a>";
+		}
+	}else if(uitype == '56')
+	{
+		if(tagValue == '1')
+		{
+			getObj(dtlView).innerHTML = "yes";
+		}else
+		{
+			getObj(dtlView).innerHTML = "";
+		}
+
+	}else if(uitype == 116)
+	{
+			getObj(dtlView).innerHTML = document.getElementById(txtBox).options[document.getElementById(txtBox).selectedIndex].text; 
+	}
+	else if(getObj(popupTxt))
+	{
+		var popObj = getObj(popupTxt);
+		if(uitype == '50' || uitype == '73' || uitype == '51')
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Accounts&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+		}
+		else if(uitype == '57')
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Contacts&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+		}
+		else if(uitype == '59')
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Products&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+		}
+		else if(uitype == '75' || uitype == '81' )
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Vendors&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+
+		}
+		else if(uitype == '76')
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Potentials&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+		}
+		else if(uitype == '78')
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=Quotes&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+		}
+		else if(uitype == '80')
+		{
+			getObj(dtlView).innerHTML = "<a href=\"index.php?module=SalesOrder&action=DetailView&record="+tagValue+"\">"+popObj.value+"&nbsp;</a>";
+		}
+		else if(uitype == '53')
+		{
+			var hdObj = getObj(hdTxt);
+			if(isAdmin == "0")
+			{
+				getObj(dtlView).innerHTML = hdObj.value;
+			}else if(isAdmin == "1")
+			{
+				getObj(dtlView).innerHTML = "<a href=\"index.php?module=Users&action=DetailView&record="+tagValue+"\">"+hdObj.value+"&nbsp;</a>";;
+			}
+		}
+		else if(uitype == '56')
+		{
+			if(tagValue == '1')
+			{
+				getObj(dtlView).innerHTML = "yes";
+			}else
+			{
+				getObj(dtlView).innerHTML = "";
+			}
+
+		}
+		else
+		{
+			getObj(dtlView).innerHTML = popObj.value;
+		}
+	}else if(uitype == '33' || uitype == '34')
+  	{
+		/* Wordwrap a long list of multi-select combo box items at the
+                 * item separator string */
+                const DETAILVIEW_WORDWRAP_WIDTH = "70"; // must match value in DetailViewUI.tpl.
+
+                var lineLength = 0;
+                for(var i=0; i < r.length; i++) {
+                        lineLength += r[i].length + 2; // + 2 for item separator string
+                        if(lineLength > DETAILVIEW_WORDWRAP_WIDTH && i > 0) {
+                                lineLength = r[i].length + 2; // reset.
+                            r[i] = '<br/>&nbsp;' + r[i]; // prepend newline.
+                        }
+                        // Prevent a browser splitting multiword items:
+                        r[i] = r[i].replace(/ /g, '&nbsp;');
+                }
+                /* Join items with item separator string (which must match string in DetailViewUI.tpl,
+                 * EditViewUtils.php and CRMEntity.php)!!
+                 */
+       		getObj(dtlView).innerHTML = r.join(", ");
+	}else if(uitype == '3' || uitype == '4' || uitype == '14' || uitype == '18' || uitype == '31' || uitype == '32') 
+	{
+	    var data = "file=DetailView&module=" + module + "&action=" + module + "Ajax&record=" + crmId+"&recordid=" + crmId ;
+	    new Ajax.Request(
+		'index.php',
+                {queue: {position: 'end', scope: 'command'},
+		    method: 'post',
+		    postBody: data,
+		    onComplete: function(response) {
+			result = response.responseText.split('<!-- @#@#@#@# '+fieldLabel+' @#@#@#@# -->');
+			$("mouseArea_"+fieldLabel).innerHTML= result[1];
+		    }
+                }
+            );
+	}else
+	{
+		getObj(dtlView).innerHTML = tagValue;
+	}
+	showHide(dtlView,editArea);  //show,hide
+	itsonview=false;
+}
+
+function SaveTag(txtBox,crmId,module)
+{
+	var tagValue = document.getElementById(txtBox).value;
+	document.getElementById(txtBox).value ='';
+	$("vtbusy_info").style.display="inline";
+	new Ajax.Request(
+		'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody: "file=TagCloud&module=" + module + "&action=" + module + "Ajax&recordid=" + crmId + "&ajxaction=SAVETAG&tagfields=" +tagValue,
+                        onComplete: function(response) {
+				        getObj('tagfields').innerHTML = response.responseText;
+					$("vtbusy_info").style.display="none";
+                        }
+                }
+        );
+    
+}
+function setSelectValue(fieldLabel)
+{
+	if(globaluitype == 53)
+	{
+		if(typeof(document.DetailView.assigntype[0]) != 'undefined')
+		{
+			var assign_type_U = document.DetailView.assigntype[0].checked;
+			var assign_type_G = document.DetailView.assigntype[1].checked;
+			if(assign_type_U == true)
+				var selCombo= 'txtbox_U'+fieldLabel;
+			else if(assign_type_G == true)	
+				var selCombo= 'txtbox_G'+fieldLabel;
+		}else
+		{
+			var selCombo= 'txtbox_U'+fieldLabel;
+		}
+	}else
+	{
+			var selCombo= 'txtbox_'+fieldLabel;
+	}
+	var hdTxtBox = 'hdtxt_'+fieldLabel;
+	var oHdTxtBox = document.getElementById(hdTxtBox);
+	var oSelCombo = document.getElementById(selCombo);
+
+	oHdTxtBox.value = oSelCombo.options[oSelCombo.selectedIndex].text;
+}
+

Modified: vtigercrm/branches/5.1_jens/include/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.1_jens/include/language/en_us.lang.php Tue Nov 14 03:16:10 2006
@@ -1,1220 +1,1258 @@
-<?php
-
-/*********************************************************************************
-
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
-
- * ("License"); You may not use this file except in compliance with the
-
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
-
- * Software distributed under the License is distributed on an  "AS IS"  basis,
-
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-
- * the specific language governing rights and limitations under the License.
-
- * The Original Code is:  SugarCRM Open Source
-
- * The Initial Developer of the Original Code is SugarCRM, Inc.
-
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
-
- * All Rights Reserved.
-
- * Contributor(s): ______________________________________.
-
- ********************************************************************************/
-
-/*********************************************************************************
-
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/include/language/en_us.lang.php,v 1.68 2005/04/26 06:50:39 rank Exp $
-
- * Description:  Defines the English language pack for the base application.
-
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
-
- * All Rights Reserved.
-
- * Contributor(s): ______________________________________..
-
- ********************************************************************************/
-
-
-
-$app_strings = Array(
-
-'LBL_CHARSET'=>'ISO-8859-1',
-
-'LBL_BROWSER_TITLE'=>'vtiger CRM 5 - Commercial Open Source CRM',
-
-'LBL_MY_ACCOUNT'=>'My Account',
-
-'LBL_MY_PREFERENCES'=>'My Preferences',
-
-'LBL_ADMIN'=>'Admin',
-
-'LBL_LOGOUT'=>'Sign out',
-
-'LBL_SEARCH'=>'Search',
-
-'LBL_LAST_VIEWED'=>'Last Viewed',
-
-'NTC_WELCOME_MESSAGE'=>"Welcome to vtiger CRM!",
-
-'NTC_DESCRIPTION'=>"Use a valid username and password to login to the vtiger CRM.",
-
-'NTC_WELCOME'=>'Welcome',
-
-'NTC_NO_ITEMS_DISPLAY'=>'none',
-
-'LBL_OR'=>'or',
-
-'LBL_ALT_HOT_KEY'=>'Alt+',
-//added for 4.2
-'LBL_SAVE_LABEL'=>'Save',
-
-'LBL_SEND_MAIL_BUTTON'=>'Send Mail',
-
-
-'LBL_SAVE_BUTTON_TITLE'=>'Save [Alt+S]',
-
-'LBL_EDIT_BUTTON_TITLE'=>'Edit [Alt+E]',
-
-'LBL_CONVERTSO_BUTTON_TITLE'=>'Create SalesOrder',
-'LBL_CONVERTINVOICE_BUTTON_TITLE'=>'Create Invoice',
-
-'LBL_EDIT_BUTTON'=>'Edit',
-
-'LBL_DUPLICATE_BUTTON_TITLE'=>'Duplicate [Alt+U]',
-
-'LBL_DUPLICATE_BUTTON'=>'Duplicate',
-
-'LBL_TABCUSTOMISE_BUTTON_TITLE'=>'Customise [Alt+C]',
-
-'LBL_FORUM_HIDE_BUTTON_TITLE'=>'Hide Forum [Alt+I]',
-
-'LBL_FORUM_HIDE_BUTTON_KEY'=>'H',
-
-'LBL_FORUM_SHOW_BUTTON_TITLE'=>'Show Forum [Alt+W]',
-
-'LBL_FORUM_SHOW_BUTTON_KEY'=>'W',
-
-'LBL_TABCUSTOMISE_BUTTON'=>'Customise',
-
-'LBL_DELETE_BUTTON_TITLE'=>'Delete [Alt+D]',
-
-'LBL_DELETE_BUTTON'=>'Delete',
-
-'LBL_FIND_BUTTON'=>'Find',
-
-'LBL_CONVERT_BUTTON_TITLE'=>'Convert [Alt+C]',
-
-'LBL_CONVERT_BUTTON_KEY'=>'C',
-
-'LBL_CONVERT_BUTTON_LABEL'=>'Convert Lead',
-
-'LBL_TABCUSTOMISE_BUTTON_KEY'=>'C',
-
-'LBL_TABCUSTOMISE_BUTTON_LABEL'=>'Customize Tab',
-
-'LBL_ROLES_BUTTON_LABEL'=>'Show Roles',
-
-'LBL_LISTROLES_BUTTON_LABEL'=>'List Roles',
-
-'LBL_FORUM_HIDE_BUTTON_LABEL'=>'Hide Forums',
-
-'LBL_FORUM_SHOW_BUTTON_LABEL'=>'Show Forums',
-
-'LBL_NEW_BUTTON_TITLE'=>'New [Alt+N]',
-
-'LBL_CHANGE_BUTTON_TITLE'=>'Change [Alt+G]',
-
-'LBL_CANCEL_BUTTON_TITLE'=>'Cancel [Alt+X]',
-
-'LBL_SEARCH_BUTTON_TITLE'=>'Search [Alt+Q]',
-
-'LBL_CLEAR_BUTTON_TITLE'=>'Clear [Alt+C]',
-
-'LBL_SELECT_BUTTON_TITLE'=>'Select [Alt+T]',
-
-'LBL_CREATE_BUTTON_LABEL' =>'Create',
-
-'LBL_GENERATE'=>'Generate',
-
-'LBL_SAVE_BUTTON_KEY'=>'S',
-
-'LBL_EDIT_BUTTON_KEY'=>'E',
-'LBL_CONVERTSO_BUTTON_KEY'=>'S',
-'LBL_CONVERTINVOICE_BUTTON_KEY'=>'I',
-
-'LBL_DUPLICATE_BUTTON_KEY'=>'U',
-
-'LBL_DELETE_BUTTON_KEY'=>'D',
-
-'LBL_NEW_BUTTON_KEY'=>'N',
-
-'LBL_CHANGE_BUTTON_KEY'=>'G',
-
-'LBL_CANCEL_BUTTON_KEY'=>'X',
-
-'LBL_SEARCH_BUTTON_KEY'=>'Q',
-
-'LBL_CLEAR_BUTTON_KEY'=>'C',
-
-'LBL_SELECT_BUTTON_KEY'=>'T',
-
-'LBL_SAVE_BUTTON_LABEL'=>'Save',
-
-'LBL_EDIT_BUTTON_LABEL'=>'Edit',
-'LBL_CONVERTSO_BUTTON_LABEL'=>'Create SalesOrder',
-'LBL_CONVERTINVOICE_BUTTON_LABEL'=>'Create Invoice',
-
-'LBL_DUPLICATE_BUTTON_LABEL'=>'Duplicate',
-
-'LBL_DELETE_BUTTON_LABEL'=>'Delete',
-
-'LBL_NEW_BUTTON_LABEL'=>'New',
-
-'LBL_CHANGE_BUTTON_LABEL'=>'Change',
-
-'LBL_CANCEL_BUTTON_LABEL'=>'Cancel',
-
-'LBL_SEARCH_BUTTON_LABEL'=>'Search',
-
-'LBL_CLEAR_BUTTON_LABEL'=>'Clear',
-
-'LBL_SELECT_BUTTON_LABEL'=>'Select',
-
-'LBL_SELECT_CONTACT_BUTTON_TITLE'=>'Select Contact [Alt+T]',
-
-'LBL_SELECT_CONTACT_BUTTON_KEY'=>'T',
-
-'LBL_SELECT_CONTACT_BUTTON_LABEL'=>'Select Contact',
-
-'LBL_SELECT_CAMPAIGN_BUTTON_LABEL'=>'Select Campaign',
-
-'LBL_SELECT_USER_BUTTON_TITLE'=>'Select User [Alt+U]',
-
-'LBL_SELECT_USER_BUTTON_KEY'=>'U',
-
-'LBL_SELECT_USER_BUTTON_LABEL'=>'Select User',
-
-'LBL_SETTINGS'=>'Settings',
-
-'LBL_LIST_USERIP'=>'User IP',
-
-'LBL_LIST_SIGNIN'=>'Sign in Time',
-
-'LBL_LIST_SIGNOUT'=>'Sign out Time',
-
-'LBL_LIST_STATUS'=>'Status',
-
-
-
-'LBL_LIST_NAME'=>'Name',
-
-'LBL_LIST_USER_NAME'=>'User Name',
-
-'LBL_LIST_EMAIL'=>'Email',
-
-'LBL_LIST_PHONE'=>'Phone',
-
-'LBL_LIST_CONTACT_NAME'=>'Contact Name',
-
-'LBL_LIST_ACCOUNT_NAME'=>'Account Name',
-
-'LBL_USER_LIST'=>'User List',
-
-'LBL_CONTACT_LIST'=>'Contact List',
-
-'LBL_LNK_SETTINGS'=> 'Settings',
-
-'LNK_IMPORT_LEADS'=>'Import Leads',
-
-'LBL_LOCATE_MAP'=>'Locate Map',
-
-'LBL_ADDRESS'=>'Address',
-
-'LBL_ADD_TAG'=>'Add Tag',
-
-'LBL_TAG_IT'=>'Tag it',
-
-'LBL_CLOSE'=>'Close',
-
-'LNK_ADVANCED_SEARCH'=>'Advanced Search',
-
-'LNK_BASIC_SEARCH'=>'Basic Search',
-
-'LNK_EDIT'=>'edit',
-
-'LNK_REMOVE'=>'rem',
-
-'LNK_DELETE'=>'del',
-
-'LNK_LIST_START'=>'Start',
-
-'LNK_LIST_NEXT'=>'Next',
-
-'LNK_LIST_PREVIOUS'=>'Previous',
-
-'LNK_LIST_END'=>'End',
-
-'LBL_LIST_OF'=>'of',
-
-'LNK_PRINT'=>'Print',
-
-'LNK_HELP'=>'Help',
-
-'LNK_VTDOCS'=>'vtiger Docs',
-
-'LNK_ABOUT'=>'About',
-
-'LNK_OUTLOOK'=>'./include/images/outlook_download.gif',
-
-'LNK_NEW_HDESK'=>'New Ticket',
-
-'LNK_NEW_PRODUCT'=>'New Product',
-
-'LNK_NEW_CONTACT'=>'New Contact',
-
-'LNK_NEW_CAMPAIGN'=>'New Campaign',
-
-'LNK_NEW_LEAD'=>'New Lead',
-
-'LNK_NEW_ACCOUNT'=>'New Account',
-
-'LNK_NEW_OPPORTUNITY'=>'New Potential',
-
-'LNK_NEW_NOTE'=>'New Note',
-
-'LNK_NEW_EMAIL'=>'New Email',
-
-'LNK_NEW_TASK'=>'New Task',
-
-'LNK_NEW_EVENT'=>'New Event',
-'LNK_NEW_QUOTE'=>'New Quote',
-'LNK_NEW_PO'=>'New Purchase Order',
-'LNK_NEW_SO'=>'New Sales Order',
-'LNK_NEW_INVOICE'=>'New Invoice',
-'LNK_NEW_VENDOR'=>'New Vendor',
-'LNK_NEW_PRICEBOOK'=>'New PriceBook',
-
-
-'NTC_REQUIRED'=>'Indicates required field',
-
-'LBL_REQUIRED_SYMBOL'=>'*',
-
-'LBL_CURRENCY_SYMBOL'=>'$',
-
-'LBL_THOUSANDS_SYMBOL'=>'K',
-
-'NTC_DATE_FORMAT'=>'(yyyy-mm-dd)',
-
-'NTC_TIME_FORMAT'=>'(24:00)',
-
-'NTC_DATE_TIME_FORMAT'=>'(yyyy-mm-dd 24:00)',
-
-'NTC_DELETE_CONFIRMATION'=>'Are you sure you want to delete this record?',
-
-'ERR_DELETE_RECORD'=>'A record number must be specified to delete the contact.',
-
-'ERR_CREATING_TABLE'=>'Error creating table: ',
-
-'ERR_CREATING_FIELDS'=>'Error filling in additional detail fields: ',
-
-'ERR_MISSING_REQUIRED_FIELDS'=>'Missing required fields:',
-
-'ERR_INVALID_EMAIL_ADDRESS'=>'not a valid email address.',
-
-'ERR_INVALID_DATE_FORMAT'=>'The date format must be: yyyy-mm-dd',
-
-'ERR_INVALID_MONTH'=>'Please enter a valid month.',
-
-'ERR_INVALID_DAY'=>'Please enter a valid day.',
-
-'ERR_INVALID_YEAR'=>'Please enter a valid 4 digit year.',
-
-'ERR_INVALID_DATE'=>'Please enter a valid date.',
-
-'ERR_INVALID_HOUR'=>'Please enter a valid hour.',
-
-'ERR_INVALID_TIME'=>'Please enter a valid time.',
-
-'NTC_CLICK_BACK'=>'Please click the browser back button and fix the error.',
-
-'LBL_LIST_ASSIGNED_USER'=>'Assigned To',
-
-'LBL_ASSIGNED_TO'=>'Assigned To:',
-
-'LBL_DATE_MODIFIED'=>'Last Modified:',
-
-'LBL_DATE_ENTERED'=>'Created:',
-
-'LBL_CURRENT_USER_FILTER'=>'Only my items:',
-
-'NTC_LOGIN_MESSAGE'=>"Login",
-
-'LBL_NONE'=>'--None--',
-
-'LBL_BACK'=>'Back',
-
-'LBL_IMPORT'=>'Import',
-
-'LBL_EXPORT'=>'Export',
-
-'LBL_EXPORT_ALL'=>'Export All',
-
-'LBL_QUICK_CREATE'=>'Quick Create',
-
-'Export'=>'Export',
-'Import'=>'Import',
-'Merge'=>'Merge',
-'ConvertLead'=>'ConvertLead',
-
-
-'LBL_SHOW_RESULTS'=>'Show Results in',
-'LBL_TOTAL_RECORDS_FOUND'=>'Total Records found :',
-'LBL_SEARCH_RESULTS_FOR'=>' -- Search results for ',
-'LBL_TAG_SEARCH'=>' -- Tag search for ',
-'LBL_NO_DATA'=>'No Data Found',
-
-
-//3.2 release
-
-'NTC_MERGE_CONFIRMATION'=>'Are you sure you want to merge this record?',
-
-'LBL_MERGE_BUTTON_TITLE'=>'Merge',
-
-'LBL_MERGE_BUTTON_KEY'=> 'Merge',
-
-'LBL_SELECTEMAILTEMPLATE_BUTTON_TITLE'=>'Select Email Template',
-
-'LBL_SELECTEMAILTEMPLATE_BUTTON_KEY'=>'Select Email Template',
-
-'LBL_SELECTEMAILTEMPLATE_BUTTON_LABEL'=>'Select Email Template',
-
-'LBL_MERGE_BUTTON_LABEL'=>'Merge',
-
-'LBL_SENDMAIL_BUTTON_TITLE'=>'SendMail',
-
-'LBL_SENDMAIL_BUTTON_KEY'=> 'SendMail',
-
-'LBL_SENDMAIL_BUTTON_LABEL'=>'Send Mail',
-
-
-
-//Added fields for upload file as attachment -- 4 Beta
-
-'LBL_UPD_DESC'=>'Description',
-
-'LBL_FILENAME'=>'File Name',
-
-'LBL_FILE'=>'File',
-
-'LBL_TYPE'=>'File Type',
-
-'LBL_DOWNLOAD'=>'Download Now',
-
-'LBL_OPERATION'=>'Operation',
-
-'LBL_GROUP_ALLOCATION_TITLE'=>'My Group Allocation ',
-
-'LBL_ENTITY_NAME'=>'Entity Name',
-
-'LBL_GROUP_NAME'=>'Group',
-
-'LBL_ENTITY_TYPE'=>'Type',
-
-
-
-//Added fields for Ticket Attachment in RelatedTicketListUtil
-
-'LBL_NEW_TICKET'=>'New Ticket',
-
-'LBL_TITLE'=>'Title',
-
-'LBL_PRIORITY'=>'Priority',
-
-'LBL_STATUS'=>'Status',
-
-
-
-//Added fields for Change Owner and Change Status in all modules -- after 4 Beta
-
-'LBL_CHANGE_OWNER'=>'Change Owner',
-
-'LBL_CHANGE_STATUS'=>'Change Status',
-
-'LBL_MASS_DELETE'=>'Delete',
-//added by raju
-
-'LBL_ADD_ITEM'=>'Add',
-
-'LBL_ADD_NEW'=>'Add',
-
-'LBL_DEDUCT'=>'Deduct',
-//Added for version 5
-
-'LBL_CALENDAR_TITLE'=>'Open Calendar...',
-'LBL_CALENDAR_ALT'=>'Open Calendar...',
-
-'LBL_CALCULATOR_TITLE'=>'Open Calculator...',
-'LBL_CALCULATOR_ALT'=>'Open Calculator...',
-
-'LBL_CLOCK_TITLE'=>'Show World Clock...',
-'LBL_CLOCK_ALT'=>'Show World Clock...',
-
-'LBL_ALL_MENU_TITLE'=>'Open All Menu...',
-'LBL_ALL_MENU_ALT'=>'Open All Menu...',
-
-'LBL_CHAT_TITLE'=>'Chat...',
-'LBL_CHAT_ALT'=>'Chat...',
-
-'LBL_SEARCH_TITLE'=>'Search in ',
-'LBL_SEARCH_ALT'=>'Search in ',
-
-'LBL_SEARCH_STRING'=>'Search...',
-
-'LBL_SEARCH_FOR'=>'Search for',
-'LBL_SEARCH_NOW_BUTTON'=>'Search Now',
-'LBL_GO_TO'=>'Go to',
-'LBL_FEWER_BUTTON'=>'Fewer',
-'LBL_IN'=>'In',
-
-'LBL_ADV_SEARCH_MSG_ANY'=>'Match Any of the Following',
-'LBL_ADV_SEARCH_MSG_ALL'=>'Match All of the Following',
-
-'COMBO_ALL'=>'All',
-
-// Added fields for Related Field Display Informations in Detail View of All Modules
-
-'LBL_OPEN_ACTIVITIES'=>'Open Activities',
-
-'LBL_HISTORY'=>'History',
-
-'LBL_ACTIVITY_HISTORY'=>'Activity History',
-
-'LBL_ATTACHMENTS'=>'Attachments',
-
-'LBL_ATTACHMENT'=>'Attachment',
-
-'LBL_TYPE'=>'Type',
-
-'LBL_ASSIGNED_TO'=>'Assigned To',
-
-'LBL_TIME'=>'Time',
-
-'LBL_ACTION'=>'Action',
-
-'LBL_SUBJECT'=>'Subject',
-
-'LBL_RELATED_TO'=>'Related To',
-
-//added by raju for emails
-
-'LBL_MULTIPLE'=>'Multiple',
-
-'LBL_DUE_DATE'=>'Due Date',
-
-'LBL_LAST_MODIFIED'=>'Last Modified',
-
-'LBL_CREATED'=>'Created', // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Added
-
-'LBL_DESCRIPTION'=>'Description',
-
-
-
-'LBL_NEW_TASK'=>'New Task',
-
-'LBL_NEW_EVENT'=>'New Event',
-
-'LBL_ATTACHMENT_AND_NOTES'=>'Attachments & Notes',
-
-'LBL_POTENTIAL_NAME'=>'Potential Name',
-
-'LBL_CONTACT_NAME'=>'Contact Name',
-
-'LBL_DEPARTMENT'=>'Department',
-
-'LBL_ROLE'=>'Role',
-
-'LBL_EMAIL'=>'Email',
-
-'LBL_PHONE'=>'Phone',
-
-'LBL_PRODUCT'=>'Product',
-
-'LBL_AMOUNT'=>'Amount',
-
-'LBL_CLOSE_DATE'=>'Close Date',
-
-'LBL_NEW_ATTACHMENT'=>'New Attachment',
-
-'LBL_NEW_NOTE'=>'New Note',
-
-
-
-'LBL_PRODUCT_TITLE'=>'Products',
-
-'LBL_NEW_PRODUCT'=>'New Product',
-
-'LBL_PRODUCT_NAME'=>'Product Name',
-
-'LBL_QUANTITY'=>'Quantity',
-
-'LBL_SALES_PRICE'=>'Sale Price',
-
-'LBL_PURCHASE_DATE'=>'Purchase Date',
-
-'LBL_TICKET_ID'=>'Ticket Id',
-
-'LBL_NEW_TICKET'=>'New Ticket',
-
-'LBL_TICKETS'=>'Tickets',
-
-
-
-'LBL_POTENTIAL_TITLE'=>'Potentials',
-
-'LBL_NEW_POTENTIAL'=>'New Potential',
-
-'LBL_LEAD_NAME'=>'Lead Name',
-
-'LBL_ACCOUNT_NAME'=>'Account Name',
-
-'LBL_ACCOUNT_TYPE'=>'Account Type',
-
-'LBL_USER_TITLE'=>'Users',
-
-'LBL_CONTACT_TITLE'=>'Contacts',
-
-
-
-// 4 GA
-
-'LBL_SHOWING' => 'Showing',
-
-//
-
-
-
-//Added fields after RC1 - Release
-
-'LBL_SELECT_PRODUCT_BUTTON_LABEL'=>'Select Product',
-
-'LBL_VIEW'=>'Filters :',
-// Mike Crowe Mod --------------------------------------------------------Added for group sort
-'LBL_GROUP_VIEW'=>'Group',
-
-
-'LBL_SALES_STAGE'=>'Sales Stage',
-
-'LBL_PROBABILITY'=>'Probability',
-
-'LBL_BULK_MAILS'=>'Bulk Mails',
-
-
-
-'LBL_WORLD_CLOCK'=>'World Clock',
-
-'LBL_CALCULATOR'=>'Calculator',
-
-'LBL_CLOSE_WON' =>'Closed-Won',			# 'Closed Won'
-'LBL_CLOSE_LOST'=>'Closed-Lost',					# 'Closed Lost'
-
-'LBL_USER'=>'User',
-
-'LBL_TEAM'=>'Team',
-
-'LBL_GROUP'=>'Group',
-
-'LBL_NONE_NO_LINE'=>'none',
-
-'LBL_SELECT_GROUP'=>'Select a group',
-
-'LBL_HOUR_AND_MINUTE'=>'(hours/minutes)',
-
-'YEAR_MONTH_DATE'=>'24:00',
-
-
-
-'COMBO_LEADS'=>'Leads',
-
-'COMBO_ACCOUNTS'=>'Accounts',
-
-'COMBO_CONTACTS'=>'Contacts',
-
-'COMBO_POTENTIALS'=>'Potentials',
-
-'COMBO_PRODUCTS'=>'Products',
-
-'COMBO_HELPDESK'=>'Trouble Tickets',
-
-'COMBO_USERS'=>'Users',
-
-'COMBO_CAMPAIGNS'=>'Campaigns',
-
-
-'LBL_SELECT'=>'Select',
-
-'LBL_EDIT'=>'Edit',
-
-'LBL_DELETE'=>'Delete',
-
-
-
-//List Fields
-
-'Name'=>'Name',
-
-'Company'=>'Company',
-
-'Phone'=>'Phone',
-
-'Website'=>'Website',
-
-'Email'=>'Email',
-
-'Assigned To'=>'Assigned To',
-
-'Account Name'=>'Account Name',
-
-'City'=>'City',
-
-'Title'=>'Title',
-
-'Potential'=>'Potential',
-
-'Sales Stage'=>'Sales Stage',
-
-'Amount'=>'Amount',
-
-'Expected Close'=>'Expected Close',
-
-'Subject'=>'Subject',
-
-'Contact Name'=>'Contact Name',
-
-'Related to'=>'Related To',
-
-'File'=>'File',
-
-'Last Modified'=>'Last Modified',
-
-'Close'=>'Close',
-
-'Type'=>'Type',
-
-'Start Date/Due Date'=>'Start Date/Due Date',
-
-'Date Sent'=>'Date Sent',
-
-'Ticket ID'=>'Ticket ID',
-
-'Status'=>'Status',
-
-'Priority'=>'Priority',
-
-'Product Name'=>'Product Name',
-
-'Product Code'=>'Part Number',
-
-'Commission Rate'=>'Commission Rate',
-
-'Qty/Unit'=>'Qty/Unit',
-
-'Unit Price'=>'Unit Price',
-
-'Question'=>'Question',
-
-'Category'=>'Category',
-
-'Price Book Name'=>'Price Book Name',
-'LBL_EVENT_ENDDATE'=>'End Date & Time',
-
-//Added after 4 GA
-'LBL_CUSTOM_INFORMATION'=>'Custom Information',
-
-//Added fields to display the related lists titles and None Scheduled 
-'LBL_NONE_SCHEDULED'=>'None Scheduled',
-
-'Leads'=>'Leads',
-'Accounts'=>'Accounts',
-'Accounts & Contacts'=>'Accounts & Contacts',
-'Contacts'=>'Contacts',
-'Potentials'=>'Potentials',
-'Products'=>'Products',
-'Emails'=>'Emails',
-'HelpDesk'=>'Trouble Tickets',
-'Activities'=>'Activities',
-'Events'=>'Events',
-'Tasks'=>'Tasks',
-'Todo'=>'To Do',
-'Call'=>'Call',
-'Meeting'=>'Meeting',
-'Quotes'=>'Quotes',
-'PriceBook'=>'Price Books',
-'PurchaseOrder'=>'Purchase Order',
-'SalesOrder'=>'Sales Order',
-'Invoice'=>'Invoices',
-'Calendar'=>'Calendar',
-'Home'=>'Home',
-'Campaigns'=>'Campaigns',
-'PriceBooks'=>'Price Books',
-'Notes'=>'Notes',
-'Faq'=>'FAQ',
-'Dashboards'=>'Dashboard',
-'Reports'=>'Reports',
-'Vendors'=>'Vendors',
-'Rss'=>'RSS',
-'Portal'=>'My Sites',
-'Webmails'=>'Webmails',
-'Attachments'=>'Attachments',
-'Activity History'=>'Activity History',
-'Ticket History'=>'Ticket History',
-'Purchase Order'=>'Purchase Order',
-'Sales Stage History'=>'Sales Stage History',
-'Users'=>'Users',
-'Admin'=>'Admin',
-'PurchaseOrder Status History'=>'PurchaseOrder Status History',
-'SalesOrder Status History'=>'SalesOrder Status History',
-'Quote Stage History'=>'Quote Stage History',
-'Invoice Status History'=>'Invoice Status History',
-'LBL_TROUBLE_TICKET'=>'Trouble Ticket',
-
-//Added language for Parent Tab
-
-'My Home Page'=>'My Home Page',
-'Marketing'=>'Marketing',
-'Sales'=>'Sales',
-'Support'=>'Support',
-'Analytics'=>'Analytics',
-'Inventory'=>'Inventory',
-'Tools'=>'Tools',
-'Settings'=>'Settings',
-
-'LBL_INFORMATION'=>'Information',
-'LBL_MORE'=>'More',
-'LBL_BASIC'=>'Basic',
-'LBL_CREATING'=>'Creating',
-'LBL_EDITING'=>'Editing',
-'LBL_NEW'=>'New',
-
-//Added for Detail/Edit/Related List of all modules
-
-'Lead'=>'Lead',
-'Account'=>'Account',
-'Contact'=>'Contact',
-'Potential'=>'Potential',
-'Opportunity'=>'Potential',
-'Product'=>'Product',
-'Email'=>'Email',
-'Activity'=>'Activity',
-'Event'=>'Event',
-'Task'=>'Task',
-'Quote'=>'Quote',
-'PriceBook'=>'PriceBook',
-'PurchaseOrder'=>'Purchase Order',
-'Ticket'=>'Ticket',
-'SalesOrder'=>'Sales Orders',
-'Campaign'=>'Campaign',
-'Note'=>'Note',
-'Dashboard'=>'Dashboards',
-'Report'=>'Report',
-'Vendor'=>'Vendor',
-'Webmail'=>'Webmail',
-
-'LBL_NONE_INCLUDED'=>'None Included',
-'LBL_ADD_TO'=>'Add to',
-
-'LBL_SELECT_TEMPLATE_TO_MAIL_MERGE'=>'Select template to Mail Merge:',
-'LBL_TITLE_OR_DESCRIPTION'=>'Title / Description',
-
-//Added for RSS Module
-'LBL_RSS_FEEDS'=>'RSS Feeds',
-'LBL_ADD_RSS_FEEDS'=>'Add New RSS Feed',
-
-//Added fields after 4.2 alpha
-'COMBO_ACCOUNTS'=>'Accounts',
-'LNK_NEW_FAQ'=>'New FAQ',
-'Vendor Name'=>'Vendor Name',
-'LNK_WEARE'=>'About us',
-'LBL_ABOUTUS_TITLE'=>'vtiger CRM - About Us',
-'LBL_DISCUSS'=>'Discuss with other users',
-'Quote Stage'=>'Quote Stage',
-'Potential Name'=>'Potential Name',
-'Total'=>'Total Amount',
-'First Name'=>'First Name',
-'Last Name'=>'Last Name',
-'User Name'=>'User Name',
-  /* For purchase order related list in vendor */
-'LBL_PORDER_BUTTON_TITLE'=>'New Purchase Order [Alt+O]',
-'LBL_PORDER_BUTTON'=>'New Purchase Order',
-'LBL_PORDER_BUTTON_KEY'=>'O',
-'Tracking Number'=>'Tracking Number',
-'Order Id'=>'Order Id',
-'Quote Name'=>'Quote Name',
-'Invoice Id'=>'Invoice Id',
-'Quote Id'=>'Quote Id',
-'Sales Order'=>'Sales Order',
- // Added Quote in activity parent type selection / Related list
-'COMBO_QUOTES'=>'Quotes',
-'End Date'=>'End Date',
-'Start Date'=>'Start Date',
-'Related to'=>'Related To',
-'Recurring Type'=> 'Recurring Type',
-'SalesOrders'=> 'Sales Order',
-'PurchaseOrder'=> 'Purchase Orders',
-'LBL_QUOTE_NAME'=>'Quote Name',
- //Added Orders in activity parent type selection / Related list
-'LBL_NEW_QUOTE_BUTTON_TITLE'=>'New Quote [Alt+Q]',
-'LBL_NEW_QUOTE_BUTTON_KEY'=>'Q',
-'LBL_NEW_QUOTE_BUTTON'=>'New Quote',
-'COMBO_PORDER'=>'Purchase Order',
-'COMBO_SORDER'=>'Sales Order',
-'LBL_PORDER_NAME'=>'Purchase Order',
-'LBL_SORDER_NAME'=>'Sales Order',
- // Added Invoice in activity parent type selection / Related list
-'COMBO_INVOICES'=>'Invoice',
-'LBL_INVOICE_NAME'=>'Invoice',
-'LBL_HELPDESK_NAME'=>'Trouble Ticket',
-'LBL_CAMPAIGN_NAME'=>'Campaign Name',
-
-'LBL_NEW_INVOICE_BUTTON_TITLE'=>'New Invoice [Alt+I]',
-'LBL_NEW_INVOICE_BUTTON_KEY'=>'I',
-'LBL_NEW_INVOICE_BUTTON'=>'New Invoice',
-'LBL_NEW_SORDER_BUTTON_TITLE'=>'New Sales Order [Alt+E]',
-'LBL_NEW_SORDER_BUTTON_KEY'=>'E',
-'LBL_NEW_SORDER_BUTTON'=>'New Sales Order',
-
-'LBL_PRODUCT_DETAILS'=>'Product Details',
-'LBL_PRODUCT'=>'Product',
-'LBL_QTY_IN_STOCK'=>'Qty In Stock',
-'LBL_QTY'=>'Qty',
-'LBL_UNIT_PRICE'=>'Unit Price',
-'LBL_LIST_PRICE'=>'List Price',
-'LBL_TOTAL'=>'Total',
-'LBL_ADD_PRODUCT'=>'Add Product',
-'LBL_SUB_TOTAL'=>'Sub Total',
-'LBL_TAX'=>'Tax',
-'LBL_ADJUSTMENT'=>'Adjustment',
-'LBL_GRAND_TOTAL'=>'Grand Total',
-'LBL_QUOTE_ID'=>'Quote Id',
-'LBL_SALES_ORDER_ID'=>'Sales Order Id',
-'LBL_PURCHASE_ORDER_ID'=>'Purchase Order Id',
-'LBL_EXPORT_TO_PDF'=>'Export To PDF',
-
-//Added for 4.2 Patch I
-'LBL_HOME_KEY_METRICS'=>'Key Metrics',
-'LBL_HOME_METRICS'=>'Metrics',
-'LBL_HOME_COUNT'=>'Count',
-
-//Added for 4.2 patch 2
-'LBL_JSCALENDAR_LANG'=>'en',
-'LNK_CV_EDIT'=>'Edit',
-'LNK_CV_DELETE'=>'Delete',
-'LNK_CV_CREATEVIEW'=>'New',
-//Added for 5.0
-'LBL_UPD_FIELD_ORD'=>'Update Field Order',
-'LBL_SEND_CUSTOM_MAIL_BUTTON'=>'Send Custom Mail',
-'LBL_UPDATED_TODAY'=>'Updated today',
-'LBL_UPDATED'=>'Updated',
-'LBL_DAY_AGO'=>'day ago',
-'LBL_DAYS_AGO'=>'days ago',
-
-//Added to convert Month string in update info - ahmed
-
-'Jan'=>'Jan',
-'Feb'=>'Feb',
-'Mar'=>'Mar',
-'Apr'=>'Apr',
-'May'=>'May',
-'Jun'=>'Jun',
-'Jul'=>'Jul',
-'Aug'=>'Aug',
-'Sep'=>'Sep',
-'Oct'=>'Oct',
-'Nov'=>'Nov',
-'Dec'=>'Dec',
-
-//Added after 5.0 Alpha5
-'Campaign Name'=>'Campaign Name',
-'Campaign Type'=>'Campaign Type',
-'Campaign Status'=>'Campaign Status',
-'Expected Revenue'=>'Expected Revenue',
-'Expected Close Date'=>'Expected Close Date',
-'LBL_ACTIONS'=>'Actions',
-'LBL_SEND'=>'Send',
-'LBL_VAT'=>'VAT',
-'LBL_SALES'=>'Sales',
-'LBL_SERVICE'=>'Service',
-'LBL_TAX_DETAILS'=>'Tax Details',
-'LBL_TAX_CALCULATION'=>'Tax Calculation',
-'COVERED_PERCENTAGE'=>'(%)',
-
-'LBL_TAG_CLOUD'=>'Tag Cloud',
-'LBL_FOR'=>'for',
-'LBL_PO_STATUS'=>'PurchaseOrder Status',
-'LBL_SO_STATUS'=>'SalesOrder Status',
-'LBL_INVOICE_STATUS'=>'Invoice Status',
-'LBL_NOTE'=>'Note',
-'LBL_MODULE'=>'Module',
-'Active'=>'Active',
-'Inactive'=>'Inactive',
-'Today'=>'Today',
-'Last 2 Days'=>'Last 2 Days',
-'Last Week'=>'Last Week',
-'This Week'=>'This Week',
-'This Month'=>'This Month',
-'This Year'=>'This Year',
-'LBL_PLEASE_CLICK'=>'Please Click',
-'LBL_TO_CONFIGURE'=>'to Configure',
-'LBL_HERE'=>'here',
-'LBL_RECORDS'=>'Records',
-'LBL_SCROLL'=>'[Scroll to Top]',
-'LBL_EXPAND_COLLAPSE'=>'Expand/Collapse',
-'LBL_RCPY_ADDRESS'=>'Copy Shipping address',
-'LBL_LCPY_ADDRESS'=>'Copy Billing address',
-'LBL_RECORD_ID'=>'Record ID',
-'LBL_ACTION_DATE'=>'Action Date',
-'LBL_HOMEPAGE_DASHBOARD'=>'HomePage Dashboard',
-'LBL_NO'=>'No',
-'LBL_FOUND'=>'Found',
-'LBL_YOU_CAN_CREATE'=>'You can Create',
-'LBL_NOW'=>'now',
-'LBL_CLICK_THE_LINK'=>'Click the link below',
-'LBL_CREATE'=>'Create',
-'LBL_A'=>'a',
-'LBL_AN'=>'an',
-'LBL_YOU_ARE_NOT_ALLOWED_TO_CREATE'=>'You are not allowed to create',
-'LBL_TRANSFER_OWNERSHIP'=>'Transfer Ownership to',
-'LBL_SELECT_STATUS'=>'Select New Status',
-'LBL_UPDATE_OWNER'=>'Update Owner',
-'LBL_UPDATE_STATUS'=>'Update Status',
-
-//added for tax calculations - after 5beta2
-'LBL_NET_PRICE'=>'Net Price',
-'LBL_TOOLS'=>'Tools',
-'LBL_DISCOUNT'=>'Discount',
-'LBL_TOTAL_AFTER_DISCOUNT'=>'Total After Discount',
-'LBL_NET_TOTAL'=>'Net Total',
-'LBL_SHIPPING_AND_HANDLING_CHARGES'=>'Shipping & Handling Charges',
-'LBL_TAX_FOR_SHIPPING_AND_HANDLING'=>'Taxes For Shipping and Handling',
-'LBL_FINISH'=>'Finish',
-'LBL_IMAGE_DELETED'=>'Image Deleted',
-'LBL_TAX_MODE'=>'Tax Mode',
-'LBL_CLEAR_COMMENT'=>'Clear Comment',
-'LBL_ZERO_DISCOUNT'=>'Zero Discount',
-'LBL_OF_PRICE'=>'of Price',
-'LBL_DIRECT_PRICE_REDUCTION'=>'Direct Price Reduction',
-'LBL_INDIVIDUAL'=>'Individual',
-
-//Added the address strings for Contacts Module
-'LBL_CPY_MAILING_ADDRESS'=>'Copy Mailing Address',
-'LBL_CPY_OTHER_ADDRESS'=>'Copy Other Address',
-
-'LBL_PERMISSION'=>'You are not permitted to execute this Operation',
-'VTIGER'=>'vtiger',
-
-//Added for Inventory Tax details
-'LBL_DIRECT_AMOUNT_DISCOUNT'=>'Direct Amount Discount',
-'LBL_NO_DISCOUNT_FOR_THIS_PRODUCT'=>'No Discount for this Product',
-'LBL_TOTAL_TAX_AMOUNT'=>'Total Tax Amount',
-'LBL_FINAL_DISCOUNT_AMOUNT'=>'Final Discount Amount',
-'LBL_SHIPPING_AND_HANDLING_CHARGE'=>'Shipping & Handling Charge',
-'LBL_GO_BACK'=>'Go Back',
-
-//Record deleted message
-'LBL_RECORD_DELETE'=>'The record you are trying to view has been deleted.',
-);
-
-
-
-//the left value is the key stored in the db and the right value is the display value
-
-//to translate, only modify the right value in each key/value pair
-
-$app_list_strings = Array(
-
-//e.g. auf Deutsch 'Contacts'=>'Contakten',
-
-'moduleList' => Array('Home'=>'Home'
-
-				, 'Dashboard'=>'Dashboard'
-
-				, 'Leads'=>'Leads'
-
-				, 'Contacts'=>'Contacts'
-
-				, 'Accounts'=>'Accounts'
-
-				, 'Potentials'=>'Potentials'
-
-				, 'Campaigns'=>'Campaigns'
-
-				, 'Notes'=>'Notes'
-
-				, 'Emails'=>'Emails'
-
-				, 'Activities'=>'Activities'
-
-				, 'Products'=>'Products'
-
-				, 'HelpDesk'=>'Trouble Tickets'
-
-				, 'Faq'=>'FAQ'
-
-				, 'Calendar'=>'Calendar'
-
-				, 'Quotes'=>'Quotes'
-		
-				, 'PurchaseOrder'=>'PurchaseOrder'
-
-				, 'Invoice'=>'Invoice'
-
-				, 'Rss'=>'RSS'
-				
-				, 'Reports'=>'Reports'
-				
-				, 'Vendors'=>'Vendors'
-				
-				, 'PriceBooks'=>'PriceBooks'
-
-				, 'SalesOrder'=>'SalesOrder'
-
-				, 'Portal'=>'My Sites'
-				
-				),
-
-
-
-//Note:  do not translate opportunity_relationship_type_default_key
-
-//       it is the key for the default opportunity_relationship_type_dom value
-
-'opportunity_relationship_type_default_key' => 'Primary Decision Maker',
-
-'opportunity_relationship_type_dom' => Array(''=>''
-
-		, 'Primary Decision Maker'=>'Primary Decision Maker'
-
-		, 'Business Decision Maker'=>'Business Decision Maker'
-
-		, 'Business Evaluator'=>'Business Evaluator'
-
-		, 'Technical Decision Maker'=>'Technical Decision Maker'
-
-		, 'Technical Evaluator'=>'Technical Evaluator'
-
-		, 'Executive Sponsor'=>'Executive Sponsor'
-
-		, 'Influencer'=>'Influencer'
-
-		, 'Other'=>'Other'
-
-		),
-
-
-
-//Note:  do not translate case_relationship_type_default_key
-
-//       it is the key for the default case_relationship_type_dom value
-
-'case_relationship_type_default_key' => 'Primary Contact',
-
-'case_relationship_type_dom' => Array(''=>''
-
-		, 'Primary Contact'=>'Primary Contact'
-
-		, 'Alternate Contact'=>'Alternate Contact'
-
-		),
-
-
-
-'task_priority_dom' => Array('High'=>'High'
-
-		, 'Medium'=>'Medium'
-
-		, 'Low'=>'Low'
-
-		),
-
-
-
-'task_status_dom' => Array('Planned'=>'Planned'
-
-		, 'Completed'=>'Completed'
-
-		, 'Deferred'=>'Deferred'
-
-		),
-
-
-
-'meeting_status_dom' => Array('Planned'=>'Planned'
-
-		, 'Held'=>'Held'
-
-		, 'Not Held'=>'Not Held'
-
-		),
-
-
-
-'call_status_dom' => Array('Planned'=>'Planned'
-
-		, 'Held'=>'Held'
-
-		, 'Not Held'=>'Not Held'
-
-		),
-
-
-
-//Note:  do not translate case_status_default_key
-
-//       it is the key for the default case_status_dom value
-
-'case_status_default_key' => 'New',
-
-'case_status_dom' => Array('New'=>'New'
-
-		, 'Assigned'=>'Assigned'
-
-		, 'Closed'=>'Closed'
-
-		, 'Pending Input'=>'Pending Input'
-
-		, 'Rejected'=>'Rejected'
-
-		),
-
-
-
-'user_status_dom' => Array('Active'=>'Active'
-
-		, 'Inactive'=>'Inactive'
-
-		),
-
-
-
-//Note:  do not translate record_type_default_key
-
-//       it is the key for the default record_type_module value
-
-'record_type_default_key' => 'Accounts',
-
-'record_type_display' => array('Accounts' => 'Account',
-
-		'Leads' => 'Lead',
-
-		'Opportunities' => 'Opportunity'),
-
-);
-
-
-
-?>
+<?php
+
+/*********************************************************************************
+
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+
+ * ("License"); You may not use this file except in compliance with the
+
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+
+ * the specific language governing rights and limitations under the License.
+
+ * The Original Code is:  SugarCRM Open Source
+
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+
+ * All Rights Reserved.
+
+ * Contributor(s): ______________________________________.
+
+ ********************************************************************************/
+
+/*********************************************************************************
+
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/include/language/en_us.lang.php,v 1.68 2005/04/26 06:50:39 rank Exp $
+
+ * Description:  Defines the English language pack for the base application.
+
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+
+ * All Rights Reserved.
+
+ * Contributor(s): ______________________________________..
+
+ ********************************************************************************/
+
+
+
+$app_strings = Array(
+
+'LBL_CHARSET'=>'ISO-8859-1',
+
+'LBL_BROWSER_TITLE'=>'vtiger CRM 5 - Commercial Open Source CRM',
+
+'LBL_MY_ACCOUNT'=>'My Account',
+
+'LBL_MY_PREFERENCES'=>'My Preferences',
+
+'LBL_ADMIN'=>'Admin',
+
+'LBL_LOGOUT'=>'Sign out',
+
+'LBL_SEARCH'=>'Search',
+
+'LBL_LAST_VIEWED'=>'Last Viewed',
+
+'LBL_TODAY'=>'Today',
+
+'LBL_ALL'=>'All',
+
+'LBL_SHOW'=>'Show :',
+
+'today'=>"Today's",
+
+'all'=>'All',
+
+'LBL_UPCOMING_EVENTS'=>'Upcoming Activities',
+
+'LBL_PENDING_EVENTS'=>'Pending Activities',
+
+'NTC_WELCOME_MESSAGE'=>"Welcome to vtiger CRM!",
+
+'NTC_DESCRIPTION'=>"Use a valid username and password to login to the vtiger CRM.",
+
+'NTC_WELCOME'=>'Welcome',
+
+'NTC_NO_ITEMS_DISPLAY'=>'none',
+
+'LBL_OR'=>'or',
+
+'LBL_ALT_HOT_KEY'=>'Alt+',
+//added for 4.2
+'LBL_SAVE_LABEL'=>'Save',
+
+'LBL_SEND_MAIL_BUTTON'=>'Send Mail',
+
+
+'LBL_SAVE_BUTTON_TITLE'=>'Save [Alt+S]',
+
+'LBL_EDIT_BUTTON_TITLE'=>'Edit [Alt+E]',
+
+'LBL_CONVERTSO_BUTTON_TITLE'=>'Create SalesOrder',
+'LBL_CONVERTINVOICE_BUTTON_TITLE'=>'Create Invoice',
+
+'LBL_EDIT_BUTTON'=>'Edit',
+
+'LBL_DUPLICATE_BUTTON_TITLE'=>'Duplicate [Alt+U]',
+
+'LBL_DUPLICATE_BUTTON'=>'Duplicate',
+
+'LBL_TABCUSTOMISE_BUTTON_TITLE'=>'Customise [Alt+C]',
+
+'LBL_FORUM_HIDE_BUTTON_TITLE'=>'Hide Forum [Alt+I]',
+
+'LBL_FORUM_HIDE_BUTTON_KEY'=>'H',
+
+'LBL_FORUM_SHOW_BUTTON_TITLE'=>'Show Forum [Alt+W]',
+
+'LBL_FORUM_SHOW_BUTTON_KEY'=>'W',
+
+'LBL_TABCUSTOMISE_BUTTON'=>'Customise',
+
+'LBL_DELETE_BUTTON_TITLE'=>'Delete [Alt+D]',
+
+'LBL_DELETE_BUTTON'=>'Delete',
+
+'LBL_FIND_BUTTON'=>'Find',
+
+'LBL_CONVERT_BUTTON_TITLE'=>'Convert [Alt+C]',
+
+'LBL_CONVERT_BUTTON_KEY'=>'C',
+
+'LBL_CONVERT_BUTTON_LABEL'=>'Convert Lead',
+
+'LBL_TABCUSTOMISE_BUTTON_KEY'=>'C',
+
+'LBL_TABCUSTOMISE_BUTTON_LABEL'=>'Customize Tab',
+
+'LBL_ROLES_BUTTON_LABEL'=>'Show Roles',
+
+'LBL_LISTROLES_BUTTON_LABEL'=>'List Roles',
+
+'LBL_FORUM_HIDE_BUTTON_LABEL'=>'Hide Forums',
+
+'LBL_FORUM_SHOW_BUTTON_LABEL'=>'Show Forums',
+
+'LBL_NEW_BUTTON_TITLE'=>'New [Alt+N]',
+
+'LBL_CHANGE_BUTTON_TITLE'=>'Change [Alt+G]',
+
+'LBL_CANCEL_BUTTON_TITLE'=>'Cancel [Alt+X]',
+
+'LBL_SEARCH_BUTTON_TITLE'=>'Search [Alt+Q]',
+
+'LBL_CLEAR_BUTTON_TITLE'=>'Clear [Alt+C]',
+
+'LBL_SELECT_BUTTON_TITLE'=>'Select [Alt+T]',
+
+'LBL_CREATE_BUTTON_LABEL' =>'Create',
+
+'LBL_GENERATE'=>'Generate',
+
+'LBL_SAVE_BUTTON_KEY'=>'S',
+
+'LBL_EDIT_BUTTON_KEY'=>'E',
+'LBL_CONVERTSO_BUTTON_KEY'=>'S',
+'LBL_CONVERTINVOICE_BUTTON_KEY'=>'I',
+
+'LBL_DUPLICATE_BUTTON_KEY'=>'U',
+
+'LBL_DELETE_BUTTON_KEY'=>'D',
+
+'LBL_NEW_BUTTON_KEY'=>'N',
+
+'LBL_CHANGE_BUTTON_KEY'=>'G',
+
+'LBL_CANCEL_BUTTON_KEY'=>'X',
+
+'LBL_SEARCH_BUTTON_KEY'=>'Q',
+
+'LBL_CLEAR_BUTTON_KEY'=>'C',
+
+'LBL_SELECT_BUTTON_KEY'=>'T',
+
+'LBL_SAVE_BUTTON_LABEL'=>'Save',
+
+'LBL_EDIT_BUTTON_LABEL'=>'Edit',
+'LBL_CONVERTSO_BUTTON_LABEL'=>'Create SalesOrder',
+'LBL_CONVERTINVOICE_BUTTON_LABEL'=>'Create Invoice',
+
+'LBL_DUPLICATE_BUTTON_LABEL'=>'Duplicate',
+
+'LBL_DELETE_BUTTON_LABEL'=>'Delete',
+
+'LBL_NEW_BUTTON_LABEL'=>'New',
+
+'LBL_CHANGE_BUTTON_LABEL'=>'Change',
+
+'LBL_CANCEL_BUTTON_LABEL'=>'Cancel',
+
+'LBL_SEARCH_BUTTON_LABEL'=>'Search',
+
+'LBL_CLEAR_BUTTON_LABEL'=>'Clear',
+
+'LBL_SELECT_BUTTON_LABEL'=>'Select',
+
+'LBL_SELECT_CONTACT_BUTTON_TITLE'=>'Select Contact [Alt+T]',
+
+'LBL_SELECT_CONTACT_BUTTON_KEY'=>'T',
+
+'LBL_SELECT_CONTACT_BUTTON_LABEL'=>'Select Contact',
+
+'LBL_SELECT_CAMPAIGN_BUTTON_LABEL'=>'Select Campaign',
+
+'LBL_SELECT_USER_BUTTON_TITLE'=>'Select User [Alt+U]',
+
+'LBL_SELECT_USER_BUTTON_KEY'=>'U',
+
+'LBL_SELECT_USER_BUTTON_LABEL'=>'Select User',
+
+'LBL_SETTINGS'=>'Settings',
+
+'LBL_LIST_USERIP'=>'User IP',
+
+'LBL_LIST_SIGNIN'=>'Sign in Time',
+
+'LBL_LIST_SIGNOUT'=>'Sign out Time',
+
+'LBL_LIST_STATUS'=>'Status',
+
+
+
+'LBL_LIST_NAME'=>'Name',
+
+'LBL_LIST_USER_NAME'=>'User Name',
+
+'LBL_LIST_EMAIL'=>'Email',
+
+'LBL_LIST_PHONE'=>'Phone',
+
+'LBL_LIST_CONTACT_NAME'=>'Contact Name',
+
+'LBL_LIST_ACCOUNT_NAME'=>'Account Name',
+
+'LBL_USER_LIST'=>'User List',
+
+'LBL_CONTACT_LIST'=>'Contact List',
+
+'LBL_LNK_SETTINGS'=> 'Settings',
+
+'LNK_IMPORT_LEADS'=>'Import Leads',
+
+'LBL_LOCATE_MAP'=>'Locate Map',
+
+'LBL_ADDRESS'=>'Address',
+
+'LBL_ADD_TAG'=>'Add Tag',
+
+'LBL_TAG_IT'=>'Tag it',
+
+'LBL_CLOSE'=>'Close',
+
+'LNK_ADVANCED_SEARCH'=>'Advanced Search',
+
+'LNK_BASIC_SEARCH'=>'Basic Search',
+
+'LNK_EDIT'=>'edit',
+
+'LNK_REMOVE'=>'rem',
+
+'LNK_DELETE'=>'del',
+
+'LNK_LIST_START'=>'Start',
+
+'LNK_LIST_NEXT'=>'Next',
+
+'LNK_LIST_PREVIOUS'=>'Previous',
+
+'LNK_LIST_END'=>'End',
+
+'LBL_LIST_OF'=>'of',
+
+'LNK_PRINT'=>'Print',
+
+'LNK_HELP'=>'Help',
+
+'LNK_VTDOCS'=>'vtiger Docs',
+
+'LNK_ABOUT'=>'About',
+
+'LNK_OUTLOOK'=>'./include/images/outlook_download.gif',
+
+'LNK_NEW_HDESK'=>'New Ticket',
+
+'LNK_NEW_PRODUCT'=>'New Product',
+
+'LNK_NEW_CONTACT'=>'New Contact',
+
+'LNK_NEW_CAMPAIGN'=>'New Campaign',
+
+'LNK_NEW_LEAD'=>'New Lead',
+
+'LNK_NEW_ACCOUNT'=>'New Account',
+
+'LNK_NEW_OPPORTUNITY'=>'New Potential',
+
+'LNK_NEW_NOTE'=>'New Note',
+
+'LNK_NEW_EMAIL'=>'New Email',
+
+'LNK_NEW_TASK'=>'New Task',
+
+'LNK_NEW_EVENT'=>'New Event',
+'LNK_NEW_QUOTE'=>'New Quote',
+'LNK_NEW_PO'=>'New Purchase Order',
+'LNK_NEW_SO'=>'New Sales Order',
+'LNK_NEW_INVOICE'=>'New Invoice',
+'LNK_NEW_VENDOR'=>'New Vendor',
+'LNK_NEW_PRICEBOOK'=>'New PriceBook',
+
+
+'NTC_REQUIRED'=>'Indicates required field',
+
+'LBL_REQUIRED_SYMBOL'=>'*',
+
+'LBL_CURRENCY_SYMBOL'=>'$',
+
+'LBL_THOUSANDS_SYMBOL'=>'K',
+
+'NTC_DATE_FORMAT'=>'(yyyy-mm-dd)',
+
+'NTC_TIME_FORMAT'=>'(24:00)',
+
+'NTC_DATE_TIME_FORMAT'=>'(yyyy-mm-dd 24:00)',
+
+'NTC_DELETE_CONFIRMATION'=>'Are you sure you want to delete this record?',
+
+'ERR_DELETE_RECORD'=>'A record number must be specified to delete the contact.',
+
+'ERR_CREATING_TABLE'=>'Error creating table: ',
+
+'ERR_CREATING_FIELDS'=>'Error filling in additional detail fields: ',
+
+'ERR_MISSING_REQUIRED_FIELDS'=>'Missing required fields:',
+
+'ERR_INVALID_EMAIL_ADDRESS'=>'not a valid email address.',
+
+'ERR_INVALID_DATE_FORMAT'=>'The date format must be: yyyy-mm-dd',
+
+'ERR_INVALID_MONTH'=>'Please enter a valid month.',
+
+'ERR_INVALID_DAY'=>'Please enter a valid day.',
+
+'ERR_INVALID_YEAR'=>'Please enter a valid 4 digit year.',
+
+'ERR_INVALID_DATE'=>'Please enter a valid date.',
+
+'ERR_INVALID_HOUR'=>'Please enter a valid hour.',
+
+'ERR_INVALID_TIME'=>'Please enter a valid time.',
+
+'NTC_CLICK_BACK'=>'Please click the browser back button and fix the error.',
+
+'LBL_LIST_ASSIGNED_USER'=>'Assigned To',
+
+'LBL_ASSIGNED_TO'=>'Assigned To:',
+
+'LBL_DATE_MODIFIED'=>'Last Modified:',
+
+'LBL_DATE_ENTERED'=>'Created:',
+
+'LBL_CURRENT_USER_FILTER'=>'Only my items:',
+
+'NTC_LOGIN_MESSAGE'=>"Login",
+
+'LBL_NONE'=>'--None--',
+
+'LBL_BACK'=>'Back',
+
+'LBL_IMPORT'=>'Import',
+
+'LBL_EXPORT'=>'Export',
+
+'LBL_EXPORT_ALL'=>'Export All',
+
+'LBL_QUICK_CREATE'=>'Quick Create',
+
+'Export'=>'Export',
+'Import'=>'Import',
+'Merge'=>'Merge',
+'ConvertLead'=>'ConvertLead',
+
+
+'LBL_SHOW_RESULTS'=>'Show Results in',
+'LBL_TOTAL_RECORDS_FOUND'=>'Total Records found :',
+'LBL_SEARCH_RESULTS_FOR'=>' -- Search results for ',
+'LBL_TAG_SEARCH'=>' -- Tag search for ',
+'LBL_NO_DATA'=>'No Data Found',
+
+
+//3.2 release
+
+'NTC_MERGE_CONFIRMATION'=>'Are you sure you want to merge this record?',
+
+'LBL_MERGE_BUTTON_TITLE'=>'Merge',
+
+'LBL_MERGE_BUTTON_KEY'=> 'Merge',
+
+'LBL_SELECTEMAILTEMPLATE_BUTTON_TITLE'=>'Select Email Template',
+
+'LBL_SELECTEMAILTEMPLATE_BUTTON_KEY'=>'Select Email Template',
+
+'LBL_SELECTEMAILTEMPLATE_BUTTON_LABEL'=>'Select Email Template',
+
+'LBL_MERGE_BUTTON_LABEL'=>'Merge',
+
+'LBL_SENDMAIL_BUTTON_TITLE'=>'SendMail',
+
+'LBL_SENDMAIL_BUTTON_KEY'=> 'SendMail',
+
+'LBL_SENDMAIL_BUTTON_LABEL'=>'Send Mail',
+
+
+
+//Added fields for upload file as attachment -- 4 Beta
+
+'LBL_UPD_DESC'=>'Description',
+
+'LBL_FILENAME'=>'File Name',
+
+'LBL_FILE'=>'File',
+
+'LBL_TYPE'=>'File Type',
+
+'LBL_DOWNLOAD'=>'Download Now',
+
+'LBL_OPERATION'=>'Operation',
+
+'LBL_GROUP_ALLOCATION_TITLE'=>'My Group Allocation ',
+
+'LBL_ENTITY_NAME'=>'Entity Name',
+
+'LBL_GROUP_NAME'=>'Group',
+
+'LBL_ENTITY_TYPE'=>'Type',
+
+
+
+//Added fields for Ticket Attachment in RelatedTicketListUtil
+
+'LBL_NEW_TICKET'=>'New Ticket',
+
+'LBL_TITLE'=>'Title',
+
+'LBL_PRIORITY'=>'Priority',
+
+'LBL_STATUS'=>'Status',
+
+
+
+//Added fields for Change Owner and Change Status in all modules -- after 4 Beta
+
+'LBL_CHANGE_OWNER'=>'Change Owner',
+
+'LBL_CHANGE_STATUS'=>'Change Status',
+
+'LBL_MASS_DELETE'=>'Delete',
+//added by raju
+
+'LBL_ADD_ITEM'=>'Add',
+
+'LBL_ADD_NEW'=>'Add',
+
+'LBL_DEDUCT'=>'Deduct',
+//Added for version 5
+
+'LBL_CALENDAR_TITLE'=>'Open Calendar...',
+'LBL_CALENDAR_ALT'=>'Open Calendar...',
+
+'LBL_CALCULATOR_TITLE'=>'Open Calculator...',
+'LBL_CALCULATOR_ALT'=>'Open Calculator...',
+
+'LBL_CLOCK_TITLE'=>'Show World Clock...',
+'LBL_CLOCK_ALT'=>'Show World Clock...',
+
+'LBL_ALL_MENU_TITLE'=>'Open All Menu...',
+'LBL_ALL_MENU_ALT'=>'Open All Menu...',
+
+'LBL_CHAT_TITLE'=>'Chat...',
+'LBL_CHAT_ALT'=>'Chat...',
+
+'LBL_SEARCH_TITLE'=>'Search in ',
+'LBL_SEARCH_ALT'=>'Search in ',
+
+'LBL_SEARCH_STRING'=>'Search...',
+
+'LBL_SEARCH_FOR'=>'Search for',
+'LBL_SEARCH_NOW_BUTTON'=>'Search Now',
+'LBL_GO_TO'=>'Go to',
+'LBL_FEWER_BUTTON'=>'Fewer',
+'LBL_IN'=>'In',
+
+'LBL_ADV_SEARCH_MSG_ANY'=>'Match Any of the Following',
+'LBL_ADV_SEARCH_MSG_ALL'=>'Match All of the Following',
+
+'COMBO_ALL'=>'All',
+
+// Added fields for Related Field Display Informations in Detail View of All Modules
+
+'LBL_OPEN_ACTIVITIES'=>'Open Activities',
+
+'LBL_HISTORY'=>'History',
+
+'LBL_ACTIVITY_HISTORY'=>'Activity History',
+
+'LBL_ATTACHMENTS'=>'Attachments',
+
+'LBL_ATTACHMENT'=>'Attachment',
+
+'LBL_TYPE'=>'Type',
+
+'LBL_ASSIGNED_TO'=>'Assigned To',
+
+'LBL_TIME'=>'Time',
+
+'LBL_ACTION'=>'Action',
+
+'LBL_SUBJECT'=>'Subject',
+
+'LBL_RELATED_TO'=>'Related To',
+
+//added by raju for emails
+
+'LBL_MULTIPLE'=>'Multiple',
+
+'LBL_DUE_DATE'=>'Due Date',
+
+'LBL_LAST_MODIFIED'=>'Last Modified',
+
+'LBL_CREATED'=>'Created', // Armando Lüscher 26.09.2005 -> §visibleDescription -> Desc: Added
+
+'LBL_DESCRIPTION'=>'Description',
+
+
+
+'LBL_NEW_TASK'=>'New Task',
+
+'LBL_NEW_EVENT'=>'New Event',
+
+'LBL_ATTACHMENT_AND_NOTES'=>'Attachments & Notes',
+
+'LBL_POTENTIAL_NAME'=>'Potential Name',
+
+'LBL_CONTACT_NAME'=>'Contact Name',
+
+'LBL_DEPARTMENT'=>'Department',
+
+'LBL_ROLE'=>'Role',
+
+'LBL_EMAIL'=>'Email',
+
+'LBL_PHONE'=>'Phone',
+
+'LBL_PRODUCT'=>'Product',
+
+'LBL_AMOUNT'=>'Amount',
+
+'LBL_CLOSE_DATE'=>'Close Date',
+
+'LBL_NEW_ATTACHMENT'=>'New Attachment',
+
+'LBL_NEW_NOTE'=>'New Note',
+
+
+
+'LBL_PRODUCT_TITLE'=>'Products',
+
+'LBL_NEW_PRODUCT'=>'New Product',
+
+'LBL_PRODUCT_NAME'=>'Product Name',
+
+'LBL_QUANTITY'=>'Quantity',
+
+'LBL_SALES_PRICE'=>'Sale Price',
+
+'LBL_PURCHASE_DATE'=>'Purchase Date',
+
+'LBL_TICKET_ID'=>'Ticket Id',
+
+'LBL_NEW_TICKET'=>'New Ticket',
+
+'LBL_TICKETS'=>'Tickets',
+
+
+
+'LBL_POTENTIAL_TITLE'=>'Potentials',
+
+'LBL_NEW_POTENTIAL'=>'New Potential',
+
+'LBL_LEAD_NAME'=>'Lead Name',
+
+'LBL_ACCOUNT_NAME'=>'Account Name',
+
+'LBL_ACCOUNT_TYPE'=>'Account Type',
+
+'LBL_USER_TITLE'=>'Users',
+
+'LBL_CONTACT_TITLE'=>'Contacts',
+
+
+
+// 4 GA
+
+'LBL_SHOWING' => 'Showing',
+
+//
+
+
+
+//Added fields after RC1 - Release
+
+'LBL_SELECT_PRODUCT_BUTTON_LABEL'=>'Select Product',
+
+'LBL_VIEW'=>'Filters :',
+// Mike Crowe Mod --------------------------------------------------------Added for group sort
+'LBL_GROUP_VIEW'=>'Group',
+
+
+'LBL_SALES_STAGE'=>'Sales Stage',
+
+'LBL_PROBABILITY'=>'Probability',
+
+'LBL_BULK_MAILS'=>'Bulk Mails',
+
+
+
+'LBL_WORLD_CLOCK'=>'World Clock',
+
+'LBL_CALCULATOR'=>'Calculator',
+
+'LBL_CLOSE_WON' =>'Closed Won',			# 'Closed Won'
+'LBL_CLOSE_LOST'=>'Closed Lost',					# 'Closed Lost'
+
+'LBL_USER'=>'User',
+
+'LBL_TEAM'=>'Team',
+
+'LBL_GROUP'=>'Group',
+
+'LBL_NONE_NO_LINE'=>'none',
+
+'LBL_SELECT_GROUP'=>'Select a group',
+
+'LBL_HOUR_AND_MINUTE'=>'(hours/minutes)',
+
+'YEAR_MONTH_DATE'=>'24:00',
+
+
+
+'COMBO_LEADS'=>'Leads',
+
+'COMBO_ACCOUNTS'=>'Accounts',
+
+'COMBO_CONTACTS'=>'Contacts',
+
+'COMBO_POTENTIALS'=>'Potentials',
+
+'COMBO_PRODUCTS'=>'Products',
+
+'COMBO_HELPDESK'=>'Trouble Tickets',
+
+'COMBO_USERS'=>'Users',
+
+'COMBO_CAMPAIGNS'=>'Campaigns',
+
+
+'LBL_SELECT'=>'Select',
+
+'LBL_EDIT'=>'Edit',
+
+'LBL_DELETE'=>'Delete',
+
+
+
+//List Fields
+
+'Name'=>'Name',
+
+'Company'=>'Company',
+
+'Phone'=>'Phone',
+
+'Website'=>'Website',
+
+'Email'=>'Email',
+
+'Assigned To'=>'Assigned To',
+
+'Account Name'=>'Account Name',
+
+'City'=>'City',
+
+'Title'=>'Title',
+
+'Potential'=>'Potential',
+
+'Sales Stage'=>'Sales Stage',
+
+'Amount'=>'Amount',
+
+'Expected Close'=>'Expected Close',
+
+'Subject'=>'Subject',
+
+'Contact Name'=>'Contact Name',
+
+'Related to'=>'Related To',
+
+'File'=>'File',
+
+'Last Modified'=>'Last Modified',
+
+'Close'=>'Close',
+
+'Type'=>'Type',
+
+'Start Date/Due Date'=>'Start Date/Due Date',
+
+'Date Sent'=>'Date Sent',
+
+'Ticket ID'=>'Ticket ID',
+
+'Status'=>'Status',
+
+'Priority'=>'Priority',
+
+'Product Name'=>'Product Name',
+
+'Product Code'=>'Part Number',
+
+'Commission Rate'=>'Commission Rate',
+
+'Qty/Unit'=>'Qty/Unit',
+
+'Unit Price'=>'Unit Price',
+
+'Question'=>'Question',
+
+'Category'=>'Category',
+
+'Price Book Name'=>'Price Book Name',
+'LBL_EVENT_ENDDATE'=>'End Date & Time',
+
+//Added after 4 GA
+'LBL_CUSTOM_INFORMATION'=>'Custom Information',
+
+//Added fields to display the related lists titles and None Scheduled 
+'LBL_NONE_SCHEDULED'=>'None Scheduled',
+
+'Leads'=>'Leads',
+'Accounts'=>'Accounts',
+'Accounts & Contacts'=>'Accounts & Contacts',
+'Contacts'=>'Contacts',
+'Potentials'=>'Potentials',
+'Products'=>'Products',
+'Emails'=>'Emails',
+'HelpDesk'=>'Trouble Tickets',
+'Activities'=>'Activities',
+'Events'=>'Events',
+'Tasks'=>'Tasks',
+'Todo'=>'To Do',
+'Call'=>'Call',
+'Meeting'=>'Meeting',
+'Quotes'=>'Quotes',
+'PriceBook'=>'Price Books',
+'PurchaseOrder'=>'Purchase Order',
+'SalesOrder'=>'Sales Order',
+'Invoice'=>'Invoices',
+'Calendar'=>'Calendar',
+'Home'=>'Home',
+'Campaigns'=>'Campaigns',
+'Organization'=>'Organization',
+'Organization Name'=>'Organization Name',
+'OrgUnit'=>'Org Unit',
+'PriceBooks'=>'Price Books',
+'Notes'=>'Notes',
+'Faq'=>'FAQ',
+'Dashboards'=>'Dashboard',
+'Reports'=>'Reports',
+'Vendors'=>'Vendors',
+'Rss'=>'RSS',
+'Portal'=>'My Sites',
+'Webmails'=>'Webmails',
+'Attachments'=>'Attachments',
+'Activity History'=>'Activity History',
+'Ticket History'=>'Ticket History',
+'Purchase Order'=>'Purchase Order',
+'Sales Stage History'=>'Sales Stage History',
+'Users'=>'Users',
+'Admin'=>'Admin',
+'PurchaseOrder Status History'=>'PurchaseOrder Status History',
+'SalesOrder Status History'=>'SalesOrder Status History',
+'Quote Stage History'=>'Quote Stage History',
+'Invoice Status History'=>'Invoice Status History',
+'LBL_TROUBLE_TICKET'=>'Trouble Ticket',
+
+//Added language for Parent Tab
+
+'My Home Page'=>'My Home Page',
+'Marketing'=>'Marketing',
+'Sales'=>'Sales',
+'Support'=>'Support',
+'Analytics'=>'Analytics',
+'Inventory'=>'Inventory',
+'Tools'=>'Tools',
+'Settings'=>'Settings',
+
+'LBL_INFORMATION'=>'Information',
+'LBL_MORE'=>'More',
+'LBL_BASIC'=>'Basic',
+'LBL_CREATING'=>'Creating',
+'LBL_EDITING'=>'Editing',
+'LBL_NEW'=>'New',
+
+//Added for Detail/Edit/Related List of all modules
+
+'Lead'=>'Lead',
+'Account'=>'Account',
+'Contact'=>'Contact',
+'Potential'=>'Potential',
+'Opportunity'=>'Potential',
+'Product'=>'Product',
+'Email'=>'Email',
+'Activity'=>'Activity',
+'Event'=>'Event',
+'Task'=>'Task',
+'Quote'=>'Quote',
+'PriceBook'=>'PriceBook',
+'PurchaseOrder'=>'Purchase Order',
+'Ticket'=>'Ticket',
+'SalesOrder'=>'Sales Orders',
+'Campaign'=>'Campaign',
+'Note'=>'Note',
+'Dashboard'=>'Dashboards',
+'Report'=>'Report',
+'Vendor'=>'Vendor',
+'Webmail'=>'Webmail',
+
+'LBL_NONE_INCLUDED'=>'None Included',
+'LBL_ADD_TO'=>'Add to',
+
+'LBL_SELECT_TEMPLATE_TO_MAIL_MERGE'=>'Select template to Mail Merge:',
+'LBL_TITLE_OR_DESCRIPTION'=>'Title / Description',
+
+//Added for RSS Module
+'LBL_RSS_FEEDS'=>'RSS Feeds',
+'LBL_ADD_RSS_FEEDS'=>'Add New RSS Feed',
+
+//Added fields after 4.2 alpha
+'COMBO_ACCOUNTS'=>'Accounts',
+'LNK_NEW_FAQ'=>'New FAQ',
+'Vendor Name'=>'Vendor Name',
+'LNK_WEARE'=>'About us',
+'LBL_ABOUTUS_TITLE'=>'vtiger CRM - About Us',
+'LBL_DISCUSS'=>'Discuss with other users',
+'Quote Stage'=>'Quote Stage',
+'Potential Name'=>'Potential Name',
+'Total'=>'Total Amount',
+'First Name'=>'First Name',
+'Last Name'=>'Last Name',
+'User Name'=>'User Name',
+  /* For purchase order related list in vendor */
+'LBL_PORDER_BUTTON_TITLE'=>'New Purchase Order [Alt+O]',
+'LBL_PORDER_BUTTON'=>'New Purchase Order',
+'LBL_PORDER_BUTTON_KEY'=>'O',
+'Tracking Number'=>'Tracking Number',
+'Order Id'=>'Order Id',
+'Quote Name'=>'Quote Name',
+'Invoice Id'=>'Invoice Id',
+'Quote Id'=>'Quote Id',
+'Sales Order'=>'Sales Order',
+ // Added Quote in activity parent type selection / Related list
+'COMBO_QUOTES'=>'Quotes',
+'End Date'=>'End Date',
+'Start Date'=>'Start Date',
+'Related to'=>'Related To',
+'Recurring Type'=> 'Recurring Type',
+'SalesOrders'=> 'Sales Order',
+'PurchaseOrder'=> 'Purchase Orders',
+'LBL_QUOTE_NAME'=>'Quote Name',
+ //Added Orders in activity parent type selection / Related list
+'LBL_NEW_QUOTE_BUTTON_TITLE'=>'New Quote [Alt+Q]',
+'LBL_NEW_QUOTE_BUTTON_KEY'=>'Q',
+'LBL_NEW_QUOTE_BUTTON'=>'New Quote',
+'COMBO_PORDER'=>'Purchase Order',
+'COMBO_SORDER'=>'Sales Order',
+'LBL_PORDER_NAME'=>'Purchase Order',
+'LBL_SORDER_NAME'=>'Sales Order',
+ // Added Invoice in activity parent type selection / Related list
+'COMBO_INVOICES'=>'Invoice',
+'LBL_INVOICE_NAME'=>'Invoice',
+'LBL_HELPDESK_NAME'=>'Trouble Ticket',
+'LBL_CAMPAIGN_NAME'=>'Campaign Name',
+
+'LBL_NEW_INVOICE_BUTTON_TITLE'=>'New Invoice [Alt+I]',
+'LBL_NEW_INVOICE_BUTTON_KEY'=>'I',
+'LBL_NEW_INVOICE_BUTTON'=>'New Invoice',
+'LBL_NEW_SORDER_BUTTON_TITLE'=>'New Sales Order [Alt+E]',
+'LBL_NEW_SORDER_BUTTON_KEY'=>'E',
+'LBL_NEW_SORDER_BUTTON'=>'New Sales Order',
+
+'LBL_PRODUCT_DETAILS'=>'Product Details',
+'LBL_PRODUCT'=>'Product',
+'LBL_QTY_IN_STOCK'=>'Qty In Stock',
+'LBL_QTY'=>'Qty',
+'LBL_UNIT_PRICE'=>'Unit Price',
+'LBL_LIST_PRICE'=>'List Price',
+'LBL_TOTAL'=>'Total',
+'LBL_ADD_PRODUCT'=>'Add Product',
+'LBL_SUB_TOTAL'=>'Sub Total',
+'LBL_TAX'=>'Tax',
+'LBL_ADJUSTMENT'=>'Adjustment',
+'LBL_GRAND_TOTAL'=>'Grand Total',
+'LBL_QUOTE_ID'=>'Quote Id',
+'LBL_SALES_ORDER_ID'=>'Sales Order Id',
+'LBL_PURCHASE_ORDER_ID'=>'Purchase Order Id',
+'LBL_EXPORT_TO_PDF'=>'Export To PDF',
+
+//Added for 4.2 Patch I
+'LBL_HOME_KEY_METRICS'=>'Key Metrics',
+'LBL_HOME_METRICS'=>'Metrics',
+'LBL_HOME_COUNT'=>'Count',
+
+//Added for 4.2 patch 2
+'LBL_JSCALENDAR_LANG'=>'en',
+'LNK_CV_EDIT'=>'Edit',
+'LNK_CV_DELETE'=>'Delete',
+'LNK_CV_CREATEVIEW'=>'New',
+//Added for 5.0
+'LBL_UPD_FIELD_ORD'=>'Update Field Order',
+'LBL_SEND_CUSTOM_MAIL_BUTTON'=>'Send Custom Mail',
+'LBL_UPDATED_TODAY'=>'Updated today',
+'LBL_UPDATED'=>'Updated',
+'LBL_DAY_AGO'=>'day ago',
+'LBL_DAYS_AGO'=>'days ago',
+
+//Added to convert Month string in update info - ahmed
+
+'Jan'=>'Jan',
+'Feb'=>'Feb',
+'Mar'=>'Mar',
+'Apr'=>'Apr',
+'May'=>'May',
+'Jun'=>'Jun',
+'Jul'=>'Jul',
+'Aug'=>'Aug',
+'Sep'=>'Sep',
+'Oct'=>'Oct',
+'Nov'=>'Nov',
+'Dec'=>'Dec',
+
+//Added after 5.0 Alpha5
+'Campaign Name'=>'Campaign Name',
+'Campaign Type'=>'Campaign Type',
+'Campaign Status'=>'Campaign Status',
+'Expected Revenue'=>'Expected Revenue',
+'Expected Close Date'=>'Expected Close Date',
+'LBL_ACTIONS'=>'Actions',
+'LBL_SEND'=>'Send',
+'LBL_VAT'=>'VAT',
+'LBL_SALES'=>'Sales',
+'LBL_SERVICE'=>'Service',
+'LBL_TAX_DETAILS'=>'Tax Details',
+'LBL_TAX_CALCULATION'=>'Tax Calculation',
+'COVERED_PERCENTAGE'=>'(%)',
+
+'LBL_TAG_CLOUD'=>'Tag Cloud',
+'LBL_FOR'=>'for',
+'LBL_PO_STATUS'=>'PurchaseOrder Status',
+'LBL_SO_STATUS'=>'SalesOrder Status',
+'LBL_INVOICE_STATUS'=>'Invoice Status',
+'LBL_NOTE'=>'Note',
+'LBL_MODULE'=>'Module',
+'Active'=>'Active',
+'Inactive'=>'Inactive',
+'Today'=>'Today',
+'Last 2 Days'=>'Last 2 Days',
+'Last Week'=>'Last Week',
+'This Week'=>'This Week',
+'This Month'=>'This Month',
+'This Year'=>'This Year',
+'LBL_PLEASE_CLICK'=>'Please Click',
+'LBL_TO_CONFIGURE'=>'to Configure',
+'LBL_HERE'=>'here',
+'LBL_RECORDS'=>'Records',
+'LBL_SCROLL'=>'[Scroll to Top]',
+'LBL_EXPAND_COLLAPSE'=>'Expand/Collapse',
+'LBL_RCPY_ADDRESS'=>'Copy Shipping address',
+'LBL_LCPY_ADDRESS'=>'Copy Billing address',
+'LBL_RECORD_ID'=>'Record ID',
+'LBL_ACTION_DATE'=>'Action Date',
+'LBL_HOMEPAGE_DASHBOARD'=>'HomePage Dashboard',
+'LBL_NO'=>'No',
+'LBL_FOUND'=>'Found',
+'LBL_YOU_CAN_CREATE'=>'You can Create',
+'LBL_NOW'=>'now',
+'LBL_CLICK_THE_LINK'=>'Click the link below',
+'LBL_CREATE'=>'Create',
+'LBL_A'=>'a',
+'LBL_AN'=>'an',
+'LBL_YOU_ARE_NOT_ALLOWED_TO_CREATE'=>'You are not allowed to create',
+'LBL_TRANSFER_OWNERSHIP'=>'Transfer Ownership to',
+'LBL_SELECT_STATUS'=>'Select New Status',
+'LBL_UPDATE_OWNER'=>'Update Owner',
+'LBL_UPDATE_STATUS'=>'Update Status',
+
+//added for tax calculations - after 5beta2
+'LBL_NET_PRICE'=>'Net Price',
+'LBL_TOOLS'=>'Tools',
+'LBL_DISCOUNT'=>'Discount',
+'LBL_TOTAL_AFTER_DISCOUNT'=>'Total After Discount',
+'LBL_NET_TOTAL'=>'Net Total',
+'LBL_SHIPPING_AND_HANDLING_CHARGES'=>'Shipping & Handling Charges',
+'LBL_TAX_FOR_SHIPPING_AND_HANDLING'=>'Taxes For Shipping and Handling',
+'LBL_FINISH'=>'Finish',
+'LBL_IMAGE_DELETED'=>'Image Deleted',
+'LBL_TAX_MODE'=>'Tax Mode',
+'LBL_CLEAR_COMMENT'=>'Clear Comment',
+'LBL_ZERO_DISCOUNT'=>'Zero Discount',
+'LBL_OF_PRICE'=>'of Price',
+'LBL_DIRECT_PRICE_REDUCTION'=>'Direct Price Reduction',
+'LBL_INDIVIDUAL'=>'Individual',
+
+//Added the address strings for Contacts Module
+'LBL_CPY_MAILING_ADDRESS'=>'Copy Mailing Address',
+'LBL_CPY_OTHER_ADDRESS'=>'Copy Other Address',
+
+'LBL_PERMISSION'=>'You are not permitted to execute this Operation',
+'VTIGER'=>'vtiger',
+
+//Added for Inventory Tax details
+'LBL_DIRECT_AMOUNT_DISCOUNT'=>'Direct Amount Discount',
+'LBL_NO_DISCOUNT_FOR_THIS_PRODUCT'=>'No Discount for this Product',
+'LBL_TOTAL_TAX_AMOUNT'=>'Total Tax Amount',
+'LBL_FINAL_DISCOUNT_AMOUNT'=>'Final Discount Amount',
+'LBL_SHIPPING_AND_HANDLING_CHARGE'=>'Shipping & Handling Charge',
+'LBL_GO_BACK'=>'Go Back',
+
+//Record deleted message
+'LBL_RECORD_DELETE'=>'The record you are trying to view has been deleted.',
+'Part Number'=>'Part Number',
+
+//Added after 5.0.1
+'Salutation'=>'Salutation ',
+'Rating'=>'Rating',
+'industry'=>'Industry',
+'Severity'=>'Severity',
+'Product Category'=>'Product Category',
+'GL Account'=>'GL Account',
+'Usage Unit'=>'Usage Unit',
+'Carrier'=>'Carrier',
+'Expected Response'=>'Expected Response',
+'LBL_ADDRESS_INF'=>'Address Information',
+
+'yes'=>'yes',
+'LBL_RENAMEPROFILE_BUTTON_LABEL'=>'Rename',
+'LBL_RENAME_PROFILE'=>'Rename Profile',
+'LBL_PROFILE_NAME'=>'Profile Name',
+'LBL_START_DATE'=>'Start Date',
+'LBL_END_DATE'=>'End Date',
+
+);
+
+
+
+//the left value is the key stored in the db and the right value is the display value
+
+//to translate, only modify the right value in each key/value pair
+
+$app_list_strings = Array(
+
+//e.g. auf Deutsch 'Contacts'=>'Contakten',
+
+'moduleList' => Array('Home'=>'Home'
+
+				, 'Dashboard'=>'Dashboard'
+
+				, 'Leads'=>'Leads'
+
+				, 'Contacts'=>'Contacts'
+
+				, 'Accounts'=>'Accounts'
+
+				, 'Potentials'=>'Potentials'
+
+				, 'Campaigns'=>'Campaigns'
+
+				, 'Notes'=>'Notes'
+
+				, 'Emails'=>'Emails'
+
+				, 'Activities'=>'Activities'
+
+				, 'Products'=>'Products'
+
+				, 'HelpDesk'=>'Trouble Tickets'
+
+				, 'Faq'=>'FAQ'
+
+				, 'Calendar'=>'Calendar'
+
+				, 'Quotes'=>'Quotes'
+		
+				, 'PurchaseOrder'=>'PurchaseOrder'
+
+				, 'Invoice'=>'Invoice'
+
+				, 'Rss'=>'RSS'
+				
+				, 'Reports'=>'Reports'
+				
+				, 'Vendors'=>'Vendors'
+				
+				, 'PriceBooks'=>'PriceBooks'
+
+				, 'SalesOrder'=>'SalesOrder'
+
+				, 'Portal'=>'My Sites'
+				
+				),
+
+
+
+//Note:  do not translate opportunity_relationship_type_default_key
+
+//       it is the key for the default opportunity_relationship_type_dom value
+
+'opportunity_relationship_type_default_key' => 'Primary Decision Maker',
+
+'opportunity_relationship_type_dom' => Array(''=>''
+
+		, 'Primary Decision Maker'=>'Primary Decision Maker'
+
+		, 'Business Decision Maker'=>'Business Decision Maker'
+
+		, 'Business Evaluator'=>'Business Evaluator'
+
+		, 'Technical Decision Maker'=>'Technical Decision Maker'
+
+		, 'Technical Evaluator'=>'Technical Evaluator'
+
+		, 'Executive Sponsor'=>'Executive Sponsor'
+
+		, 'Influencer'=>'Influencer'
+
+		, 'Other'=>'Other'
+
+		),
+
+
+
+//Note:  do not translate case_relationship_type_default_key
+
+//       it is the key for the default case_relationship_type_dom value
+
+'case_relationship_type_default_key' => 'Primary Contact',
+
+'case_relationship_type_dom' => Array(''=>''
+
+		, 'Primary Contact'=>'Primary Contact'
+
+		, 'Alternate Contact'=>'Alternate Contact'
+
+		),
+
+
+
+'task_priority_dom' => Array('High'=>'High'
+
+		, 'Medium'=>'Medium'
+
+		, 'Low'=>'Low'
+
+		),
+
+
+
+'task_status_dom' => Array('Planned'=>'Planned'
+
+		, 'Completed'=>'Completed'
+
+		, 'Deferred'=>'Deferred'
+
+		),
+
+
+
+'meeting_status_dom' => Array('Planned'=>'Planned'
+
+		, 'Held'=>'Held'
+
+		, 'Not Held'=>'Not Held'
+
+		),
+
+
+
+'call_status_dom' => Array('Planned'=>'Planned'
+
+		, 'Held'=>'Held'
+
+		, 'Not Held'=>'Not Held'
+
+		),
+
+
+
+//Note:  do not translate case_status_default_key
+
+//       it is the key for the default case_status_dom value
+
+'case_status_default_key' => 'New',
+
+'case_status_dom' => Array('New'=>'New'
+
+		, 'Assigned'=>'Assigned'
+
+		, 'Closed'=>'Closed'
+
+		, 'Pending Input'=>'Pending Input'
+
+		, 'Rejected'=>'Rejected'
+
+		),
+
+
+
+'user_status_dom' => Array('Active'=>'Active'
+
+		, 'Inactive'=>'Inactive'
+
+		),
+
+
+
+//Note:  do not translate record_type_default_key
+
+//       it is the key for the default record_type_module value
+
+'record_type_default_key' => 'Accounts',
+
+'record_type_display' => array('Accounts' => 'Account',
+
+		'Leads' => 'Lead',
+
+		'Opportunities' => 'Opportunity'),
+
+);
+
+
+
+?>

Modified: vtigercrm/branches/5.1_jens/include/nusoap/class.soap_transport_http.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/nusoap/class.soap_transport_http.php (original)
+++ vtigercrm/branches/5.1_jens/include/nusoap/class.soap_transport_http.php Tue Nov 14 03:16:10 2006
@@ -1,1038 +1,1038 @@
-<?php
-
-
-
-
-/**
-* transport class for sending/receiving data via HTTP and HTTPS
-* NOTE: PHP must be compiled with the CURL extension for HTTPS support
-*
-* @author   Dietrich Ayala <dietrich at ganx4.com>
-* @version  $Id: class.soap_transport_http.php,v 1.57 2005/07/27 19:24:42 snichol Exp $
-* @access public
-*/
-class soap_transport_http extends nusoap_base {
-
-	var $url = '';
-	var $uri = '';
-	var $digest_uri = '';
-	var $scheme = '';
-	var $host = '';
-	var $port = '';
-	var $path = '';
-	var $request_method = 'POST';
-	var $protocol_version = '1.0';
-	var $encoding = '';
-	var $outgoing_headers = array();
-	var $incoming_headers = array();
-	var $incoming_cookies = array();
-	var $outgoing_payload = '';
-	var $incoming_payload = '';
-	var $useSOAPAction = true;
-	var $persistentConnection = false;
-	var $ch = false;	// cURL handle
-	var $username = '';
-	var $password = '';
-	var $authtype = '';
-	var $digestRequest = array();
-	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional)
-								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
-								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
-								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
-								// passphrase: SSL key password/passphrase
-								// verifypeer: default is 1
-								// verifyhost: default is 1
-
-	/**
-	* constructor
-	*/
-	function soap_transport_http($url){
-		parent::nusoap_base();
-		$this->setURL($url);
-		ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
-		$this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
-		$this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
-	}
-
-	function setURL($url) {
-		$this->url = $url;
-
-		$u = parse_url($url);
-		foreach($u as $k => $v){
-			$this->debug("$k = $v");
-			$this->$k = $v;
-		}
-		
-		// add any GET params to path
-		if(isset($u['query']) && $u['query'] != ''){
-            $this->path .= '?' . $u['query'];
-		}
-		
-		// set default port
-		if(!isset($u['port'])){
-			if($u['scheme'] == 'https'){
-				$this->port = 443;
-			} else {
-				$this->port = 80;
-			}
-		}
-		
-		$this->uri = $this->path;
-		$this->digest_uri = $this->uri;
-		
-		// build headers
-		if (!isset($u['port'])) {
-			$this->outgoing_headers['Host'] = $this->host;
-		} else {
-			$this->outgoing_headers['Host'] = $this->host.':'.$this->port;
-		}
-		$this->debug('set Host: ' . $this->outgoing_headers['Host']);
-
-		if (isset($u['user']) && $u['user'] != '') {
-			$this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
-		}
-	}
-	
-	function connect($connection_timeout=0,$response_timeout=30){
-	  	// For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
-	  	// "regular" socket.
-	  	// TODO: disabled for now because OpenSSL must be *compiled* in (not just
-	  	//       loaded), and until PHP5 stream_get_wrappers is not available.
-//	  	if ($this->scheme == 'https') {
-//		  	if (version_compare(phpversion(), '4.3.0') >= 0) {
-//		  		if (extension_loaded('openssl')) {
-//		  			$this->scheme = 'ssl';
-//		  			$this->debug('Using SSL over OpenSSL');
-//		  		}
-//		  	}
-//		}
-		$this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-		// use persistent connection
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
-			if (!feof($this->fp)) {
-				$this->debug('Re-use persistent connection');
-				return true;
-			}
-			fclose($this->fp);
-			$this->debug('Closed persistent connection at EOF');
-		}
-
-		// munge host if using OpenSSL
-		if ($this->scheme == 'ssl') {
-			$host = 'ssl://' . $this->host;
-		} else {
-			$host = $this->host;
-		}
-		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
-
-		// open socket
-		if($connection_timeout > 0){
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
-		} else {
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
-		}
-		
-		// test pointer
-		if(!$this->fp) {
-			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
-			if ($this->errno) {
-				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
-			} else {
-				$msg .= ' prior to connect().  This is often a problem looking up the host name.';
-			}
-			$this->debug($msg);
-			$this->setError($msg);
-			return false;
-		}
-		
-		// set response timeout
-		$this->debug('set response timeout to ' . $response_timeout);
-		socket_set_timeout( $this->fp, $response_timeout);
-
-		$this->debug('socket connected');
-		return true;
-	  } else if ($this->scheme == 'https') {
-		if (!extension_loaded('curl')) {
-			$this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
-			return false;
-		}
-		$this->debug('connect using https');
-		// init CURL
-		$this->ch = curl_init();
-		// set url
-		$hostURL = ($this->port != '') ? "https://$this->host:$this->port" : "https://$this->host";
-		// add path
-		$hostURL .= $this->path;
-		curl_setopt($this->ch, CURLOPT_URL, $hostURL);
-		// follow location headers (re-directs)
-		curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
-		// ask for headers in the response output
-		curl_setopt($this->ch, CURLOPT_HEADER, 1);
-		// ask for the response output as the return value
-		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
-		// encode
-		// We manage this ourselves through headers and encoding
-//		if(function_exists('gzuncompress')){
-//			curl_setopt($this->ch, CURLOPT_ENCODING, 'deflate');
-//		}
-		// persistent connection
-		if ($this->persistentConnection) {
-			// The way we send data, we cannot use persistent connections, since
-			// there will be some "junk" at the end of our request.
-			//curl_setopt($this->ch, CURL_HTTP_VERSION_1_1, true);
-			$this->persistentConnection = false;
-			$this->outgoing_headers['Connection'] = 'close';
-			$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-		}
-		// set timeout
-		if ($connection_timeout != 0) {
-			curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
-		}
-		// TODO: cURL has added a connection timeout separate from the response timeout
-		//if ($connection_timeout != 0) {
-		//	curl_setopt($this->ch, CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
-		//}
-		//if ($response_timeout != 0) {
-		//	curl_setopt($this->ch, CURLOPT_TIMEOUT, $response_timeout);
-		//}
-
-		// recent versions of cURL turn on peer/host checking by default,
-		// while PHP binaries are not compiled with a default location for the
-		// CA cert bundle, so disable peer/host checking.
-//curl_setopt($this->ch, CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');		
-		curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
-		curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
-
-		// support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
-		if ($this->authtype == 'certificate') {
-			if (isset($this->certRequest['cainfofile'])) {
-				curl_setopt($this->ch, CURLOPT_CAINFO, $this->certRequest['cainfofile']);
-			}
-			if (isset($this->certRequest['verifypeer'])) {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
-			} else {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
-			}
-			if (isset($this->certRequest['verifyhost'])) {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
-			} else {
-				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
-			}
-			if (isset($this->certRequest['sslcertfile'])) {
-				curl_setopt($this->ch, CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
-			}
-			if (isset($this->certRequest['sslkeyfile'])) {
-				curl_setopt($this->ch, CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
-			}
-			if (isset($this->certRequest['passphrase'])) {
-				curl_setopt($this->ch, CURLOPT_SSLKEYPASSWD , $this->certRequest['passphrase']);
-			}
-		}
-		$this->debug('cURL connection set up');
-		return true;
-	  } else {
-		$this->setError('Unknown scheme ' . $this->scheme);
-		$this->debug('Unknown scheme ' . $this->scheme);
-		return false;
-	  }
-	}
-	
-	/**
-	* send the SOAP message via HTTP
-	*
-	* @param    string $data message data
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @param	array $cookies cookies to send
-	* @return	string data
-	* @access   public
-	*/
-	function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
-		
-		$this->debug('entered send() with data of length: '.strlen($data));
-
-		$this->tryagain = true;
-		$tries = 0;
-		while ($this->tryagain) {
-			$this->tryagain = false;
-			if ($tries++ < 2) {
-				// make connnection
-				if (!$this->connect($timeout, $response_timeout)){
-					return false;
-				}
-				
-				// send request
-				if (!$this->sendRequest($data, $cookies)){
-					return false;
-				}
-				
-				// get response
-				$respdata = $this->getResponse();
-			} else {
-				$this->setError('Too many tries to get an OK response');
-			}
-		}		
-		$this->debug('end of send()');
-		return $respdata;
-	}
-
-
-	/**
-	* send the SOAP message via HTTPS 1.0 using CURL
-	*
-	* @param    string $msg message data
-	* @param    integer $timeout set connection timeout in seconds
-	* @param	integer $response_timeout set response timeout in seconds
-	* @param	array $cookies cookies to send
-	* @return	string data
-	* @access   public
-	*/
-	function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
-		return $this->send($data, $timeout, $response_timeout, $cookies);
-	}
-	
-	/**
-	* if authenticating, set user credentials here
-	*
-	* @param    string $username
-	* @param    string $password
-	* @param	string $authtype (basic, digest, certificate)
-	* @param	array $digestRequest (keys must be nonce, nc, realm, qop)
-	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
-	* @access   public
-	*/
-	function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
-		$this->debug("Set credentials for authtype $authtype");
-		// cf. RFC 2617
-		if ($authtype == 'basic') {
-			$this->outgoing_headers['Authorization'] = 'Basic '.base64_encode(str_replace(':','',$username).':'.$password);
-		} elseif ($authtype == 'digest') {
-			if (isset($digestRequest['nonce'])) {
-				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
-				
-				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
-	
-				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
-	
-				// H(A1) = MD5(A1)
-				$HA1 = md5($A1);
-	
-				// A2 = Method ":" digest-uri-value
-				$A2 = 'POST:' . $this->digest_uri;
-	
-				// H(A2)
-				$HA2 =  md5($A2);
-	
-				// KD(secret, data) = H(concat(secret, ":", data))
-				// if qop == auth:
-				// request-digest  = <"> < KD ( H(A1),     unq(nonce-value)
-				//                              ":" nc-value
-				//                              ":" unq(cnonce-value)
-				//                              ":" unq(qop-value)
-				//                              ":" H(A2)
-				//                            ) <">
-				// if qop is missing,
-				// request-digest  = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
-	
-				$unhashedDigest = '';
-				$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
-				$cnonce = $nonce;
-				if ($digestRequest['qop'] != '') {
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
-				} else {
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
-				}
-	
-				$hashedDigest = md5($unhashedDigest);
-	
-				$this->outgoing_headers['Authorization'] = 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"';
-			}
-		} elseif ($authtype == 'certificate') {
-			$this->certRequest = $certRequest;
-		}
-		$this->username = $username;
-		$this->password = $password;
-		$this->authtype = $authtype;
-		$this->digestRequest = $digestRequest;
-		
-		if (isset($this->outgoing_headers['Authorization'])) {
-			$this->debug('set Authorization: ' . substr($this->outgoing_headers['Authorization'], 0, 12) . '...');
-		} else {
-			$this->debug('Authorization header not set');
-		}
-	}
-	
-	/**
-	* set the soapaction value
-	*
-	* @param    string $soapaction
-	* @access   public
-	*/
-	function setSOAPAction($soapaction) {
-		$this->outgoing_headers['SOAPAction'] = '"' . $soapaction . '"';
-		$this->debug('set SOAPAction: ' . $this->outgoing_headers['SOAPAction']);
-	}
-	
-	/**
-	* use http encoding
-	*
-	* @param    string $enc encoding style. supported values: gzip, deflate, or both
-	* @access   public
-	*/
-	function setEncoding($enc='gzip, deflate') {
-		if (function_exists('gzdeflate')) {
-			$this->protocol_version = '1.1';
-			$this->outgoing_headers['Accept-Encoding'] = $enc;
-			$this->debug('set Accept-Encoding: ' . $this->outgoing_headers['Accept-Encoding']);
-			if (!isset($this->outgoing_headers['Connection'])) {
-				$this->outgoing_headers['Connection'] = 'close';
-				$this->persistentConnection = false;
-				$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-			}
-			set_magic_quotes_runtime(0);
-			// deprecated
-			$this->encoding = $enc;
-		}
-	}
-	
-	/**
-	* set proxy info here
-	*
-	* @param    string $proxyhost
-	* @param    string $proxyport
-	* @param	string $proxyusername
-	* @param	string $proxypassword
-	* @access   public
-	*/
-	function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
-		$this->uri = $this->url;
-		$this->host = $proxyhost;
-		$this->port = $proxyport;
-		if ($proxyusername != '' && $proxypassword != '') {
-			$this->outgoing_headers['Proxy-Authorization'] = ' Basic '.base64_encode($proxyusername.':'.$proxypassword);
-			$this->debug('set Proxy-Authorization: ' . $this->outgoing_headers['Proxy-Authorization']);
-		}
-	}
-	
-	/**
-	* decode a string that is encoded w/ "chunked' transfer encoding
- 	* as defined in RFC2068 19.4.6
-	*
-	* @param    string $buffer
-	* @param    string $lb
-	* @returns	string
-	* @access   public
-	* @deprecated
-	*/
-	function decodeChunked($buffer, $lb){
-		// length := 0
-		$length = 0;
-		$new = '';
-		
-		// read chunk-size, chunk-extension (if any) and CRLF
-		// get the position of the linebreak
-		$chunkend = strpos($buffer, $lb);
-		if ($chunkend == FALSE) {
-			$this->debug('no linebreak found in decodeChunked');
-			return $new;
-		}
-		$temp = substr($buffer,0,$chunkend);
-		$chunk_size = hexdec( trim($temp) );
-		$chunkstart = $chunkend + strlen($lb);
-		// while (chunk-size > 0) {
-		while ($chunk_size > 0) {
-			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
-		  	
-			// Just in case we got a broken connection
-		  	if ($chunkend == FALSE) {
-		  	    $chunk = substr($buffer,$chunkstart);
-				// append chunk-data to entity-body
-		    	$new .= $chunk;
-		  	    $length += strlen($chunk);
-		  	    break;
-			}
-			
-		  	// read chunk-data and CRLF
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
-		  	// append chunk-data to entity-body
-		  	$new .= $chunk;
-		  	// length := length + chunk-size
-		  	$length += strlen($chunk);
-		  	// read chunk-size and CRLF
-		  	$chunkstart = $chunkend + strlen($lb);
-			
-		  	$chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
-			if ($chunkend == FALSE) {
-				break; //Just in case we got a broken connection
-			}
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
-			$chunk_size = hexdec( trim($temp) );
-			$chunkstart = $chunkend;
-		}
-		return $new;
-	}
-	
-	/*
-	 *	Writes payload, including HTTP headers, to $this->outgoing_payload.
-	 */
-	function buildPayload($data, $cookie_str = '') {
-		// add content-length header
-		$this->outgoing_headers['Content-Length'] = strlen($data);
-		$this->debug('set Content-Length: ' . $this->outgoing_headers['Content-Length']);
-
-		// start building outgoing payload:
-		$req = "$this->request_method $this->uri HTTP/$this->protocol_version";
-		$this->debug("HTTP request: $req");
-		$this->outgoing_payload = "$req\r\n";
-
-		// loop thru headers, serializing
-		foreach($this->outgoing_headers as $k => $v){
-			$hdr = $k.': '.$v;
-			$this->debug("HTTP header: $hdr");
-			$this->outgoing_payload .= "$hdr\r\n";
-		}
-
-		// add any cookies
-		if ($cookie_str != '') {
-			$hdr = 'Cookie: '.$cookie_str;
-			$this->debug("HTTP header: $hdr");
-			$this->outgoing_payload .= "$hdr\r\n";
-		}
-
-		// header/body separator
-		$this->outgoing_payload .= "\r\n";
-		
-		// add data
-		$this->outgoing_payload .= $data;
-	}
-
-	function sendRequest($data, $cookies = NULL) {
-		// build cookie string
-		$cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
-
-		// build payload
-		$this->buildPayload($data, $cookie_str);
-
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-		// send payload
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
-			$this->setError('couldn\'t write message data to socket');
-			$this->debug('couldn\'t write message data to socket');
-			return false;
-		}
-		$this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
-		return true;
-	  } else if ($this->scheme == 'https') {
-		// set payload
-		// TODO: cURL does say this should only be the verb, and in fact it
-		// turns out that the URI and HTTP version are appended to this, which
-		// some servers refuse to work with
-		//curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
-		foreach($this->outgoing_headers as $k => $v){
-			$curl_headers[] = "$k: $v";
-		}
-		if ($cookie_str != '') {
-			$curl_headers[] = 'Cookie: ' . $cookie_str;
-		}
-		curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
-		if ($this->request_method == "POST") {
-	  		curl_setopt($this->ch, CURLOPT_POST, 1);
-	  		curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
-	  	} else {
-	  	}
-		$this->debug('set cURL payload');
-		return true;
-	  }
-	}
-
-	function getResponse(){
-		$this->incoming_payload = '';
-	    
-	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
-	    // loop until headers have been retrieved
-	    $data = '';
-	    while (!isset($lb)){
-
-			// We might EOF during header read.
-			if(feof($this->fp)) {
-				$this->incoming_payload = $data;
-				$this->debug('found no headers before EOF after length ' . strlen($data));
-				$this->debug("received before EOF:\n" . $data);
-				$this->setError('server failed to send headers');
-				return false;
-			}
-
-			$tmp = fgets($this->fp, 256);
-			$tmplen = strlen($tmp);
-			$this->debug("read line of $tmplen bytes: " . trim($tmp));
-
-			if ($tmplen == 0) {
-				$this->incoming_payload = $data;
-				$this->debug('socket read of headers timed out after length ' . strlen($data));
-				$this->debug("read before timeout: " . $data);
-				$this->setError('socket read of headers timed out');
-				return false;
-			}
-
-			$data .= $tmp;
-			$pos = strpos($data,"\r\n\r\n");
-			if($pos > 1){
-				$lb = "\r\n";
-			} else {
-				$pos = strpos($data,"\n\n");
-				if($pos > 1){
-					$lb = "\n";
-				}
-			}
-			// remove 100 header
-			if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
-				unset($lb);
-				$data = '';
-			}//
-		}
-		// store header data
-		$this->incoming_payload .= $data;
-		$this->debug('found end of headers after length ' . strlen($data));
-		// process headers
-		$header_data = trim(substr($data,0,$pos));
-		$header_array = explode($lb,$header_data);
-		$this->incoming_headers = array();
-		$this->incoming_cookies = array();
-		foreach($header_array as $header_line){
-			$arr = explode(':',$header_line, 2);
-			if(count($arr) > 1){
-				$header_name = strtolower(trim($arr[0]));
-				$this->incoming_headers[$header_name] = trim($arr[1]);
-				if ($header_name == 'set-cookie') {
-					// TODO: allow multiple cookies from parseCookie
-					$cookie = $this->parseCookie(trim($arr[1]));
-					if ($cookie) {
-						$this->incoming_cookies[] = $cookie;
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
-					} else {
-						$this->debug('did not find cookie in ' . trim($arr[1]));
-					}
-    			}
-			} else if (isset($header_name)) {
-				// append continuation line to previous header
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
-			}
-		}
-		
-		// loop until msg has been received
-		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
-			$content_length =  2147483647;	// ignore any content-length header
-			$chunked = true;
-			$this->debug("want to read chunked content");
-		} elseif (isset($this->incoming_headers['content-length'])) {
-			$content_length = $this->incoming_headers['content-length'];
-			$chunked = false;
-			$this->debug("want to read content of length $content_length");
-		} else {
-			$content_length =  2147483647;
-			$chunked = false;
-			$this->debug("want to read content to EOF");
-		}
-		$data = '';
-		do {
-			if ($chunked) {
-				$tmp = fgets($this->fp, 256);
-				$tmplen = strlen($tmp);
-				$this->debug("read chunk line of $tmplen bytes");
-				if ($tmplen == 0) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of chunk length timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of chunk length timed out');
-					return false;
-				}
-				$content_length = hexdec(trim($tmp));
-				$this->debug("chunk length $content_length");
-			}
-			$strlen = 0;
-		    while (($strlen < $content_length) && (!feof($this->fp))) {
-		    	$readlen = min(8192, $content_length - $strlen);
-				$tmp = fread($this->fp, $readlen);
-				$tmplen = strlen($tmp);
-				$this->debug("read buffer of $tmplen bytes");
-				if (($tmplen == 0) && (!feof($this->fp))) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of body timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of body timed out');
-					return false;
-				}
-				$strlen += $tmplen;
-				$data .= $tmp;
-			}
-			if ($chunked && ($content_length > 0)) {
-				$tmp = fgets($this->fp, 256);
-				$tmplen = strlen($tmp);
-				$this->debug("read chunk terminator of $tmplen bytes");
-				if ($tmplen == 0) {
-					$this->incoming_payload = $data;
-					$this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
-					$this->debug("read before timeout:\n" . $data);
-					$this->setError('socket read of chunk terminator timed out');
-					return false;
-				}
-			}
-		} while ($chunked && ($content_length > 0) && (!feof($this->fp)));
-		if (feof($this->fp)) {
-			$this->debug('read to EOF');
-		}
-		$this->debug('read body of length ' . strlen($data));
-		$this->incoming_payload .= $data;
-		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
-		
-		// close filepointer
-		if(
-			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
-			(! $this->persistentConnection) || feof($this->fp)){
-			fclose($this->fp);
-			$this->fp = false;
-			$this->debug('closed socket');
-		}
-		
-		// connection was closed unexpectedly
-		if($this->incoming_payload == ''){
-			$this->setError('no response from server');
-			return false;
-		}
-		
-		// decode transfer-encoding
-//		if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
-//			if(!$data = $this->decodeChunked($data, $lb)){
-//				$this->setError('Decoding of chunked data failed');
-//				return false;
-//			}
-			//print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
-			// set decoded payload
-//			$this->incoming_payload = $header_data.$lb.$lb.$data;
-//		}
-	
-	  } else if ($this->scheme == 'https') {
-		// send and receive
-		$this->debug('send and receive with cURL');
-		$this->incoming_payload = curl_exec($this->ch);
-		$data = $this->incoming_payload;
-
-        $cErr = curl_error($this->ch);
-		if ($cErr != '') {
-        	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
-        	// TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
-			foreach(curl_getinfo($this->ch) as $k => $v){
-				$err .= "$k: $v<br>";
-			}
-			$this->debug($err);
-			$this->setError($err);
-			curl_close($this->ch);
-	    	return false;
-		} else {
-			//echo '<pre>';
-			//var_dump(curl_getinfo($this->ch));
-			//echo '</pre>';
-		}
-		// close curl
-		$this->debug('No cURL error, closing cURL');
-		curl_close($this->ch);
-		
-		// remove 100 header(s)
-		while (ereg('^HTTP/1.1 100',$data)) {
-			if ($pos = strpos($data,"\r\n\r\n")) {
-				$data = ltrim(substr($data,$pos));
-			} elseif($pos = strpos($data,"\n\n") ) {
-				$data = ltrim(substr($data,$pos));
-			}
-		}
-		
-		// separate content from HTTP headers
-		if ($pos = strpos($data,"\r\n\r\n")) {
-			$lb = "\r\n";
-		} elseif( $pos = strpos($data,"\n\n")) {
-			$lb = "\n";
-		} else {
-			$this->debug('no proper separation of headers and document');
-			$this->setError('no proper separation of headers and document');
-			return false;
-		}
-		$header_data = trim(substr($data,0,$pos));
-		$header_array = explode($lb,$header_data);
-		$data = ltrim(substr($data,$pos));
-		$this->debug('found proper separation of headers and document');
-		$this->debug('cleaned data, stringlen: '.strlen($data));
-		// clean headers
-		foreach ($header_array as $header_line) {
-			$arr = explode(':',$header_line,2);
-			if(count($arr) > 1){
-				$header_name = strtolower(trim($arr[0]));
-				$this->incoming_headers[$header_name] = trim($arr[1]);
-				if ($header_name == 'set-cookie') {
-					// TODO: allow multiple cookies from parseCookie
-					$cookie = $this->parseCookie(trim($arr[1]));
-					if ($cookie) {
-						$this->incoming_cookies[] = $cookie;
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
-					} else {
-						$this->debug('did not find cookie in ' . trim($arr[1]));
-					}
-    			}
-			} else if (isset($header_name)) {
-				// append continuation line to previous header
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
-			}
-		}
-	  }
-
-		$arr = explode(' ', $header_array[0], 3);
-		$http_version = $arr[0];
-		$http_status = intval($arr[1]);
-		$http_reason = count($arr) > 2 ? $arr[2] : '';
-
- 		// see if we need to resend the request with http digest authentication
- 		if (isset($this->incoming_headers['location']) && $http_status == 301) {
- 			$this->debug("Got 301 $http_reason with Location: " . $this->incoming_headers['location']);
- 			$this->setURL($this->incoming_headers['location']);
-			$this->tryagain = true;
-			return false;
-		}
-
- 		// see if we need to resend the request with http digest authentication
- 		if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
- 			$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
- 			if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
- 				$this->debug('Server wants digest authentication');
- 				// remove "Digest " from our elements
- 				$digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
- 				
- 				// parse elements into array
- 				$digestElements = explode(',', $digestString);
- 				foreach ($digestElements as $val) {
- 					$tempElement = explode('=', trim($val), 2);
- 					$digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
- 				}
-
-				// should have (at least) qop, realm, nonce
- 				if (isset($digestRequest['nonce'])) {
- 					$this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
- 					$this->tryagain = true;
- 					return false;
- 				}
- 			}
-			$this->debug('HTTP authentication failed');
-			$this->setError('HTTP authentication failed');
-			return false;
- 		}
-		
-		if (
-			($http_status >= 300 && $http_status <= 307) ||
-			($http_status >= 400 && $http_status <= 417) ||
-			($http_status >= 501 && $http_status <= 505)
-		   ) {
-			$this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient2->response has contents of the response)");
-			return false;
-		}
-
-		// decode content-encoding
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
-    			// if decoding works, use it. else assume data wasn't gzencoded
-    			if(function_exists('gzinflate')){
-					//$timer->setMarker('starting decoding of gzip/deflated content');
-					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
-					// this means there are no Zlib headers, although there should be
-					$this->debug('The gzinflate function exists');
-					$datalen = strlen($data);
-					if ($this->incoming_headers['content-encoding'] == 'deflate') {
-						if ($degzdata = @gzinflate($data)) {
-	    					$data = $degzdata;
-	    					$this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
-	    					if (strlen($data) < $datalen) {
-	    						// test for the case that the payload has been compressed twice
-		    					$this->debug('The inflated payload is smaller than the gzipped one; try again');
-								if ($degzdata = @gzinflate($data)) {
-			    					$data = $degzdata;
-			    					$this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
-								}
-	    					}
-	    				} else {
-	    					$this->debug('Error using gzinflate to inflate the payload');
-	    					$this->setError('Error using gzinflate to inflate the payload');
-	    				}
-					} elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
-						if ($degzdata = @gzinflate(substr($data, 10))) {	// do our best
-							$data = $degzdata;
-	    					$this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
-	    					if (strlen($data) < $datalen) {
-	    						// test for the case that the payload has been compressed twice
-		    					$this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
-								if ($degzdata = @gzinflate(substr($data, 10))) {
-			    					$data = $degzdata;
-			    					$this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
-								}
-	    					}
-	    				} else {
-	    					$this->debug('Error using gzinflate to un-gzip the payload');
-							$this->setError('Error using gzinflate to un-gzip the payload');
-	    				}
-					}
-					//$timer->setMarker('finished decoding of gzip/deflated content');
-					//print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
-					// set decoded payload
-					$this->incoming_payload = $header_data.$lb.$lb.$data;
-    			} else {
-					$this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
-					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
-				}
-			} else {
-				$this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
-				$this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
-			}
-		} else {
-			$this->debug('No Content-Encoding header');
-		}
-		
-		if(strlen($data) == 0){
-			$this->debug('no data after headers!');
-			$this->setError('no data present after HTTP headers');
-			return false;
-		}
-		
-		return $data;
-	}
-
-	function setContentType($type, $charset = false) {
-		$this->outgoing_headers['Content-Type'] = $type . ($charset ? '; charset=' . $charset : '');
-		$this->debug('set Content-Type: ' . $this->outgoing_headers['Content-Type']);
-	}
-
-	function usePersistentConnection(){
-		if (isset($this->outgoing_headers['Accept-Encoding'])) {
-			return false;
-		}
-		$this->protocol_version = '1.1';
-		$this->persistentConnection = true;
-		$this->outgoing_headers['Connection'] = 'Keep-Alive';
-		$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
-		return true;
-	}
-
-	/**
-	 * parse an incoming Cookie into it's parts
-	 *
-	 * @param	string $cookie_str content of cookie
-	 * @return	array with data of that cookie
-	 * @access	private
-	 */
-	/*
-	 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
-	 */
-	function parseCookie($cookie_str) {
-		$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
-		$data = split(';', $cookie_str);
-		$value_str = $data[0];
-
-		$cookie_param = 'domain=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ($start > 0) {
-			$domain = substr($cookie_str, $start + strlen($cookie_param));
-			$domain = substr($domain, 0, strpos($domain, ';'));
-		} else {
-			$domain = '';
-		}
-
-		$cookie_param = 'expires=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ($start > 0) {
-			$expires = substr($cookie_str, $start + strlen($cookie_param));
-			$expires = substr($expires, 0, strpos($expires, ';'));
-		} else {
-			$expires = '';
-		}
-
-		$cookie_param = 'path=';
-		$start = strpos($cookie_str, $cookie_param);
-		if ( $start > 0 ) {
-			$path = substr($cookie_str, $start + strlen($cookie_param));
-			$path = substr($path, 0, strpos($path, ';'));
-		} else {
-			$path = '/';
-		}
-						
-		$cookie_param = ';secure;';
-		if (strpos($cookie_str, $cookie_param) !== FALSE) {
-			$secure = true;
-		} else {
-			$secure = false;
-		}
-
-		$sep_pos = strpos($value_str, '=');
-
-		if ($sep_pos) {
-			$name = substr($value_str, 0, $sep_pos);
-			$value = substr($value_str, $sep_pos + 1);
-			$cookie= array(	'name' => $name,
-			                'value' => $value,
-							'domain' => $domain,
-							'path' => $path,
-							'expires' => $expires,
-							'secure' => $secure
-							);		
-			return $cookie;
-		}
-		return false;
-	}
-  
-	/**
-	 * sort out cookies for the current request
-	 *
-	 * @param	array $cookies array with all cookies
-	 * @param	boolean $secure is the send-content secure or not?
-	 * @return	string for Cookie-HTTP-Header
-	 * @access	private
-	 */
-	function getCookiesForRequest($cookies, $secure=false) {
-		$cookie_str = '';
-		if ((! is_null($cookies)) && (is_array($cookies))) {
-			foreach ($cookies as $cookie) {
-				if (! is_array($cookie)) {
-					continue;
-				}
-	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
-					if (strtotime($cookie['expires']) <= time()) {
-						$this->debug('cookie has expired');
-						continue;
-					}
-				}
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
-					$domain = preg_quote($cookie['domain']);
-					if (! preg_match("'.*$domain$'i", $this->host)) {
-						$this->debug('cookie has different domain');
-						continue;
-					}
-				}
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
-					$path = preg_quote($cookie['path']);
-					if (! preg_match("'^$path.*'i", $this->path)) {
-						$this->debug('cookie is for a different path');
-						continue;
-					}
-				}
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
-					$this->debug('cookie is secure, transport is not');
-					continue;
-				}
-				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
-	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
-			}
-		}
-		return $cookie_str;
-  }
-}
-
-
+<?php
+
+
+
+
+/**
+* transport class for sending/receiving data via HTTP and HTTPS
+* NOTE: PHP must be compiled with the CURL extension for HTTPS support
+*
+* @author   Dietrich Ayala <dietrich at ganx4.com>
+* @version  $Id: class.soap_transport_http.php,v 1.57 2005/07/27 19:24:42 snichol Exp $
+* @access public
+*/
+class soap_transport_http extends nusoap_base {
+
+	var $url = '';
+	var $uri = '';
+	var $digest_uri = '';
+	var $scheme = '';
+	var $host = '';
+	var $port = '';
+	var $path = '';
+	var $request_method = 'POST';
+	var $protocol_version = '1.0';
+	var $encoding = '';
+	var $outgoing_headers = array();
+	var $incoming_headers = array();
+	var $incoming_cookies = array();
+	var $outgoing_payload = '';
+	var $incoming_payload = '';
+	var $useSOAPAction = true;
+	var $persistentConnection = false;
+	var $ch = false;	// cURL handle
+	var $username = '';
+	var $password = '';
+	var $authtype = '';
+	var $digestRequest = array();
+	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional)
+								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
+								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
+								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
+								// passphrase: SSL key password/passphrase
+								// verifypeer: default is 1
+								// verifyhost: default is 1
+
+	/**
+	* constructor
+	*/
+	function soap_transport_http($url){
+		parent::nusoap_base();
+		$this->setURL($url);
+		ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+		$this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
+		$this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
+	}
+
+	function setURL($url) {
+		$this->url = $url;
+
+		$u = parse_url($url);
+		foreach($u as $k => $v){
+			$this->debug("$k = $v");
+			$this->$k = $v;
+		}
+		
+		// add any GET params to path
+		if(isset($u['query']) && $u['query'] != ''){
+            $this->path .= '?' . $u['query'];
+		}
+		
+		// set default port
+		if(!isset($u['port'])){
+			if($u['scheme'] == 'https'){
+				$this->port = 443;
+			} else {
+				$this->port = 80;
+			}
+		}
+		
+		$this->uri = $this->path;
+		$this->digest_uri = $this->uri;
+		
+		// build headers
+		if (!isset($u['port'])) {
+			$this->outgoing_headers['Host'] = $this->host;
+		} else {
+			$this->outgoing_headers['Host'] = $this->host.':'.$this->port;
+		}
+		$this->debug('set Host: ' . $this->outgoing_headers['Host']);
+
+		if (isset($u['user']) && $u['user'] != '') {
+			$this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
+		}
+	}
+	
+	function connect($connection_timeout=0,$response_timeout=30){
+	  	// For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
+	  	// "regular" socket.
+	  	// TODO: disabled for now because OpenSSL must be *compiled* in (not just
+	  	//       loaded), and until PHP5 stream_get_wrappers is not available.
+//	  	if ($this->scheme == 'https') {
+//		  	if (version_compare(phpversion(), '4.3.0') >= 0) {
+//		  		if (extension_loaded('openssl')) {
+//		  			$this->scheme = 'ssl';
+//		  			$this->debug('Using SSL over OpenSSL');
+//		  		}
+//		  	}
+//		}
+		$this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port");
+	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
+		// use persistent connection
+		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
+			if (!feof($this->fp)) {
+				$this->debug('Re-use persistent connection');
+				return true;
+			}
+			fclose($this->fp);
+			$this->debug('Closed persistent connection at EOF');
+		}
+
+		// munge host if using OpenSSL
+		if ($this->scheme == 'ssl') {
+			$host = 'ssl://' . $this->host;
+		} else {
+			$host = $this->host;
+		}
+		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
+
+		// open socket
+		if($connection_timeout > 0){
+			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
+		} else {
+			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
+		}
+		
+		// test pointer
+		if(!$this->fp) {
+			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
+			if ($this->errno) {
+				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
+			} else {
+				$msg .= ' prior to connect().  This is often a problem looking up the host name.';
+			}
+			$this->debug($msg);
+			$this->setError($msg);
+			return false;
+		}
+		
+		// set response timeout
+		$this->debug('set response timeout to ' . $response_timeout);
+		socket_set_timeout( $this->fp, $response_timeout);
+
+		$this->debug('socket connected');
+		return true;
+	  } else if ($this->scheme == 'https') {
+		if (!extension_loaded('curl')) {
+			$this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS');
+			return false;
+		}
+		$this->debug('connect using https');
+		// init CURL
+		$this->ch = curl_init();
+		// set url
+		$hostURL = ($this->port != '') ? "https://$this->host:$this->port" : "https://$this->host";
+		// add path
+		$hostURL .= $this->path;
+		curl_setopt($this->ch, CURLOPT_URL, $hostURL);
+		// follow location headers (re-directs)
+		curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
+		// ask for headers in the response output
+		curl_setopt($this->ch, CURLOPT_HEADER, 1);
+		// ask for the response output as the return value
+		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
+		// encode
+		// We manage this ourselves through headers and encoding
+//		if(function_exists('gzuncompress')){
+//			curl_setopt($this->ch, CURLOPT_ENCODING, 'deflate');
+//		}
+		// persistent connection
+		if ($this->persistentConnection) {
+			// The way we send data, we cannot use persistent connections, since
+			// there will be some "junk" at the end of our request.
+			//curl_setopt($this->ch, CURL_HTTP_VERSION_1_1, true);
+			$this->persistentConnection = false;
+			$this->outgoing_headers['Connection'] = 'close';
+			$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
+		}
+		// set timeout
+		if ($connection_timeout != 0) {
+			curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
+		}
+		// TODO: cURL has added a connection timeout separate from the response timeout
+		//if ($connection_timeout != 0) {
+		//	curl_setopt($this->ch, CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
+		//}
+		//if ($response_timeout != 0) {
+		//	curl_setopt($this->ch, CURLOPT_TIMEOUT, $response_timeout);
+		//}
+
+		// recent versions of cURL turn on peer/host checking by default,
+		// while PHP binaries are not compiled with a default location for the
+		// CA cert bundle, so disable peer/host checking.
+//curl_setopt($this->ch, CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');		
+		curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
+		curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
+
+		// support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
+		if ($this->authtype == 'certificate') {
+			if (isset($this->certRequest['cainfofile'])) {
+				curl_setopt($this->ch, CURLOPT_CAINFO, $this->certRequest['cainfofile']);
+			}
+			if (isset($this->certRequest['verifypeer'])) {
+				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
+			} else {
+				curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
+			}
+			if (isset($this->certRequest['verifyhost'])) {
+				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
+			} else {
+				curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
+			}
+			if (isset($this->certRequest['sslcertfile'])) {
+				curl_setopt($this->ch, CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
+			}
+			if (isset($this->certRequest['sslkeyfile'])) {
+				curl_setopt($this->ch, CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
+			}
+			if (isset($this->certRequest['passphrase'])) {
+				curl_setopt($this->ch, CURLOPT_SSLKEYPASSWD , $this->certRequest['passphrase']);
+			}
+		}
+		$this->debug('cURL connection set up');
+		return true;
+	  } else {
+		$this->setError('Unknown scheme ' . $this->scheme);
+		$this->debug('Unknown scheme ' . $this->scheme);
+		return false;
+	  }
+	}
+	
+	/**
+	* send the SOAP message via HTTP
+	*
+	* @param    string $data message data
+	* @param    integer $timeout set connection timeout in seconds
+	* @param	integer $response_timeout set response timeout in seconds
+	* @param	array $cookies cookies to send
+	* @return	string data
+	* @access   public
+	*/
+	function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
+		
+		$this->debug('entered send() with data of length: '.strlen($data));
+
+		$this->tryagain = true;
+		$tries = 0;
+		while ($this->tryagain) {
+			$this->tryagain = false;
+			if ($tries++ < 2) {
+				// make connnection
+				if (!$this->connect($timeout, $response_timeout)){
+					return false;
+				}
+				
+				// send request
+				if (!$this->sendRequest($data, $cookies)){
+					return false;
+				}
+				
+				// get response
+				$respdata = $this->getResponse();
+			} else {
+				$this->setError('Too many tries to get an OK response');
+			}
+		}		
+		$this->debug('end of send()');
+		return $respdata;
+	}
+
+
+	/**
+	* send the SOAP message via HTTPS 1.0 using CURL
+	*
+	* @param    string $msg message data
+	* @param    integer $timeout set connection timeout in seconds
+	* @param	integer $response_timeout set response timeout in seconds
+	* @param	array $cookies cookies to send
+	* @return	string data
+	* @access   public
+	*/
+	function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
+		return $this->send($data, $timeout, $response_timeout, $cookies);
+	}
+	
+	/**
+	* if authenticating, set user credentials here
+	*
+	* @param    string $username
+	* @param    string $password
+	* @param	string $authtype (basic, digest, certificate)
+	* @param	array $digestRequest (keys must be nonce, nc, realm, qop)
+	* @param	array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)
+	* @access   public
+	*/
+	function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
+		$this->debug("Set credentials for authtype $authtype");
+		// cf. RFC 2617
+		if ($authtype == 'basic') {
+			$this->outgoing_headers['Authorization'] = 'Basic '.base64_encode(str_replace(':','',$username).':'.$password);
+		} elseif ($authtype == 'digest') {
+			if (isset($digestRequest['nonce'])) {
+				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
+				
+				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
+	
+				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
+				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
+	
+				// H(A1) = MD5(A1)
+				$HA1 = md5($A1);
+	
+				// A2 = Method ":" digest-uri-value
+				$A2 = 'POST:' . $this->digest_uri;
+	
+				// H(A2)
+				$HA2 =  md5($A2);
+	
+				// KD(secret, data) = H(concat(secret, ":", data))
+				// if qop == auth:
+				// request-digest  = <"> < KD ( H(A1),     unq(nonce-value)
+				//                              ":" nc-value
+				//                              ":" unq(cnonce-value)
+				//                              ":" unq(qop-value)
+				//                              ":" H(A2)
+				//                            ) <">
+				// if qop is missing,
+				// request-digest  = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
+	
+				$unhashedDigest = '';
+				$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
+				$cnonce = $nonce;
+				if ($digestRequest['qop'] != '') {
+					$unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
+				} else {
+					$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
+				}
+	
+				$hashedDigest = md5($unhashedDigest);
+	
+				$this->outgoing_headers['Authorization'] = 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"';
+			}
+		} elseif ($authtype == 'certificate') {
+			$this->certRequest = $certRequest;
+		}
+		$this->username = $username;
+		$this->password = $password;
+		$this->authtype = $authtype;
+		$this->digestRequest = $digestRequest;
+		
+		if (isset($this->outgoing_headers['Authorization'])) {
+			$this->debug('set Authorization: ' . substr($this->outgoing_headers['Authorization'], 0, 12) . '...');
+		} else {
+			$this->debug('Authorization header not set');
+		}
+	}
+	
+	/**
+	* set the soapaction value
+	*
+	* @param    string $soapaction
+	* @access   public
+	*/
+	function setSOAPAction($soapaction) {
+		$this->outgoing_headers['SOAPAction'] = '"' . $soapaction . '"';
+		$this->debug('set SOAPAction: ' . $this->outgoing_headers['SOAPAction']);
+	}
+	
+	/**
+	* use http encoding
+	*
+	* @param    string $enc encoding style. supported values: gzip, deflate, or both
+	* @access   public
+	*/
+	function setEncoding($enc='gzip, deflate') {
+		if (function_exists('gzdeflate')) {
+			$this->protocol_version = '1.1';
+			$this->outgoing_headers['Accept-Encoding'] = $enc;
+			$this->debug('set Accept-Encoding: ' . $this->outgoing_headers['Accept-Encoding']);
+			if (!isset($this->outgoing_headers['Connection'])) {
+				$this->outgoing_headers['Connection'] = 'close';
+				$this->persistentConnection = false;
+				$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
+			}
+			set_magic_quotes_runtime(0);
+			// deprecated
+			$this->encoding = $enc;
+		}
+	}
+	
+	/**
+	* set proxy info here
+	*
+	* @param    string $proxyhost
+	* @param    string $proxyport
+	* @param	string $proxyusername
+	* @param	string $proxypassword
+	* @access   public
+	*/
+	function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') {
+		$this->uri = $this->url;
+		$this->host = $proxyhost;
+		$this->port = $proxyport;
+		if ($proxyusername != '' && $proxypassword != '') {
+			$this->outgoing_headers['Proxy-Authorization'] = ' Basic '.base64_encode($proxyusername.':'.$proxypassword);
+			$this->debug('set Proxy-Authorization: ' . $this->outgoing_headers['Proxy-Authorization']);
+		}
+	}
+	
+	/**
+	* decode a string that is encoded w/ "chunked' transfer encoding
+ 	* as defined in RFC2068 19.4.6
+	*
+	* @param    string $buffer
+	* @param    string $lb
+	* @returns	string
+	* @access   public
+	* @deprecated
+	*/
+	function decodeChunked($buffer, $lb){
+		// length := 0
+		$length = 0;
+		$new = '';
+		
+		// read chunk-size, chunk-extension (if any) and CRLF
+		// get the position of the linebreak
+		$chunkend = strpos($buffer, $lb);
+		if ($chunkend == FALSE) {
+			$this->debug('no linebreak found in decodeChunked');
+			return $new;
+		}
+		$temp = substr($buffer,0,$chunkend);
+		$chunk_size = hexdec( trim($temp) );
+		$chunkstart = $chunkend + strlen($lb);
+		// while (chunk-size > 0) {
+		while ($chunk_size > 0) {
+			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
+			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
+		  	
+			// Just in case we got a broken connection
+		  	if ($chunkend == FALSE) {
+		  	    $chunk = substr($buffer,$chunkstart);
+				// append chunk-data to entity-body
+		    	$new .= $chunk;
+		  	    $length += strlen($chunk);
+		  	    break;
+			}
+			
+		  	// read chunk-data and CRLF
+		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
+		  	// append chunk-data to entity-body
+		  	$new .= $chunk;
+		  	// length := length + chunk-size
+		  	$length += strlen($chunk);
+		  	// read chunk-size and CRLF
+		  	$chunkstart = $chunkend + strlen($lb);
+			
+		  	$chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
+			if ($chunkend == FALSE) {
+				break; //Just in case we got a broken connection
+			}
+			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
+			$chunk_size = hexdec( trim($temp) );
+			$chunkstart = $chunkend;
+		}
+		return $new;
+	}
+	
+	/*
+	 *	Writes payload, including HTTP headers, to $this->outgoing_payload.
+	 */
+	function buildPayload($data, $cookie_str = '') {
+		// add content-length header
+		$this->outgoing_headers['Content-Length'] = strlen($data);
+		$this->debug('set Content-Length: ' . $this->outgoing_headers['Content-Length']);
+
+		// start building outgoing payload:
+		$req = "$this->request_method $this->uri HTTP/$this->protocol_version";
+		$this->debug("HTTP request: $req");
+		$this->outgoing_payload = "$req\r\n";
+
+		// loop thru headers, serializing
+		foreach($this->outgoing_headers as $k => $v){
+			$hdr = $k.': '.$v;
+			$this->debug("HTTP header: $hdr");
+			$this->outgoing_payload .= "$hdr\r\n";
+		}
+
+		// add any cookies
+		if ($cookie_str != '') {
+			$hdr = 'Cookie: '.$cookie_str;
+			$this->debug("HTTP header: $hdr");
+			$this->outgoing_payload .= "$hdr\r\n";
+		}
+
+		// header/body separator
+		$this->outgoing_payload .= "\r\n";
+		
+		// add data
+		$this->outgoing_payload .= $data;
+	}
+
+	function sendRequest($data, $cookies = NULL) {
+		// build cookie string
+		$cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
+
+		// build payload
+		$this->buildPayload($data, $cookie_str);
+
+	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
+		// send payload
+		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
+			$this->setError('couldn\'t write message data to socket');
+			$this->debug('couldn\'t write message data to socket');
+			return false;
+		}
+		$this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
+		return true;
+	  } else if ($this->scheme == 'https') {
+		// set payload
+		// TODO: cURL does say this should only be the verb, and in fact it
+		// turns out that the URI and HTTP version are appended to this, which
+		// some servers refuse to work with
+		//curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
+		foreach($this->outgoing_headers as $k => $v){
+			$curl_headers[] = "$k: $v";
+		}
+		if ($cookie_str != '') {
+			$curl_headers[] = 'Cookie: ' . $cookie_str;
+		}
+		curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
+		if ($this->request_method == "POST") {
+	  		curl_setopt($this->ch, CURLOPT_POST, 1);
+	  		curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
+	  	} else {
+	  	}
+		$this->debug('set cURL payload');
+		return true;
+	  }
+	}
+
+	function getResponse(){
+		$this->incoming_payload = '';
+	    
+	  if ($this->scheme == 'http' || $this->scheme == 'ssl') {
+	    // loop until headers have been retrieved
+	    $data = '';
+	    while (!isset($lb)){
+
+			// We might EOF during header read.
+			if(feof($this->fp)) {
+				$this->incoming_payload = $data;
+				$this->debug('found no headers before EOF after length ' . strlen($data));
+				$this->debug("received before EOF:\n" . $data);
+				$this->setError('server failed to send headers');
+				return false;
+			}
+
+			$tmp = fgets($this->fp, 256);
+			$tmplen = strlen($tmp);
+			$this->debug("read line of $tmplen bytes: " . trim($tmp));
+
+			if ($tmplen == 0) {
+				$this->incoming_payload = $data;
+				$this->debug('socket read of headers timed out after length ' . strlen($data));
+				$this->debug("read before timeout: " . $data);
+				$this->setError('socket read of headers timed out');
+				return false;
+			}
+
+			$data .= $tmp;
+			$pos = strpos($data,"\r\n\r\n");
+			if($pos > 1){
+				$lb = "\r\n";
+			} else {
+				$pos = strpos($data,"\n\n");
+				if($pos > 1){
+					$lb = "\n";
+				}
+			}
+			// remove 100 header
+			if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
+				unset($lb);
+				$data = '';
+			}//
+		}
+		// store header data
+		$this->incoming_payload .= $data;
+		$this->debug('found end of headers after length ' . strlen($data));
+		// process headers
+		$header_data = trim(substr($data,0,$pos));
+		$header_array = explode($lb,$header_data);
+		$this->incoming_headers = array();
+		$this->incoming_cookies = array();
+		foreach($header_array as $header_line){
+			$arr = explode(':',$header_line, 2);
+			if(count($arr) > 1){
+				$header_name = strtolower(trim($arr[0]));
+				$this->incoming_headers[$header_name] = trim($arr[1]);
+				if ($header_name == 'set-cookie') {
+					// TODO: allow multiple cookies from parseCookie
+					$cookie = $this->parseCookie(trim($arr[1]));
+					if ($cookie) {
+						$this->incoming_cookies[] = $cookie;
+						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
+					} else {
+						$this->debug('did not find cookie in ' . trim($arr[1]));
+					}
+    			}
+			} else if (isset($header_name)) {
+				// append continuation line to previous header
+				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
+			}
+		}
+		
+		// loop until msg has been received
+		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
+			$content_length =  2147483647;	// ignore any content-length header
+			$chunked = true;
+			$this->debug("want to read chunked content");
+		} elseif (isset($this->incoming_headers['content-length'])) {
+			$content_length = $this->incoming_headers['content-length'];
+			$chunked = false;
+			$this->debug("want to read content of length $content_length");
+		} else {
+			$content_length =  2147483647;
+			$chunked = false;
+			$this->debug("want to read content to EOF");
+		}
+		$data = '';
+		do {
+			if ($chunked) {
+				$tmp = fgets($this->fp, 256);
+				$tmplen = strlen($tmp);
+				$this->debug("read chunk line of $tmplen bytes");
+				if ($tmplen == 0) {
+					$this->incoming_payload = $data;
+					$this->debug('socket read of chunk length timed out after length ' . strlen($data));
+					$this->debug("read before timeout:\n" . $data);
+					$this->setError('socket read of chunk length timed out');
+					return false;
+				}
+				$content_length = hexdec(trim($tmp));
+				$this->debug("chunk length $content_length");
+			}
+			$strlen = 0;
+		    while (($strlen < $content_length) && (!feof($this->fp))) {
+		    	$readlen = min(8192, $content_length - $strlen);
+				$tmp = fread($this->fp, $readlen);
+				$tmplen = strlen($tmp);
+				$this->debug("read buffer of $tmplen bytes");
+				if (($tmplen == 0) && (!feof($this->fp))) {
+					$this->incoming_payload = $data;
+					$this->debug('socket read of body timed out after length ' . strlen($data));
+					$this->debug("read before timeout:\n" . $data);
+					$this->setError('socket read of body timed out');
+					return false;
+				}
+				$strlen += $tmplen;
+				$data .= $tmp;
+			}
+			if ($chunked && ($content_length > 0)) {
+				$tmp = fgets($this->fp, 256);
+				$tmplen = strlen($tmp);
+				$this->debug("read chunk terminator of $tmplen bytes");
+				if ($tmplen == 0) {
+					$this->incoming_payload = $data;
+					$this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
+					$this->debug("read before timeout:\n" . $data);
+					$this->setError('socket read of chunk terminator timed out');
+					return false;
+				}
+			}
+		} while ($chunked && ($content_length > 0) && (!feof($this->fp)));
+		if (feof($this->fp)) {
+			$this->debug('read to EOF');
+		}
+		$this->debug('read body of length ' . strlen($data));
+		$this->incoming_payload .= $data;
+		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
+		
+		// close filepointer
+		if(
+			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
+			(! $this->persistentConnection) || feof($this->fp)){
+			fclose($this->fp);
+			$this->fp = false;
+			$this->debug('closed socket');
+		}
+		
+		// connection was closed unexpectedly
+		if($this->incoming_payload == ''){
+			$this->setError('no response from server');
+			return false;
+		}
+		
+		// decode transfer-encoding
+//		if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
+//			if(!$data = $this->decodeChunked($data, $lb)){
+//				$this->setError('Decoding of chunked data failed');
+//				return false;
+//			}
+			//print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
+			// set decoded payload
+//			$this->incoming_payload = $header_data.$lb.$lb.$data;
+//		}
+	
+	  } else if ($this->scheme == 'https') {
+		// send and receive
+		$this->debug('send and receive with cURL');
+		$this->incoming_payload = curl_exec($this->ch);
+		$data = $this->incoming_payload;
+
+        $cErr = curl_error($this->ch);
+		if ($cErr != '') {
+        	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
+        	// TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
+			foreach(curl_getinfo($this->ch) as $k => $v){
+				$err .= "$k: $v<br>";
+			}
+			$this->debug($err);
+			$this->setError($err);
+			curl_close($this->ch);
+	    	return false;
+		} else {
+			//echo '<pre>';
+			//var_dump(curl_getinfo($this->ch));
+			//echo '</pre>';
+		}
+		// close curl
+		$this->debug('No cURL error, closing cURL');
+		curl_close($this->ch);
+		
+		// remove 100 header(s)
+		while (ereg('^HTTP/1.1 100',$data)) {
+			if ($pos = strpos($data,"\r\n\r\n")) {
+				$data = ltrim(substr($data,$pos));
+			} elseif($pos = strpos($data,"\n\n") ) {
+				$data = ltrim(substr($data,$pos));
+			}
+		}
+		
+		// separate content from HTTP headers
+		if ($pos = strpos($data,"\r\n\r\n")) {
+			$lb = "\r\n";
+		} elseif( $pos = strpos($data,"\n\n")) {
+			$lb = "\n";
+		} else {
+			$this->debug('no proper separation of headers and document');
+			$this->setError('no proper separation of headers and document');
+			return false;
+		}
+		$header_data = trim(substr($data,0,$pos));
+		$header_array = explode($lb,$header_data);
+		$data = ltrim(substr($data,$pos));
+		$this->debug('found proper separation of headers and document');
+		$this->debug('cleaned data, stringlen: '.strlen($data));
+		// clean headers
+		foreach ($header_array as $header_line) {
+			$arr = explode(':',$header_line,2);
+			if(count($arr) > 1){
+				$header_name = strtolower(trim($arr[0]));
+				$this->incoming_headers[$header_name] = trim($arr[1]);
+				if ($header_name == 'set-cookie') {
+					// TODO: allow multiple cookies from parseCookie
+					$cookie = $this->parseCookie(trim($arr[1]));
+					if ($cookie) {
+						$this->incoming_cookies[] = $cookie;
+						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
+					} else {
+						$this->debug('did not find cookie in ' . trim($arr[1]));
+					}
+    			}
+			} else if (isset($header_name)) {
+				// append continuation line to previous header
+				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
+			}
+		}
+	  }
+
+		$arr = explode(' ', $header_array[0], 3);
+		$http_version = $arr[0];
+		$http_status = intval($arr[1]);
+		$http_reason = count($arr) > 2 ? $arr[2] : '';
+
+ 		// see if we need to resend the request with http digest authentication
+ 		if (isset($this->incoming_headers['location']) && $http_status == 301) {
+ 			$this->debug("Got 301 $http_reason with Location: " . $this->incoming_headers['location']);
+ 			$this->setURL($this->incoming_headers['location']);
+			$this->tryagain = true;
+			return false;
+		}
+
+ 		// see if we need to resend the request with http digest authentication
+ 		if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
+ 			$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
+ 			if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
+ 				$this->debug('Server wants digest authentication');
+ 				// remove "Digest " from our elements
+ 				$digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
+ 				
+ 				// parse elements into array
+ 				$digestElements = explode(',', $digestString);
+ 				foreach ($digestElements as $val) {
+ 					$tempElement = explode('=', trim($val), 2);
+ 					$digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]);
+ 				}
+
+				// should have (at least) qop, realm, nonce
+ 				if (isset($digestRequest['nonce'])) {
+ 					$this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
+ 					$this->tryagain = true;
+ 					return false;
+ 				}
+ 			}
+			$this->debug('HTTP authentication failed');
+			$this->setError('HTTP authentication failed');
+			return false;
+ 		}
+		
+		if (
+			($http_status >= 300 && $http_status <= 307) ||
+			($http_status >= 400 && $http_status <= 417) ||
+			($http_status >= 501 && $http_status <= 505)
+		   ) {
+			$this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient2->response has contents of the response)");
+			return false;
+		}
+
+		// decode content-encoding
+		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
+			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
+    			// if decoding works, use it. else assume data wasn't gzencoded
+    			if(function_exists('gzinflate')){
+					//$timer->setMarker('starting decoding of gzip/deflated content');
+					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
+					// this means there are no Zlib headers, although there should be
+					$this->debug('The gzinflate function exists');
+					$datalen = strlen($data);
+					if ($this->incoming_headers['content-encoding'] == 'deflate') {
+						if ($degzdata = @gzinflate($data)) {
+	    					$data = $degzdata;
+	    					$this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
+	    					if (strlen($data) < $datalen) {
+	    						// test for the case that the payload has been compressed twice
+		    					$this->debug('The inflated payload is smaller than the gzipped one; try again');
+								if ($degzdata = @gzinflate($data)) {
+			    					$data = $degzdata;
+			    					$this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
+								}
+	    					}
+	    				} else {
+	    					$this->debug('Error using gzinflate to inflate the payload');
+	    					$this->setError('Error using gzinflate to inflate the payload');
+	    				}
+					} elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
+						if ($degzdata = @gzinflate(substr($data, 10))) {	// do our best
+							$data = $degzdata;
+	    					$this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
+	    					if (strlen($data) < $datalen) {
+	    						// test for the case that the payload has been compressed twice
+		    					$this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
+								if ($degzdata = @gzinflate(substr($data, 10))) {
+			    					$data = $degzdata;
+			    					$this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
+								}
+	    					}
+	    				} else {
+	    					$this->debug('Error using gzinflate to un-gzip the payload');
+							$this->setError('Error using gzinflate to un-gzip the payload');
+	    				}
+					}
+					//$timer->setMarker('finished decoding of gzip/deflated content');
+					//print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
+					// set decoded payload
+					$this->incoming_payload = $header_data.$lb.$lb.$data;
+    			} else {
+					$this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
+					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
+				}
+			} else {
+				$this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
+				$this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
+			}
+		} else {
+			$this->debug('No Content-Encoding header');
+		}
+		
+		if(strlen($data) == 0){
+			$this->debug('no data after headers!');
+			$this->setError('no data present after HTTP headers');
+			return false;
+		}
+		
+		return $data;
+	}
+
+	function setContentType($type, $charset = false) {
+		$this->outgoing_headers['Content-Type'] = $type . ($charset ? '; charset=' . $charset : '');
+		$this->debug('set Content-Type: ' . $this->outgoing_headers['Content-Type']);
+	}
+
+	function usePersistentConnection(){
+		if (isset($this->outgoing_headers['Accept-Encoding'])) {
+			return false;
+		}
+		$this->protocol_version = '1.1';
+		$this->persistentConnection = true;
+		$this->outgoing_headers['Connection'] = 'Keep-Alive';
+		$this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
+		return true;
+	}
+
+	/**
+	 * parse an incoming Cookie into it's parts
+	 *
+	 * @param	string $cookie_str content of cookie
+	 * @return	array with data of that cookie
+	 * @access	private
+	 */
+	/*
+	 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
+	 */
+	function parseCookie($cookie_str) {
+		$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
+		$data = split(';', $cookie_str);
+		$value_str = $data[0];
+
+		$cookie_param = 'domain=';
+		$start = strpos($cookie_str, $cookie_param);
+		if ($start > 0) {
+			$domain = substr($cookie_str, $start + strlen($cookie_param));
+			$domain = substr($domain, 0, strpos($domain, ';'));
+		} else {
+			$domain = '';
+		}
+
+		$cookie_param = 'expires=';
+		$start = strpos($cookie_str, $cookie_param);
+		if ($start > 0) {
+			$expires = substr($cookie_str, $start + strlen($cookie_param));
+			$expires = substr($expires, 0, strpos($expires, ';'));
+		} else {
+			$expires = '';
+		}
+
+		$cookie_param = 'path=';
+		$start = strpos($cookie_str, $cookie_param);
+		if ( $start > 0 ) {
+			$path = substr($cookie_str, $start + strlen($cookie_param));
+			$path = substr($path, 0, strpos($path, ';'));
+		} else {
+			$path = '/';
+		}
+						
+		$cookie_param = ';secure;';
+		if (strpos($cookie_str, $cookie_param) !== FALSE) {
+			$secure = true;
+		} else {
+			$secure = false;
+		}
+
+		$sep_pos = strpos($value_str, '=');
+
+		if ($sep_pos) {
+			$name = substr($value_str, 0, $sep_pos);
+			$value = substr($value_str, $sep_pos + 1);
+			$cookie= array(	'name' => $name,
+			                'value' => $value,
+							'domain' => $domain,
+							'path' => $path,
+							'expires' => $expires,
+							'secure' => $secure
+							);		
+			return $cookie;
+		}
+		return false;
+	}
+  
+	/**
+	 * sort out cookies for the current request
+	 *
+	 * @param	array $cookies array with all cookies
+	 * @param	boolean $secure is the send-content secure or not?
+	 * @return	string for Cookie-HTTP-Header
+	 * @access	private
+	 */
+	function getCookiesForRequest($cookies, $secure=false) {
+		$cookie_str = '';
+		if ((! is_null($cookies)) && (is_array($cookies))) {
+			foreach ($cookies as $cookie) {
+				if (! is_array($cookie)) {
+					continue;
+				}
+	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
+				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
+					if (strtotime($cookie['expires']) <= time()) {
+						$this->debug('cookie has expired');
+						continue;
+					}
+				}
+				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
+					$domain = preg_quote($cookie['domain']);
+					if (! preg_match("'.*$domain$'i", $this->host)) {
+						$this->debug('cookie has different domain');
+						continue;
+					}
+				}
+				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
+					$path = preg_quote($cookie['path']);
+					if (! preg_match("'^$path.*'i", $this->path)) {
+						$this->debug('cookie is for a different path');
+						continue;
+					}
+				}
+				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
+					$this->debug('cookie is secure, transport is not');
+					continue;
+				}
+				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
+	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
+			}
+		}
+		return $cookie_str;
+  }
+}
+
+
 ?>

Modified: vtigercrm/branches/5.1_jens/include/utils/CommonUtils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/CommonUtils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/CommonUtils.php Tue Nov 14 03:16:10 2006
@@ -220,6 +220,33 @@
         return $string;
 }
 
+/**
+ *	Function used to decodes the given single quote and double quote only. This function used for popup selection 
+ *	@param string $string - string to be converted, $encode - flag to decode
+ *	@return string $string - the decoded value in string fromat where as only single and double quotes will be decoded
+ */
+
+function popup_from_html($string, $encode=true)
+{
+	global $log;
+	$log->debug("Entering popup_from_html(".$string.",".$encode.") method ...");
+
+	$popup_toHtml = array(
+        			'"' => '&quot;',
+			        "'" =>  '&#039;',
+			     );
+
+        //if($encode && is_string($string))$string = html_entity_decode($string, ENT_QUOTES);
+        if($encode && is_string($string))
+	{
+                $string = addslashes(str_replace(array_values($popup_toHtml), array_keys($popup_toHtml), $string));
+        }
+
+	$log->debug("Exiting popup_from_html method ...");
+        return $string;
+}
+
+
 /** To get the Currency of the specified user
   * @param $id -- The user Id:: Type integer
   * @returns  vtiger_currencyid :: Type integer
@@ -411,6 +438,27 @@
 	$log->debug("Exiting getContactName method ...");
         return $contact_name;
 }
+
+/**
+ * Function to get the Campaign Name when a campaign id is given
+ * Takes the input as $campaign_id - campaign id
+ * returns the Campaign Name in string format.
+ */
+
+function getOrgUnitName($orgunit_id)
+{
+	global $log;
+	$log->debug("Entering getOrgUnitName(".$orgunit_id.") method ...");
+	$log->info("in getOrgUnitName ".$orgunit_id);
+
+	global $adb;
+	$sql = "select * from vtiger_orgunit where orgunitid=".$orgunit_id;
+	$result = $adb->query($sql);
+	$orgunit_name = $adb->query_result($result,0,"name");
+	$log->debug("Exiting getOrgUnitName method ...");
+	return $orgunit_name;
+}
+
 
 /**
  * Function to get the Campaign Name when a campaign id is given
@@ -600,9 +648,6 @@
 
 /**
  * Get the username by giving the user id.   This method expects the user id
- * param $label_list - the array of strings to that contains the option list
- * param $key_list - the array of strings to that contains the values list
- * param $selected - the string which contains the default value
  */
      
 function getUserName($userid)
@@ -620,6 +665,29 @@
 	}
 	$log->debug("Exiting getUserName method ...");
 	return $user_name;	
+}
+
+/**
+* Get the user full name by giving the user id.   This method expects the user id
+* DG 30 Aug 2006
+*/
+
+function getUserFullName($userid)
+{
+	global $log;
+	$log->debug("Entering getUserFullName(".$userid.") method ...");
+	$log->info("in getUserFullName ".$userid);
+	global $adb;
+	if($userid != '')
+	{
+		$sql = "select first_name, last_name from vtiger_users where id=".$userid;
+		$result = $adb->query($sql);
+		$first_name = $adb->query_result($result,0,"first_name");
+		$last_name = $adb->query_result($result,0,"last_name");
+		$user_name = $first_name." ".$last_name;
+	}
+        $log->debug("Exiting getUserFullName method ...");
+        return $user_name;
 }
 
 /**
@@ -1020,7 +1088,6 @@
 		$result = $adb->query($sql);
                 $getBlockInfo=getBlockInformation($module,$result,$col_fields,$tabid,$block_label,$mode);	
 	}
-	$log->debug("Exiting getBlocks method ...");
 	$index_count =1;
 	$max_index =0;
 	foreach($getBlockInfo as $label=>$contents)
@@ -1045,6 +1112,7 @@
 			
 		}
 	}
+	$log->debug("Exiting getBlocks method ...");
 	return $getBlockInfo;
 }	
 /**
@@ -1552,27 +1620,26 @@
 			$value = $_REQUEST[$fieldname];
 			$focus->column_fields[$fieldname] = $value;
 		}
-		if(isset($_REQUEST['txtTax']))
-		{
-			$value = convertToDollar($_REQUEST['txtTax'],$rate);
-			$focus->column_fields['txtTax'] = $value;
-		}
-		if(isset($_REQUEST['txtAdjustment']))
-		{
-			$value = convertToDollar($_REQUEST['txtAdjustment'],$rate);
-			$focus->column_fields['txtAdjustment'] = $value;
-		}
-		if(isset($_REQUEST['hdnSubTotal']))
-		{
-			$value = convertToDollar($_REQUEST['hdnSubTotal'],$rate);
-			$focus->column_fields['hdnSubTotal'] = $value;
-		}
-		if(isset($_REQUEST['hdnGrandTotal']))
-		{
-			$value = convertToDollar($_REQUEST['hdnGrandTotal'],$rate);
-			$focus->column_fields['hdnGrandTotal'] = $value;
-		}
-
+	}
+	if(isset($_REQUEST['txtTax']))
+	{
+		$value = convertToDollar($_REQUEST['txtTax'],$rate);
+		$focus->column_fields['txtTax'] = $value;
+	}
+	if(isset($_REQUEST['txtAdjustment']))
+	{
+		$value = convertToDollar($_REQUEST['txtAdjustment'],$rate);
+		$focus->column_fields['txtAdjustment'] = $value;
+	}
+	if(isset($_REQUEST['hdnSubTotal']))
+	{
+		$value = convertToDollar($_REQUEST['hdnSubTotal'],$rate);
+		$focus->column_fields['hdnSubTotal'] = $value;
+	}
+	if(isset($_REQUEST['hdnGrandTotal']))
+	{
+		$value = convertToDollar($_REQUEST['hdnGrandTotal'],$rate);
+		$focus->column_fields['hdnGrandTotal'] = $value;
 	}
 	$log->debug("Exiting setObjectValuesFromRequest method ...");
 }
@@ -1953,7 +2020,10 @@
 
 	foreach($object_column_fields as $fieldname => $fieldlabel)
 	{
-		$description .= $fieldlabel.' : <b>'.$focus->column_fields[$fieldname].'</b><br>';
+		//Get the translated string
+		$temp_label = isset($app_strings[$fieldlabel])?$app_strings[$fieldlabel]:(isset($mod_strings[$fieldlabel])?$mod_strings[$fieldlabel]:$fieldlabel);
+
+		$description .= $temp_label.' : <b>'.$focus->column_fields[$fieldname].'</b><br>';
 	}
 
 	$description .= '<br><br>Thank You <br>';
@@ -1976,6 +2046,26 @@
 	$change_owner = get_select_options_with_id($usernamelist,'admin');
 	$log->debug("Exiting getUserslist method ...");
 	return $change_owner;
+}
+
+
+function getGroupslist()
+{
+	global $log;
+	$log->debug("Entering getGroupslist() method ...");
+	global $adb;
+	$result=$adb->query("select * from vtiger_groups");
+	
+	for($i=0;$i<$adb->num_rows($result);$i++)
+	{
+	       $groupidlist[$i]=$adb->query_result($result,$i,'groupid');
+	       $groupnamelist[$groupidlist[$i]]=$adb->query_result($result,$i,'groupname');
+	       
+	}
+	$change_groups_owner = get_select_options_with_id($groupnamelist,'');
+	$log->debug("Exiting getGroupslist method ...");
+
+	return $change_groups_owner;
 }
 
 
@@ -2019,214 +2109,30 @@
 	global $log;
 	$log->debug("Entering getEntityName(".$module.") method ...");
 		
-	switch ($module)
-	{
-		case "Accounts" : $query = "select accountname from vtiger_account where accountid in (".$list.")";
-				  $result = $adb->query($query);
-				  $numrows = $adb->num_rows($result);
-				  $account_name = array();	
-				  	for ($i = 0; $i < $numrows; $i++)
-				  	{
-				 		$acc_id = $ids_list[$i];
-						$account_name[$acc_id] = $adb->query_result($result,$i,'accountname');
-				  	}
-					return $account_name;
-					break;
-
-		  case "Leads" :  $query = "select concat(firstname,' ',lastname) as leadname from vtiger_leaddetails where leadid in (".$list.")";
-				  $result = $adb->query($query);
-				  $numrows = $adb->num_rows($result);
-				  $lead_name = array();
-					for($i = 0; $i < $numrows; $i++)
-					{
-						$lead_id = $ids_list[$i];
-						$lead_name[$lead_id] = $adb->query_result($result,$i,'leadname');
-					}	
-								
-					return $lead_name;
-					break;
-		
-	       case "Contacts" : $query = "select concat(firstname,' ',lastname) as contactname from vtiger_contactdetails where contactid in (".$list.")"; 
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $contact_name = array();
-					for($i=0; $i < $numrows; $i++)
-					{
-						$cont_id = $ids_list[$i];
-						$contact_name[$cont_id] = $adb->query_result($result,$i,'contactname');
-					}
-					
-					return $contact_name;
-					break;
-
-	    case "Potentials"  : $query = "select potentialname from vtiger_potential where potentialid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $potential_name = array();
-					for($i=0; $i < $numrows; $i++)
-					{
-						$pot_id = $ids_list[$i];
-						$potential_name[$pot_id] = $adb->query_result($result,$i,'potentialname');
-					}
-					
-					return $potential_name;
-					break;
-
-	        case "Quotes"  : $query = "select subject from vtiger_quotes where quoteid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $quote_subject = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$quote_id = $ids_list[$i];
-						$quote_subject[$quote_id] = $adb->query_result($result,$i,'subject'); 
-				 	}
-					
-					return $quote_subject;
-					break;	
-
-	    case "SalesOrder"  : $query = "select subject from vtiger_salesorder where salesorderid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $so_subject = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$so_id = $ids_list[$i];
-						$so_subject[$so_id] = $adb->query_result($result,$i,'subject'); 
-				 	}
-					
-					return $so_subject;
-					break;
-	
-	       case "Invoice"  : $query = "select subject from vtiger_invoice where invoiceid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $inv_subject = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$inv_id = $ids_list[$i];
-						$inv_subject[$inv_id] = $adb->query_result($result,$i,'subject'); 
-				 	}
-					
-					return $inv_subject;
-					break;
-		
-	      case "Products"  : $query = "select productname from vtiger_products where productid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $product_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$prod_id = $ids_list[$i];
-						$product_name[$prod_id] = $adb->query_result($result,$i,'productname'); 
-				 	}
-					
-					return $product_name;
-					break;
-
-	   case "PriceBooks"  :  $query = "select bookname from vtiger_pricebook where pricebookid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $pbook_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$pbook_id = $ids_list[$i];
-						$pbook_name[$pbook_id] = $adb->query_result($result,$i,'bookname'); 
-				 	}
-					
-					return $pbook_name;
-					break;
-
-	        case "Notes"  :  $query = "select title from vtiger_notes where notesid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $notes_title = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$note_id = $ids_list[$i];
-						$notes_title[$note_id] = $adb->query_result($result,$i,'title'); 
-				 	}
-					
-					return $notes_title;
-					break;
-		
-	  case "Calendar"  :  $query = "select subject from vtiger_activity where activityid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $activity_subject = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$act_id = $ids_list[$i];
-						$activity_subject[$act_id] = $adb->query_result($result,$i,'subject'); 
-				 	}
-					
-					return $activity_subject;
-					break;
-
-	    case "Campaigns"  :  $query = "select campaignname from vtiger_campaign where campaignid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $campaign_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$cmpn_id = $ids_list[$i];
-						$campaign_name[$cmpn_id] = $adb->query_result($result,$i,'campaignname'); 
-				 	}
-					
-					return $campaign_name;
-					break;
-
-	          case "Faq"  :  $query = "select question from vtiger_faq where id in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $faq_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$faq_id = $ids_list[$i];
-						$faq_name[$faq_id] = $adb->query_result($result,$i,'question'); 
-				 	}
-					
-					return $faq_name;
-					break;
-		
-	      case "Vendors"  :  $query = "select vendorname from vtiger_vendor where vendorid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $vendor_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$ven_id = $ids_list[$i];
-						$vendor_name[$ven_id] = $adb->query_result($result,$i,'vendorname'); 
-				 	}
-					
-					return $vendor_name;
-					break;
-
-	case "PurchaseOrder"  :  $query = "select subject from vtiger_purchaseorder where purchaseorderid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $po_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$po_id = $ids_list[$i];
-						$po_name[$po_id] = $adb->query_result($result,$i,'subject'); 
-				 	}
-					
-					return $po_name;
-					break;
-
-	     case "HelpDesk"  :  $query = "select title from vtiger_troubletickets where ticketid in (".$list.")";
-				 $result = $adb->query($query);
-				 $numrows = $adb->num_rows($result);
-				 $ticket_name = array();		    	
-					for($i=0; $i < $numrows; $i++)
-					{
-						$tick_id = $ids_list[$i];
-						$ticket_name[$tick_id] = $adb->query_result($result,$i,'title'); 
-				 	}
-					
-					return $ticket_name;
-					break;
+	if($module != '')
+	{
+		 $query = "select fieldname,tablename,entityidfield from vtiger_entityname where modulename = '$module'";
+		 $result = $adb->query($query);
+		 $fieldsname = $adb->query_result($result,0,'fieldname');
+		 $tablename = $adb->query_result($result,0,'tablename'); 
+		 $entityidfield = $adb->query_result($result,0,'entityidfield'); 
+		 if(!(strpos($fieldsname,',') === false))
+		 {
+			 $fieldlists = explode(',',$fieldsname);
+			 $fieldsname = "concat(";
+			 $fieldsname = $fieldsname.implode(",' ',",$fieldlists);
+			 $fieldsname = $fieldsname.")";
+		 }	
+		 $query1 = "select $fieldsname as entityname from $tablename where $entityidfield in (".$list.")"; 
+		 $result = $adb->query($query1);
+		 $numrows = $adb->num_rows($result);
+	  	 $account_name = array();
+		 for ($i = 0; $i < $numrows; $i++)
+		 {
+			$entity_id = $ids_list[$i];
+			$entity_info[$entity_id] = $adb->query_result($result,$i,'entityname');
+		 }
+		 return $entity_info;
 	}
 	$log->debug("Exiting getEntityName method ...");
 }
@@ -2430,6 +2336,13 @@
 		case 'Contacts':
 			if(is_array($fields["contacts"]))
 			{
+				//Checking for salutation type and checking the table column to be queried
+				$key = array_search('salutationtype',$fields["contacts"]);
+				if(isset($key) && $key !='')
+				{
+					$fields["contacts"][$key]='salutation';
+				}	
+				
 				$columnfields = implode(',',$fields["contacts"]);
 				$query = 'select '.$columnfields.' from vtiger_contactdetails where contactid='.$id;
 				$result = $adb->query($query);
@@ -2443,6 +2356,12 @@
 		case 'Leads':	
 			if(is_array($fields["leads"]))
 			{
+				//Checking for salutation type and checking the table column to be queried
+				$key = array_search('salutationtype',$fields["contacts"]);
+				if(isset($key) && $key !='')
+				{
+					$fields["contacts"][$key]='salutation';
+				}
 				$columnfields = implode(',',$fields["leads"]);
 				$query = 'select '.$columnfields.' from vtiger_leaddetails where leadid='.$id;
 				$result = $adb->query($query);

Modified: vtigercrm/branches/5.1_jens/include/utils/DeleteUtils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/DeleteUtils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/DeleteUtils.php Tue Nov 14 03:16:10 2006
@@ -6,7 +6,7 @@
  * The Initial Developer of the Original Code is vtiger.
  * Portions created by vtiger are Copyright (C) vtiger.
  * All Rights Reserved.
-*
+ *
  ********************************************************************************/
 
 /**
@@ -341,11 +341,22 @@
 		$del_query = "delete from vtiger_portal where portalid=".$record;
 		$adb->query($del_query);
 	break;
+	case Organization:
+		$del_query = "update vtiger_orgunit set deleted=1 where organizationname='".$record."'";
+		$adb->query($del_query);
+		$del_query = "update vtiger_organizationdetails set deleted=1 where organizationname='".$record."'";
+		$adb->query($del_query);
+	break;
+	case OrgUnit:
+		$del_query = "update vtiger_orgunit set deleted=1 where orgunitid=".$record;
+		$adb->query($del_query);
+	break;
 	endswitch;
 	}
 
 	//this is added to update the crmentity.deleted=1 when we delete from listview and not from relatedlist
-	if($return_module == $module && $return_module !='Rss' && $return_module !='Portal')
+	if($return_module == $module && $return_module != 'Rss' && $return_module != 'Portal' &&
+	     $return_module != 'Organization' && $return_module != 'OrgUnit')
 	{	
 		require_once('include/freetag/freetag.class.php');
 		$freetag=new freetag();
@@ -354,7 +365,7 @@
 	}
 
 	//This is to delete the entity information from tracker ie., lastviewed 
-	if($module != 'Faq')
+	if($module != 'Faq' && $module != 'Organization' && $module != 'OrgUnit')
 	{	
 		$sql_recentviewed ='delete from vtiger_tracker where user_id = '.$current_user->id.' and item_id = '.$record;
         	$adb->query($sql_recentviewed);

Modified: vtigercrm/branches/5.1_jens/include/utils/DetailViewUtils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/DetailViewUtils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/DetailViewUtils.php Tue Nov 14 03:16:10 2006
@@ -304,7 +304,8 @@
                    {
                            $imgpath = "test/contact/".$imagename;
                            $label_fld[] =$mod_strings[$fieldlabel];
-                           $label_fld["cntimage"] ='<div style="position:absolute;height=100px"><img class="thumbnail" src="'.$imgpath.'" width="60" height="60" border="0"></div>&nbsp;'.$mod_strings[$fieldlabel];
+			   //This is used to show the contact image as a thumbnail near First Name field
+                           //$label_fld["cntimage"] ='<div style="position:absolute;height=100px"><img class="thumbnail" src="'.$imgpath.'" width="60" height="60" border="0"></div>&nbsp;'.$mod_strings[$fieldlabel];
                    }
                    else
                    {
@@ -332,7 +333,8 @@
 		$value = $col_fields[$fieldname];
 		if($value == 1)
 		{
-			$display_val = 'yes';
+			//Since "yes" is not been translated it is given as app strings here..
+			$display_val = $app_strings['yes'];
 		}
 		else
 		{
@@ -363,7 +365,6 @@
 		$label_fld[] = $campaign_name;
 		$label_fld["secid"] = $campaign_id;
 		$label_fld["link"] = "index.php?module=Campaigns&action=DetailView&record=".$campaign_id;
-
 	}
 	elseif($uitype == 59)
 	{
@@ -462,7 +463,7 @@
 		if($tabid==4)
 		{
 			//$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
-			$sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid where vtiger_seattachmentsrel.crmid=".$col_fields['record_id'];
+			$sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid inner join vtiger_contactdetails on vtiger_contactdetails.imagename=vtiger_attachments.name where vtiger_seattachmentsrel.crmid=".$col_fields['record_id'];
 			$image_res = $adb->query($sql);
 			$image_id = $adb->query_result($image_res,0,'attachmentsid');
 			$image_path = $adb->query_result($image_res,0,'path');
@@ -554,11 +555,14 @@
 
 
 	}
-	elseif($uitype == 105)//Added for user image
+	// UItype 105 added for user image
+	elseif($uitype == 105)
 	{
 		$label_fld[] =$mod_strings[$fieldlabel];
-		//$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
-		$sql = "select vtiger_attachments.* from vtiger_attachments left join vtiger_salesmanattachmentsrel on vtiger_salesmanattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid where vtiger_salesmanattachmentsrel.smid=".$col_fields['record_id'];
+		$sql = "select vtiger_attachments.* from vtiger_attachments
+		    left join vtiger_salesmanattachmentsrel
+			on vtiger_salesmanattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid
+		    where vtiger_salesmanattachmentsrel.smid=".$col_fields['record_id'];
 		$image_res = $adb->query($sql);
 		$image_id = $adb->query_result($image_res,0,'attachmentsid');
 		$image_path = $adb->query_result($image_res,0,'path');
@@ -568,6 +572,18 @@
 		$label_fld[] ='<a href="'.$imgpath.'" target="_blank"><img src="'.$imgpath.'" width="450" height="300" alt="'.$col_fields['user_name'].'" title="'.$col_fields['user_name'].'" border="0"></a>';
 		else
 			$label_fld[] = '';
+	}
+	// UItype 107 added for company logo
+	elseif($uitype == 107)
+	{
+		$label_fld[] =$mod_strings[$fieldlabel];
+		$sql = "select logoname from vtiger_organizationdetails where organizationname='".$col_fields['record_id']."'";
+		$image_res = $adb->query($sql);
+		$image_name = $adb->query_result($image_res,0,'logoname');
+		if($image_name != '')
+		    $label_fld[] = $image_name;
+		else
+		    $label_fld[] = '';
 	}
 	elseif($uitype == 66)
 	{
@@ -847,6 +863,18 @@
 		}
 		$label_fld["cursymb"] = $curr_symbol;
           	$label_fld[] = $display_val;
+	}
+	elseif($uitype == 74)
+	{
+		$label_fld[] =$mod_strings[$fieldlabel];
+		$orgunit_id = $col_fields[$fieldname];
+		if($orgunit_id != '')
+		{
+			$orgunit_name = getOrgUnitName($orgunit_id);
+		}
+		$label_fld[] = $orgunit_name;
+		$label_fld["secid"] = $orgunit_id;
+		$label_fld["link"] = "index.php?module=Organization&action=DetailView&record=".$orgunit_id;
 	}
 	elseif($uitype == 75 || $uitype == 81)
         {
@@ -932,6 +960,10 @@
 			$label_fld[] = '<a href="index.php?module=Users&action=RoleDetailView&roleid='.$col_fields[$fieldname].'">'.getRoleName($col_fields[$fieldname]).'</a>';
 		else
 			$label_fld[] = getRoleName($col_fields[$fieldname]);
+	}elseif($uitype == 85) //Added for Skype by Minnie
+	{
+		$label_fld[] =$mod_strings[$fieldlabel];
+		$label_fld[]= $col_fields[$fieldname];
 	}
 	else
 	{
@@ -940,13 +972,20 @@
               $col_fields[$fieldname]='';
 	 if($uitype == 1 && ($fieldname=='expectedrevenue' || $fieldname=='budgetcost' || $fieldname=='actualcost' || $fieldname=='expectedroi' || $fieldname=='actualroi' ))
 	 {
-		$label_fld[] = convertFromDollar($col_fields[$fieldname],$rate);
+		  $rate_symbol=getCurrencySymbolandCRate($user_info['currency_id']);
+		  $label_fld[] = convertFromDollar($col_fields[$fieldname],$rate_symbol['rate']);
 	 }
 	else
 		$label_fld[] = $col_fields[$fieldname];
 	}
 	$label_fld[]=$uitype;
 	
+	// For inheritance
+	if ( in_array($uitype,array(3,4,18,31,32)) )
+	{
+		$label_fld["inherit"] = $col_fields[$fieldname."@##@"];
+	}
+
 	//sets whether the currenct user is admin or not
 	if(is_admin($current_user))
 	{
@@ -1352,7 +1391,7 @@
 		$custfld = getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields,$generatedtype,$tabid);
 		if(is_array($custfld))
 		{
-			$label_data[$block][] = array($custfld[0]=>array("value"=>$custfld[1],"ui"=>$custfld[2],"options"=>$custfld["options"],"secid"=>$custfld["secid"],"link"=>$custfld["link"],"cursymb"=>$custfld["cursymb"],"salut"=>$custfld["salut"],"cntimage"=>$custfld["cntimage"],"isadmin"=>$custfld["isadmin"],"tablename"=>$fieldtablename,"fldname"=>$fieldname));
+			$label_data[$block][] = array($custfld[0]=>array("value"=>$custfld[1],"ui"=>$custfld[2],"options"=>$custfld["options"],"secid"=>$custfld["secid"],"link"=>$custfld["link"],"cursymb"=>$custfld["cursymb"],"salut"=>$custfld["salut"],"cntimage"=>$custfld["cntimage"],"isadmin"=>$custfld["isadmin"],"tablename"=>$fieldtablename,"fldname"=>$fieldname,"inherit"=>$custfld["inherit"]));
 		}
 		$i++;
 		if($i<$noofrows)
@@ -1370,7 +1409,7 @@
 			$custfld = getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields,$generatedtype,$tabid);
 			if(is_array($custfld))
 			{
-				$label_data[$block][] = array($custfld[0]=>array("value"=>$custfld[1],"ui"=>$custfld[2],"options"=>$custfld["options"],"secid"=>$custfld["secid"],"link"=>$custfld["link"],"cursymb"=>$custfld["cursymb"],"salut"=>$custfld["salut"],"cntimage"=>$custfld["cntimage"],"isadmin"=>$custfld["isadmin"],"tablename"=>$fieldtablename,"fldname"=>$fieldname));
+				$label_data[$block][] = array($custfld[0]=>array("value"=>$custfld[1],"ui"=>$custfld[2],"options"=>$custfld["options"],"secid"=>$custfld["secid"],"link"=>$custfld["link"],"cursymb"=>$custfld["cursymb"],"salut"=>$custfld["salut"],"cntimage"=>$custfld["cntimage"],"isadmin"=>$custfld["isadmin"],"tablename"=>$fieldtablename,"fldname"=>$fieldname,"inherit"=>$custfld["inherit"]));
 			}
 		}
 

Modified: vtigercrm/branches/5.1_jens/include/utils/EditViewUtils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/EditViewUtils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/EditViewUtils.php Tue Nov 14 03:16:10 2006
@@ -106,7 +106,8 @@
 			}
 			else
 			{
-				$curr_time = date('H:i');
+				$endtime = time() + (60 * 60);
+				$curr_time = date('H:i',$endtime);
 			}
 		}
 		$fieldvalue[] = array($disp_value => $curr_time) ;
@@ -151,7 +152,12 @@
 		}
 		$fieldvalue [] = $options;
 	}
-	elseif($uitype == 17)
+	elseif($uitype == 17 || $uitype == 18)
+	{
+		$editview_label[]=$mod_strings[$fieldlabel];
+		$fieldvalue [] = $value;
+	}
+	elseif($uitype == 85) //added for Skype by Minnie
 	{
 		$editview_label[]=$mod_strings[$fieldlabel];
 		$fieldvalue [] = $value;
@@ -578,8 +584,8 @@
  			    $query = 'select vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name from vtiger_products left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_products.productid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where productid='.$col_fields['record_id'];
  		    }
  		    else
- 		    {
- 			    $query = "select vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name from vtiger_contactdetails left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_contactdetails.contactid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where contactid=".$col_fields['record_id'];
+		    {
+			    $query = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid inner join vtiger_contactdetails on vtiger_contactdetails.imagename=vtiger_attachments.name where vtiger_seattachmentsrel.crmid=".$col_fields['record_id'];
  		    }
  		    $result_image = $adb->query($query);
  		    for($image_iter=0;$image_iter < $adb->num_rows($result_image);$image_iter++)	
@@ -857,15 +863,15 @@
 				$nemail=count($realid);
 
 				if ($pmodule=='Accounts'){
-					require_once('modules/Accounts/Account.php');
-					$myfocus = new Account();
+					require_once('modules/Accounts/Accounts.php');
+					$myfocus = new Accounts();
 					$myfocus->retrieve_entity_info($entityid,"Accounts");
 					$fullname=br2nl($myfocus->column_fields['accountname']);
 					$account_selected = 'selected';
 				}
 				elseif ($pmodule=='Contacts'){
-					require_once('modules/Contacts/Contact.php');
-					$myfocus = new Contact();
+					require_once('modules/Contacts/Contacts.php');
+					$myfocus = new Contacts();
 					$myfocus->retrieve_entity_info($entityid,"Contacts");
 					$fname=br2nl($myfocus->column_fields['firstname']);
 					$lname=br2nl($myfocus->column_fields['lastname']);
@@ -873,8 +879,8 @@
 					$contact_selected = 'selected';
 				}
 				elseif ($pmodule=='Leads'){
-					require_once('modules/Leads/Lead.php');
-					$myfocus = new Lead();
+					require_once('modules/Leads/Leads.php');
+					$myfocus = new Leads();
 					$myfocus->retrieve_entity_info($entityid,"Leads");
 					$fname=br2nl($myfocus->column_fields['firstname']);
 					$lname=br2nl($myfocus->column_fields['lastname']);
@@ -1195,12 +1201,14 @@
 	elseif($uitype == 105)
 	{
 		$editview_label[]=$mod_strings[$fieldlabel];
-			$query = "select attachments.path, attachments.name from contactdetails left join seattachmentsrel on seattachmentsrel.crmid=contactdetails.contactid inner join attachments on attachments.attachmentsid=seattachmentsrel.attachmentsid where contactdetails.imagename=attachments.name and contactid=".$col_fields['record_id'];
-		$result_image = $adb->query($query);
-		for($image_iter=0;$image_iter < $adb->num_rows($result_image);$image_iter++)	
-		{
-			$image_array[] = $adb->query_result($result_image,$image_iter,'name');	
-			$image_path_array[] = $adb->query_result($result_image,$image_iter,'path');	
+		 if( isset( $col_fields['record_id']) && $col_fields['record_id'] != '') {
+			$query = "select vtiger_attachments.path, vtiger_attachments.name from vtiger_contactdetails left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_contactdetails.contactid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where vtiger_contactdetails.imagename=vtiger_attachments.name and contactid=".$col_fields['record_id'];
+			$result_image = $adb->query($query);
+			for($image_iter=0;$image_iter < $adb->num_rows($result_image);$image_iter++)	
+			{
+				$image_array[] = $adb->query_result($result_image,$image_iter,'name');	
+				$image_path_array[] = $adb->query_result($result_image,$image_iter,'path');	
+			}
 		}
 		if(is_array($image_array))
 			for($img_itr=0;$img_itr<count($image_array);$img_itr++)
@@ -1225,10 +1233,16 @@
 		$editview_label[]=$mod_strings[$fieldlabel];
 		if($uitype == 1 && ($fieldname=='expectedrevenue' || $fieldname=='budgetcost' || $fieldname=='actualcost' || $fieldname=='expectedroi' || $fieldname=='actualroi' ) && ($module_name=='Campaigns'))
 		{
-			$fieldvalue[] = convertFromDollar($value,$rate);
+			$rate_symbol = getCurrencySymbolandCRate($user_info['currency_id']);
+			$fieldvalue[] = convertFromDollar($value,$rate_symbol['rate']);
 		}
 		else
 			$fieldvalue[] = $value;
+	}
+
+	// For inheritance
+	if ( in_array($uitype,array(3,4,18,31,32)) ) {
+	    $fieldvalue[] = $col_fields[$fieldname."@##@"];
 	}
 
 	// Mike Crowe Mod --------------------------------------------------------force numerics right justified.
@@ -1243,6 +1257,7 @@
 	$final_arr[]=$editview_label;
 	$final_arr[]=$editview_fldname;
 	$final_arr[]=$fieldvalue;
+	$final_arr[]=$inherit;
 	$log->debug("Exiting getOutputHtml method ...");
 	return $final_arr;
 }
@@ -1827,4 +1842,104 @@
 }
 
 
+/** This function returns the detailed list of organization units associated to 
+*   the selected organization
+* Param $organization - organization object 
+*/
+
+function getOrgUnits($organization,$orgunitid="")
+{
+    // The array we're about to build
+    $orgunittab = array();
+    $fields = "orgunitid,type,name,address,city,state,country,code,phone,fax,website";
+    $fields .= ",logoname,quote_template,so_template,po_template,invoice_template";
+    global $adb;
+
+    // Parameter check
+    if( !isset( $organization) || $organization == '' ||
+	!isset( $organization->id) || $organization->id == '')
+	return $orgunittab;
+
+    // Database query
+    if( $orgunitid != "0")
+	$query = "SELECT vtiger_orgunit.orgunitid AS orgunitid,";
+    else
+	$query = "SELECT 0 AS orgunitid,";
+
+    // logoname is only defined in the organization record.
+    $query .= "'@##@' AS logoname, vtiger_organizationdetails.logoname AS org_logoname";
+
+    foreach( split( ',', $fields) as $field) {
+	if( $field != "orgunitid" && $field != "logoname") {
+	    if( $orgunitid != "0")
+		$query .= ",vtiger_orgunit.".$field." AS ".$field;
+	    else
+		$query .= ",NULL AS ".$field;
+	    if( $field != "type" && $field != "name")
+		$query .= ",vtiger_organizationdetails.".$field." AS org_".$field;
+	}
+    }
+
+    if( $orgunitid != "0" ) {
+	// database joins
+	$query .= " FROM vtiger_orgunit 
+			LEFT JOIN vtiger_organizationdetails
+			    ON vtiger_orgunit.organizationname=vtiger_organizationdetails.organizationname ";
+
+	// single or list query?
+	if( $orgunitid == "")
+	    $query .= "WHERE vtiger_orgunit.organizationname='".$organization->id."' ";
+	else
+	    $query .= "WHERE vtiger_orgunit.orgunitid=".$orgunitid." ";
+
+	// do not return deleted orgunits
+	$query .= "AND vtiger_orgunit.deleted=0";
+    }
+
+    else {
+	$query .= " FROM vtiger_organizationdetails ";
+	$query .= " WHERE vtiger_organizationdetails.organizationname='".$organization->id."' ";
+    }
+
+    // Do not return deleted organizations
+    $query .= " AND vtiger_organizationdetails.deleted=0";
+
+    $result = $adb->query( $query);
+    $noofrows = $adb->num_rows($result);
+
+    // Get all rows from database
+    for($j = 0; $j < $noofrows; $j++) {
+	$orgunit = array();
+	foreach( split( ',', $fields) as $field) {
+	    if( $orgunitid != "0") {
+		$orgunit[$field] = $adb->query_result($result,$j,$field);
+
+		// Inherited and extended fields
+		if( substr( $orgunit[$field], 0, 4) == "@##@") {
+		    if( $field == "name") {
+			$orgunit[$field] = substr($orgunit[$field], 4, strlen( $orgunit[$field])-4);
+			if( $orgunitid != "") 
+			    $orgunit[$field] = $organization->id." ".$orgunit[$field];
+		    } else {
+			$orgunit[$field] = $adb->query_result($result,$j,"org_".$field);
+		    }
+		}
+	    }
+
+	    // no orgunit selected
+	    else {
+		if( $field == "name") 
+		    $orgunit[$field] = $organization->id;
+		elseif( $field == "orgunitid")
+		    $orgunit[$field] = 0;
+		else
+		    $orgunit[$field] = $adb->query_result($result,$j,"org_".$field);
+	    }
+	}
+	$id = $orgunit["orgunitid"];
+	$orgunittab[$id] = $orgunit;
+    }
+    // Return what we've found
+    return $orgunittab;
+}
 ?>

Modified: vtigercrm/branches/5.1_jens/include/utils/InventoryUtils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/InventoryUtils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/InventoryUtils.php Tue Nov 14 03:16:10 2006
@@ -469,7 +469,7 @@
  *	@param $update_prod_stock - true or false (default), if true we have to update the stock for PO only
  *	@return void
  */
-function saveInventoryProductDetails($focus, $module, $update_prod_stock='false')
+function saveInventoryProductDetails($focus, $module, $update_prod_stock='false', $updateDemand='')
 {
 	global $log, $adb;
 	$log->debug("Entering into function saveInventoryProductDetails($focus, $module).");
@@ -488,6 +488,10 @@
 	}
 
 	$tot_no_prod = $_REQUEST['totalProductCount'];
+
+	//If the taxtype is group then retrieve all available taxes, else retrive associated taxes for each product inside loop
+	if($_REQUEST['taxtype'] == 'group')
+		$all_available_taxes = getAllTaxes('available');
 
 	$prod_seq=1;
 	for($i=1; $i<=$tot_no_prod; $i++)
@@ -508,6 +512,17 @@
 		{
 			addToProductStock($prod_id,$qty);
 		}
+		if($module == 'SalesOrder')
+		{
+			if($updateDemand == '-')
+			{
+				deductFromProductDemand($prod_id,$qty);
+			}
+			elseif($updateDemand == '+')
+			{
+				addToProductDemand($prod_id,$qty);
+			}
+		}
 
 		$query ="insert into vtiger_inventoryproductrel(id, productid, sequence_no, quantity, listprice, comment) values($focus->id, $prod_id , $prod_seq, $qty, $listprice, '$comment')";
 		$prod_seq++;
@@ -519,8 +534,6 @@
 			updateStk($prod_id,$qty,$focus->mode,$ext_prod_arr,$module);
 		}
 
-		$taxes_for_product = getTaxDetailsForProduct($prod_id,'all');
-
 		//we should update discount and tax details
 		$updatequery = "update vtiger_inventoryproductrel set ";
 
@@ -535,12 +548,11 @@
 			$updatequery .= " discount_amount='".$discount_amount."',";
 		}
 
-
 		if($_REQUEST['taxtype'] == 'group')
 		{
-			for($tax_count=0;$tax_count<count($taxes_for_product);$tax_count++)
+			for($tax_count=0;$tax_count<count($all_available_taxes);$tax_count++)
 			{
-				$tax_name = $taxes_for_product[$tax_count]['taxname'];
+				$tax_name = $all_available_taxes[$tax_count]['taxname'];
 				$request_tax_name = $tax_name."_group_percentage";
 			
 				$updatequery .= "$tax_name = '".$_REQUEST[$request_tax_name]."',";
@@ -549,6 +561,7 @@
 		}
 		else
 		{
+			$taxes_for_product = getTaxDetailsForProduct($prod_id,'all');
 			for($tax_count=0;$tax_count<count($taxes_for_product);$tax_count++)
 			{
 				$tax_name = $taxes_for_product[$tax_count]['taxname'];

Modified: vtigercrm/branches/5.1_jens/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/ListViewUtils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/ListViewUtils.php Tue Nov 14 03:16:10 2006
@@ -528,7 +528,10 @@
 	{
 		$list_header =Array();
 		//Getting the entityid
-		if($module != 'Users')
+		if($module == 'Organization')
+		{
+			$entity_id = $adb->query_result($list_result,$i-1,"organizationname");
+		}elseif($module != 'Users')
 		{
 			$entity_id = $adb->query_result($list_result,$i-1,"crmid");
 			$owner_id = $adb->query_result($list_result,$i-1,"smownerid");
@@ -538,22 +541,25 @@
 		}	
 		// Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
 		// begin: Armando Lüscher 05.07.2005 -> §priority
-		// Code contri buted by fredy Desc: Set Priority color
-		$priority = $adb->query_result($list_result,$i-1,"priority");
-
-		$font_color_high = "color:#00DD00;";
-		$font_color_medium = "color:#DD00DD;";
-		$P_FONT_COLOR = "";
-		switch ($priority)
-		{
-			case 'High':
-				$P_FONT_COLOR = $font_color_high;
-				break;
-			case 'Medium':
-				$P_FONT_COLOR = $font_color_medium;
-				break;
-			default:
-				$P_FONT_COLOR = "";
+		// Code contributed by fredy Desc: Set Priority color
+		if($module != 'Organization')
+		{
+		    $priority = $adb->query_result($list_result,$i-1,"priority");
+
+		    $font_color_high = "color:#00DD00;";
+		    $font_color_medium = "color:#DD00DD;";
+		    $P_FONT_COLOR = "";
+		    switch ($priority)
+		    {
+			    case 'High':
+				    $P_FONT_COLOR = $font_color_high;
+				    break;
+			    case 'Medium':
+				    $P_FONT_COLOR = $font_color_medium;
+				    break;
+			    default:
+				    $P_FONT_COLOR = "";
+		    }
 		}
 		//end: Armando Lüscher 05.07.2005 -> §priority
 
@@ -572,9 +578,6 @@
 
 			if($is_admin==true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0 || in_array($fieldname,$field))
 			{
-
-
-
 				if($fieldname == '')
 				{
 					$table_name = '';
@@ -772,7 +775,6 @@
 	}
 	$log->debug("Exiting getListViewEntries method ...");
 	return $list_block;
-	
 }
 
 /**This function generates the List view entries in a popup list view 
@@ -861,9 +863,11 @@
 	{
 		for ($i=$navigation_array['start']; $i<=$navigation_array['end_val']; $i++)
 		{
-
 			//Getting the entityid
-			if($module != 'Users')	
+			if($module == 'Organization') 
+			{
+				$entity_id = $adb->query_result($list_result,$i-1,"organizationname");
+			}elseif($module != 'Users')	
 			{
 				$entity_id = $adb->query_result($list_result,$i-1,"crmid");
 			}else
@@ -1275,6 +1279,16 @@
 		else
 			$value='';
         }
+	elseif($uitype == 74)
+	{
+		if($temp_val != '')
+		{
+			$orgunitname=getOrgUnitName($temp_val);
+			$value= '<a href=index.php?module=Organization&action=DetailView&record='.$temp_val.'>'.$orgunitname.'</a>';
+		}
+		else
+			$value='';
+	}
 	elseif($uitype == 75 || $uitype == 81)
         {
 
@@ -1309,12 +1323,13 @@
 					}
 
 					$temp_val = str_replace("'",'\"',$temp_val);
+					$temp_val = popup_from_html($temp_val);
 
 					//Added to avoid the error when select SO from Invoice through AjaxEdit
 					if($module == 'SalesOrder')
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'","'.$_REQUEST['form'].'"); window.close()\'>'.$temp_val.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'","'.$_REQUEST['form'].'");\'>'.$temp_val.'</a>';
 					else
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'"); window.close()\'>'.$temp_val.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "detailview")
 				{
@@ -1323,18 +1338,20 @@
 					elseif($colname == "lastname" && $module == 'Leads')
 						$firstname=$adb->query_result($list_result,$list_result_count,'firstname');
 					$temp_val =$temp_val.' '.$firstname;
+					$temp_val = popup_from_html($temp_val);
 
 					$focus->record_id = $_REQUEST['recordid'];
 					if($_REQUEST['return_module'] == "Calendar")
 					{
-						$value = '<a href="a" id="calendarCont'.$entity_id.'" LANGUAGE=javascript onclick=\'add_data_to_relatedlist_incal("'.$entity_id.'","'.$temp_val.'"); window.close()\'>'.$temp_val.'</a>';
+						$value = '<a href="javascript:window.close();" id="calendarCont'.$entity_id.'" LANGUAGE=javascript onclick=\'add_data_to_relatedlist_incal("'.$entity_id.'","'.$temp_val.'");\'>'.$temp_val.'</a>';
 					}
 					else
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'add_data_to_relatedlist("'.$entity_id.'","'.$focus->record_id.'","'.$module.'"); window.close()\'>'.$temp_val.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'add_data_to_relatedlist("'.$entity_id.'","'.$focus->record_id.'","'.$module.'");\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "formname_specific")
 				{
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_formname_specific("'.$_REQUEST['form'].'", "'.$entity_id.'", "'.br2nl($temp_val).'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_formname_specific("'.$_REQUEST['form'].'", "'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "inventory_prod")
 				{
@@ -1354,7 +1371,8 @@
 					$unitprice = convertFromDollar($unitprice,$rate);
 					$qty_stock=$adb->query_result($list_result,$list_result_count,'qtyinstock');
 
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$qty_stock.'","'.$tax_str.'","'.$row_id.'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_inventory("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$qty_stock.'","'.$tax_str.'","'.$row_id.'");\'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "inventory_prod_po")
 				{
@@ -1372,7 +1390,9 @@
 					$rate = $rate_symbol['rate'];
 					$unitprice=$adb->query_result($list_result,$list_result_count,'unit_price');
 					$unitprice = convertFromDollar($unitprice,$rate);
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory_po("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$tax_str.'","'.$row_id.'"); window.close()\'>'.$temp_val.'</a>';
+
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_po("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$unitprice.'", "'.$tax_str.'","'.$row_id.'"); \'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "inventory_pb")
 				{
@@ -1381,36 +1401,39 @@
 					$flname =  $_REQUEST['fldname'];
 					$listprice=getListPrice($prod_id,$entity_id);	
 
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_inventory_pb("'.$listprice.'", "'.$flname.'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_pb("'.$listprice.'", "'.$flname.'"); \'>'.$temp_val.'</a>';
 				}
 				elseif($popuptype == "specific_account_address")
 				{
-					require_once('modules/Accounts/Account.php');
-					$acct_focus = new Account();
+					require_once('modules/Accounts/Accounts.php');
+					$acct_focus = new Accounts();
 					$acct_focus->retrieve_entity_info($entity_id,"Accounts");
 
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.br2nl($acct_focus->column_fields['bill_street']).'", "'.br2nl($acct_focus->column_fields['ship_street']).'", "'.br2nl($acct_focus->column_fields['bill_city']).'", "'.br2nl($acct_focus->column_fields['ship_city']).'", "'.br2nl($acct_focus->column_fields['bill_state']).'", "'.br2nl($acct_focus->column_fields['ship_state']).'", "'.br2nl($acct_focus->column_fields['bill_code']).'", "'.br2nl($acct_focus->column_fields['ship_code']).'", "'.br2nl($acct_focus->column_fields['bill_country']).'", "'.br2nl($acct_focus->column_fields['ship_country']).'","'.br2nl($acct_focus->column_fields['bill_pobox']).'", "'.br2nl($acct_focus->column_fields['ship_pobox']).'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.br2nl($acct_focus->column_fields['bill_street']).'", "'.br2nl($acct_focus->column_fields['ship_street']).'", "'.br2nl($acct_focus->column_fields['bill_city']).'", "'.br2nl($acct_focus->column_fields['ship_city']).'", "'.br2nl($acct_focus->column_fields['bill_state']).'", "'.br2nl($acct_focus->column_fields['ship_state']).'", "'.br2nl($acct_focus->column_fields['bill_code']).'", "'.br2nl($acct_focus->column_fields['ship_code']).'", "'.br2nl($acct_focus->column_fields['bill_country']).'", "'.br2nl($acct_focus->column_fields['ship_country']).'","'.br2nl($acct_focus->column_fields['bill_pobox']).'", "'.br2nl($acct_focus->column_fields['ship_pobox']).'");\'>'.$temp_val.'</a>';
 
 				}
 				elseif($popuptype == "specific_contact_account_address")
 				{
-					require_once('modules/Accounts/Account.php');
-					$acct_focus = new Account();
+					require_once('modules/Accounts/Accounts.php');
+					$acct_focus = new Accounts();
 					$acct_focus->retrieve_entity_info($entity_id,"Accounts");
 
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_contact_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.br2nl($acct_focus->column_fields['bill_street']).'", "'.br2nl($acct_focus->column_fields['ship_street']).'", "'.br2nl($acct_focus->column_fields['bill_city']).'", "'.br2nl($acct_focus->column_fields['ship_city']).'", "'.br2nl($acct_focus->column_fields['bill_state']).'", "'.br2nl($acct_focus->column_fields['ship_state']).'", "'.br2nl($acct_focus->column_fields['bill_code']).'", "'.br2nl($acct_focus->column_fields['ship_code']).'", "'.br2nl($acct_focus->column_fields['bill_country']).'", "'.br2nl($acct_focus->column_fields['ship_country']).'","'.br2nl($acct_focus->column_fields['bill_pobox']).'", "'.br2nl($acct_focus->column_fields['ship_pobox']).'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_contact_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.br2nl($acct_focus->column_fields['bill_street']).'", "'.br2nl($acct_focus->column_fields['ship_street']).'", "'.br2nl($acct_focus->column_fields['bill_city']).'", "'.br2nl($acct_focus->column_fields['ship_city']).'", "'.br2nl($acct_focus->column_fields['bill_state']).'", "'.br2nl($acct_focus->column_fields['ship_state']).'", "'.br2nl($acct_focus->column_fields['bill_code']).'", "'.br2nl($acct_focus->column_fields['ship_code']).'", "'.br2nl($acct_focus->column_fields['bill_country']).'", "'.br2nl($acct_focus->column_fields['ship_country']).'","'.br2nl($acct_focus->column_fields['bill_pobox']).'", "'.br2nl($acct_focus->column_fields['ship_pobox']).'");\'>'.$temp_val.'</a>';
 
 				}
-
 				elseif($popuptype == "specific_potential_account_address")
 				{
 					$acntid = $adb->query_result($list_result,$list_result_count,"accountid");
-					require_once('modules/Accounts/Account.php');
-					$acct_focus = new Account();
+					require_once('modules/Accounts/Accounts.php');
+					$acct_focus = new Accounts();
 					$acct_focus->retrieve_entity_info($acntid,"Accounts");
 					$account_name = getAccountName($acntid);
 
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$acntid.'", "'.br2nl($account_name).'", "'.br2nl($acct_focus->column_fields['bill_street']).'", "'.br2nl($acct_focus->column_fields['ship_street']).'", "'.br2nl($acct_focus->column_fields['bill_city']).'", "'.br2nl($acct_focus->column_fields['ship_city']).'", "'.br2nl($acct_focus->column_fields['bill_state']).'", "'.br2nl($acct_focus->column_fields['ship_state']).'", "'.br2nl($acct_focus->column_fields['bill_code']).'", "'.br2nl($acct_focus->column_fields['ship_code']).'", "'.br2nl($acct_focus->column_fields['bill_country']).'", "'.br2nl($acct_focus->column_fields['ship_country']).'","'.br2nl($acct_focus->column_fields['bill_pobox']).'", "'.br2nl($acct_focus->column_fields['ship_pobox']).'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.$acntid.'", "'.br2nl($account_name).'", "'.br2nl($acct_focus->column_fields['bill_street']).'", "'.br2nl($acct_focus->column_fields['ship_street']).'", "'.br2nl($acct_focus->column_fields['bill_city']).'", "'.br2nl($acct_focus->column_fields['ship_city']).'", "'.br2nl($acct_focus->column_fields['bill_state']).'", "'.br2nl($acct_focus->column_fields['ship_state']).'", "'.br2nl($acct_focus->column_fields['bill_code']).'", "'.br2nl($acct_focus->column_fields['ship_code']).'", "'.br2nl($acct_focus->column_fields['bill_country']).'", "'.br2nl($acct_focus->column_fields['ship_country']).'","'.br2nl($acct_focus->column_fields['bill_pobox']).'", "'.br2nl($acct_focus->column_fields['ship_pobox']).'");\'>'.$temp_val.'</a>';
 
 				}
 				//added by rdhital/Raju for better emails 
@@ -1429,7 +1452,7 @@
 						//Change this index 0 - to get the vtiger_fieldid based on email1 or email2
 						$fieldid = $adb->query_result($queryres,0,'fieldid');
 
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'return set_return_emails('.$entity_id.','.$fieldid.',"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'return set_return_emails('.$entity_id.','.$fieldid.',"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
 
 					}elseif ($module=='Contacts' || $module=='Leads')
 					{
@@ -1445,7 +1468,7 @@
 						//Change this index 0 - to get the vtiger_fieldid based on email or yahooid
 						$fieldid = $adb->query_result($queryres,0,'fieldid');
 
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'return set_return_emails('.$entity_id.','.$fieldid.',"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'return set_return_emails('.$entity_id.','.$fieldid.',"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
 
 					}else
 					{
@@ -1454,23 +1477,25 @@
 						$name=$lastname.' '.$firstname;
 						$emailaddress=$adb->query_result($list_result,$list_result_count,"email1");
 
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'return set_return_emails('.$entity_id.',-1,"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'return set_return_emails('.$entity_id.',-1,"'.$name.'","'.$emailaddress.'"); \'>'.$name.'</a>';
 						
 					}
 						
 				}	
 				elseif($popuptype == "specific_vendor_address")
 				{
-					require_once('modules/Vendors/Vendor.php');
-					$acct_focus = new Vendor();
+					require_once('modules/Vendors/Vendors.php');
+					$acct_focus = new Vendors();
 					$acct_focus->retrieve_entity_info($entity_id,"Vendors");
 
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.br2nl($acct_focus->column_fields['street']).'", "'.br2nl($acct_focus->column_fields['city']).'", "'.br2nl($acct_focus->column_fields['state']).'", "'.br2nl($acct_focus->column_fields['postalcode']).'", "'.br2nl($acct_focus->column_fields['country']).'","'.br2nl($acct_focus->column_fields['pobox']).'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_address("'.$entity_id.'", "'.br2nl($temp_val).'", "'.br2nl($acct_focus->column_fields['street']).'", "'.br2nl($acct_focus->column_fields['city']).'", "'.br2nl($acct_focus->column_fields['state']).'", "'.br2nl($acct_focus->column_fields['postalcode']).'", "'.br2nl($acct_focus->column_fields['country']).'","'.br2nl($acct_focus->column_fields['pobox']).'");\'>'.$temp_val.'</a>';
 
 				}
 				elseif($popuptype == "specific_campaign")
 				{
-					$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_specific_campaign("'.$entity_id.'", "'.br2nl($temp_val).'"); window.close()\'>'.$temp_val.'</a>';
+					$temp_val = popup_from_html($temp_val);
+					$value = '<a href="javascript:window.close();" onclick=\'set_return_specific_campaign("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
 				}
 				else
 				{
@@ -1479,12 +1504,13 @@
 					$temp_val =$temp_val.' '.$firstname;
 
 					$temp_val = str_replace("'",'\"',$temp_val);
+					$temp_val = popup_from_html($temp_val);
 
 					$log->debug("Exiting getValue method ...");
 					if($_REQUEST['maintab'] == 'Calendar')
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return_todo("'.$entity_id.'", "'.br2nl($temp_val).'"); window.close()\'>'.$temp_val.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'set_return_todo("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
 					else
-						$value = '<a href="a" LANGUAGE=javascript onclick=\'set_return("'.$entity_id.'", "'.br2nl($temp_val).'"); window.close()\'>'.$temp_val.'</a>';
+						$value = '<a href="javascript:window.close();" onclick=\'set_return("'.$entity_id.'", "'.br2nl($temp_val).'");\'>'.$temp_val.'</a>';
 				}
 			}
 			else
@@ -1576,6 +1602,7 @@
 function getListQuery($module,$where='')
 {
 	global $log;
+	global $current_organization;
 	$log->debug("Entering getListQuery(".$module.",".$where.") method ...");
 
 	global $current_user;
@@ -1595,6 +1622,9 @@
 				ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_ticketgrouprelation
 				ON vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
 			LEFT JOIN vtiger_groups
@@ -1628,6 +1658,9 @@
 			FROM vtiger_account
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_account.accountid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_accountbillads
 				ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid
 			INNER JOIN vtiger_accountshipads
@@ -1692,6 +1725,9 @@
 			FROM vtiger_potential
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_potential.potentialid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_account
 				ON vtiger_potential.accountid = vtiger_account.accountid
 			INNER JOIN vtiger_potentialscf
@@ -1722,6 +1758,9 @@
 			FROM vtiger_leaddetails
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_leadsubdetails
 				ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid
 			INNER JOIN vtiger_leadaddress
@@ -1748,6 +1787,9 @@
 			FROM vtiger_products
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_products.productid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_productcf
 				ON vtiger_products.productid = vtiger_productcf.productid
 			LEFT JOIN vtiger_seproductsrel
@@ -1771,6 +1813,9 @@
 			FROM vtiger_notes
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_notes.notesid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_senotesrel
 				ON vtiger_senotesrel.notesid = vtiger_notes.notesid
 			LEFT JOIN vtiger_contactdetails
@@ -1798,6 +1843,9 @@
 			FROM vtiger_contactdetails
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_contactaddress
 				ON vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
 			INNER JOIN vtiger_contactsubdetails
@@ -1831,6 +1879,9 @@
 			FROM vtiger_activity
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_activity.activityid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_cntactivityrel
 				ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid
 			LEFT JOIN vtiger_contactdetails
@@ -1870,6 +1921,9 @@
 			FROM vtiger_activity
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_activity.activityid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_users
 				ON vtiger_users.id = vtiger_crmentity.smownerid
 			LEFT JOIN vtiger_seactivityrel
@@ -1903,6 +1957,9 @@
 			FROM vtiger_faq
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_faq.id
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_products
 				ON vtiger_faq.product_id = vtiger_products.productid
 			WHERE vtiger_crmentity.deleted = 0".$where;
@@ -1920,6 +1977,9 @@
 			FROM vtiger_vendor
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_vendor.vendorid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			WHERE vtiger_crmentity.deleted = 0";
 	}
 	if($module == "PriceBooks")
@@ -1942,6 +2002,9 @@
 			FROM vtiger_quotes
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_quotes.quoteid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_quotesbillads
 				ON vtiger_quotes.quoteid = vtiger_quotesbillads.quotebilladdressid
 			INNER JOIN vtiger_quotesshipads
@@ -1976,6 +2039,9 @@
 			FROM vtiger_purchaseorder
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_purchaseorder.purchaseorderid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT OUTER JOIN vtiger_vendor
 				ON vtiger_purchaseorder.vendorid = vtiger_vendor.vendorid
 			INNER JOIN vtiger_pobillads
@@ -2009,6 +2075,9 @@
 			FROM vtiger_salesorder
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_salesorder.salesorderid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_sobillads
 				ON vtiger_salesorder.salesorderid = vtiger_sobillads.sobilladdressid
 			INNER JOIN vtiger_soshipads
@@ -2045,6 +2114,9 @@
 			FROM vtiger_invoice
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_invoice.invoiceid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			INNER JOIN vtiger_invoicebillads
 				ON vtiger_invoice.invoiceid = vtiger_invoicebillads.invoicebilladdressid
 			INNER JOIN vtiger_invoiceshipads
@@ -2077,8 +2149,13 @@
 			FROM vtiger_campaign
 			INNER JOIN vtiger_crmentity
 				ON vtiger_crmentity.crmid = vtiger_campaign.campaignid
+			INNER JOIN vtiger_entity2org
+				ON vtiger_crmentity.crmid = vtiger_entity2org.crmid
+				AND vtiger_entity2org.organizationname = '".$current_organization."'
 			LEFT JOIN vtiger_campaigngrouprelation
 				ON vtiger_campaign.campaignid = vtiger_campaigngrouprelation.campaignid
+			INNER JOIN vtiger_campaignscf
+			        ON vtiger_campaign.campaignid = vtiger_campaignscf.campaignid
 			LEFT JOIN vtiger_groups
 				ON vtiger_groups.groupname = vtiger_campaigngrouprelation.groupname
 			LEFT JOIN vtiger_users
@@ -2094,9 +2171,13 @@
 	{
 		$query = "select id,user_name,roleid,first_name,last_name,email1,phone_mobile,phone_work,is_admin,status from vtiger_users inner join vtiger_user2role on vtiger_user2role.userid=vtiger_users.id where deleted=0 ".$where ;
 	}
+	if($module == "Organization")
+	{
+		$query = "SELECT organizationname,address,city,state,code FROM vtiger_organizationdetails where deleted=0 ".$where;
+	}
 	
 
-	$log->debug("Exiting getListQuery method ...");
+	$log->debug("Exiting getListQuery method ... ");
 	return $query;
 }
 

Modified: vtigercrm/branches/5.1_jens/include/utils/UserInfoUtil.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/UserInfoUtil.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/UserInfoUtil.php Tue Nov 14 03:16:10 2006
@@ -1346,6 +1346,23 @@
 	$log->debug("Exiting getProfileName method ...");
 	return $profilename;	
 }
+/** Function to get the vtiger_profile Description from the vtiger_profileid
+  * @param $profileid -- Profile Id:: Type integer
+  * @returns $rolename -- Role Name:: Type varchar
+  *
+ */
+function getProfileDescription($profileid)
+{
+        global $log;
+        $log->debug("Entering getProfileDescription(".$profileid.") method ...");
+        global $adb;
+        $sql1 = "select  description from vtiger_profile where profileid=".$profileid;
+        $result = $adb->query($sql1);
+        $profileDescription = $adb->query_result($result,0,"description");
+        $log->debug("Exiting getProfileName method ...");
+        return $profileDescription;
+}
+
 
 /** Function to check if the currently logged in user is permitted to perform the specified action  
   * @param $module -- Module Name:: Type varchar

Modified: vtigercrm/branches/5.1_jens/include/utils/export.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/export.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/export.php Tue Nov 14 03:16:10 2006
@@ -20,23 +20,23 @@
 require_once('config.php');
 require_once('include/logging.php');
 require_once('include/database/PearDatabase.php');
-require_once('modules/Accounts/Account.php');
-require_once('modules/Contacts/Contact.php');
-require_once('modules/Leads/Lead.php');
-require_once('modules/Contacts/Contact.php');
-require_once('modules/Emails/Email.php');
+require_once('modules/Accounts/Accounts.php');
+require_once('modules/Contacts/Contacts.php');
+require_once('modules/Leads/Leads.php');
+require_once('modules/Contacts/Contacts.php');
+require_once('modules/Emails/Emails.php');
 require_once('modules/Calendar/Activity.php');
-require_once('modules/Notes/Note.php');
-require_once('modules/Potentials/Opportunity.php');
-require_once('modules/Users/User.php');
-require_once('modules/Products/Product.php');
+require_once('modules/Notes/Notes.php');
+require_once('modules/Potentials/Potentials.php');
+require_once('modules/Users/Users.php');
+require_once('modules/Products/Products.php');
 require_once('include/utils/UserInfoUtil.php');
 
 global $allow_exports;
 
 session_start();
 
-$current_user = new User();
+$current_user = new Users();
 
 if(isset($_SESSION['authenticated_user_id']))
 {
@@ -87,51 +87,15 @@
 {
 	global $log;
 	$log->debug("Entering export_all(".$type.") method ...");
-	$contact_fields = Array();
-	$account_fields = Array();
 	global $adb;
+
 	$focus = 0;
 	$content = '';
 
-	if ($type == "Contacts")
+	if ($type != "")
 	{
-		$focus = new Contact;
+		$focus = new $type;
 	}
-	else if ($type == "Accounts")
-	{
-		$focus = new Account;
-		$exp_query="SELECT columnname, fieldlabel FROM vtiger_field where tabid=6";
-		$account_result=$adb->query($exp_query);
-		if($adb->num_rows($account_result)!=0)
-		{
-			while($result = $adb->fetch_array($account_result))
-			{
-				$account_columnname = $result['columnname'];
-				$account_fieldlabel = $result['fieldlabel'];
-				$account_fields[$account_columnname] = $account_fieldlabel;
-			}
-		}
-	}
-	else if ($type == "Potentials")
-	{
-        	$focus = new Potential;
-	}
-	else if ($type == "Notes")
-	{
-		$focus = new Note;
-	}
-	else if ($type == "Leads")
-	{
-		$focus = new Lead;
-	}
-	else if ($type == "Emails")
-	{
-		$focus = new Email;
-	}
-	else if ($type == "Products")
-        {
-                $focus = new Product;
-        }
 
 	$log = LoggerManager::getLogger('export_'.$type);
 	$db = new PearDatabase();

Modified: vtigercrm/branches/5.1_jens/include/utils/utils.php
==============================================================================
--- vtigercrm/branches/5.1_jens/include/utils/utils.php (original)
+++ vtigercrm/branches/5.1_jens/include/utils/utils.php Tue Nov 14 03:16:10 2006
@@ -385,6 +385,35 @@
 
 	$return_value = $mod_strings;
 	$mod_strings = $temp_mod_strings;
+
+	$log->debug("Exiting return_module_language method ...");
+	return $return_value;
+}
+
+/*This function returns the mod_strings for the current language and the specified module
+*/
+
+function return_specified_module_language($language, $module)
+{
+	global $log;
+	global $default_language, $translation_string_prefix;
+
+	@include("modules/$module/language/$language.lang.php");
+	if(!isset($mod_strings))
+	{
+		$log->warn("Unable to find the module language file for language: ".$language." and module: ".$module);
+		require("modules/$module/language/$default_language.lang.php");
+		$language_used = $default_language;
+	}
+
+	if(!isset($mod_strings))
+	{
+		$log->fatal("Unable to load the module($module) language file for the selected language($language) or the default language($default_language)");
+		$log->debug("Exiting return_module_language method ...");
+		return null;
+	}
+
+	$return_value = $mod_strings;
 
 	$log->debug("Exiting return_module_language method ...");
 	return $return_value;
@@ -837,7 +866,8 @@
 	$log->debug("Entering to_html(".$string.",".$encode.") method ...");
         global $toHtml;
         if($encode && is_string($string)){//$string = htmlentities($string, ENT_QUOTES);
-        $string = str_replace(array_keys($toHtml), array_values($toHtml), $string);
+		if (is_array($toHtml))
+			$string = str_replace(array_keys($toHtml), array_values($toHtml), $string);
         }
 	$log->debug("Exiting to_html method ...");
         return $string;
@@ -947,8 +977,11 @@
         $noofrows = $adb->num_rows($result);
 	for($i=0; $i<$noofrows; $i++)
 	{
+		$uitype = $adb->query_result($result,$i,"uitype");
 		$fieldname = $adb->query_result($result,$i,"fieldname");
 		$column_fld[$fieldname] = ''; 
+		if( $uitype == 3 || $uitype == 4 || $uitype == 18 || $uitype == 31 || $uitype == 32)
+		    $column_fld[$fieldname."@##@"] = 0;
 	}
 	$log->debug("Exiting getColumnFields method ...");
 	return $column_fld;	
@@ -2047,9 +2080,9 @@
 	$log->debug("Entering getEmailParentsList(".$module.",".$id.") method ...");
         global $adb;
 	if($module == 'Contacts')
-		$focus = new Contact();
+		$focus = new Contacts();
 	if($module == 'Leads')
-		$focus = new Lead();
+		$focus = new Leads();
         
 	$focus->retrieve_entity_info($id,$module);
         $fieldid = 0;
@@ -2104,6 +2137,59 @@
 	$log->debug("Exiting addToProductStock method ...");
 	
 }
+
+/**	This Function adds the specified product quantity to the Product Quantity in Demand in the Warehouse 
+  *	@param int $productId - ProductId
+  *	@param int $qty - Quantity to be added
+  */
+function addToProductDemand($productId,$qty)
+{
+	global $log;
+	$log->debug("Entering addToProductDemand(".$productId.",".$qty.") method ...");
+	global $adb;
+	$qtyInStck=getProductQtyInDemand($productId);
+	$updQty=$qtyInStck + $qty;
+	$sql = "UPDATE vtiger_products set qtyindemand=$updQty where productid=".$productId;
+	$adb->query($sql);
+	$log->debug("Exiting addToProductDemand method ...");
+	
+}
+
+/**	This Function subtract the specified product quantity to the Product Quantity in Stock in the Warehouse 
+  *	@param int $productId - ProductId
+  *	@param int $qty - Quantity to be subtracted
+  */
+function deductFromProductStock($productId,$qty)
+{
+	global $log;
+	$log->debug("Entering deductFromProductStock(".$productId.",".$qty.") method ...");
+	global $adb;
+	$qtyInStck=getProductQtyInStock($productId);
+	$updQty=$qtyInStck - $qty;
+	$sql = "UPDATE vtiger_products set qtyinstock=$updQty where productid=".$productId;
+	$adb->query($sql);
+	$log->debug("Exiting deductFromProductStock method ...");
+	
+}
+
+/**	This Function subtract the specified product quantity to the Product Quantity in Demand in the Warehouse 
+  *	@param int $productId - ProductId
+  *	@param int $qty - Quantity to be subtract
+  */
+function deductFromProductDemand($productId,$qty)
+{
+	global $log;
+	$log->debug("Entering deductFromProductDemand(".$productId.",".$qty.") method ...");
+	global $adb;
+	$qtyInStck=getProductQtyInDemand($productId);
+	$updQty=$qtyInStck - $qty;
+	$sql = "UPDATE vtiger_products set qtyindemand=$updQty where productid=".$productId;
+	$adb->query($sql);
+	$log->debug("Exiting deductFromProductDemand method ...");
+	
+}
+
+
 /** This Function returns the current product quantity in stock.
   * The following is the input parameter for the function:
   *  $product_id --> ProductId, Type:Integer
@@ -2121,6 +2207,23 @@
 
 
 }
+
+/**	This Function returns the current product quantity in demand.
+  *	@param int $product_id - ProductId
+  *	@return int $qtyInDemand - Quantity in Demand of a product
+  */
+function getProductQtyInDemand($product_id)
+{
+	global $log;
+	$log->debug("Entering getProductQtyInDemand(".$product_id.") method ...");
+        global $adb;
+        $query1 = "select qtyindemand from vtiger_products where productid=".$product_id;
+        $result = $adb->query($query1);
+        $qtyInDemand = $adb->query_result($result,0,"qtyindemand");
+	$log->debug("Exiting getProductQtyInDemand method ...");
+        return $qtyInDemand;
+}
+
 /** Function to seperate the Date and Time
   * This function accepts a sting with date and time and
   * returns an array of two elements.The first element
@@ -2175,6 +2278,12 @@
 	{
 		$tablename = $adb->query_result($res,0,'tablename');
 	}
+
+	//Since the introduction of the entity2org table, crmid has become 
+	//ambiguous. So we need to explicitely set the vtiger_crmentity table
+	//in this case ...
+	if( $tablename == '' && $fieldname == 'crmid')
+	    $tablename = 'vtiger_crmentity';
 
 	$log->debug("Exiting getTableNameForField method ...");
 	return $tablename;
@@ -2617,4 +2726,40 @@
 	global $current_user,$adb;
 	return $adb->query_result($adb->query("select int_mailer from vtiger_mail_accounts where user_id='".$current_user->id."'"),0,"int_mailer");
 }
+
+/**
+* the function is like unescape in javascript
+* added by dingjianting on 2006-10-1 for picklist editor
+*/
+function utf8RawUrlDecode ($source) {
+    $decodedStr = "";
+    $pos = 0;
+    $len = strlen ($source);
+    while ($pos < $len) {
+        $charAt = substr ($source, $pos, 1);
+        if ($charAt == '%') {
+            $pos++;
+            $charAt = substr ($source, $pos, 1);
+            if ($charAt == 'u') {
+                // we got a unicode character
+                $pos++;
+                $unicodeHexVal = substr ($source, $pos, 4);
+                $unicode = hexdec ($unicodeHexVal);
+                $entity = "&#". $unicode . ';';
+                $decodedStr .= utf8_encode ($entity);
+                $pos += 4;
+            }
+            else {
+                // we have an escaped ascii character
+                $hexVal = substr ($source, $pos, 2);
+                $decodedStr .= chr (hexdec ($hexVal));
+                $pos += 2;
+            }
+        } else {
+            $decodedStr .= $charAt;
+            $pos++;
+        }
+    }
+    return $decodedStr;
+}
 ?>

Modified: vtigercrm/branches/5.1_jens/index.php
==============================================================================
--- vtigercrm/branches/5.1_jens/index.php (original)
+++ vtigercrm/branches/5.1_jens/index.php Tue Nov 14 03:16:10 2006
@@ -101,7 +101,7 @@
  	
 set_default_config($default_config_values);
 require_once('include/logging.php');
-require_once('modules/Users/User.php');
+require_once('modules/Users/Users.php');
 
 global $currentModule;
 
@@ -164,7 +164,7 @@
 }
 
 //Code added for 'Multiple SQL Injection Vulnerabilities & XSS issue' fixes - Philip
-if(isset($_REQUEST['record']) && !is_numeric($_REQUEST['record']) && $_REQUEST['record']!='')
+if(isset($_REQUEST['record']) && $module!="Organization" && !is_numeric($_REQUEST['record']) && $_REQUEST['record']!='')
 {
         die("An invalid record number specified to view details.");
 }
@@ -350,9 +350,15 @@
 $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : "";
 $record = (isset($_REQUEST['record'])) ? $_REQUEST['record'] : "";
 $lang_crm = (isset($_SESSION['authenticated_user_language'])) ? $_SESSION['authenticated_user_language'] : "";
+
+if( isset($_REQUEST['org']) && $_REQUEST['org'] != '') {
+	$_SESSION['authenticated_user_current_organization'] = $_REQUEST['org'];
+	$log->debug("Change organization for user id ".$current_user->id.":".$_REQUEST['org']);
+}
+
 $GLOBALS['request_string'] = "&module=$module&action=$action&record=$record&lang_crm=$lang_crm";
 
-$current_user = new User();
+$current_user = new Users();
 
 if($use_current_login)
 {
@@ -417,6 +423,58 @@
 }
 $log->debug('current_language is: '.$current_language);
 
+//Current Organization
+if( $use_current_login) {
+    if(isset($_SESSION['authenticated_user_organizations']) && $_SESSION['authenticated_user_organizations'] != '') {
+	$user_organizations = $_SESSION['authenticated_user_organizations'];
+
+    } else {
+	$user_org_query = "SELECT organizationname,primarytag FROM vtiger_user2org WHERE userid=".$current_user->id;
+	$user_org_result = $adb->query($user_org_query);
+	$user_organizations = '';
+	$current_organization = '';
+	while($user_org = $adb->fetch_array($user_org_result)) {
+	    if( $user_organizations != '')
+		$user_organizations .= "|";
+	    $user_organizations .= $user_org["organizationname"];
+	    if( $user_org["primarytag"] == 1)
+		$current_organization = $user_org["organizationname"];
+	}
+	if( $current_organization == '') {
+	    if( strpos($user_organizations,"|")) {
+		$current_organization = substr($user_organizations,0,strpos($user_organizations,"|"));
+	    } else {
+		$current_organization = $user_organizations;
+	    }
+	}
+ 
+	$_SESSION['authenticated_user_organizations'] = $user_organizations;
+	$log->debug("Reloaded organizations for user id ".$current_user->id.":".$user_organizations);
+	$log->debug("Primary organization for user id ".$current_user->id.":".$current_organization);
+    }
+
+    if(isset($_SESSION['authenticated_user_current_organization']) && $_SESSION['authenticated_user_current_organization'] != '') {
+	$current_organization = $_SESSION['authenticated_user_current_organization'];
+	$log->debug("Current organization for user id ".$current_user->id.":".$current_organization);
+
+    } else {
+	if( $current_organization == '') {
+	    $current_organization = "-- NONE --";
+	} else {
+	    $_SESSION['authenticated_user_current_organization'] = $current_organization;
+	}
+    }
+
+//No user authenticated, thus no organizations
+} else {
+    $_SESSION['authenticated_user_current_organization'] = '';
+    $_SESSION['authenticated_user_organizations'] = '';
+}
+
+//As long as we are modifying an existing record, the default organization may
+//not change
+$org_change_ok = ($record != "" || $action == "EditView") ? 0 : 1;
+
 //set module and application string arrays based upon selected language
 $app_strings = return_application_language($current_language);
 $app_list_strings = return_app_list_strings_language($current_language);
@@ -432,90 +490,22 @@
 	// Use the record to track the viewing.
 	// todo - Have a record of modules and thier primary object names.
 	//Getting the actual module
-	$actualModule = $currentModule;
 	switch($currentModule)
 	{
-		case 'Leads':
-			require_once("modules/$currentModule/Lead.php");
-			$focus = new Lead();
-			break;
-		case 'Contacts':
-			require_once("modules/$currentModule/Contact.php");
-			$focus = new Contact();
-			break;
-		case 'Accounts':
-			require_once("modules/$currentModule/Account.php");
-			$focus = new Account();
-			break;
-		case 'Potentials':
-			require_once("modules/$currentModule/Opportunity.php");
-			$focus = new Potential();
-			break;
 		case 'Calendar':
 			require_once("modules/$currentModule/Activity.php");
 			$focus = new Activity();
 			break;
-		case 'Notes':
-			require_once("modules/$currentModule/Note.php");
-			$focus = new Note();
-			break;
-		case 'Emails':
-			require_once("modules/$currentModule/Email.php");
-			$focus = new Email();
-			break;
-		case 'Users':
-			require_once("modules/$currentModule/User.php");
-			$focus = new User();
-			break;
-		case 'Products':
-			require_once("modules/$currentModule/Product.php");
-			$focus = new Product();
-			break;
-		case 'Vendors':
-			require_once("modules/$currentModule/Vendor.php");
-			$focus = new Vendor();
-			$actualModule = 'Vendors';
-			break;
-		case 'PriceBooks':
-			require_once("modules/$currentModule/PriceBook.php");
-			$focus = new PriceBook();
-			$actualModule = 'PriceBooks';
-			break;
-		case 'HelpDesk':
-			require_once("modules/$currentModule/HelpDesk.php");
-			$focus = new HelpDesk();
-			break;
-		case 'Faq':
-			require_once("modules/$currentModule/Faq.php");
-			$focus = new Faq();
-			break;
-		case 'Quotes':
-			require_once("modules/$currentModule/Quote.php");
-			$focus = new Quote();
-			break;
-		case 'PurchaseOrder':
-                        require_once("modules/$currentModule/PurchaseOrder.php");
-                        $focus = new Order();
-                        break;
-                case 'SalesOrder':
-                        require_once("modules/$currentModule/SalesOrder.php");
-                        $focus = new SalesOrder();
-                        break;
-
-		case 'Invoice':
-			require_once("modules/$currentModule/Invoice.php");
-			$focus = new Invoice();
-			break;
-		case 'Campaigns':
-			require_once("modules/$currentModule/Campaign.php");
-			$focus = new Campaign();
+		default:
+			require_once("modules/$currentModule/$currentModule.php");
+			$focus = new $currentModule();
 			break;
 		}
 	
 	if(isset($_REQUEST['record']) && $_REQUEST['record']!='' && $_REQUEST["module"] != "Webmails") 
         {
                 // Only track a viewing if the record was retrieved.
-                $focus->track_view($current_user->id, $actualModule,$_REQUEST['record']);
+                $focus->track_view($current_user->id, $currentModule,$_REQUEST['record']);
         }
 
 }	
@@ -586,6 +576,7 @@
 
 if(!$skipSecurityCheck)
 {
+
 
 
 	require_once('include/utils/UserInfoUtil.php');
@@ -707,7 +698,7 @@
 		echo "<script language = 'JavaScript' type='text/javascript' src = 'include/js/popup.js'></script>";
 		echo '<style type="text/css">@import url("themes/'.$theme.'/style.css"); </style>';
 		echo "<br><br><br><table border=0 cellspacing=0 cellpadding=5 width=100% class=settingsSelectedUI >";
-		echo "<tr><td class=small align=left>vtiger CRM 5.0.0 | Visit <a href='http://www.vtiger.com'>www.vtiger.com</a> for more information </td>";
+		echo "<tr><td class=small align=left>vtiger CRM 5.0.2 | Visit <a href='http://www.vtiger.com'>www.vtiger.com</a> for more information </td>";
 		echo "<td class=small align=right> &copy; <a href='javascript:mypopup()'>Copyright Details</a></td></tr></table>";
 			
 	//	echo "<table align='center'><tr><td align='center'>";

Modified: vtigercrm/branches/5.1_jens/install/0welcome.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/0welcome.php (original)
+++ vtigercrm/branches/5.1_jens/install/0welcome.php Tue Nov 14 03:16:10 2006
@@ -1,164 +1,164 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is: SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/0welcome.php,v 1.10 2004/08/26 11:44:30 saraj Exp $
- * Description:  Executes a step in the installation process.
- ********************************************************************************/
-
-//get php configuration settings.  requires elaborate parsing of phpinfo() output
-ob_start();
-phpinfo(INFO_GENERAL);
-$string = ob_get_contents();
-ob_end_clean();
-
-$pieces = explode("<h2", $string);
-$settings = array();
-foreach($pieces as $val)
-{
-   preg_match("/<a name=\"module_([^<>]*)\">/", $val, $sub_key);
-   preg_match_all("/<tr[^>]*>
-									   <td[^>]*>(.*)<\/td>
-									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub);
-   preg_match_all("/<tr[^>]*>
-									   <td[^>]*>(.*)<\/td>
-									   <td[^>]*>(.*)<\/td>
-									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub_ext);
-   foreach($sub[0] as $key => $val) {
-		if (preg_match("/Configuration File \(php.ini\) Path /", $val)) {
-	   		$val = preg_replace("/Configuration File \(php.ini\) Path /", '', $val);
-			$phpini = strip_tags($val);
-	   	}
-   }
-
-}
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<title>vtiger CRM 5 - Configuration Wizard - Welcome</title>
-	<link href="include/install/install.css" rel="stylesheet" type="text/css">
-</head>
-
-<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
-
-	<br><br><br>
-	<!-- Table for cfgwiz starts -->
-
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
-		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
-
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
-	<tr>
-		<td class="small" bgcolor="#4572BE" align=center>
-			<!-- Master display -->
-			<table border=0 cellspacing=0 cellpadding=0 width=97%>
-			<tr>
-				<td width=20% valign=top>
-
-				<!-- Left side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>Welcome</b></div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
-					</table>
-					
-				</td>
-				<td width=80% valign=top class="cwContentDisplay" align=left>
-				<!-- Right side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class=small align=left><img src="include/install/images/welcome.gif" alt="Welcome to Configuration Wizard" title="Welcome to Configuration Wizard"><br>
-					  <hr noshade size=1></td></tr>
-
-					<tr>
-						<td align=left class="small" style="padding-left:20px">
-		<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This Configuration Wizard will create vtiger CRM 5.0.0 databases and tables and configuration files you need to start. The entire process should take about four minutes. Click the Start button when you are ready. 
-<br><br>
-<p><span style="color:#555555">- vtiger CRM 5.0.0 is tested on mySQL 4.1.X, mySQL 5.0.19, PHP 5.0.19 and Apache 2.0.40.</p> 
-<p align="center"><font color='red'><b>vtiger CRM 5.0.0 will not work on mysql 4.0.x versions</b></font></center><center><font color='blue'><b>vtiger crm can run on a system which has xampp/lampp/wampp already installed in it provided it meets the above mentioned requirements</b></font></center>
-<p>The installation wizard will guide you with the installation regardless of the setup you may have.</span>
-						
-					  </td>
-					</tr>
-					<tr>
-					<td><span style="color:#999999">Please take a moment to register your copy of vtiger CRM. Though this is optional, we encourage you to register. Only your name and email address are required for registration. We do not sell, rent, share or otherwise, distribute your information to third parties.<br></span>
-		
-					</td>
-					</tr>
-					<tr>
-						<td align=center>
-						<IFRAME src="http://www.vtiger.com/products/crm/registration.html" width="500" height=250 scrolling='no' frameborder="0">
-						  [Your user agent does not support frames or is currently configured
-						  not to display frames. However, you may visit
-						  <A href="http://www.vtiger.com/products/crm/registration.html">the related document.</A>] 
-						 </IFRAME>
-				 		 </td>
-					</tr>
-					<tr>
-						<td align="center">
-							Please read the <a href="Copyright.txt" target="_BLANK">license agreement</a> and click the "Start" button to continue. 
-						</td>
-					</tr>		
-					<tr>
-						<td align=center>
-						<form action="install.php" method="post" name="installform" id="form">
-				                <input type="hidden" name="file" value="1checkSystem.php" />	
-						<input type="image" src="include/install/images/start.jpg" alt="Start" border="0" title="Start" style="cursor:pointer;" onClick="window.document.installform.submit();">
-						</form><br>
-					    <br></td>
-					</tr>
-					
-					
-				</table>
-			</td>
-		</tr>
-	</table>
-	<!-- Master display stops -->
-	<br>
-	</td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-
-		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
-	</tr>
-	</table>
-    	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-
-      	<tr>
-        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
-      	</tr>
-    	</table>
-</body>
-</html>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/0welcome.php,v 1.10 2004/08/26 11:44:30 saraj Exp $
+ * Description:  Executes a step in the installation process.
+ ********************************************************************************/
+
+//get php configuration settings.  requires elaborate parsing of phpinfo() output
+ob_start();
+phpinfo(INFO_GENERAL);
+$string = ob_get_contents();
+ob_end_clean();
+
+$pieces = explode("<h2", $string);
+$settings = array();
+foreach($pieces as $val)
+{
+   preg_match("/<a name=\"module_([^<>]*)\">/", $val, $sub_key);
+   preg_match_all("/<tr[^>]*>
+									   <td[^>]*>(.*)<\/td>
+									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub);
+   preg_match_all("/<tr[^>]*>
+									   <td[^>]*>(.*)<\/td>
+									   <td[^>]*>(.*)<\/td>
+									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub_ext);
+   foreach($sub[0] as $key => $val) {
+		if (preg_match("/Configuration File \(php.ini\) Path /", $val)) {
+	   		$val = preg_replace("/Configuration File \(php.ini\) Path /", '', $val);
+			$phpini = strip_tags($val);
+	   	}
+   }
+
+}
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<title>vtiger CRM 5 - Configuration Wizard - Welcome</title>
+	<link href="include/install/install.css" rel="stylesheet" type="text/css">
+</head>
+
+<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+
+	<br><br><br>
+	<!-- Table for cfgwiz starts -->
+
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
+		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
+
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
+	<tr>
+		<td class="small" bgcolor="#4572BE" align=center>
+			<!-- Master display -->
+			<table border=0 cellspacing=0 cellpadding=0 width=97%>
+			<tr>
+				<td width=20% valign=top>
+
+				<!-- Left side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>Welcome</b></div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
+					</table>
+					
+				</td>
+				<td width=80% valign=top class="cwContentDisplay" align=left>
+				<!-- Right side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class=small align=left><img src="include/install/images/welcome.gif" alt="Welcome to Configuration Wizard" title="Welcome to Configuration Wizard"><br>
+					  <hr noshade size=1></td></tr>
+
+					<tr>
+						<td align=left class="small" style="padding-left:20px">
+		<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This Configuration Wizard will create vtiger CRM 5.0.2 databases and tables and configuration files you need to start. The entire process should take about four minutes. Click the Start button when you are ready. 
+<br><br>
+<p><span style="color:#555555">- vtiger CRM 5.0.2 is tested on mySQL 4.1.X, mySQL 5.0.19, PHP 5.0.19 and Apache 2.0.40.</p> 
+<p align="center"><font color='red'><b>vtiger CRM 5.0.2 will not work on mysql 4.0.x versions</b></font></center><center><font color='blue'><b>vtiger crm can run on a system which has xampp/lampp/wampp already installed in it provided it meets the above mentioned requirements</b></font></center>
+<p>The installation wizard will guide you with the installation regardless of the setup you may have.</span>
+						
+					  </td>
+					</tr>
+					<tr>
+					<td><span style="color:#999999">Please take a moment to register your copy of vtiger CRM. Though this is optional, we encourage you to register. Only your name and email address are required for registration. We do not sell, rent, share or otherwise, distribute your information to third parties.<br></span>
+		
+					</td>
+					</tr>
+					<tr>
+						<td align=center>
+						<IFRAME src="http://www.vtiger.com/products/crm/registration.html" width="500" height=250 scrolling='no' frameborder="0">
+						  [Your user agent does not support frames or is currently configured
+						  not to display frames. However, you may visit
+						  <A href="http://www.vtiger.com/products/crm/registration.html">the related document.</A>] 
+						 </IFRAME>
+				 		 </td>
+					</tr>
+					<tr>
+						<td align="center">
+							Please read the <a href="Copyright.txt" target="_BLANK">license agreement</a> and click the "Start" button to continue. 
+						</td>
+					</tr>		
+					<tr>
+						<td align=center>
+						<form action="install.php" method="post" name="installform" id="form">
+				                <input type="hidden" name="file" value="1checkSystem.php" />	
+						<input type="image" src="include/install/images/start.jpg" alt="Start" border="0" title="Start" style="cursor:pointer;" onClick="window.document.installform.submit();">
+						</form><br>
+					    <br></td>
+					</tr>
+					
+					
+				</table>
+			</td>
+		</tr>
+	</table>
+	<!-- Master display stops -->
+	<br>
+	</td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+
+		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
+	</tr>
+	</table>
+    	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+
+      	<tr>
+        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
+      	</tr>
+    	</table>
+</body>
+</html>

Modified: vtigercrm/branches/5.1_jens/install/1checkSystem.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/1checkSystem.php (original)
+++ vtigercrm/branches/5.1_jens/install/1checkSystem.php Tue Nov 14 03:16:10 2006
@@ -1,374 +1,374 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is: SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/1checkSystem.php,v 1.16 2005/03/08 12:01:36 samk Exp $
- * Description:  Executes a step in the installation process.
- ********************************************************************************/
-
-//get php configuration settings.  requires elaborate parsing of phpinfo() output
-?>
-<html>
-<?php
-
-
-ob_start();
-eval("phpinfo();");
-$info = ob_get_contents();
-ob_end_clean();
-
- foreach(explode("\n", $info) as $line) {
-           if(strpos($line, "Client API version")!==false)
-               $mysql_version = trim(str_replace("Client API version", "", strip_tags($line)));
- }
-
-
-
-
-
-
-
-
-
-ob_start();
-phpinfo(INFO_GENERAL);
-$string = ob_get_contents();
-ob_end_clean();
-
-$pieces = explode("<h2", $string);
-$settings = array();
-foreach($pieces as $val)
-{
-   preg_match("/<a name=\"module_([^<>]*)\">/", $val, $sub_key);
-   preg_match_all("/<tr[^>]*>
-									   <td[^>]*>(.*)<\/td>
-									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub);
-   preg_match_all("/<tr[^>]*>
-									   <td[^>]*>(.*)<\/td>
-									   <td[^>]*>(.*)<\/td>
-									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub_ext);
-   foreach($sub[0] as $key => $val) {
-		if (preg_match("/Configuration File \(php.ini\) Path /", $val)) {
-	   		$val = preg_replace("/Configuration File \(php.ini\) Path /", '', $val);
-			$phpini = strip_tags($val);
-	   	}
-   }
-
-}
-
-$gd_info_alternate = 'function gd_info() {
-$array = Array(
-                       "GD Version" => "",
-                       "FreeType Support" => 0,
-                       "FreeType Support" => 0,
-                       "FreeType Linkage" => "",
-                       "T1Lib Support" => 0,
-                       "GIF Read Support" => 0,
-                       "GIF Create Support" => 0,
-                       "JPG Support" => 0,
-                       "PNG Support" => 0,
-                       "WBMP Support" => 0,
-                       "XBM Support" => 0
-                     );
-       $gif_support = 0;
-
-       ob_start();
-       eval("phpinfo();");
-       $info = ob_get_contents();
-       ob_end_clean();
-
-       foreach(explode("\n", $info) as $line) {
-           if(strpos($line, "GD Version")!==false)
-               $array["GD Version"] = trim(str_replace("GD Version", "", strip_tags($line)));
-           if(strpos($line, "FreeType Support")!==false)
-               $array["FreeType Support"] = trim(str_replace("FreeType Support", "", strip_tags($line)));
-           if(strpos($line, "FreeType Linkage")!==false)
-               $array["FreeType Linkage"] = trim(str_replace("FreeType Linkage", "", strip_tags($line)));
-           if(strpos($line, "T1Lib Support")!==false)
-               $array["T1Lib Support"] = trim(str_replace("T1Lib Support", "", strip_tags($line)));
-           if(strpos($line, "GIF Read Support")!==false)
-               $array["GIF Read Support"] = trim(str_replace("GIF Read Support", "", strip_tags($line)));
-           if(strpos($line, "GIF Create Support")!==false)
-               $array["GIF Create Support"] = trim(str_replace("GIF Create Support", "", strip_tags($line)));
-           if(strpos($line, "GIF Support")!==false)
-               $gif_support = trim(str_replace("GIF Support", "", strip_tags($line)));
-           if(strpos($line, "JPG Support")!==false)
-               $array["JPG Support"] = trim(str_replace("JPG Support", "", strip_tags($line)));
-           if(strpos($line, "PNG Support")!==false)
-               $array["PNG Support"] = trim(str_replace("PNG Support", "", strip_tags($line)));
-           if(strpos($line, "WBMP Support")!==false)
-               $array["WBMP Support"] = trim(str_replace("WBMP Support", "", strip_tags($line)));
-           if(strpos($line, "XBM Support")!==false)
-               $array["XBM Support"] = trim(str_replace("XBM Support", "", strip_tags($line)));
-       }
-
-       if($gif_support==="enabled") {
-           $array["GIF Read Support"]  = 1;
-           $array["GIF Create Support"] = 1;
-       }
-
-       if($array["FreeType Support"]==="enabled"){
-           $array["FreeType Support"] = 1;    }
-
-       if($array["T1Lib Support"]==="enabled")
-           $array["T1Lib Support"] = 1;
-
-       if($array["GIF Read Support"]==="enabled"){
-           $array["GIF Read Support"] = 1;    }
-
-       if($array["GIF Create Support"]==="enabled")
-           $array["GIF Create Support"] = 1;
-
-       if($array["JPG Support"]==="enabled")
-           $array["JPG Support"] = 1;
-
-       if($array["PNG Support"]==="enabled")
-           $array["PNG Support"] = 1;
-
-       if($array["WBMP Support"]==="enabled")
-           $array["WBMP Support"] = 1;
-
-       if($array["XBM Support"]==="enabled")
-           $array["XBM Support"] = 1;
-
-       return $array;
-
-}';
-
-?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<title>vtiger CRM 5 - Configuration Wizard - Installation Check</title>
-	<link href="include/install/install.css" rel="stylesheet" type="text/css">
-</head>
-
-<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
-
-	<br><br><br>
-	<!-- Table for cfgwiz starts -->
-
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
-		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
-
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
-	<tr>
-		<td class="small" bgcolor="#4572BE" align=center>
-			<!-- Master display -->
-			<table border=0 cellspacing=0 cellpadding=0 width=97%>
-			<tr>
-				<td width=20% valign=top>
-
-				<!-- Left side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
-					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>Installation Check</b></div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
-					</table>
-					
-				</td>
-				<td width=80% valign=top class="cwContentDisplay" align=left>
-				<!-- Right side tabs -->
-				    <table border=0 cellspacing=0 cellpadding=10 width=100%>
-				    <tr><td class=small align=left><img src="include/install/images/confWizInstallCheck.gif" alt="Pre Installation Check" title="Pre Installation Check"><br>
-					  <hr noshade size=1></td></tr>
-				    <tr>
-					<td align=left class="small" style="padding-left:20px">
-	    				<table cellpadding="10" cellspacing="1" width="90%" border="0" class="small" style="background-color:#cccccc">
-					<tr bgcolor="#efefef"><td colspan=2><span style="color:#003399"><strong>Core Components</strong></span></td></tr>
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>PHP version 5.0.x</strong><BR></td>
-						<td  valign=top bgcolor="white"><?php $php_version = phpversion(); echo (str_replace(".", "", $php_version) < "430") ? "<strong><font color=\"#FF0000\">Failed.</strong><br> Invalid version ($php_version) Installed</font>" : "<strong><font color=\"#00CC00\">Passed</strong><br>Version $php_version Installed</font>"; ?></td>
-    					</tr>
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>IMAP Support Availability</strong></td>
-				        	<td valign=top bgcolor=white><?php echo function_exists('imap_open')?"<strong><font color=\"#00CC00\">Passed</strong><br>IMAP library available</font>":"<strong><font color=\"#FF0000\">Failed</strong><br>Not Available</font>";?></td>
-					</tr>
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>GD graphics library</strong><br> version 2.0 or later</td>
-						<td valign=top bgcolor="white"><?php
-						if (!extension_loaded('gd')) {
-							echo "<strong><font size=-1 color=\"#FF0000\">GD Graphics Library not configured. </strong>.<br>Check out our <a href='http://sourceforge.net/docman/?group_id=107819'>online documentation</a> for tips on enabling this library. You can ignore this error and continue your vtiger CRM installation, however the chart images simply won't work.</font>";
-						}
-						else {
-							if (!function_exists('gd_info'))
-							{
-								eval($gd_info_alternate);
-							}
-							$gd_info = gd_info();
-
-							if (isset($gd_info['GD Version'])) {
-								$gd_version = $gd_info['GD Version'];
-								$gd_version=preg_replace('%[^0-9.]%', '', $gd_version);
-
-								if ($gd_version > "2.0") {
-									echo "<strong><font color=\"#00CC00\">Passed</strong><br>Version $gd_version Installed</font>";
-								}
-								else {
-									echo "<strong><font color=\"#00CC00\">Passed</strong><br>Version $gd_version Installed.</font>";
-								}
-							}
-							else {
-								echo "<strong><font size=-1 color=\"#FF0000\">GD Library available, but not properly configured in your PHP installation</strong>.<br>You can ignore this error and continue your vtiger CRM installation, however the chart images simply won't work.</font>";
-							}
-						}
-						?>
-						</td>
-					</tr>
-					<tr bgcolor="#efefef"><td colspan=2><strong><span style="color:#003399">Read/Write Access</span></strong></td></tr>
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>PHP Configuration</strong><br>(config.inc.php)</strong></td>
-						<td valign=top bgcolor="white" ><?php echo (is_writable('./config.inc.php') || is_writable('.'))?"<strong><font color=\"#00CC00\">Writeable</font>":"<strong><font color=\"#FF0000\">Failed</strong><br>Not Writeable</font>"; ?></td>
-					</tr>
-		 			<tr bgcolor="#fafafa">
-						<td valign=top ><strong>Cache Directory </strong> <br>(cache/)</td>
-            					<td valign=top bgcolor="white" ><?php echo (is_writable('./cache/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</font></strong>"; ?></td>
-        				</tr>
-		 			
-					<tr bgcolor="#fafafa">
-		    				<td valign=top ><strong>Uploads Directory</strong><br> (storage/)</td>
-            					<td valign=top bgcolor="white"><?php echo (is_writable('./storage/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the file vtiger_attachments feature. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
-        				</tr>
-					<tr bgcolor="#fafafa">
-		    				<td valign=top ><strong>Install Directory</strong><br> (install/)</td>
-            					<td valign=top bgcolor="white"><?php echo (is_writable('./install/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the last step of installation.</font>"; ?></td>
-        				</tr>
-					<tr bgcolor="#fafafa">
-		    				<td valign=top ><strong>Installation file</strong><br> (install.php)</td>
-            					<td valign=top bgcolor="white"><?php echo (is_writable('./install.php'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the last step of installation.</font>"; ?></td>
-					</tr>
-					<tr bgcolor="#fafafa">
-				                <td valign=top ><strong>Tabdata File Permission </strong><br> (tabdata.php) </td>
-				                <td valign=top bgcolor="white"><?php echo (is_writable('./tabdata.php'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You will not be able to work with the product</font>";?></td>
-				        </tr>
-
-					<tr bgcolor="#fafafa">
-				                <td valign=top ><strong>ParentTabdata File Permission </strong><br> (parent_tabdata.php) </td>
-				                <td valign=top bgcolor="white"><?php echo (is_writable('./parent_tabdata.php'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You will not be able to work with the product</font>";?></td>
-				        </tr>
-
-					<tr bgcolor="#fafafa">
-           					<td valign=top ><strong>User Privileges</strong><br> (user_privileges/)</td>
-           					<td valign=top bgcolor="white"><?php echo (is_writable('./user_privileges/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong><br> You will not be able to login </font>"; ?></td>
-        				</tr>
-
-					
-					<tr bgcolor="#fafafa">
-                				<td valign=top ><strong>Smarty Cache Directory </strong><br> (Smarty/cache)</td>
-                				<td valign=top bgcolor="white"><?php echo (is_writable('./Smarty/cache/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong>";?></td>
-					</tr>
-					<tr bgcolor="#fafafa">
-				                <td valign=top ><strong>Smarty Compile Directory </strong><br> (Smarty/templates_c)</td>
-				                <td valign=top bgcolor="white"><?php echo (is_writable('./Smarty/templates_c/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You will not be able to login </font>";?></td>
-					</tr>
-
-					<tr bgcolor="#fafafa">
-		    				<td valign=top ><strong>Email Templates Directory</strong><br> (modules/Emails/templates/)</td>
-						<td valign=top bgcolor="white"><?php echo (is_writable('./modules/Emails/templates/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong><br> You might experience problems with the email templates feature. Refer <a href= http://www.vtiger.com/forums/viewtopic.php?t=388&highlight=permission>Email templates issue </a> for more details  </font>"; ?></td>
-					</tr>
-				
-					<tr bgcolor="#fafafa">
-		    				<td valign=top ><strong>Mail Merge Template Directory </strong><br>(test/wordtemplatedownload/)</td>
-            					<td valign=top bgcolor="white"><?php echo (is_writable('./test/wordtemplatedownload/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong><br> You might experience issues with the word template feature. Visit <a href=\"http://www.vtiger.com/discussions/viewtopic.php?p=2200#2200\" target=\"_blank\">forums</a> for more details </font>"; ?></td>
-        				</tr>
-				
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>Product Image Directory</strong><br> (test/product/)</td>
-						<td valign=top bgcolor="white"><?php echo (is_writable('./test/product/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems while attaching image for Products.Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
-					</tr>
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>User Image Directory</strong><br> (test/user/)</td>
-						<td valign=top bgcolor="white"><?php echo (is_writable('./test/user/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems while attaching image for Users. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
-					</tr>
-					<tr bgcolor="#fafafa">
-						<td valign=top ><strong>Contact Image Directory</strong><br> (test/contact/)</td>
-						<td valign=top bgcolor="white"><?php echo (is_writable('./test/contact/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems while attaching image for Contacts. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
-					</tr>	
-					<tr bgcolor="#fafafa">
-		    				<td valign=top ><strong>Logo Directory</strong><br> (test/logo/)</td>
-					        <td valign=top bgcolor="white"><?php echo (is_writable('./test/logo/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the company logo in the pdf generation. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
-					</tr>
-					
-
-       				</table>
-				<br><br>
-	   	   		<!-- Recommended Settings -->
-				<table cellpadding="10" cellspacing="1" width="90%" border="0" class="small" style="background-color:#cccccc">
-				<tr bgcolor="#efefef"><td colspan=2><span style="color:#003399"><strong>Recommended Settings: We strongly suggest that you check for the following values in your php.ini file </strong></span></td></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>Safe Mode Off</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>Display Errors On</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>File Uploads On</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>Register Globals Off</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>Max Execution Time 600</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>output_buffering= On</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>Change the memory limit = 32M</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>error_reporting = E_WARNING & ~E_NOTICE</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>allow_call_time_reference = On</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>log_errors = Off</strong></tr>
-				<tr bgcolor="#ffffff"> <td valign=top ><strong>short_open_tag= On</strong></tr>
-				<tr bgcolor="#ffffff">  <td valign=top ><a href="http://www.vtiger.com/products/crm/help/vtiger_CRM_Linux_Dependencies.pdf" target="_blank">Linux installation pre-requisites</a></tr>
-				</table>
-			</td>
-			</tr>
-			<tr>
-				<td align=center>
-					<form action="install.php" method="post" name="installform" id="form">
-			                <input type="hidden" name="file" value="2setConfig.php" />	
-					<input type="image" src="include/install/images/cwBtnNext.gif" alt="Next" border="0" title="Next" onClick="window.document.installform.submit();">
-					</form><br>
-				    <br></td>
-			</tr>
-		</table>
-	</td>
-		</tr>
-	</table>
-	<!-- Master display stops -->
-	<br>
-	</td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-
-		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
-	</tr>
-	</table>	
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-
-      	<tr>
-        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
-      	</tr>
-    	</table>
-</body>
-</html>	
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/1checkSystem.php,v 1.16 2005/03/08 12:01:36 samk Exp $
+ * Description:  Executes a step in the installation process.
+ ********************************************************************************/
+
+//get php configuration settings.  requires elaborate parsing of phpinfo() output
+?>
+<html>
+<?php
+
+
+ob_start();
+eval("phpinfo();");
+$info = ob_get_contents();
+ob_end_clean();
+
+ foreach(explode("\n", $info) as $line) {
+           if(strpos($line, "Client API version")!==false)
+               $mysql_version = trim(str_replace("Client API version", "", strip_tags($line)));
+ }
+
+
+
+
+
+
+
+
+
+ob_start();
+phpinfo(INFO_GENERAL);
+$string = ob_get_contents();
+ob_end_clean();
+
+$pieces = explode("<h2", $string);
+$settings = array();
+foreach($pieces as $val)
+{
+   preg_match("/<a name=\"module_([^<>]*)\">/", $val, $sub_key);
+   preg_match_all("/<tr[^>]*>
+									   <td[^>]*>(.*)<\/td>
+									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub);
+   preg_match_all("/<tr[^>]*>
+									   <td[^>]*>(.*)<\/td>
+									   <td[^>]*>(.*)<\/td>
+									   <td[^>]*>(.*)<\/td>/Ux", $val, $sub_ext);
+   foreach($sub[0] as $key => $val) {
+		if (preg_match("/Configuration File \(php.ini\) Path /", $val)) {
+	   		$val = preg_replace("/Configuration File \(php.ini\) Path /", '', $val);
+			$phpini = strip_tags($val);
+	   	}
+   }
+
+}
+
+$gd_info_alternate = 'function gd_info() {
+$array = Array(
+                       "GD Version" => "",
+                       "FreeType Support" => 0,
+                       "FreeType Support" => 0,
+                       "FreeType Linkage" => "",
+                       "T1Lib Support" => 0,
+                       "GIF Read Support" => 0,
+                       "GIF Create Support" => 0,
+                       "JPG Support" => 0,
+                       "PNG Support" => 0,
+                       "WBMP Support" => 0,
+                       "XBM Support" => 0
+                     );
+       $gif_support = 0;
+
+       ob_start();
+       eval("phpinfo();");
+       $info = ob_get_contents();
+       ob_end_clean();
+
+       foreach(explode("\n", $info) as $line) {
+           if(strpos($line, "GD Version")!==false)
+               $array["GD Version"] = trim(str_replace("GD Version", "", strip_tags($line)));
+           if(strpos($line, "FreeType Support")!==false)
+               $array["FreeType Support"] = trim(str_replace("FreeType Support", "", strip_tags($line)));
+           if(strpos($line, "FreeType Linkage")!==false)
+               $array["FreeType Linkage"] = trim(str_replace("FreeType Linkage", "", strip_tags($line)));
+           if(strpos($line, "T1Lib Support")!==false)
+               $array["T1Lib Support"] = trim(str_replace("T1Lib Support", "", strip_tags($line)));
+           if(strpos($line, "GIF Read Support")!==false)
+               $array["GIF Read Support"] = trim(str_replace("GIF Read Support", "", strip_tags($line)));
+           if(strpos($line, "GIF Create Support")!==false)
+               $array["GIF Create Support"] = trim(str_replace("GIF Create Support", "", strip_tags($line)));
+           if(strpos($line, "GIF Support")!==false)
+               $gif_support = trim(str_replace("GIF Support", "", strip_tags($line)));
+           if(strpos($line, "JPG Support")!==false)
+               $array["JPG Support"] = trim(str_replace("JPG Support", "", strip_tags($line)));
+           if(strpos($line, "PNG Support")!==false)
+               $array["PNG Support"] = trim(str_replace("PNG Support", "", strip_tags($line)));
+           if(strpos($line, "WBMP Support")!==false)
+               $array["WBMP Support"] = trim(str_replace("WBMP Support", "", strip_tags($line)));
+           if(strpos($line, "XBM Support")!==false)
+               $array["XBM Support"] = trim(str_replace("XBM Support", "", strip_tags($line)));
+       }
+
+       if($gif_support==="enabled") {
+           $array["GIF Read Support"]  = 1;
+           $array["GIF Create Support"] = 1;
+       }
+
+       if($array["FreeType Support"]==="enabled"){
+           $array["FreeType Support"] = 1;    }
+
+       if($array["T1Lib Support"]==="enabled")
+           $array["T1Lib Support"] = 1;
+
+       if($array["GIF Read Support"]==="enabled"){
+           $array["GIF Read Support"] = 1;    }
+
+       if($array["GIF Create Support"]==="enabled")
+           $array["GIF Create Support"] = 1;
+
+       if($array["JPG Support"]==="enabled")
+           $array["JPG Support"] = 1;
+
+       if($array["PNG Support"]==="enabled")
+           $array["PNG Support"] = 1;
+
+       if($array["WBMP Support"]==="enabled")
+           $array["WBMP Support"] = 1;
+
+       if($array["XBM Support"]==="enabled")
+           $array["XBM Support"] = 1;
+
+       return $array;
+
+}';
+
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<title>vtiger CRM 5 - Configuration Wizard - Installation Check</title>
+	<link href="include/install/install.css" rel="stylesheet" type="text/css">
+</head>
+
+<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+
+	<br><br><br>
+	<!-- Table for cfgwiz starts -->
+
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
+		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
+
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
+	<tr>
+		<td class="small" bgcolor="#4572BE" align=center>
+			<!-- Master display -->
+			<table border=0 cellspacing=0 cellpadding=0 width=97%>
+			<tr>
+				<td width=20% valign=top>
+
+				<!-- Left side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
+					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>Installation Check</b></div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
+					</table>
+					
+				</td>
+				<td width=80% valign=top class="cwContentDisplay" align=left>
+				<!-- Right side tabs -->
+				    <table border=0 cellspacing=0 cellpadding=10 width=100%>
+				    <tr><td class=small align=left><img src="include/install/images/confWizInstallCheck.gif" alt="Pre Installation Check" title="Pre Installation Check"><br>
+					  <hr noshade size=1></td></tr>
+				    <tr>
+					<td align=left class="small" style="padding-left:20px">
+	    				<table cellpadding="10" cellspacing="1" width="90%" border="0" class="small" style="background-color:#cccccc">
+					<tr bgcolor="#efefef"><td colspan=2><span style="color:#003399"><strong>Core Components</strong></span></td></tr>
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>PHP version</strong><BR></td>
+						<td  valign=top bgcolor="white"><?php $php_version = phpversion(); echo (str_replace(".", "", $php_version) < "430") ? "<strong><font color=\"#FF0000\">Failed.</strong><br> Invalid version ($php_version) Installed</font>" : "<strong><font color=\"#00CC00\">Passed</strong><br>Version $php_version Installed</font>"; ?></td>
+    					</tr>
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>IMAP Support Availability</strong></td>
+				        	<td valign=top bgcolor=white><?php echo function_exists('imap_open')?"<strong><font color=\"#00CC00\">Passed</strong><br>IMAP library available</font>":"<strong><font color=\"#FF0000\">Failed</strong><br>Not Available</font>";?></td>
+					</tr>
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>GD graphics library</strong><br> version 2.0 or later</td>
+						<td valign=top bgcolor="white"><?php
+						if (!extension_loaded('gd')) {
+							echo "<strong><font size=-1 color=\"#FF0000\">GD Graphics Library not configured. </strong>.<br>Check out our <a href='http://sourceforge.net/docman/?group_id=107819'>online documentation</a> for tips on enabling this library. You can ignore this error and continue your vtiger CRM installation, however the chart images simply won't work.</font>";
+						}
+						else {
+							if (!function_exists('gd_info'))
+							{
+								eval($gd_info_alternate);
+							}
+							$gd_info = gd_info();
+
+							if (isset($gd_info['GD Version'])) {
+								$gd_version = $gd_info['GD Version'];
+								$gd_version=preg_replace('%[^0-9.]%', '', $gd_version);
+
+								if ($gd_version > "2.0") {
+									echo "<strong><font color=\"#00CC00\">Passed</strong><br>Version $gd_version Installed</font>";
+								}
+								else {
+									echo "<strong><font color=\"#00CC00\">Passed</strong><br>Version $gd_version Installed.</font>";
+								}
+							}
+							else {
+								echo "<strong><font size=-1 color=\"#FF0000\">GD Library available, but not properly configured in your PHP installation</strong>.<br>You can ignore this error and continue your vtiger CRM installation, however the chart images simply won't work.</font>";
+							}
+						}
+						?>
+						</td>
+					</tr>
+					<tr bgcolor="#efefef"><td colspan=2><strong><span style="color:#003399">Read/Write Access</span></strong></td></tr>
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>PHP Configuration</strong><br>(config.inc.php)</strong></td>
+						<td valign=top bgcolor="white" ><?php echo (is_writable('./config.inc.php') || is_writable('.'))?"<strong><font color=\"#00CC00\">Writeable</font>":"<strong><font color=\"#FF0000\">Failed</strong><br>Not Writeable</font>"; ?></td>
+					</tr>
+		 			<tr bgcolor="#fafafa">
+						<td valign=top ><strong>Cache Directory </strong> <br>(cache/)</td>
+            					<td valign=top bgcolor="white" ><?php echo (is_writable('./cache/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</font></strong>"; ?></td>
+        				</tr>
+		 			
+					<tr bgcolor="#fafafa">
+		    				<td valign=top ><strong>Uploads Directory</strong><br> (storage/)</td>
+            					<td valign=top bgcolor="white"><?php echo (is_writable('./storage/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the file vtiger_attachments feature. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
+        				</tr>
+					<tr bgcolor="#fafafa">
+		    				<td valign=top ><strong>Install Directory</strong><br> (install/)</td>
+            					<td valign=top bgcolor="white"><?php echo (is_writable('./install/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the last step of installation.</font>"; ?></td>
+        				</tr>
+					<tr bgcolor="#fafafa">
+		    				<td valign=top ><strong>Installation file</strong><br> (install.php)</td>
+            					<td valign=top bgcolor="white"><?php echo (is_writable('./install.php'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the last step of installation.</font>"; ?></td>
+					</tr>
+					<tr bgcolor="#fafafa">
+				                <td valign=top ><strong>Tabdata File Permission </strong><br> (tabdata.php) </td>
+				                <td valign=top bgcolor="white"><?php echo (is_writable('./tabdata.php'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You will not be able to work with the product</font>";?></td>
+				        </tr>
+
+					<tr bgcolor="#fafafa">
+				                <td valign=top ><strong>ParentTabdata File Permission </strong><br> (parent_tabdata.php) </td>
+				                <td valign=top bgcolor="white"><?php echo (is_writable('./parent_tabdata.php'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You will not be able to work with the product</font>";?></td>
+				        </tr>
+
+					<tr bgcolor="#fafafa">
+           					<td valign=top ><strong>User Privileges</strong><br> (user_privileges/)</td>
+           					<td valign=top bgcolor="white"><?php echo (is_writable('./user_privileges/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong><br> You will not be able to login </font>"; ?></td>
+        				</tr>
+
+					
+					<tr bgcolor="#fafafa">
+                				<td valign=top ><strong>Smarty Cache Directory </strong><br> (Smarty/cache)</td>
+                				<td valign=top bgcolor="white"><?php echo (is_writable('./Smarty/cache/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong>";?></td>
+					</tr>
+					<tr bgcolor="#fafafa">
+				                <td valign=top ><strong>Smarty Compile Directory </strong><br> (Smarty/templates_c)</td>
+				                <td valign=top bgcolor="white"><?php echo (is_writable('./Smarty/templates_c/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You will not be able to login </font>";?></td>
+					</tr>
+
+					<tr bgcolor="#fafafa">
+		    				<td valign=top ><strong>Email Templates Directory</strong><br> (modules/Emails/templates/)</td>
+						<td valign=top bgcolor="white"><?php echo (is_writable('./modules/Emails/templates/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong><br> You might experience problems with the email templates feature. Refer <a href= http://www.vtiger.com/forums/viewtopic.php?t=388&highlight=permission>Email templates issue </a> for more details  </font>"; ?></td>
+					</tr>
+				
+					<tr bgcolor="#fafafa">
+		    				<td valign=top ><strong>Mail Merge Template Directory </strong><br>(test/wordtemplatedownload/)</td>
+            					<td valign=top bgcolor="white"><?php echo (is_writable('./test/wordtemplatedownload/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong><br> You might experience issues with the word template feature. Visit <a href=\"http://www.vtiger.com/discussions/viewtopic.php?p=2200#2200\" target=\"_blank\">forums</a> for more details </font>"; ?></td>
+        				</tr>
+				
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>Product Image Directory</strong><br> (test/product/)</td>
+						<td valign=top bgcolor="white"><?php echo (is_writable('./test/product/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems while attaching image for Products.Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
+					</tr>
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>User Image Directory</strong><br> (test/user/)</td>
+						<td valign=top bgcolor="white"><?php echo (is_writable('./test/user/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems while attaching image for Users. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
+					</tr>
+					<tr bgcolor="#fafafa">
+						<td valign=top ><strong>Contact Image Directory</strong><br> (test/contact/)</td>
+						<td valign=top bgcolor="white"><?php echo (is_writable('./test/contact/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems while attaching image for Contacts. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
+					</tr>	
+					<tr bgcolor="#fafafa">
+		    				<td valign=top ><strong>Logo Directory</strong><br> (test/logo/)</td>
+					        <td valign=top bgcolor="white"><?php echo (is_writable('./test/logo/'))?"<strong><font color=\"#00CC00\">Writeable</font></strong>":"<strong><font color=\"#FF0000\">Not Writeable</strong> <br>You might experience problems with the company logo in the pdf generation. Refer <a href=http://www.vtiger.com/forums/viewtopic.php?t=24&highlight=permission>File vtiger_attachments issue</a> for more details </font>"; ?></td>
+					</tr>
+					
+
+       				</table>
+				<br><br>
+	   	   		<!-- Recommended Settings -->
+				<table cellpadding="10" cellspacing="1" width="90%" border="0" class="small" style="background-color:#cccccc">
+				<tr bgcolor="#efefef"><td colspan=2><span style="color:#003399"><strong>Recommended Settings: We strongly suggest that you check for the following values in your php.ini file </strong></span></td></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>Safe Mode Off</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>Display Errors On</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>File Uploads On</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>Register Globals Off</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>Max Execution Time 600</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>output_buffering= On</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>Change the memory limit = 32M</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>error_reporting = E_WARNING & ~E_NOTICE</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>allow_call_time_reference = On</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>log_errors = Off</strong></tr>
+				<tr bgcolor="#ffffff"> <td valign=top ><strong>short_open_tag= On</strong></tr>
+				<tr bgcolor="#ffffff">  <td valign=top ><a href="http://www.vtiger.com/products/crm/help/vtiger_CRM_Linux_Dependencies.pdf" target="_blank">Linux installation pre-requisites</a></tr>
+				</table>
+			</td>
+			</tr>
+			<tr>
+				<td align=center>
+					<form action="install.php" method="post" name="installform" id="form">
+			                <input type="hidden" name="file" value="2setConfig.php" />	
+					<input type="image" src="include/install/images/cwBtnNext.gif" alt="Next" border="0" title="Next" onClick="window.document.installform.submit();">
+					</form><br>
+				    <br></td>
+			</tr>
+		</table>
+	</td>
+		</tr>
+	</table>
+	<!-- Master display stops -->
+	<br>
+	</td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+
+		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
+	</tr>
+	</table>	
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+
+      	<tr>
+        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
+      	</tr>
+    	</table>
+</body>
+</html>	

Modified: vtigercrm/branches/5.1_jens/install/2setConfig.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/2setConfig.php (original)
+++ vtigercrm/branches/5.1_jens/install/2setConfig.php Tue Nov 14 03:16:10 2006
@@ -1,523 +1,523 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is: SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- lpha2* Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat'vtiger_crm/sugarcrm/install/2setConfig.php,v 1.41 2005/04/29 06:44:13 samk Exp $
- * Description:  Executes a step in the installation process.
- ********************************************************************************/
-
-// TODO: deprecate connection.php file
-//require_once("connection.php");
-
-// TODO: introduce MySQL port as parameters to use non-default value 3306
-//$sock_path=":" .$mysql_port;
-$hostname = $_SERVER['SERVER_NAME'];
-
-// TODO: introduce Apache port as parameters to use non-default value 80
-//$web_root = $_SERVER['SERVER_NAME']. ":" .$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
-//$web_root = $hostname.$_SERVER['PHP_SELF'];
-$web_root = $HTTP_SERVER_VARS["HTTP_HOST"] . $HTTP_SERVER_VARS["REQUEST_URI"];
-$web_root = str_replace("/install.php", "", $web_root);
-$web_root = "http://".$web_root;
-
-$current_dir = pathinfo(dirname(__FILE__));
-$current_dir = $current_dir['dirname']."/";
-$cache_dir = "cache/";
-
-if (is_file("config.php") && is_file("config.inc.php")) {
-	require_once("config.inc.php");
-	session_start();
-
-	if(isset($upload_maxsize))
-	$_SESSION['upload_maxsize'] = $upload_maxsize;
-
-	if(isset($allow_exports))
-	$_SESSION['allow_exports'] = $allow_exports;
-
-	if(isset($disable_persistent_connections))
-	$_SESSION['disable_persistent_connections'] = $disable_persistent_connections;
-
-	if(isset($default_language))
-	$_SESSION['default_language'] = $default_language;
-
-	if(isset($translation_string_prefix))
-	$_SESSION['translation_string_prefix'] = $translation_string_prefix;
-
-	if(isset($default_charset))
-	$_SESSION['default_charset'] = $default_charset;
-
-	if(isset($languages)) {
-		// need to encode the languages in a way that can be retrieved later
-		$language_keys = Array();
-		$language_values = Array();
-
-		foreach($languages as $key=>$value) {
-			$language_keys[] = $key;
-			$language_values[] = $value;
-		}
-		$_SESSION['language_keys'] = urlencode(implode(",",$language_keys));
-		$_SESSION['language_values'] = urlencode(implode(",",$language_values));
-	}
-													
-	global $dbconfig;
-
-	if (isset($_REQUEST['db_hostname']))
-	$db_hostname = $_REQUEST['db_hostname'];
-	elseif (isset($dbconfig['db_hostname']))
-	$db_hostname = $dbconfig['db_hostname'];
-	else
-	$db_hostname = $hostname;
-
-	if (isset($_REQUEST['db_username']))
-	$db_username = $_REQUEST['db_username'];
-	elseif (isset($dbconfig['db_username']))
-	$db_username = $dbconfig['db_username'];
-
-	if (isset($_REQUEST['db_password']))
-	$db_password = $_REQUEST['db_password'];
-	elseif (isset($dbconfig['db_password']))
-	$db_password = $dbconfig['db_password'];
-
-	if (isset($_REQUEST['db_type']))
-	$db_type = $_REQUEST['db_type'];
-	elseif (isset($dbconfig['db_type']))
-	$db_type = $dbconfig['db_type'];
-
-	if (isset($_REQUEST['db_name']))
-	$db_name = $_REQUEST['db_name'];
-	elseif (isset($dbconfig['db_name']) && $dbconfig['db_name']!='_DBC_NAME_')
-	$db_name = $dbconfig['db_name'];
-	else
-	$db_name = 'vtigercrm5';
-
-	!isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
-	if (isset($_REQUEST['host_name'])) $host_name = $_REQUEST['host_name'];
-	else $host_name = $hostname;
-
-	if (isset($_REQUEST['site_URL'])) $site_URL = $_REQUEST['site_URL'];
-	elseif (isset($site_URL) && $site_URL!='_SITE_URL_')
-	$site_URL = $site_URL;
-	else $site_URL = $web_root;
-
-	if(isset($_REQUEST['root_directory'])) $root_directory = $_REQUEST['root_directory'];
-	else $root_directory = $current_dir;
-	    
-	if (isset($_REQUEST['cache_dir']))
-	$cache_dir= $_REQUEST['cache_dir'];
-
-	if (isset($_REQUEST['mail_server']))
-	$mail_server= $_REQUEST['mail_server'];
-
-	if (isset($_REQUEST['mail_server_username']))
-	$mail_server_username= $_REQUEST['mail_server_username'];
-
-	if (isset($_REQUEST['mail_server_password']))
-	$mail_server_password= $_REQUEST['mail_server_password'];
-
-	if (isset($_REQUEST['admin_email']))
-	$admin_email = $_REQUEST['admin_email'];
-
-	if (isset($_REQUEST['admin_password']))
-	$admin_password = $_REQUEST['admin_password'];
-	
-	if (isset($_REQUEST['currency_name']))
-		$currency_name = $_REQUEST['currency_name'];
-	else
-		$currency_name = '';
-	
-	if (isset($_REQUEST['currency_symbol']))
-	$currency_symbol = $_REQUEST['currency_symbol'];
-	
-	if (isset($_REQUEST['currency_code']))
-	$currency_code = $_REQUEST['currency_code'];
-
-	}
-	else {
-		!isset($_REQUEST['db_hostname']) ? $db_hostname = $hostname: $db_hostname = $_REQUEST['db_hostname'];
-		!isset($_REQUEST['db_name']) ? $db_name = "vtigercrm5" : $db_name = $_REQUEST['db_name'];
-		!isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
-		!isset($_REQUEST['host_name']) ? $host_name= $hostname : $host_name= $_REQUEST['host_name'];
-		!isset($_REQUEST['site_URL']) ? $site_URL = $web_root : $site_URL = $_REQUEST['site_URL'];
-		!isset($_REQUEST['root_directory']) ? $root_directory = $current_dir : $root_directory = stripslashes($_REQUEST['root_directory']);
-		!isset($_REQUEST['cache_dir']) ? $cache_dir = $cache_dir : $cache_dir = stripslashes($_REQUEST['cache_dir']);
-		!isset($_REQUEST['mail_server']) ? $mail_server = $mail_server : $mail_server = stripslashes($_REQUEST['mail_server']);
-		!isset($_REQUEST['mail_server_username']) ? $mail_server_username = $mail_server_username : $mail_server_username = stripslashes($_REQUEST['mail_server_username']);
-		!isset($_REQUEST['mail_server_password']) ? $mail_server_password = $mail_server_password : $mail_server_password = stripslashes($_REQUEST['mail_server_password']);
-		!isset($_REQUEST['admin_email']) ? $admin_email = "" : $admin_email = $_REQUEST['admin_email'];
-		}
-		!isset($_REQUEST['check_createdb']) ? $check_createdb = "" : $check_createdb = $_REQUEST['check_createdb'];
-		!isset($_REQUEST['root_user']) ? $root_user = "" : $root_user = $_REQUEST['root_user'];
-		!isset($_REQUEST['root_password']) ? $root_password = "" : $root_password = $_REQUEST['root_password'];
-		// determine database options
-		$db_options = array();
-		if(function_exists('mysql_connect')) {
-			$db_options['mysql'] = 'MySQL';
-		}
-		if(function_exists('pg_connect')) {
-			$db_options['pgsql'] = 'Postgres';
-		}
-?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<title>vtiger CRM 5 - Configuration Wizard - System Configuration</title>
-	<link href="include/install/install.css" rel="stylesheet" type="text/css">
-</head>
-
-<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
-<style>
-	.hide_tab{display:none;}
-	.show_tab{display:inline-table;}
-</style>
-
-<script type="text/javascript" language="Javascript">
-
-	function fnShow_Hide(){
-		var sourceTag = document.getElementById('check_createdb').checked;
-		if(sourceTag){
-			document.getElementById('root_user').className = 'show_tab';
-			document.getElementById('root_pass').className = 'show_tab';
-			document.getElementById('root_user_txtbox').focus();
-		}
-		else{
-			document.getElementById('root_user').className = 'hide_tab';
-			document.getElementById('root_pass').className = 'hide_tab';
-		}
-	}
-
-function trim(s) {
-        while (s.substring(0,1) == " ") {
-                s = s.substring(1, s.length);
-        }
-        while (s.substring(s.length-1, s.length) == ' ') {
-                s = s.substring(0,s.length-1);
-        }
-
-        return s;
-}
-
-function verify_data(form) {
-	var isError = false;
-	var errorMessage = "";
-	// Here we decide whether to submit the form.
-	if (trim(form.db_hostname.value) =='') {
-		isError = true;
-		errorMessage += "\n database host name";
-		form.db_hostname.focus();
-	}
-	if (trim(form.db_username.value) =='') {
-		isError = true;
-		errorMessage += "\n database user name";
-		form.db_username.focus();
-	}
-	if (trim(form.db_name.value) =='') {
-		isError = true;
-		errorMessage += "\n database name";
-		form.db_name.focus();
-	}
-	if (trim(form.site_URL.value) =='') {
-		isError = true;
-		errorMessage += "\n site url";
-		form.site_URL.focus();
-	}
-	if (trim(form.root_directory.value) =='') {
-		isError = true;
-		errorMessage += "\n path";
-		form.root_directory.focus();
-	}
-	if (trim(form.admin_password.value) =='') {
-		isError = true;
-		errorMessage += "\n admin password";
-		form.admin_password.focus();
-	}
-	if (trim(form.admin_email.value) =='') {
-		isError = true;
-		errorMessage += "\n user email";
-		form.admin_email.focus();
-	}
-	if (trim(form.cache_dir.value) =='') {
-                isError = true;
-                errorMessage += "\n temp directory path";
-                form.cache_dir.focus();
-        }
-	if (trim(form.currency_name.value) =='') {
-                isError = true;
-                errorMessage += "\n currency name";
-                form.currency_name.focus();
-        }
-	if (trim(form.currency_symbol.value) =='') {
-                isError = true;
-                errorMessage += "\n currency symbol";
-                form.currency_symbol.focus();
-        }	
-	if (trim(form.currency_code.value) =='') {
-                isError = true;
-                errorMessage += "\n currency code";
-                form.currency_code.focus();
-        }
-
-
-	if(document.getElementById('check_createdb').checked == true)
-	{
-		if (trim(form.root_user.value) =='') {
-			isError = true;
-			errorMessage += "\n root username";
-			form.root_user.focus();
-		}
-	}
-
-	// Here we decide whether to submit the form.
-	if (isError == true) {
-		alert("Missing required fields: " + errorMessage);
-		return false;
-	}
-	if (trim(form.admin_email.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.admin_email.value)) {
-		alert("The email id '"+form.admin_email.value+"' in the email field is invalid");
-		form.admin_email.focus();
-		exit();
-	}
-
-	form.submit();
-}
-// end hiding contents from old browsers  -->
-</script>
-
-	<br><br><br>
-	<!-- Table for cfgwiz starts -->
-
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
-		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
-
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
-	<tr>
-		<td class="small" bgcolor="#4572BE" align=center>
-			<!-- Master display -->
-			<table border=0 cellspacing=0 cellpadding=0 width=97%>
-			<tr>
-				<td width=20% valign=top>
-
-				<!-- Left side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
-					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>System Configuration</b></div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
-					</table>
-					
-				</td>
-				<td width=80% valign=top class="cwContentDisplay" align=left>
-				<!-- Right side tabs -->
-				    <form action="install.php" method="post" name="installform" id="form" name="setConfig" id="form">
-				    <table border=0 cellspacing=0 cellpadding=10 width=100%>
-				    <tr><td class=small align=left><img src="include/install/images/confWizSysConfig.gif" alt="System Configuration" title="System Configuration"><br>
-					  <hr noshade size=1></td></tr>
-				    <tr>
-					<td align=left class="small" style="padding-left:20px">
-
-	
-				<table width="100%" cellpadding="5"  cellspacing="1" border="0" class=small><tbody>
-				<tr>
-					<td >
-		          		<b>Please enter your database configuration information below...</b><br>
-
-					  If you do not have root access to your database (for example you are installing in a virtual
-					  hosting environment), you will need to have your database created for you before you proceed.
-					  However, this installer will still be able to create the necessary database tables. <br><br>
-			
-					  If you are unsure of your database host, username or password, we suggest that you use the default
-					  values below. <br><br>
-					  
-					  *- required information
-					  
-
-					</td>
-				</tr>
-				</table>
-			
-			<br>
-			
-			<table width="90%" cellpadding="5"  cellspacing="1" border="0" class=small style="background-color:#cccccc"><tbody>
-			<tr><td colspan=2><strong>Database Configuration</strong></td></tr>
-			<tr>
-               <td width="25%" nowrap bgcolor="#F5F5F5" ><strong>Database Type</strong> <sup><font color=red>*</font></sup></td>
-               <td width="75%" bgcolor="white" align="left">
-		<?php if(!$db_options) : ?>
-			No Database Support Deteched
-		<?php elseif(count($db_options) == 1) : ?>
-			<?php list($db_type, $label) = each($db_options); ?>
-			<input type="hidden" name="db_type" value="<?php echo $db_type ?>"><?php echo $label ?>
-		<?php else : ?>
-			<select name="db_type">
-			<?php foreach($db_options as $db_option_type => $label) : ?>
-				<option value="<?php echo $db_option_type ?>" <?php if(isset($db_type) && $db_type == $db_option_type) { echo "SELECTED"; } ?>><?php echo $label ?></option>
-			<?php endforeach ?>
-			</select>
-		<?php endif ?>
-			   </td>
-            </tr>
-			<tr>
-               <td width="25%" nowrap bgcolor="#F5F5F5" ><strong>Host Name</strong> <sup><font color=red>*</font></sup></td>
-               <td width="75%" bgcolor="white" align="left"><input type="text" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" /></td>
-              </tr>
-              <tr>
-               <td nowrap bgcolor="#F5F5F5"><strong>User Name</strong> <sup><font color=red>*</font></sup></td>
-               <td bgcolor="white" align="left"><input type="text" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" /></td>
-              </tr>
-              <tr>
-               <td nowrap bgcolor="#F5F5F5"><strong>Password</strong></td>
-               <td bgcolor="white" align="left"><input type="password" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" /></td>
-              </tr>
-              <tr>
-               <td nowrap bgcolor="#F5F5F5"><strong>Database Name</strong> <sup><font color=red>*</font></sup></td>
-               <td bgcolor="white" align="left"><input type="text" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" />&nbsp;
-		       <?php if($check_createdb == 'on')
-			       {?>
-			       <input name="check_createdb" type="checkbox" id="check_createdb" checked onClick="fnShow_Hide()"/>
-			       <?php }else{?>
-				       <input name="check_createdb" type="checkbox" id="check_createdb" onClick="fnShow_Hide()"/>
-			       <?php } ?>
-			       &nbsp;Create Database(will drop the database if exists)</td>
-              </tr>
-	      <tr id="root_user" class="hide_tab">
-			   <td bgcolor="#f5f5f5" nowrap="nowrap" width="25%"><strong>Root Username</strong> <sup><font color="red">*</font></sup></td>
-			   <td align="left" bgcolor="white"><input class="dataInput" name="root_user" id="root_user_txtbox" value="<?php echo $root_user;?>" type="text"></td>
- 	      </tr>
-	      <tr id="root_pass" class="hide_tab">
-			   <td bgcolor="#f5f5f5" nowrap="nowrap"><strong>Root Password</strong></td>
-			   <td align="left" bgcolor="white"><input class="dataInput" name="root_password" value="<?php echo $root_password;?>" type="password"></td>
-	      </tr>
-              </table>
-			
-			<br><br>
-			
-		  <!-- Web site configuration -->
-		<table width="90%" cellpadding="5" border="0" style="background-color:#cccccc" cellspacing="1" class="small"><tbody>
-            <tr>
-				<td ><strong>Site Configuration</strong></td>
-            </tr>
-			<tr>
-				<td width="25%" bgcolor="#F5F5F5" ><strong>URL</strong> <sup><font color=red>*</font></sup></td>
-				<td width="75%" bgcolor=white align="left"><input class="dataInput" type="text" name="site_URL"
-				value="<?php if (isset($site_URL)) echo $site_URL; ?>" size="40" />
-				</td>
-			</tr>
-			<tr>
-				<td bgcolor="#F5F5F5"><strong>Path</strong> <sup><font color=red>*</font></sup></td>
-				<td align="left" bgcolor="white"><input class="dataInput" type="text" name="root_directory" value="<?php if (isset($root_directory)) echo "$root_directory"; ?>" size="40" /> </td>
-			</tr>
-			<tr valign="top">
-				<td bgcolor="#F5F5F5"><strong>Path to Cache Directory  <sup><font color=red>*</font></sup><br>(must be writable)</td>
-				<td align="left" bgcolor="white"><?php echo $root_directory; ?><input class="dataInput" type="text" name="cache_dir" size='14' value="<?php if (isset($cache_dir)) echo $cache_dir; ?>" size="40" /> </td>
-          </tr>
-          </table>
-			<br><br>
-			
-			<!-- Admin Configuration -->
-            <table width="90%" cellpadding="5" border="0" class="small" cellspacing="1" style="background-color:#cccccc">
-			<tr>
-				<td colspan=2><strong>Admin Configuration</strong></td>
-            </tr>
-			<tr>
-				<td nowrap width=25% bgcolor="#F5F5F5" ><strong>User name</strong></td>
-				<td width=75% bgcolor="white" align="left">admin</td>
-			</tr>
-			<tr>
-				<td bgcolor="#F5F5F5" nowrap><strong>Password</strong><sup><font color=red>*</font></sup></td>
-				<td bgcolor="white" align="left"><input class="dataInput" type="password" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; else echo "admin"; ?>"></td>
-			</tr>
-			<tr>
-				<td bgcolor="#F5F5F5" nowrap><strong>Email</strong><sup><font color=red>*</font></sup></td>
-				<td bgcolor="white" align="left"><input class="dataInput" type="text" name="admin_email" value="<?php if (isset($admin_email)) echo "$admin_email"; else echo "admin at your-domain.com"; ?>"></td>
-			</tr>
-			<tr>
-				<td colspan="2" bgcolor="white"><font color=blue> <b>Note:</b> The default password is 'admin'. You can change the password if necessary now or else you can change it later after logging-in.</font></td>
-			</tr>
-			</table>
-	
-				<br><br>
-		<!-- Currency Configuration -->
-            <table width="90%" cellpadding="5" border="0" class="small" cellspacing="1" style="background-color:#cccccc">
-			<tr>
-				<td colspan=2><strong>Currency Configuration</strong></td>
-            </tr>
-			<tr>
-				<td nowrap width=25% bgcolor="#F5F5F5" ><strong>Name</strong><sup><font color=red>*</font></sup></td>
-				<td width=75% bgcolor="white" align="left"><input class="dataInput" type="text" name="currency_name" value="<?php if (isset($currency_name)) echo "$currency_name"; ?>"></td>
-			</tr>
-			<tr>
-				<td bgcolor="#F5F5F5" nowrap><strong>Symbol</strong><sup><font color=red>*</font></sup></td>
-				<td bgcolor="white" align="left"><input class="dataInput" type="text" name="currency_symbol" value="<?php if (isset($currency_symbol)) echo "$currency_symbol";?>"></td>
-			</tr>
-			<tr>
-				<td bgcolor="#F5F5F5" nowrap><strong>Code</strong><sup><font color=red>*</font></sup></td>
-				<td bgcolor="white" align="left"><input class="dataInput" type="text" name="currency_code" value="<?php if (isset($currency_code)) echo "$currency_code"; ?>"></td>
-			</tr>
-			</table>
-
-		<!-- System Configuration -->
-		</td>
-		</tr>
-		<tr>
-				<td align=center>
-					<input type="hidden" name="file" value="3confirmConfig.php" />
-					<input type="image" src="include/install/images/cwBtnNext.gif" id="starttbn" alt="Next" border="0" title="Next" onClick="return verify_data(window.document.installform);">
-					<br>
-				    <br></td>
-			</tr>
-		</table>
-		</form>
-	</td>
-		</tr>
-	</table>
-	<!-- Master display stops -->
-	<br>
-	</td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-
-		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
-	</tr>
-	</table>	
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-
-      	<tr>
-        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
-      	</tr>
-    	</table>
-	<script>
-	fnShow_Hide();
-	</script>
-</body>
-</html>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ lpha2* Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat'vtiger_crm/sugarcrm/install/2setConfig.php,v 1.41 2005/04/29 06:44:13 samk Exp $
+ * Description:  Executes a step in the installation process.
+ ********************************************************************************/
+
+// TODO: deprecate connection.php file
+//require_once("connection.php");
+
+// TODO: introduce MySQL port as parameters to use non-default value 3306
+//$sock_path=":" .$mysql_port;
+$hostname = $_SERVER['SERVER_NAME'];
+
+// TODO: introduce Apache port as parameters to use non-default value 80
+//$web_root = $_SERVER['SERVER_NAME']. ":" .$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
+//$web_root = $hostname.$_SERVER['PHP_SELF'];
+$web_root = $HTTP_SERVER_VARS["HTTP_HOST"] . $HTTP_SERVER_VARS["REQUEST_URI"];
+$web_root = str_replace("/install.php", "", $web_root);
+$web_root = "http://".$web_root;
+
+$current_dir = pathinfo(dirname(__FILE__));
+$current_dir = $current_dir['dirname']."/";
+$cache_dir = "cache/";
+
+if (is_file("config.php") && is_file("config.inc.php")) {
+	require_once("config.inc.php");
+	session_start();
+
+	if(isset($upload_maxsize))
+	$_SESSION['upload_maxsize'] = $upload_maxsize;
+
+	if(isset($allow_exports))
+	$_SESSION['allow_exports'] = $allow_exports;
+
+	if(isset($disable_persistent_connections))
+	$_SESSION['disable_persistent_connections'] = $disable_persistent_connections;
+
+	if(isset($default_language))
+	$_SESSION['default_language'] = $default_language;
+
+	if(isset($translation_string_prefix))
+	$_SESSION['translation_string_prefix'] = $translation_string_prefix;
+
+	if(isset($default_charset))
+	$_SESSION['default_charset'] = $default_charset;
+
+	if(isset($languages)) {
+		// need to encode the languages in a way that can be retrieved later
+		$language_keys = Array();
+		$language_values = Array();
+
+		foreach($languages as $key=>$value) {
+			$language_keys[] = $key;
+			$language_values[] = $value;
+		}
+		$_SESSION['language_keys'] = urlencode(implode(",",$language_keys));
+		$_SESSION['language_values'] = urlencode(implode(",",$language_values));
+	}
+													
+	global $dbconfig;
+
+	if (isset($_REQUEST['db_hostname']))
+	$db_hostname = $_REQUEST['db_hostname'];
+	elseif (isset($dbconfig['db_hostname']))
+	$db_hostname = $dbconfig['db_hostname'];
+	else
+	$db_hostname = $hostname;
+
+	if (isset($_REQUEST['db_username']))
+	$db_username = $_REQUEST['db_username'];
+	elseif (isset($dbconfig['db_username']))
+	$db_username = $dbconfig['db_username'];
+
+	if (isset($_REQUEST['db_password']))
+	$db_password = $_REQUEST['db_password'];
+	elseif (isset($dbconfig['db_password']))
+	$db_password = $dbconfig['db_password'];
+
+	if (isset($_REQUEST['db_type']))
+	$db_type = $_REQUEST['db_type'];
+	elseif (isset($dbconfig['db_type']))
+	$db_type = $dbconfig['db_type'];
+
+	if (isset($_REQUEST['db_name']))
+	$db_name = $_REQUEST['db_name'];
+	elseif (isset($dbconfig['db_name']) && $dbconfig['db_name']!='_DBC_NAME_')
+	$db_name = $dbconfig['db_name'];
+	else
+	$db_name = 'vtigercrm502';
+
+	!isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
+	if (isset($_REQUEST['host_name'])) $host_name = $_REQUEST['host_name'];
+	else $host_name = $hostname;
+
+	if (isset($_REQUEST['site_URL'])) $site_URL = $_REQUEST['site_URL'];
+	elseif (isset($site_URL) && $site_URL!='_SITE_URL_')
+	$site_URL = $site_URL;
+	else $site_URL = $web_root;
+
+	if(isset($_REQUEST['root_directory'])) $root_directory = $_REQUEST['root_directory'];
+	else $root_directory = $current_dir;
+	    
+	if (isset($_REQUEST['cache_dir']))
+	$cache_dir= $_REQUEST['cache_dir'];
+
+	if (isset($_REQUEST['mail_server']))
+	$mail_server= $_REQUEST['mail_server'];
+
+	if (isset($_REQUEST['mail_server_username']))
+	$mail_server_username= $_REQUEST['mail_server_username'];
+
+	if (isset($_REQUEST['mail_server_password']))
+	$mail_server_password= $_REQUEST['mail_server_password'];
+
+	if (isset($_REQUEST['admin_email']))
+	$admin_email = $_REQUEST['admin_email'];
+
+	if (isset($_REQUEST['admin_password']))
+	$admin_password = $_REQUEST['admin_password'];
+	
+	if (isset($_REQUEST['currency_name']))
+		$currency_name = $_REQUEST['currency_name'];
+	else
+		$currency_name = '';
+	
+	if (isset($_REQUEST['currency_symbol']))
+	$currency_symbol = $_REQUEST['currency_symbol'];
+	
+	if (isset($_REQUEST['currency_code']))
+	$currency_code = $_REQUEST['currency_code'];
+
+	}
+	else {
+		!isset($_REQUEST['db_hostname']) ? $db_hostname = $hostname: $db_hostname = $_REQUEST['db_hostname'];
+		!isset($_REQUEST['db_name']) ? $db_name = "vtigercrm502" : $db_name = $_REQUEST['db_name'];
+		!isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
+		!isset($_REQUEST['host_name']) ? $host_name= $hostname : $host_name= $_REQUEST['host_name'];
+		!isset($_REQUEST['site_URL']) ? $site_URL = $web_root : $site_URL = $_REQUEST['site_URL'];
+		!isset($_REQUEST['root_directory']) ? $root_directory = $current_dir : $root_directory = stripslashes($_REQUEST['root_directory']);
+		!isset($_REQUEST['cache_dir']) ? $cache_dir = $cache_dir : $cache_dir = stripslashes($_REQUEST['cache_dir']);
+		!isset($_REQUEST['mail_server']) ? $mail_server = $mail_server : $mail_server = stripslashes($_REQUEST['mail_server']);
+		!isset($_REQUEST['mail_server_username']) ? $mail_server_username = $mail_server_username : $mail_server_username = stripslashes($_REQUEST['mail_server_username']);
+		!isset($_REQUEST['mail_server_password']) ? $mail_server_password = $mail_server_password : $mail_server_password = stripslashes($_REQUEST['mail_server_password']);
+		!isset($_REQUEST['admin_email']) ? $admin_email = "" : $admin_email = $_REQUEST['admin_email'];
+	}
+		!isset($_REQUEST['check_createdb']) ? $check_createdb = "" : $check_createdb = $_REQUEST['check_createdb'];
+		!isset($_REQUEST['root_user']) ? $root_user = "" : $root_user = $_REQUEST['root_user'];
+		!isset($_REQUEST['root_password']) ? $root_password = "" : $root_password = $_REQUEST['root_password'];
+		// determine database options
+		$db_options = array();
+		if(function_exists('mysql_connect')) {
+			$db_options['mysql'] = 'MySQL';
+		}
+		if(function_exists('pg_connect')) {
+			$db_options['pgsql'] = 'Postgres';
+		}
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<title>vtiger CRM 5 - Configuration Wizard - System Configuration</title>
+	<link href="include/install/install.css" rel="stylesheet" type="text/css">
+</head>
+
+<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+<style>
+	.hide_tab{display:none;}
+	.show_tab{display:inline-table;}
+</style>
+
+<script type="text/javascript" language="Javascript">
+
+	function fnShow_Hide(){
+		var sourceTag = document.getElementById('check_createdb').checked;
+		if(sourceTag){
+			document.getElementById('root_user').className = 'show_tab';
+			document.getElementById('root_pass').className = 'show_tab';
+			document.getElementById('root_user_txtbox').focus();
+		}
+		else{
+			document.getElementById('root_user').className = 'hide_tab';
+			document.getElementById('root_pass').className = 'hide_tab';
+		}
+	}
+
+function trim(s) {
+        while (s.substring(0,1) == " ") {
+                s = s.substring(1, s.length);
+        }
+        while (s.substring(s.length-1, s.length) == ' ') {
+                s = s.substring(0,s.length-1);
+        }
+
+        return s;
+}
+
+function verify_data(form) {
+	var isError = false;
+	var errorMessage = "";
+	// Here we decide whether to submit the form.
+	if (trim(form.db_hostname.value) =='') {
+		isError = true;
+		errorMessage += "\n database host name";
+		form.db_hostname.focus();
+	}
+	if (trim(form.db_username.value) =='') {
+		isError = true;
+		errorMessage += "\n database user name";
+		form.db_username.focus();
+	}
+	if (trim(form.db_name.value) =='') {
+		isError = true;
+		errorMessage += "\n database name";
+		form.db_name.focus();
+	}
+	if (trim(form.site_URL.value) =='') {
+		isError = true;
+		errorMessage += "\n site url";
+		form.site_URL.focus();
+	}
+	if (trim(form.root_directory.value) =='') {
+		isError = true;
+		errorMessage += "\n path";
+		form.root_directory.focus();
+	}
+	if (trim(form.admin_password.value) =='') {
+		isError = true;
+		errorMessage += "\n admin password";
+		form.admin_password.focus();
+	}
+	if (trim(form.admin_email.value) =='') {
+		isError = true;
+		errorMessage += "\n user email";
+		form.admin_email.focus();
+	}
+	if (trim(form.cache_dir.value) =='') {
+                isError = true;
+                errorMessage += "\n temp directory path";
+                form.cache_dir.focus();
+        }
+	if (trim(form.currency_name.value) =='') {
+                isError = true;
+                errorMessage += "\n currency name";
+                form.currency_name.focus();
+        }
+	if (trim(form.currency_symbol.value) =='') {
+                isError = true;
+                errorMessage += "\n currency symbol";
+                form.currency_symbol.focus();
+        }	
+	if (trim(form.currency_code.value) =='') {
+                isError = true;
+                errorMessage += "\n currency code";
+                form.currency_code.focus();
+        }
+
+
+	if(document.getElementById('check_createdb').checked == true)
+	{
+		if (trim(form.root_user.value) =='') {
+			isError = true;
+			errorMessage += "\n root username";
+			form.root_user.focus();
+		}
+	}
+
+	// Here we decide whether to submit the form.
+	if (isError == true) {
+		alert("Missing required fields: " + errorMessage);
+		return false;
+	}
+	if (trim(form.admin_email.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.admin_email.value)) {
+		alert("The email id '"+form.admin_email.value+"' in the email field is invalid");
+		form.admin_email.focus();
+		exit();
+	}
+
+	form.submit();
+}
+// end hiding contents from old browsers  -->
+</script>
+
+	<br><br><br>
+	<!-- Table for cfgwiz starts -->
+
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
+		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
+
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
+	<tr>
+		<td class="small" bgcolor="#4572BE" align=center>
+			<!-- Master display -->
+			<table border=0 cellspacing=0 cellpadding=0 width=97%>
+			<tr>
+				<td width=20% valign=top>
+
+				<!-- Left side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
+					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>System Configuration</b></div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
+					</table>
+					
+				</td>
+				<td width=80% valign=top class="cwContentDisplay" align=left>
+				<!-- Right side tabs -->
+				    <form action="install.php" method="post" name="installform" id="form" name="setConfig" id="form">
+				    <table border=0 cellspacing=0 cellpadding=10 width=100%>
+				    <tr><td class=small align=left><img src="include/install/images/confWizSysConfig.gif" alt="System Configuration" title="System Configuration"><br>
+					  <hr noshade size=1></td></tr>
+				    <tr>
+					<td align=left class="small" style="padding-left:20px">
+
+	
+				<table width="100%" cellpadding="5"  cellspacing="1" border="0" class=small><tbody>
+				<tr>
+					<td >
+		          		<b>Please enter your database configuration information below...</b><br>
+
+					  If you do not have root access to your database (for example you are installing in a virtual
+					  hosting environment), you will need to have your database created for you before you proceed.
+					  However, this installer will still be able to create the necessary database tables. <br><br>
+			
+					  If you are unsure of your database host, username or password, we suggest that you use the default
+					  values below. <br><br>
+					  
+					  *- required information
+					  
+
+					</td>
+				</tr>
+				</table>
+			
+			<br>
+			
+			<table width="90%" cellpadding="5"  cellspacing="1" border="0" class=small style="background-color:#cccccc"><tbody>
+			<tr><td colspan=2><strong>Database Configuration</strong></td></tr>
+			<tr>
+               <td width="25%" nowrap bgcolor="#F5F5F5" ><strong>Database Type</strong> <sup><font color=red>*</font></sup></td>
+               <td width="75%" bgcolor="white" align="left">
+		<?php if(!$db_options) : ?>
+			No Database Support Detected
+		<?php elseif(count($db_options) == 1) : ?>
+			<?php list($db_type, $label) = each($db_options); ?>
+			<input type="hidden" name="db_type" value="<?php echo $db_type ?>"><?php echo $label ?>
+		<?php else : ?>
+			<select name="db_type">
+			<?php foreach($db_options as $db_option_type => $label) : ?>
+				<option value="<?php echo $db_option_type ?>" <?php if(isset($db_type) && $db_type == $db_option_type) { echo "SELECTED"; } ?>><?php echo $label ?></option>
+			<?php endforeach ?>
+			</select>
+		<?php endif ?>
+			   </td>
+            </tr>
+			<tr>
+               <td width="25%" nowrap bgcolor="#F5F5F5" ><strong>Host Name</strong> <sup><font color=red>*</font></sup></td>
+               <td width="75%" bgcolor="white" align="left"><input type="text" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" /></td>
+              </tr>
+              <tr>
+               <td nowrap bgcolor="#F5F5F5"><strong>User Name</strong> <sup><font color=red>*</font></sup></td>
+               <td bgcolor="white" align="left"><input type="text" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" /></td>
+              </tr>
+              <tr>
+               <td nowrap bgcolor="#F5F5F5"><strong>Password</strong></td>
+               <td bgcolor="white" align="left"><input type="password" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" /></td>
+              </tr>
+              <tr>
+               <td nowrap bgcolor="#F5F5F5"><strong>Database Name</strong> <sup><font color=red>*</font></sup></td>
+               <td bgcolor="white" align="left"><input type="text" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" />&nbsp;
+		       <?php if($check_createdb == 'on')
+			       {?>
+			       <input name="check_createdb" type="checkbox" id="check_createdb" checked onClick="fnShow_Hide()"/>
+			       <?php }else{?>
+				       <input name="check_createdb" type="checkbox" id="check_createdb" onClick="fnShow_Hide()"/>
+			       <?php } ?>
+			       &nbsp;Create Database(will drop the database if exists)</td>
+              </tr>
+	      <tr id="root_user" class="hide_tab">
+			   <td bgcolor="#f5f5f5" nowrap="nowrap" width="25%"><strong>Root Username</strong> <sup><font color="red">*</font></sup></td>
+			   <td align="left" bgcolor="white"><input class="dataInput" name="root_user" id="root_user_txtbox" value="<?php echo $root_user;?>" type="text"></td>
+ 	      </tr>
+	      <tr id="root_pass" class="hide_tab">
+			   <td bgcolor="#f5f5f5" nowrap="nowrap"><strong>Root Password</strong></td>
+			   <td align="left" bgcolor="white"><input class="dataInput" name="root_password" value="<?php echo $root_password;?>" type="password"></td>
+	      </tr>
+              </table>
+			
+			<br><br>
+			
+		  <!-- Web site configuration -->
+		<table width="90%" cellpadding="5" border="0" style="background-color:#cccccc" cellspacing="1" class="small"><tbody>
+            <tr>
+				<td ><strong>Site Configuration</strong></td>
+            </tr>
+			<tr>
+				<td width="25%" bgcolor="#F5F5F5" ><strong>URL</strong> <sup><font color=red>*</font></sup></td>
+				<td width="75%" bgcolor=white align="left"><input class="dataInput" type="text" name="site_URL"
+				value="<?php if (isset($site_URL)) echo $site_URL; ?>" size="40" />
+				</td>
+			</tr>
+			<tr>
+				<td bgcolor="#F5F5F5"><strong>Path</strong> <sup><font color=red>*</font></sup></td>
+				<td align="left" bgcolor="white"><input class="dataInput" type="text" name="root_directory" value="<?php if (isset($root_directory)) echo "$root_directory"; ?>" size="40" /> </td>
+			</tr>
+			<tr valign="top">
+				<td bgcolor="#F5F5F5"><strong>Path to Cache Directory  <sup><font color=red>*</font></sup><br>(must be writable)</td>
+				<td align="left" bgcolor="white"><?php echo $root_directory; ?><input class="dataInput" type="text" name="cache_dir" size='14' value="<?php if (isset($cache_dir)) echo $cache_dir; ?>" size="40" /> </td>
+          </tr>
+          </table>
+			<br><br>
+			
+			<!-- Admin Configuration -->
+            <table width="90%" cellpadding="5" border="0" class="small" cellspacing="1" style="background-color:#cccccc">
+			<tr>
+				<td colspan=2><strong>Admin Configuration</strong></td>
+            </tr>
+			<tr>
+				<td nowrap width=25% bgcolor="#F5F5F5" ><strong>User name</strong></td>
+				<td width=75% bgcolor="white" align="left">admin</td>
+			</tr>
+			<tr>
+				<td bgcolor="#F5F5F5" nowrap><strong>Password</strong><sup><font color=red>*</font></sup></td>
+				<td bgcolor="white" align="left"><input class="dataInput" type="password" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; else echo "admin"; ?>"></td>
+			</tr>
+			<tr>
+				<td bgcolor="#F5F5F5" nowrap><strong>Email</strong><sup><font color=red>*</font></sup></td>
+				<td bgcolor="white" align="left"><input class="dataInput" type="text" name="admin_email" value="<?php if (isset($admin_email)) echo "$admin_email"; else echo "admin at your-domain.com"; ?>"></td>
+			</tr>
+			<tr>
+				<td colspan="2" bgcolor="white"><font color=blue> <b>Note:</b> The default password is 'admin'. You can change the password if necessary now or else you can change it later after logging-in.</font></td>
+			</tr>
+			</table>
+	
+				<br><br>
+		<!-- Currency Configuration -->
+            <table width="90%" cellpadding="5" border="0" class="small" cellspacing="1" style="background-color:#cccccc">
+			<tr>
+				<td colspan=2><strong>Currency Configuration</strong></td>
+            </tr>
+			<tr>
+				<td nowrap width=25% bgcolor="#F5F5F5" ><strong>Name</strong><sup><font color=red>*</font></sup></td>
+				<td width=75% bgcolor="white" align="left"><input class="dataInput" type="text" name="currency_name" value="<?php if (isset($currency_name)) echo "$currency_name"; ?>"></td>
+			</tr>
+			<tr>
+				<td bgcolor="#F5F5F5" nowrap><strong>Symbol</strong><sup><font color=red>*</font></sup></td>
+				<td bgcolor="white" align="left"><input class="dataInput" type="text" name="currency_symbol" value="<?php if (isset($currency_symbol)) echo "$currency_symbol";?>"></td>
+			</tr>
+			<tr>
+				<td bgcolor="#F5F5F5" nowrap><strong>Code</strong><sup><font color=red>*</font></sup></td>
+				<td bgcolor="white" align="left"><input class="dataInput" type="text" name="currency_code" value="<?php if (isset($currency_code)) echo "$currency_code"; ?>"></td>
+			</tr>
+			</table>
+
+		<!-- System Configuration -->
+		</td>
+		</tr>
+		<tr>
+				<td align=center>
+					<input type="hidden" name="file" value="3confirmConfig.php" />
+					<input type="image" src="include/install/images/cwBtnNext.gif" id="starttbn" alt="Next" border="0" title="Next" onClick="return verify_data(window.document.installform);">
+					<br>
+				    <br></td>
+			</tr>
+		</table>
+		</form>
+	</td>
+		</tr>
+	</table>
+	<!-- Master display stops -->
+	<br>
+	</td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+
+		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
+	</tr>
+	</table>	
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+
+      	<tr>
+        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
+      	</tr>
+    	</table>
+	<script>
+	fnShow_Hide();
+	</script>
+</body>
+</html>

Modified: vtigercrm/branches/5.1_jens/install/4createConfigFile.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/4createConfigFile.php (original)
+++ vtigercrm/branches/5.1_jens/install/4createConfigFile.php Tue Nov 14 03:16:10 2006
@@ -1,505 +1,505 @@
-<?php
-
-/*********************************************************************************
-
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
-
- * ("License"); You may not use this file except in compliance with the
-
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
-
- * Software distributed under the License is distributed on an  "AS IS"  basis,
-
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
-
- * the specific language governing rights and limitations under the License.
-
- * The Original Code is:  SugarCRM Open Source
-
- * The Initial Developer of the Original Code is SugarCRM, Inc.
-
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
-
- * All Rights Reserved.
-
- * Contributor(s): ______________________________________.
-
- ********************************************************************************/
-
-/*********************************************************************************
-
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/4createConfigFile.php,v 1.26 2005/04/25 05:40:50 samk Exp $
-
- * Description:  Executes a step in the installation process.
-
- ********************************************************************************/
-
-
-
-include('vtigerversion.php');
-
-
-session_start();
-
-
-
-// vtiger CRM version number; do not edit!
-
-$vtiger_version = "5.0.0";
-$release_date = "14 September 2006";
-
-
-if (isset($_REQUEST['db_hostname']))
-{
-	if(strpos($_REQUEST['db_hostname'], ":"))
-	{
-		list($db_hostname,$db_port) = split(":",$_REQUEST['db_hostname']);
-	}	
-	else
-	{
-		$db_hostname = $_REQUEST['db_hostname'];
-		if($db_type == "pgsql")
-		     $db_port = '5432';
-		else
-		     $db_port = '3306';
-	}	
-}
-if (isset($_REQUEST['db_username']))$db_username = $_REQUEST['db_username'];
-
-if (isset($_REQUEST['db_password']))$db_password = $_REQUEST['db_password'];
-
-if (isset($_REQUEST['db_name']))$db_name = $_REQUEST['db_name'];
-
-if (isset($_REQUEST['db_type'])) $db_type = $_REQUEST['db_type'];
-
-if (isset($_REQUEST['db_drop_tables'])) $db_drop_tables = $_REQUEST['db_drop_tables'];
-
-if (isset($_REQUEST['db_create'])) $db_create = $_REQUEST['db_create'];
-
-if (isset($_REQUEST['db_populate'])) $db_populate = $_REQUEST['db_populate'];
-
-if (isset($_REQUEST['site_URL'])) $site_URL = $_REQUEST['site_URL'];
- 
-if (isset($_REQUEST['admin_email'])) $admin_email = $_REQUEST['admin_email'];
-
-if (isset($_REQUEST['admin_password'])) $admin_password = $_REQUEST['admin_password'];
-
-if (isset($_REQUEST['currency_name'])) $currency_name = $_REQUEST['currency_name'];
-
-if (isset($_REQUEST['currency_code'])) $currency_code = $_REQUEST['currency_code'];
-
-if (isset($_REQUEST['currency_symbol'])) $currency_symbol = $_REQUEST['currency_symbol'];
-
-if (isset($_REQUEST['mail_server'])) $mail_server = $_REQUEST['mail_server'];
-
-if (isset($_REQUEST['mail_server_username'])) $mail_server_username = $_REQUEST['mail_server_username'];
-
-if (isset($_REQUEST['mail_server_password'])) $mail_server_password = $_REQUEST['mail_server_password'];
-
-if (isset($_REQUEST['ftpserver'])) $ftpserver = $_REQUEST['ftpserver'];
-
-if (isset($_REQUEST['ftpuser'])) $ftpuser = $_REQUEST['ftpuser'];
-
-if (isset($_REQUEST['ftppassword'])) $ftppassword = $_REQUEST['ftppassword'];
-
-// update default port
-if ($db_port == '')
-{
-	if($db_type == 'mysql')
-	{
-		$db_port = "3306";
-	}
-	elseif($db_type = 'pgsql')
-	{
-		$db_port = "5432";
-	}
-	elseif($db_type = 'oci8')
-	{
-		$db_port = '1521';
-	}
-}
-
-$cache_dir = 'cache/';
-
-
-?>
-	
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-	<title>vtiger CRM 5 - Configuration Wizard - Config File Creation</title>
-	<link href="include/install/install.css" rel="stylesheet" type="text/css">
-</head>
-
-<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
-
-<br><br>
-	<!-- Table for cfgwiz starts -->
-
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
-		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
-
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
-	<tr>
-		<td class="small" bgcolor="#4572BE" align=center>
-			<!-- Master display -->
-			<table border=0 cellspacing=0 cellpadding=0 width=97%>
-			<tr>
-				<td width=20% valign=top>
-
-				<!-- Left side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
-					<tr><td class="small cwSelectedTab" id="configfile_tab" align=right><div align="left"><b>Config File Creation</b></div></td></tr>
-					<tr><td class="small cwUnSelectedTab" id="dbcreate_tab" align=right><div align="left">Database Generation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
-					</table>
-					
-				</td>
-				<td width=80% valign=top class="cwContentDisplay" align=left>
-				<table border=0 cellspacing=0 cellpadding=10 width=100%>
-				<tr><td class=small align=left><img id="title_img" src="include/install/images/confWizConfFile.gif" alt="Config File Creation" title="Config File Creation"><img id="title_img1" src="include/install/images/confWizDbGeneration.gif" style="display:none;" alt="Database Generation" title="Database Generation"><br>
-					  <hr noshade size=1></td></tr>
-				<tr>
-					<td align=left class="small" style="padding-left:20px">
-					<?php
-					if (isset($_REQUEST['root_directory']))
-						$root_directory = $_REQUEST['root_directory'];
-		
-					if (is_file('config.inc.php'))
-					    	$is_writable = is_writable('config.inc.php');
-					else
-	      					$is_writable = is_writable('.');
-
-	      				/* open template configuration file read only */
-	      				$templateFilename = 'config.template.php';
-	      				$templateHandle = fopen($templateFilename, "r");
-	      				if($templateHandle) {
-		      				/* open include configuration file write only */
-		      				$includeFilename = 'config.inc.php';
-					      	$includeHandle = fopen($includeFilename, "w");
-		      				if($includeHandle) {
-			      			   while (!feof($templateHandle)) {
-				      			$buffer = fgets($templateHandle);
-
-				     			/* replace _DBC_ variable */
-				      			$buffer = str_replace( "_DBC_SERVER_", $db_hostname, $buffer);
-				      			$buffer = str_replace( "_DBC_PORT_", $db_port, $buffer);
-				      			$buffer = str_replace( "_DBC_USER_", $db_username, $buffer);
-				      			$buffer = str_replace( "_DBC_PASS_", $db_password, $buffer);
-				      			$buffer = str_replace( "_DBC_NAME_", $db_name, $buffer);
-				      			$buffer = str_replace( "_DBC_TYPE_", $db_type, $buffer);
-
-				      			$buffer = str_replace( "_SITE_URL_", $site_URL, $buffer);
-
-				      			/* replace dir variable */
-				      			$buffer = str_replace( "_VT_ROOTDIR_", $root_directory, $buffer);
-				      			$buffer = str_replace( "_VT_CACHEDIR_", $cache_dir, $buffer);
-				      			$buffer = str_replace( "_VT_TMPDIR_", $cache_dir."images/", $buffer);
-				      			$buffer = str_replace( "_VT_UPLOADDIR_", $cache_dir."upload/", $buffer);
-				      			/* replace mail variable */
-				      			$buffer = str_replace( "_MAIL_SERVER_", $mail_server, $buffer);
-				      			$buffer = str_replace( "_MAIL_USERNAME_", $mail_server_username, $buffer);
-						      	$buffer = str_replace( "_MAIL_PASSWORD_", $mail_server_password, $buffer);
-						      	$buffer = str_replace( "_DB_STAT_", "true", $buffer);
-				
-						      	/* replace the application unique key variable */
-				      			$buffer = str_replace( "_MASTER_CURRENCY_", $currency_name, $buffer);
-
-						      	/* replace the application unique key variable */
-					      		$buffer = str_replace( "_VT_APP_UNIQKEY_", md5($root_directory), $buffer);
-	
-					      		fwrite($includeHandle, $buffer);
-					      		}
-
-				      		fclose($includeHandle);
-				      		}
-
-				      	fclose($templateHandle);
-				      	}
-  
-	if ($templateHandle && $includeHandle) {?>
-			<div id="config_info">
-			<p><strong class="big">Successfully created configuration file (config.inc.php) in :</strong><br><br>
-			<font color="green"><b><?php echo $root_directory; ?></b></font><br><br>
-			The installation will take at least 4 minutes. Grab a coffee,sit back and relax...<br>
-			</p>
-			</div>
-			<br>		
-	<?php } 
-	else {?>
-			<div id="config_info"><p><strong class="big"><font color="red">Cannot write configuration file (config.inc.php ) in : </font></strong><br><br>
-			<font color="green"><b><?php echo $root_directory; ?></b></font><br><br>
-			<P>You can continue this installation by manually creating the config.inc.php file and pasting the configuration information below inside.However, you <strong>must</strong> create the configuration file before you continue to the next step.<P><br><br>
-	<?php			
-	$config = "<?php \n";
- 	$config .= "/*********************************************************************************\n";
- 	$config .= " * The contents of this file are subject to the SugarCRM Public License Version 1.1.2\n";
- 	$config .= " * (\"License\"); You may not use this file except in compliance with the \n";
- 	$config .= " * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL\n";
- 	$config .= " * Software distributed under the License is distributed on an  \"AS IS\"  basis,\n";
- 	$config .= " * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for\n";
- 	$config .= " * the specific language governing rights and limitations under the License.\n";
- 	$config .= " * The Original Code is:  SugarCRM Open Source\n";
- 	$config .= " * The Initial Developer of the Original Code is SugarCRM, Inc.\n";
- 	$config .= " * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;\n";
- 	$config .= " * All Rights Reserved.\n";
- 	$config .= " * Contributor(s): ______________________________________.\n";
- 	$config .= "********************************************************************************/\n\n";
- 	$config .= "include('vtigerversion.php');\n\n";
- 	$config .= "// more than 8MB memory needed for graphics\n\n";
- 	$config .= "// memory limit default value = 16M\n\n";
- 	$config .= "ini_set('memory_limit','16M');\n\n";
- 	$config .= "// show or hide world clock, calculator and FCKEditor\n\n";
- 	$config .= "// world_clock_display default value = true\n";
- 	$config .= "// calculator_display default value = true\n";
- 	$config .= "// fckeditor_display default value = true\n\n";
- 	$config .= "\$WORLD_CLOCK_DISPLAY = 'true';\n";
- 	$config .= "\$CALCULATOR_DISPLAY = 'true';\n";
- 	$config .= "\$FCKEDITOR_DISPLAY = 'true';\n\n";
- 	
- 	$config .= "//This is the URL for customer portal. (Ex. http://vtiger.com/portal)\n";
- 	$config .= "\$PORTAL_URL = 'http://yourdomain.com/customerportal';\n\n";
- 	$config .= "//These two are the HelpDesk support email id and the support name. ";
- 	$config .= "(Ex. 'support at vtiger.com' and 'vtiger Support')\n";
- 	$config .= "\$HELPDESK_SUPPORT_EMAIL_ID = 'support at yourdomain.com';\n";
- 	$config .= "\$HELPDESK_SUPPORT_NAME = 'yourdomain Name';\n\n";
- 	
- 	$config .= "/* Database configuration\n";
- 	$config .= "      db_host_name:     MySQL Database Hostname\n";
- 	$config .= "      db_user_name:        MySQL Username\n";
- 	$config .= "      db_password:         MySQL Password\n";
- 	$config .= "      db_name:             MySQL Database Name\n*/\n";
- 	$config .= "\$dbconfig['db_server'] =     '".$db_hostname."';\n";
- 	$config .= "\$dbconfig['db_port'] =     '".$db_port."';\n";
- 	$config .= "\$dbconfig['db_username'] =     '".$db_username."';\n";
- 	$config .= "\$dbconfig['db_password'] =         '".$db_password."';\n";
- 	$config .= "\$dbconfig['db_name'] =             '".$db_name."';\n";
- 	$config .= "\$dbconfig['db_type'] = '".$db_type."';\n";
-	$config .= "\$dbconfig['db_status'] = 'true';\n";
-
-	$config .= "// TODO: test if port is empty\n";
-	$config .= "// TODO: set db_hostname dependending on db_type\n";
- 	$config .= "\$dbconfig['db_hostname'] = \$dbconfig['db_server'].\$dbconfig['db_port'];\n\n";
-
-	
-	$config .= "// log_sql default value = false\n";
-	$config .= "\$dbconfig['log_sql'] = false;\n\n";
-	
-	$config .= "// persistent default value = true\n";
-	$config .= "\$dbconfigoption['persistent'] = true;\n\n";
-
-	$config .= "// autofree default value = false\n";
-	$config .= "\$dbconfigoption['autofree'] = false;\n\n";
-	
-	$config .= "// debug default value = 0\n";
-	$config .= "\$dbconfigoption['debug'] = 0;\n\n";
-
-	$config .= "// seqname_format default value = '%s_seq'\n";
-	$config .= "\$dbconfigoption['seqname_format'] = '%s_seq';\n\n";
-
-	$config .= "// portability default value = 0\n";
-	$config .= "\$dbconfigoption['portability'] = 0;\n\n";
-
-	$config .= "// ssl default value = false\n";
-	$config .= "\$dbconfigoption['ssl'] = false;\n\n";
-
-	$config .= "\$host_name = \$dbconfig['db_hostname'];\n\n";
-	
-	$config .= "\$site_URL ='$site_URL';\n\n";
-
-	$config .= "// root directory path\n";
-	$config .= "\$root_directory = '$root_directory';\n\n";
-
-	$config .= "// cache direcory path\n";
-	$config .= "\$cache_dir = '$cache_dir';\n\n";
-
-	$config .= "// tmp_dir default value prepended by cache_dir = images/\n";
-	$config .= "\$tmp_dir = '$cache_dir"."images/';\n\n";
-
-	$config .= "// import_dir default value prepended by cache_dir = import/\n";
-	$config .= "\$tmp_dir = '$cache_dir"."import/';\n\n";
-
-	$config .= "// upload_dir default value prepended by cache_dir = upload/\n";
-	$config .= "\$tmp_dir = '$cache_dir"."upload/';\n\n";
-
-	$config .= "// mail server parameters\n";
-	$config .= "\$mail_server = '$mail_server';\n";
-	$config .= "\$mail_server_username = '$mail_server_username';\n";
-	$config .= "\$mail_server_password = '$mail_server_password';\n\n";
-	
-	$config .= "// maximum file size for uploaded files in bytes also used when uploading import files\n";
-	$config .= "// upload_maxsize default value = 3000000\n";
-	$config .= "\$upload_maxsize = 3000000;\n\n";
-
-	$config .= "// flag to allow export functionality\n";
-	$config .= "// 'all' to allow anyone to use exports \n";
-	$config .= "// 'admin' to only allow admins to export\n";
-	$config .= "// 'none' to block exports completely\n";
-	$config .= "// allow_exports default value = all\n";
-	$config .= "\$allow_exports = 'all';\n\n";
-
- 	$config .= "// Files with one of these extensions will have '.txt' appended to their filename on upload\n";
-	$config .= "// upload_badext default value = php, php3, php4, php5, pl, cgi, py, asp, cfm, js, vbs, html, htm\n";
- 	$config .= "\$upload_badext = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm');\n\n";
-
- 	$config .= "// This is the full path to the include directory including the trailing slash\n";
-	$config .= "// includeDirectory default value = $root_directory..'include/\n";
- 	$config .= "\$includeDirectory = \$root_directory.'include/';\n\n";
-	
-	$config .= "// list_max_entries_per_page default value = 20\n";
-	$config .= "\$list_max_entries_per_page = '20';\n\n";
-
- 	$config .= "// change this number to whatever you want. This is the number of pages that will appear in the pagination. by Raju \n";
- 	$config .= "\$limitpage_navigation = '9';\n\n";
-	
-	$config .= "// history_max_viewed default value = 5\n";
- 	$config .= "\$history_max_viewed = '5';\n\n";
- 	
- 	$config .= "// Map Sugar language codes to jscalendar language codes\n";
- 	$config .= "// Unimplemented until jscalendar language files are fixed\n";
- 	$config .= "// \$cal_codes = array('en_us'=>'en', 'ja'=>'jp', 'sp_ve'=>'sp', 'it_it'=>'it', 'tw_zh'=>'zh', 'pt_br'=>'pt', 'se'=>'sv', 'cn_zh'=>'zh', 'ge_ge'=>'de', 'ge_ch'=>'de', 'fr'=>'fr');\n\n";
-
-	$config .= "//set default module and action\n";
- 	$config .= "\$default_module = 'Home';\n";
- 	$config .= "\$default_action = 'index';\n\n";
-
- 	$config .= "//set default theme\n";
- 	$config .= "\$default_theme = 'bluelagoon';\n\n";
-
- 	$config .= "// If true, the time to compose each page is placed in the browser.\n";
- 	$config .= "\$calculate_response_time = true;\n";
-
- 	$config .= "// Default Username - The default text that is placed initially in the login form for user name.\n";
- 	$config .= "\$default_user_name = '';\n";
-	
- 	$config .= "// Default Password - The default text that is placed initially in the login form for password.\n";
- 	$config .= "\$default_password = '';\n";
-
- 	$config .= "// Create default user - If true, a user with the default username and password is created.\n";
- 	$config .= "\$create_default_user = false;\n";
- 	$config .= "\$default_user_is_admin = false;\n";
-
- 	$config .= "// disable persistent connections - If your MySQL/PHP configuration does not support persistent connections set this to true to avoid a large performance slowdown\n";
- 	$config .= "\$disable_persistent_connections = false;\n";
- 	$config .= "// Defined languages available.  The key must be the language file prefix.  E.g. 'en_us' is the prefix for every 'en_us.lang.php' file. \n";
- 	
- 	$language_value = "Array('en_us'=>'US English',)";
- 	if(isset($_SESSION['language_keys']) && isset($_SESSION['language_values']))
- 	{
- 	    $language_value = 'Array(';
- 	    $language_keys = explode(',', urldecode($_SESSION['language_keys']));
- 	    $language_values = explode(',', urldecode($_SESSION['language_values']));
- 	    $size = count($language_keys);
- 	    for($i = 0; $i < $size; $i+=1)
- 	    {
- 	        $language_value .= "'$language_keys[$i]'=>'$language_values[$i]',";
- 	    }
- 	    $language_value .= ')';
- 	}
- 	$config .= "\$languages = $language_value;\n";
-	$config .= "// Master currency name\n";
- 	$config .= "\$currency_name = '$currency_name';\n";
- 	$config .= "// Default charset if the language specific character set is not found.\n";
- 	$config .= "\$default_charset = 'ISO-8859-1';\n";
- 	$config .= "// Default language in case all or part of the user's language pack is not available.\n";
- 	$config .= "\$default_language = 'en_us';\n";
- 	$config .= "// Translation String Prefix - This will add the language pack name to every translation string in the display.\n";
- 	$config .= "\$translation_string_prefix = false;\n";
- 	
- 	$config .= "//Option to cache tabs permissions for speed.\n";
- 	$config .= "\$cache_tab_perms = true;\n\n";
- 	
- 	$config .= "//Option to hide empty home blocks if no entries.\n";
- 	$config .= "\$display_empty_home_blocks = false;\n\n";
-
- 	$config .= "// Generating Unique Application Key\n";
- 	$config .= "\$application_unique_key = '".md5($root_directory)."';\n\n";
- 	$config .= "?>";
-		
-			echo "<TEXTAREA class=\"dataInput\" rows=\"15\" cols=\"80\">".$config."</TEXTAREA><br><br>";
-			echo "<P>Did you remember to create the config.inc.php file ?</p>";
-	
-				  
-		}	?>
-				</div></td>
-				</tr>
-				<tr><td align="center"><img id="populating_info" src="include/install/images/loading.gif" style="visibility:hidden;"></td></tr>
-				<tr>
-				<td align=right style="height:60px;">
-				 <form action="install.php" method="post" name="form" id="form">
-				 <!--<form action="install.php" method="post" name="form" id="form"> -->
-				 <input type="hidden" name="file" value="5createTables.php">
-				 <input type="hidden" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" />
-				 <input type="hidden" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" />
-				 <input type="hidden" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" />
-				 <input type="hidden" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" />
-				 <input type="hidden" class="dataInput" name="db_drop_tables" value="<?php if (isset($db_drop_tables)) echo "$db_drop_tables"; ?>" />
-				 <input type="hidden" class="dataInput" name="db_create" value="<?php if (isset($db_create)) echo "$db_create"; ?>" />
-				 <input type="hidden" class="dataInput" name="db_populate" value="<?php if (isset($db_populate)) echo "$db_populate"; ?>" />
-				 <input type="hidden" class="dataInput" name="admin_email" value="<?php if (isset($admin_email)) echo "$admin_email"; ?>" />
-				 <input type="hidden" class="dataInput" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; ?>" />
-				 <input type="hidden" class="dataInput" name="currency_name" value="<?php if (isset($currency_name)) echo "$currency_name"; ?>" />
-				 <input type="hidden" class="dataInput" name="currency_code" value="<?php if (isset($currency_code)) echo "$currency_code"; ?>" />
-				 <input type="hidden" class="dataInput" name="currency_symbol" value="<?php if (isset($currency_symbol)) echo "$currency_symbol"; ?>" />
-				 <input  type="image" name="next" value="Next" id="next_btn" src="include/install/images/cwBtnNext.gif" onClick="window.location=('install.php');createtablejs();" />
-				 </form>
-					
-				</td>
-			</tr>
-
-			</table>
-		</td>
-	</tr>
-	</table>
-	<!-- Master display stops -->
-	<br>
-	</td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-
-		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-
-      	<tr>
-        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
-      	</tr>
-    	</table>	
-	<script>
-	function createtablejs()
-	{
-		document.getElementById('dbcreate_tab').innerHTML = '<div align="left"><b>Database Generation</b></div>';
-		document.getElementById('configfile_tab').className = 'small cwUnSelectedTab';
-		document.getElementById('configfile_tab').innerHTML = '<div align="left">Config File Creation</div>';
-		document.getElementById('dbcreate_tab').className = 'small cwSelectedTab';
-		oImg = document.getElementById('title_img').style.display = 'none';
-		oImg = document.getElementById('title_img1').style.display = 'block';
-		document.getElementById('populating_info').style.visibility='visible';
-		document.getElementById("next_btn").style.display = 'none';
-		window.document.title = 'vtiger CRM 5 - Configuration Wizard - Database Generation ...';
-	}
-	</script>
-</body>
-</html>
+<?php
+
+/*********************************************************************************
+
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+
+ * ("License"); You may not use this file except in compliance with the
+
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+
+ * the specific language governing rights and limitations under the License.
+
+ * The Original Code is:  SugarCRM Open Source
+
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+
+ * All Rights Reserved.
+
+ * Contributor(s): ______________________________________.
+
+ ********************************************************************************/
+
+/*********************************************************************************
+
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/4createConfigFile.php,v 1.26 2005/04/25 05:40:50 samk Exp $
+
+ * Description:  Executes a step in the installation process.
+
+ ********************************************************************************/
+
+
+
+include('vtigerversion.php');
+
+
+session_start();
+
+
+
+// vtiger CRM version number; do not edit!
+
+$vtiger_version = "5.0.2";
+$release_date = "31 October 2006";
+
+
+if (isset($_REQUEST['db_type'])) $db_type = $_REQUEST['db_type'];
+
+if (isset($_REQUEST['db_hostname']))
+{
+	if(strpos($_REQUEST['db_hostname'], ":"))
+	{
+		list($db_hostname,$db_port) = split(":",$_REQUEST['db_hostname']);
+	}	
+	else
+	{
+		$db_hostname = $_REQUEST['db_hostname'];
+		if($db_type == "pgsql")
+		     $db_port = '5432';
+		else
+		     $db_port = '3306';
+	}	
+}
+if (isset($_REQUEST['db_username']))$db_username = $_REQUEST['db_username'];
+
+if (isset($_REQUEST['db_password']))$db_password = $_REQUEST['db_password'];
+
+if (isset($_REQUEST['db_name']))$db_name = $_REQUEST['db_name'];
+
+if (isset($_REQUEST['db_drop_tables'])) $db_drop_tables = $_REQUEST['db_drop_tables'];
+
+if (isset($_REQUEST['db_create'])) $db_create = $_REQUEST['db_create'];
+
+if (isset($_REQUEST['db_populate'])) $db_populate = $_REQUEST['db_populate'];
+
+if (isset($_REQUEST['site_URL'])) $site_URL = $_REQUEST['site_URL'];
+ 
+if (isset($_REQUEST['admin_email'])) $admin_email = $_REQUEST['admin_email'];
+
+if (isset($_REQUEST['admin_password'])) $admin_password = $_REQUEST['admin_password'];
+
+if (isset($_REQUEST['currency_name'])) $currency_name = $_REQUEST['currency_name'];
+
+if (isset($_REQUEST['currency_code'])) $currency_code = $_REQUEST['currency_code'];
+
+if (isset($_REQUEST['currency_symbol'])) $currency_symbol = $_REQUEST['currency_symbol'];
+
+if (isset($_REQUEST['mail_server'])) $mail_server = $_REQUEST['mail_server'];
+
+if (isset($_REQUEST['mail_server_username'])) $mail_server_username = $_REQUEST['mail_server_username'];
+
+if (isset($_REQUEST['mail_server_password'])) $mail_server_password = $_REQUEST['mail_server_password'];
+
+if (isset($_REQUEST['ftpserver'])) $ftpserver = $_REQUEST['ftpserver'];
+
+if (isset($_REQUEST['ftpuser'])) $ftpuser = $_REQUEST['ftpuser'];
+
+if (isset($_REQUEST['ftppassword'])) $ftppassword = $_REQUEST['ftppassword'];
+
+// update default port
+if ($db_port == '')
+{
+	if($db_type == 'mysql')
+	{
+		$db_port = "3306";
+	}
+	elseif($db_type = 'pgsql')
+	{
+		$db_port = "5432";
+	}
+	elseif($db_type = 'oci8')
+	{
+		$db_port = '1521';
+	}
+}
+
+$cache_dir = 'cache/';
+
+
+?>
+	
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<title>vtiger CRM 5 - Configuration Wizard - Config File Creation</title>
+	<link href="include/install/install.css" rel="stylesheet" type="text/css">
+</head>
+
+<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+
+<br><br>
+	<!-- Table for cfgwiz starts -->
+
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
+		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
+
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
+	<tr>
+		<td class="small" bgcolor="#4572BE" align=center>
+			<!-- Master display -->
+			<table border=0 cellspacing=0 cellpadding=0 width=97%>
+			<tr>
+				<td width=20% valign=top>
+
+				<!-- Left side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
+					<tr><td class="small cwSelectedTab" id="configfile_tab" align=right><div align="left"><b>Config File Creation</b></div></td></tr>
+					<tr><td class="small cwUnSelectedTab" id="dbcreate_tab" align=right><div align="left">Database Generation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Finish</div></td></tr>
+					</table>
+					
+				</td>
+				<td width=80% valign=top class="cwContentDisplay" align=left>
+				<table border=0 cellspacing=0 cellpadding=10 width=100%>
+				<tr><td class=small align=left><img id="title_img" src="include/install/images/confWizConfFile.gif" alt="Config File Creation" title="Config File Creation"><img id="title_img1" src="include/install/images/confWizDbGeneration.gif" style="display:none;" alt="Database Generation" title="Database Generation"><br>
+					  <hr noshade size=1></td></tr>
+				<tr>
+					<td align=left class="small" style="padding-left:20px">
+					<?php
+					if (isset($_REQUEST['root_directory']))
+						$root_directory = $_REQUEST['root_directory'];
+		
+					if (is_file('config.inc.php'))
+					    	$is_writable = is_writable('config.inc.php');
+					else
+	      					$is_writable = is_writable('.');
+
+	      				/* open template configuration file read only */
+	      				$templateFilename = 'config.template.php';
+	      				$templateHandle = fopen($templateFilename, "r");
+	      				if($templateHandle) {
+		      				/* open include configuration file write only */
+		      				$includeFilename = 'config.inc.php';
+					      	$includeHandle = fopen($includeFilename, "w");
+		      				if($includeHandle) {
+			      			   while (!feof($templateHandle)) {
+				      			$buffer = fgets($templateHandle);
+
+				     			/* replace _DBC_ variable */
+				      			$buffer = str_replace( "_DBC_SERVER_", $db_hostname, $buffer);
+				      			$buffer = str_replace( "_DBC_PORT_", $db_port, $buffer);
+				      			$buffer = str_replace( "_DBC_USER_", $db_username, $buffer);
+				      			$buffer = str_replace( "_DBC_PASS_", $db_password, $buffer);
+				      			$buffer = str_replace( "_DBC_NAME_", $db_name, $buffer);
+				      			$buffer = str_replace( "_DBC_TYPE_", $db_type, $buffer);
+
+				      			$buffer = str_replace( "_SITE_URL_", $site_URL, $buffer);
+
+				      			/* replace dir variable */
+				      			$buffer = str_replace( "_VT_ROOTDIR_", $root_directory, $buffer);
+				      			$buffer = str_replace( "_VT_CACHEDIR_", $cache_dir, $buffer);
+				      			$buffer = str_replace( "_VT_TMPDIR_", $cache_dir."images/", $buffer);
+				      			$buffer = str_replace( "_VT_UPLOADDIR_", $cache_dir."upload/", $buffer);
+				      			/* replace mail variable */
+				      			$buffer = str_replace( "_MAIL_SERVER_", $mail_server, $buffer);
+				      			$buffer = str_replace( "_MAIL_USERNAME_", $mail_server_username, $buffer);
+						      	$buffer = str_replace( "_MAIL_PASSWORD_", $mail_server_password, $buffer);
+						      	$buffer = str_replace( "_DB_STAT_", "true", $buffer);
+				
+						      	/* replace the application unique key variable */
+				      			$buffer = str_replace( "_MASTER_CURRENCY_", $currency_name, $buffer);
+
+						      	/* replace the application unique key variable */
+					      		$buffer = str_replace( "_VT_APP_UNIQKEY_", md5($root_directory), $buffer);
+	
+					      		fwrite($includeHandle, $buffer);
+					      		}
+
+				      		fclose($includeHandle);
+				      		}
+
+				      	fclose($templateHandle);
+				      	}
+  
+	if ($templateHandle && $includeHandle) {?>
+			<div id="config_info">
+			<p><strong class="big">Successfully created configuration file (config.inc.php) in :</strong><br><br>
+			<font color="green"><b><?php echo $root_directory; ?></b></font><br><br>
+			The installation will take at least 4 minutes. Grab a coffee,sit back and relax...<br>
+			</p>
+			</div>
+			<br>		
+	<?php } 
+	else {?>
+			<div id="config_info"><p><strong class="big"><font color="red">Cannot write configuration file (config.inc.php ) in : </font></strong><br><br>
+			<font color="green"><b><?php echo $root_directory; ?></b></font><br><br>
+			<P>You can continue this installation by manually creating the config.inc.php file and pasting the configuration information below inside.However, you <strong>must</strong> create the configuration file before you continue to the next step.<P><br><br>
+	<?php			
+	$config = "<?php \n";
+ 	$config .= "/*********************************************************************************\n";
+ 	$config .= " * The contents of this file are subject to the SugarCRM Public License Version 1.1.2\n";
+ 	$config .= " * (\"License\"); You may not use this file except in compliance with the \n";
+ 	$config .= " * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL\n";
+ 	$config .= " * Software distributed under the License is distributed on an  \"AS IS\"  basis,\n";
+ 	$config .= " * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for\n";
+ 	$config .= " * the specific language governing rights and limitations under the License.\n";
+ 	$config .= " * The Original Code is:  SugarCRM Open Source\n";
+ 	$config .= " * The Initial Developer of the Original Code is SugarCRM, Inc.\n";
+ 	$config .= " * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;\n";
+ 	$config .= " * All Rights Reserved.\n";
+ 	$config .= " * Contributor(s): ______________________________________.\n";
+ 	$config .= "********************************************************************************/\n\n";
+ 	$config .= "include('vtigerversion.php');\n\n";
+ 	$config .= "// more than 8MB memory needed for graphics\n\n";
+ 	$config .= "// memory limit default value = 16M\n\n";
+ 	$config .= "ini_set('memory_limit','16M');\n\n";
+ 	$config .= "// show or hide world clock, calculator and FCKEditor\n\n";
+ 	$config .= "// world_clock_display default value = true\n";
+ 	$config .= "// calculator_display default value = true\n";
+ 	$config .= "// fckeditor_display default value = true\n\n";
+ 	$config .= "\$WORLD_CLOCK_DISPLAY = 'true';\n";
+ 	$config .= "\$CALCULATOR_DISPLAY = 'true';\n";
+ 	$config .= "\$FCKEDITOR_DISPLAY = 'true';\n\n";
+ 	
+ 	$config .= "//This is the URL for customer portal. (Ex. http://vtiger.com/portal)\n";
+ 	$config .= "\$PORTAL_URL = 'http://yourdomain.com/customerportal';\n\n";
+ 	$config .= "//These two are the HelpDesk support email id and the support name. ";
+ 	$config .= "(Ex. 'support at vtiger.com' and 'vtiger Support')\n";
+ 	$config .= "\$HELPDESK_SUPPORT_EMAIL_ID = 'support at yourdomain.com';\n";
+ 	$config .= "\$HELPDESK_SUPPORT_NAME = 'yourdomain Name';\n\n";
+ 	
+ 	$config .= "/* Database configuration\n";
+ 	$config .= "      db_host_name:     MySQL Database Hostname\n";
+ 	$config .= "      db_user_name:        MySQL Username\n";
+ 	$config .= "      db_password:         MySQL Password\n";
+ 	$config .= "      db_name:             MySQL Database Name\n*/\n";
+ 	$config .= "\$dbconfig['db_server'] =     '".$db_hostname."';\n";
+ 	$config .= "\$dbconfig['db_port'] =     '".$db_port."';\n";
+ 	$config .= "\$dbconfig['db_username'] =     '".$db_username."';\n";
+ 	$config .= "\$dbconfig['db_password'] =         '".$db_password."';\n";
+ 	$config .= "\$dbconfig['db_name'] =             '".$db_name."';\n";
+ 	$config .= "\$dbconfig['db_type'] = '".$db_type."';\n";
+	$config .= "\$dbconfig['db_status'] = 'true';\n";
+
+	$config .= "// TODO: test if port is empty\n";
+	$config .= "// TODO: set db_hostname dependending on db_type\n";
+ 	$config .= "\$dbconfig['db_hostname'] = \$dbconfig['db_server'].\$dbconfig['db_port'];\n\n";
+
+	
+	$config .= "// log_sql default value = false\n";
+	$config .= "\$dbconfig['log_sql'] = false;\n\n";
+	
+	$config .= "// persistent default value = true\n";
+	$config .= "\$dbconfigoption['persistent'] = true;\n\n";
+
+	$config .= "// autofree default value = false\n";
+	$config .= "\$dbconfigoption['autofree'] = false;\n\n";
+	
+	$config .= "// debug default value = 0\n";
+	$config .= "\$dbconfigoption['debug'] = 0;\n\n";
+
+	$config .= "// seqname_format default value = '%s_seq'\n";
+	$config .= "\$dbconfigoption['seqname_format'] = '%s_seq';\n\n";
+
+	$config .= "// portability default value = 0\n";
+	$config .= "\$dbconfigoption['portability'] = 0;\n\n";
+
+	$config .= "// ssl default value = false\n";
+	$config .= "\$dbconfigoption['ssl'] = false;\n\n";
+
+	$config .= "\$host_name = \$dbconfig['db_hostname'];\n\n";
+	
+	$config .= "\$site_URL ='$site_URL';\n\n";
+
+	$config .= "// root directory path\n";
+	$config .= "\$root_directory = '$root_directory';\n\n";
+
+	$config .= "// cache direcory path\n";
+	$config .= "\$cache_dir = '$cache_dir';\n\n";
+
+	$config .= "// tmp_dir default value prepended by cache_dir = images/\n";
+	$config .= "\$tmp_dir = '$cache_dir"."images/';\n\n";
+
+	$config .= "// import_dir default value prepended by cache_dir = import/\n";
+	$config .= "\$tmp_dir = '$cache_dir"."import/';\n\n";
+
+	$config .= "// upload_dir default value prepended by cache_dir = upload/\n";
+	$config .= "\$tmp_dir = '$cache_dir"."upload/';\n\n";
+
+	$config .= "// mail server parameters\n";
+	$config .= "\$mail_server = '$mail_server';\n";
+	$config .= "\$mail_server_username = '$mail_server_username';\n";
+	$config .= "\$mail_server_password = '$mail_server_password';\n\n";
+	
+	$config .= "// maximum file size for uploaded files in bytes also used when uploading import files\n";
+	$config .= "// upload_maxsize default value = 3000000\n";
+	$config .= "\$upload_maxsize = 3000000;\n\n";
+
+	$config .= "// flag to allow export functionality\n";
+	$config .= "// 'all' to allow anyone to use exports \n";
+	$config .= "// 'admin' to only allow admins to export\n";
+	$config .= "// 'none' to block exports completely\n";
+	$config .= "// allow_exports default value = all\n";
+	$config .= "\$allow_exports = 'all';\n\n";
+
+ 	$config .= "// Files with one of these extensions will have '.txt' appended to their filename on upload\n";
+	$config .= "// upload_badext default value = php, php3, php4, php5, pl, cgi, py, asp, cfm, js, vbs, html, htm\n";
+ 	$config .= "\$upload_badext = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm');\n\n";
+
+ 	$config .= "// This is the full path to the include directory including the trailing slash\n";
+	$config .= "// includeDirectory default value = $root_directory..'include/\n";
+ 	$config .= "\$includeDirectory = \$root_directory.'include/';\n\n";
+	
+	$config .= "// list_max_entries_per_page default value = 20\n";
+	$config .= "\$list_max_entries_per_page = '20';\n\n";
+
+ 	$config .= "// change this number to whatever you want. This is the number of pages that will appear in the pagination. by Raju \n";
+ 	$config .= "\$limitpage_navigation = '9';\n\n";
+	
+	$config .= "// history_max_viewed default value = 5\n";
+ 	$config .= "\$history_max_viewed = '5';\n\n";
+ 	
+ 	$config .= "// Map Sugar language codes to jscalendar language codes\n";
+ 	$config .= "// Unimplemented until jscalendar language files are fixed\n";
+ 	$config .= "// \$cal_codes = array('en_us'=>'en', 'ja'=>'jp', 'sp_ve'=>'sp', 'it_it'=>'it', 'tw_zh'=>'zh', 'pt_br'=>'pt', 'se'=>'sv', 'cn_zh'=>'zh', 'ge_ge'=>'de', 'ge_ch'=>'de', 'fr'=>'fr');\n\n";
+
+	$config .= "//set default module and action\n";
+ 	$config .= "\$default_module = 'Home';\n";
+ 	$config .= "\$default_action = 'index';\n\n";
+
+ 	$config .= "//set default theme\n";
+ 	$config .= "\$default_theme = 'bluelagoon';\n\n";
+
+ 	$config .= "// If true, the time to compose each page is placed in the browser.\n";
+ 	$config .= "\$calculate_response_time = true;\n";
+
+ 	$config .= "// Default Username - The default text that is placed initially in the login form for user name.\n";
+ 	$config .= "\$default_user_name = '';\n";
+	
+ 	$config .= "// Default Password - The default text that is placed initially in the login form for password.\n";
+ 	$config .= "\$default_password = '';\n";
+
+ 	$config .= "// Create default user - If true, a user with the default username and password is created.\n";
+ 	$config .= "\$create_default_user = false;\n";
+ 	$config .= "\$default_user_is_admin = false;\n";
+
+ 	$config .= "// disable persistent connections - If your MySQL/PHP configuration does not support persistent connections set this to true to avoid a large performance slowdown\n";
+ 	$config .= "\$disable_persistent_connections = false;\n";
+ 	$config .= "// Defined languages available.  The key must be the language file prefix.  E.g. 'en_us' is the prefix for every 'en_us.lang.php' file. \n";
+ 	
+ 	$language_value = "Array('en_us'=>'US English',)";
+ 	if(isset($_SESSION['language_keys']) && isset($_SESSION['language_values']))
+ 	{
+ 	    $language_value = 'Array(';
+ 	    $language_keys = explode(',', urldecode($_SESSION['language_keys']));
+ 	    $language_values = explode(',', urldecode($_SESSION['language_values']));
+ 	    $size = count($language_keys);
+ 	    for($i = 0; $i < $size; $i+=1)
+ 	    {
+ 	        $language_value .= "'$language_keys[$i]'=>'$language_values[$i]',";
+ 	    }
+ 	    $language_value .= ')';
+ 	}
+ 	$config .= "\$languages = $language_value;\n";
+	$config .= "// Master currency name\n";
+ 	$config .= "\$currency_name = '$currency_name';\n";
+ 	$config .= "// Default charset if the language specific character set is not found.\n";
+ 	$config .= "\$default_charset = 'ISO-8859-1';\n";
+ 	$config .= "// Default language in case all or part of the user's language pack is not available.\n";
+ 	$config .= "\$default_language = 'en_us';\n";
+ 	$config .= "// Translation String Prefix - This will add the language pack name to every translation string in the display.\n";
+ 	$config .= "\$translation_string_prefix = false;\n";
+ 	
+ 	$config .= "//Option to cache tabs permissions for speed.\n";
+ 	$config .= "\$cache_tab_perms = true;\n\n";
+ 	
+ 	$config .= "//Option to hide empty home blocks if no entries.\n";
+ 	$config .= "\$display_empty_home_blocks = false;\n\n";
+
+ 	$config .= "// Generating Unique Application Key\n";
+ 	$config .= "\$application_unique_key = '".md5($root_directory)."';\n\n";
+ 	$config .= "?>";
+		
+			echo "<TEXTAREA class=\"dataInput\" rows=\"15\" cols=\"80\">".$config."</TEXTAREA><br><br>";
+			echo "<P>Did you remember to create the config.inc.php file ?</p>";
+	
+				  
+		}	?>
+				</div></td>
+				</tr>
+				<tr><td align="center"><img id="populating_info" src="include/install/images/loading.gif" style="visibility:hidden;"></td></tr>
+				<tr>
+				<td align=right style="height:60px;">
+				 <form action="install.php" method="post" name="form" id="form">
+				 <!--<form action="install.php" method="post" name="form" id="form"> -->
+				 <input type="hidden" name="file" value="5createTables.php">
+				 <input type="hidden" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" />
+				 <input type="hidden" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" />
+				 <input type="hidden" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" />
+				 <input type="hidden" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" />
+				 <input type="hidden" class="dataInput" name="db_drop_tables" value="<?php if (isset($db_drop_tables)) echo "$db_drop_tables"; ?>" />
+				 <input type="hidden" class="dataInput" name="db_create" value="<?php if (isset($db_create)) echo "$db_create"; ?>" />
+				 <input type="hidden" class="dataInput" name="db_populate" value="<?php if (isset($db_populate)) echo "$db_populate"; ?>" />
+				 <input type="hidden" class="dataInput" name="admin_email" value="<?php if (isset($admin_email)) echo "$admin_email"; ?>" />
+				 <input type="hidden" class="dataInput" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; ?>" />
+				 <input type="hidden" class="dataInput" name="currency_name" value="<?php if (isset($currency_name)) echo "$currency_name"; ?>" />
+				 <input type="hidden" class="dataInput" name="currency_code" value="<?php if (isset($currency_code)) echo "$currency_code"; ?>" />
+				 <input type="hidden" class="dataInput" name="currency_symbol" value="<?php if (isset($currency_symbol)) echo "$currency_symbol"; ?>" />
+				 <input  type="image" name="next" value="Next" id="next_btn" src="include/install/images/cwBtnNext.gif" onClick="window.location=('install.php');createtablejs();" />
+				 </form>
+					
+				</td>
+			</tr>
+
+			</table>
+		</td>
+	</tr>
+	</table>
+	<!-- Master display stops -->
+	<br>
+	</td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+
+		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+
+      	<tr>
+        	<td class=small align=center> <a href="http://www.vtiger.com" target="_blank">www.vtiger.com</a></td>
+      	</tr>
+    	</table>	
+	<script>
+	function createtablejs()
+	{
+		document.getElementById('dbcreate_tab').innerHTML = '<div align="left"><b>Database Generation</b></div>';
+		document.getElementById('configfile_tab').className = 'small cwUnSelectedTab';
+		document.getElementById('configfile_tab').innerHTML = '<div align="left">Config File Creation</div>';
+		document.getElementById('dbcreate_tab').className = 'small cwSelectedTab';
+		oImg = document.getElementById('title_img').style.display = 'none';
+		oImg = document.getElementById('title_img1').style.display = 'block';
+		document.getElementById('populating_info').style.visibility='visible';
+		document.getElementById("next_btn").style.display = 'none';
+		window.document.title = 'vtiger CRM 5 - Configuration Wizard - Database Generation ...';
+	}
+	</script>
+</body>
+</html>

Modified: vtigercrm/branches/5.1_jens/install/5createTables.inc.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/5createTables.inc.php (original)
+++ vtigercrm/branches/5.1_jens/install/5createTables.inc.php Tue Nov 14 03:16:10 2006
@@ -1,304 +1,283 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is: SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
- * Description:  Executes a step in the installation process.
- ********************************************************************************/
-
-$new_tables = 0;
-
-require_once('config.php');
-require_once('include/database/PearDatabase.php');
-require_once('include/logging.php');
-require_once('modules/Leads/Lead.php');
-require_once('modules/Contacts/Contact.php');
-require_once('modules/Accounts/Account.php');
-require_once('modules/Potentials/Opportunity.php');
-require_once('modules/Calendar/Activity.php');
-require_once('modules/Notes/Note.php');
-require_once('modules/Emails/Email.php');
-require_once('modules/Users/User.php');
-require_once('modules/Import/ImportMap.php');
-require_once('modules/Import/UsersLastImport.php');
-require_once('modules/Users/LoginHistory.php');
-require_once('data/Tracker.php');
-require_once('include/utils/utils.php');
-require_once('modules/Users/DefaultDataPopulator.php');
-require_once('modules/Users/CreateUserPrivilegeFile.php');
-
-// load the config_override.php file to provide default user settings
-if (is_file("config_override.php")) {
-	require_once("config_override.php");
-}
-
-$db = new PearDatabase();
-
-$log =& LoggerManager::getLogger('INSTALL');
-
-function eecho($msg = FALSE) {
-	if ($useHtmlEntities) {
-		echo htmlentities(nl2br($msg));
-	}
-	else {
-		echo $msg;
-	}
-}
-
-function create_default_users() {
-        global $log, $db;
-        global $admin_email;
-        global $admin_password;
-        global $create_default_user;
-        global $default_user_name;
-        global $default_password;
-        global $default_user_is_admin;
-
-        // create default admin user
-    	$user = new User();
-        $user->column_fields["last_name"] = 'Administrator';
-        $user->column_fields["user_name"] = 'admin';
-        $user->column_fields["status"] = 'Active';
-        $user->column_fields["is_admin"] = 'on';
-        $user->column_fields["user_password"] = $admin_password;
-        $user->column_fields["tz"] = 'Europe/Berlin';
-        $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
-        $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
-        $user->column_fields["weekstart"] = '1';
-        $user->column_fields["namedays"] = '';
-        $user->column_fields["currency_id"] = 1;
-	$user->column_fields["date_format"] = 'yyyy-mm-dd';
-	$user->column_fields["hour_format"] = 'am/pm';
-	$user->column_fields["start_hour"] = '08:00';
-	$user->column_fields["end_hour"] = '23:00';
-	$user->column_fields["imagename"] = '';
-        $user->column_fields["activity_view"] = 'This Year';	
-	$user->column_fields["lead_view"] = 'Today';
-	$user->column_fields["defhomeview"] = 'home_metrics';
-        //added by philip for default default admin emailid
-	if($admin_email == '')
-	$admin_email ="admin at vtigeruser.com";
-        $user->column_fields["email1"] = $admin_email;
-	//to get the role id for standard_user	
-	$role_query = "select roleid from vtiger_role where rolename='CEO'";
-	$db->checkConnection();
-	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
-	$role_result = $db->query($role_query);
-	$role_id = $db->query_result($role_result,0,"roleid");
-	$user->column_fields["roleid"] = $role_id;
-
-        $user->save("Users");
-
-	//Inserting Entries into vtiger_groups table
-	$result = $db->query("select groupid from vtiger_groups where groupname='Team Selling';");
- 	$group1_id = $db->query_result($result,0,"groupid");
- 	$result = $db->query("select groupid from vtiger_groups where groupname='Marketing Group';");
- 	$group2_id = $db->query_result($result,0,"groupid");
- 	$result = $db->query("select groupid from vtiger_groups where groupname='Support Group';");
- 	$group3_id = $db->query_result($result,0,"groupid");
-
- 	$db->query("insert into vtiger_users2group values ('".$group2_id."',".$user->id.")");
-
-        // we need to change the admin user to a fixed id of 1.
-        //$query = "update vtiger_users set id='1' where user_name='$user->user_name'";
-        //$result = $db->query($query, true, "Error updating admin user ID: ");
-
-        $log->info("Created ".$user->table_name." vtiger_table. for user $user->id");
-
-	//Creating the flat files
-	createUserPrivilegesfile($user->id);
-        createUserSharingPrivilegesfile($user->id);
-
-
-	//Creating the Standard User
-    	$user = new User();
-        $user->column_fields["last_name"] = 'StandardUser';
-        $user->column_fields["user_name"] = 'standarduser';
-        $user->column_fields["is_admin"] = 'off';
-        $user->column_fields["status"] = 'Active';
-        $user->column_fields["user_password"] = 'standarduser';
-        $user->column_fields["tz"] = 'Europe/Berlin';
-        $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
-        $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
-        $user->column_fields["weekstart"] = '1';
-        $user->column_fields["namedays"] = '';
-        $user->column_fields["currency_id"] = 1;
-	$user->column_fields["date_format"] = 'yyyy-mm-dd';
-	$user->column_fields["imagename"] = '';
-        $user->column_fields["activity_view"] = 'This Year';	
-	$user->column_fields["lead_view"] = 'Today';
-	$user->column_fields["defhomeview"] = 'home_metrics';
-        //added by philip for default default admin emailid
-	if($admin_email == '')
-	$std_email ="standarduser at vtigeruser.com";
-        $user->column_fields["email1"] = $std_email;
-	//to get the role id for standard_user	
-	$role_query = "select roleid from vtiger_role where rolename='Vice President'";
-	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
-	$role_result = $db->query($role_query);
-	$role_id = $db->query_result($role_result,0,"roleid");
-	$user->column_fields["roleid"] = $role_id;
-
-    $user->save('Users');
-
-	//Creating the flat vtiger_files
-	createUserPrivilegesfile($user->id);
-        createUserSharingPrivilegesfile($user->id);
-
-	$db->query("insert into vtiger_users2group values ('".$group1_id."',".$user->id.")");
- 	$db->query("insert into vtiger_users2group values ('".$group2_id."',".$user->id.")");
- 	$db->query("insert into vtiger_users2group values ('".$group3_id."',".$user->id.")");
-
-}
-
-//$startTime = microtime();
-$modules = array("DefaultDataPopulator");
-$focus=0;				
-// tables creation
-//eecho("Creating Core tables: ");
-//$adb->setDebug(true);
-$success = $adb->createTables("schema/DatabaseSchema.xml");
-
-//Postgres8 fix - create sequences. 
-//   This should be a part of "createTables" however ...
- if( $adb->dbType == "pgsql" ) {
-     $sequences = array(
- 	"vtiger_leadsource_seq",
- 	"vtiger_accounttype_seq",
- 	"vtiger_industry_seq",
- 	"vtiger_leadstatus_seq",
- 	"vtiger_rating_seq",
- 	"vtiger_licencekeystatus_seq",
- 	"vtiger_opportunity_type_seq",
- 	"vtiger_salutationtype_seq",
- 	"vtiger_sales_stage_seq",
- 	"vtiger_ticketstatus_seq",
- 	"vtiger_ticketpriorities_seq",
- 	"vtiger_ticketseverities_seq",
- 	"vtiger_ticketcategories_seq",
- 	"vtiger_duration_minutes_seq",
- 	"vtiger_eventstatus_seq",
- 	"vtiger_taskstatus_seq",
- 	"vtiger_taskpriority_seq",
- 	"vtiger_manufacturer_seq",
- 	"vtiger_productcategory_seq",
- 	"vtiger_activitytype_seq",
- 	"vtiger_currency_seq",
- 	"vtiger_faqcategories_seq",
- 	"vtiger_usageunit_seq",
- 	"vtiger_glacct_seq",
- 	"vtiger_quotestage_seq",
- 	"vtiger_carrier_seq",
- 	"vtiger_taxclass_seq",
- 	"vtiger_recurringtype_seq",
- 	"vtiger_faqstatus_seq",
- 	"vtiger_invoicestatus_seq",
- 	"vtiger_postatus_seq",
- 	"vtiger_sostatus_seq",
- 	"vtiger_visibility_seq",
- 	"vtiger_campaigntype_seq",
- 	"vtiger_campaignstatus_seq",
- 	"vtiger_expectedresponse_seq",
- 	"vtiger_status_seq",
- 	"vtiger_activity_view_seq",
- 	"vtiger_lead_view_seq",
- 	"vtiger_date_format_seq",
- 	"vtiger_users_seq",
- 	"vtiger_role_seq",
- 	"vtiger_profile_seq",
- 	"vtiger_field_seq",
- 	"vtiger_def_org_share_seq",
- 	"vtiger_datashare_relatedmodules_seq",
- 	"vtiger_relatedlists_seq",
- 	"vtiger_notificationscheduler_seq",
- 	"vtiger_inventorynotification_seq",
- 	"vtiger_currency_info_seq",
- 	"vtiger_emailtemplates_seq",
- 	"vtiger_inventory_tandc_seq",
- 	"vtiger_selectquery_seq",
- 	"vtiger_customview_seq",
- 	"vtiger_crmentity_seq",
- 	"vtiger_seactivityrel_seq",
- 	"vtiger_freetags_seq",
- 	"vtiger_shippingtaxinfo_seq",
- 	"vtiger_inventorytaxinfo_seq"
- 	);
- 
-     foreach ($sequences as $sequence ) {
- 	$log->info( "Creating sequence ".$sequence);
- 	$adb->query( "CREATE SEQUENCE ".$sequence." INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1;");
-     }
- }
-
-
-// TODO HTML
-if($success==0)
-	die("Error: Tables not created.  Table creation failed.\n");
-elseif ($success==1)
-	die("Error: Tables partially created.  Table creation failed.\n");
-	//eecho("Tables Successfully created.\n");
-
-foreach ($modules as $module ) 
-{
-	$focus = new $module();
-	$focus->create_tables();
-}
-			
-
-// create and populate combo tables
-require_once('include/PopulateComboValues.php');
-$combo = new PopulateComboValues();
-$combo->create_tables();
-
-//Writing tab data in flat file
-create_tab_data_file();
-create_parenttab_data_file();
-
-create_default_users();
-
-// default report population
-require_once('modules/Reports/PopulateReports.php');
-
-// default customview population
-require_once('modules/CustomView/PopulateCustomView.php');
-
-
-// ensure required sequences are created (adodb creates them as needed, but if
-// creation occurs within a transaction we get problems
-$db->getUniqueID("vtiger_crmentity");
-$db->getUniqueID("vtiger_seactivityrel");
-$db->getUniqueID("vtiger_freetags");
-
-//Master currency population
-//Insert into vtiger_currency vtiger_table
-               $db->query("insert into vtiger_currency_info values(".$db->getUniqueID("vtiger_currency_info").",'$currency_name','$currency_code','$currency_symbol',1,'Active','-11')");
-
-// populate the db with seed data
-if ($db_populate) {
-        //eecho ("Populate seed data into $db_name");
-        include("install/populateSeedData.php");
-        //eecho ("...<font color=\"00CC00\">done</font><BR><P>\n");
-}
-
-// populate forums data
-global $log, $db;
-
-//$endTime = microtime();
-//$deltaTime = microtime_diff($startTime, $endTime);
-
-
-// populate calendar data
-
-//eecho ("total time: $deltaTime seconds.\n");
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
+ * Description:  Executes a step in the installation process.
+ ********************************************************************************/
+
+$new_tables = 0;
+
+require_once('config.php');
+require_once('include/database/PearDatabase.php');
+require_once('include/logging.php');
+require_once('modules/Leads/Leads.php');
+require_once('modules/Contacts/Contacts.php');
+require_once('modules/Accounts/Accounts.php');
+require_once('modules/Potentials/Potentials.php');
+require_once('modules/Calendar/Activity.php');
+require_once('modules/Notes/Notes.php');
+require_once('modules/Emails/Emails.php');
+require_once('modules/Users/Users.php');
+require_once('modules/Import/ImportMap.php');
+require_once('modules/Import/UsersLastImport.php');
+require_once('modules/Users/LoginHistory.php');
+require_once('data/Tracker.php');
+require_once('include/utils/utils.php');
+require_once('modules/Users/DefaultDataPopulator.php');
+require_once('modules/Users/CreateUserPrivilegeFile.php');
+
+// load the config_override.php file to provide default user settings
+if (is_file("config_override.php")) {
+	require_once("config_override.php");
+}
+
+$db = new PearDatabase();
+
+$log =& LoggerManager::getLogger('INSTALL');
+
+function eecho($msg = FALSE) {
+	if ($useHtmlEntities) {
+		echo htmlentities(nl2br($msg));
+	}
+	else {
+		echo $msg;
+	}
+}
+
+function create_default_users() {
+        global $log, $db;
+        global $admin_email;
+        global $admin_password;
+        global $create_default_user;
+        global $default_user_name;
+        global $default_password;
+        global $default_user_is_admin;
+
+        // create default admin user
+    	$user = new Users();
+        $user->column_fields["last_name"] = 'Administrator';
+        $user->column_fields["user_name"] = 'admin';
+        $user->column_fields["status"] = 'Active';
+        $user->column_fields["is_admin"] = 'on';
+        $user->column_fields["user_password"] = $admin_password;
+        $user->column_fields["tz"] = 'Europe/Berlin';
+        $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
+        $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
+        $user->column_fields["weekstart"] = '1';
+        $user->column_fields["namedays"] = '';
+        $user->column_fields["currency_id"] = 1;
+	$user->column_fields["date_format"] = 'yyyy-mm-dd';
+	$user->column_fields["hour_format"] = 'am/pm';
+	$user->column_fields["start_hour"] = '08:00';
+	$user->column_fields["end_hour"] = '23:00';
+	$user->column_fields["imagename"] = '';
+        $user->column_fields["activity_view"] = 'This Year';	
+	$user->column_fields["lead_view"] = 'Today';
+	$user->column_fields["defhomeview"] = 'home_metrics';
+        //added by philip for default default admin emailid
+	if($admin_email == '')
+	$admin_email ="admin at vtigeruser.com";
+        $user->column_fields["email1"] = $admin_email;
+	//to get the role id for standard_user	
+	$role_query = "select roleid from vtiger_role where rolename='CEO'";
+	$db->checkConnection();
+	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
+	$role_result = $db->query($role_query);
+	$role_id = $db->query_result($role_result,0,"roleid");
+	$user->column_fields["roleid"] = $role_id;
+	$user->column_fields["assigned_org"] = array( "0" => "vtiger");
+	$user->column_fields["primray_org"] = "vtiger";
+
+        $user->save("Users");
+
+        // we need to change the admin user to a fixed id of 1.
+        //$query = "update vtiger_users set id='1' where user_name='$user->user_name'";
+        //$result = $db->query($query, true, "Error updating admin user ID: ");
+
+        $log->info("Created ".$user->table_name." vtiger_table. for user $user->id");
+
+	//Creating the flat files
+	createUserPrivilegesfile($user->id);
+        createUserSharingPrivilegesfile($user->id);
+
+
+	//Creating the Standard User
+    	$user = new Users();
+        $user->column_fields["last_name"] = 'StandardUser';
+        $user->column_fields["user_name"] = 'standarduser';
+        $user->column_fields["is_admin"] = 'off';
+        $user->column_fields["status"] = 'Active';
+        $user->column_fields["user_password"] = 'standarduser';
+        $user->column_fields["tz"] = 'Europe/Berlin';
+        $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
+        $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
+        $user->column_fields["weekstart"] = '1';
+        $user->column_fields["namedays"] = '';
+        $user->column_fields["currency_id"] = 1;
+	$user->column_fields["date_format"] = 'yyyy-mm-dd';
+	$user->column_fields["imagename"] = '';
+        $user->column_fields["activity_view"] = 'This Year';	
+	$user->column_fields["lead_view"] = 'Today';
+	$user->column_fields["defhomeview"] = 'home_metrics';
+        //added by philip for default default admin emailid
+	if($admin_email == '')
+	$std_email ="standarduser at vtigeruser.com";
+        $user->column_fields["email1"] = $std_email;
+	//to get the role id for standard_user	
+	$role_query = "select roleid from vtiger_role where rolename='Vice President'";
+	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
+	$role_result = $db->query($role_query);
+	$role_id = $db->query_result($role_result,0,"roleid");
+	$user->column_fields["roleid"] = $role_id;
+	$user->column_fields["assigned_org"] = array( "0" => "vtiger");
+	$user->column_fields["primray_org"] = "vtiger";
+
+	$user->save('Users');
+
+	//Creating the flat vtiger_files
+	createUserPrivilegesfile($user->id);
+        createUserSharingPrivilegesfile($user->id);
+
+	//Inserting into vtiger_groups table
+	$db->startTransaction();
+	$result = $db->query("select groupid from vtiger_groups where groupname='Team Selling';");
+	$group1_id = $db->query_result($result,0,"groupid");
+	$result = $db->query("select groupid from vtiger_groups where groupname='Marketing Group';");
+	$group2_id = $db->query_result($result,0,"groupid");
+	$result = $db->query("select groupid from vtiger_groups where groupname='Support Group';");
+	$group3_id = $db->query_result($result,0,"groupid");
+
+	$db->query("insert into vtiger_users2group values ('".$group1_id."',2)");
+	$db->query("insert into vtiger_users2group values ('".$group2_id."',1)");
+	$db->query("insert into vtiger_users2group values ('".$group2_id."',2)");
+	$db->query("insert into vtiger_users2group values ('".$group3_id."',2)");
+	$db->completeTransaction();
+}
+
+//$startTime = microtime();
+$modules = array("DefaultDataPopulator");
+$focus=0;				
+// tables creation
+//eecho("Creating Core tables: ");
+//$adb->setDebug(true);
+$success = $adb->createTables("schema/DatabaseSchema.xml");
+
+//Postgres8 fix - create sequences. 
+ if( $adb->dbType == "pgsql" ) {
+     //  Create required functions
+     $adb->query( 'CREATE LANGUAGE plperl');
+     $adb->query( 'CREATE OR REPLACE FUNCTION concat(varchar,varchar)  RETURNS varchar AS $$
+		      my $s = "";
+		      foreach my $t (@_) { $s .= $t; }
+		      return $s;
+		   $$ LANGUAGE plperl');
+     $adb->query( 'CREATE OR REPLACE FUNCTION concat(varchar,varchar,varchar)  RETURNS varchar AS $$
+		      my $s = "";
+		      foreach my $t (@_) { $s .= $t; }
+		      return $s;
+		   $$ LANGUAGE plperl');
+     $adb->query( 'CREATE OR REPLACE FUNCTION concat(varchar,varchar,varchar,varchar)  RETURNS varchar AS $$
+		      my $s = "";
+		      foreach my $t (@_) { $s .= $t; }
+		      return $s;
+		   $$ LANGUAGE plperl');
+
+     //  Create sequences currently not implemented in the database schema
+     $sequences = array(
+	"vtiger_role_roleid_seq",
+	"vtiger_audit_trial_auditid_seq",
+	"vtiger_datashare_relatedmodules_datashare_relatedmodule_id_seq",
+	"vtiger_relatedlists_relation_id_seq",
+	"vtiger_inventory_tandc_id_seq",
+	"vtiger_customview_cvid_seq",
+	"vtiger_crmentity_crmid_seq",
+	"vtiger_seactivityrel_crmid_seq",
+	"vtiger_selectquery_queryid_seq",
+	"vtiger_systems_id_seq",
+	"vtiger_freetags_id_seq",
+	"vtiger_inventorytaxinfo_taxid_seq",
+	"vtiger_shippingtaxinfo_taxid_seq",
+	"vtiger_groups_groupid_seq"
+    );
+ 
+     foreach ($sequences as $sequence ) {
+ 	$log->info( "Creating sequence ".$sequence);
+ 	$adb->query( "CREATE SEQUENCE ".$sequence." INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1;");
+     }
+ }
+
+
+// TODO HTML
+if($success==0)
+	die("Error: Tables not created.  Table creation failed.\n");
+elseif ($success==1)
+	die("Error: Tables partially created.  Table creation failed.\n");
+	//eecho("Tables Successfully created.\n");
+
+// Populate default data
+foreach ($modules as $module ) 
+{
+	$focus = new $module();
+	$focus->create_tables();
+}
+			
+
+// create and populate combo tables
+require_once('include/PopulateComboValues.php');
+$combo = new PopulateComboValues();
+$combo->create_tables();
+
+//Writing tab data in flat file
+create_tab_data_file();
+create_parenttab_data_file();
+
+// Create the default users
+create_default_users();
+
+// default report population
+require_once('modules/Reports/PopulateReports.php');
+
+// default customview population
+require_once('modules/CustomView/PopulateCustomView.php');
+
+
+// ensure required sequences are created (adodb creates them as needed, but if
+// creation occurs within a transaction we get problems
+$db->getUniqueID("vtiger_crmentity");
+$db->getUniqueID("vtiger_seactivityrel");
+$db->getUniqueID("vtiger_freetags");
+
+//Master currency population
+//Insert into vtiger_currency vtiger_table
+               $db->query("insert into vtiger_currency_info values(".$db->getUniqueID("vtiger_currency_info").",'$currency_name','$currency_code','$currency_symbol',1,'Active','-11')");
+
+// populate the db with seed data
+if ($db_populate) {
+        //eecho ("Populate seed data into $db_name");
+        include("install/populateSeedData.php");
+        //eecho ("...<font color=\"00CC00\">done</font><BR><P>\n");
+}
+
+// populate forums data
+global $log, $db;
+
+//$endTime = microtime();
+//$deltaTime = microtime_diff($startTime, $endTime);
+
+
+// populate calendar data
+
+//eecho ("total time: $deltaTime seconds.\n");
+?>

Modified: vtigercrm/branches/5.1_jens/install/5createTables.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/5createTables.php (original)
+++ vtigercrm/branches/5.1_jens/install/5createTables.php Tue Nov 14 03:16:10 2006
@@ -1,179 +1,179 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is: SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
- * Description:  Executes a step in the installation process.
- ********************************************************************************/
-set_time_limit(600);
-
-if (isset($_REQUEST['db_name'])) $db_name  				= $_REQUEST['db_name'];
-if (isset($_REQUEST['db_drop_tables'])) $db_drop_tables 	= $_REQUEST['db_drop_tables'];
-if (isset($_REQUEST['db_create'])) $db_create 			= $_REQUEST['db_create'];
-if (isset($_REQUEST['db_populate'])) $db_populate		= $_REQUEST['db_populate'];
-if (isset($_REQUEST['admin_email'])) $admin_email		= $_REQUEST['admin_email'];
-if (isset($_REQUEST['admin_password'])) $admin_password	= $_REQUEST['admin_password'];
-if (isset($_REQUEST['currency_name'])) $currency_name	= $_REQUEST['currency_name'];
-if (isset($_REQUEST['currency_code'])) $currency_code	= $_REQUEST['currency_code'];
-if (isset($_REQUEST['currency_symbol'])) $currency_symbol	= $_REQUEST['currency_symbol'];
-
-?>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>vtiger CRM 5 - Configuration Wizard - Finish</title>
-
-
-<link href="include/install/install.css" rel="stylesheet" type="text/css">
-</head>
-
-<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
-
-	<br><br><br>
-	<!-- Table for cfgwiz starts -->
-
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
-		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
-
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
-	<tr>
-		<td class="small" bgcolor="#4572BE" align=center>
-			<!-- Master display -->
-			<table border=0 cellspacing=0 cellpadding=0 width=97%>
-			<tr>
-				<td width=20% valign=top>
-
-				<!-- Left side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
-					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
-					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>Finish</b></div></td></tr>
-					</table>
-					
-				</td>
-				<td width=80% valign=top class="cwContentDisplay" align=left>
-				<!-- Right side tabs -->
-					<table border=0 cellspacing=0 cellpadding=10 width=100%>
-					<tr><td class=small align=left><img src="include/install/images/confWizFinish.gif" alt="Configuration Completed" title="Configuration Completed"><br>
-					  <hr noshade size=1></td></tr>
-
-					<tr>
-					<td align=center class="small" style="height:250px;"> 
-
-<?php
-
-	// Output html instead of plain text for the web
-	$useHtmlEntities = true;
-
-	require_once('install/5createTables.inc.php');
-
-	
-//populating forums data
-
-//this is to rename the installation file and folder so that no one destroys the setup
-$renamefile = uniqid(rand(), true);
-
-//@rename("install.php", $renamefile."install.php.txt");
-if(!rename("install.php", $renamefile."install.php.txt"))
-{
-	if (copy ("install.php", $renamefile."install.php.txt"))
-       	{
-        	 unlink($renamefile."install.php.txt");
-     	}
-}
-
-//@rename("install/", $renamefile."install/");
-if(!rename("install/", $renamefile."install/"))
-{
-	if (copy ("install/", $renamefile."install/"))
-       	{
-        	 unlink($renamefile."install/");
-     	}
-}
-//populate Calendar data
-
-
-?>
-		<table borde=0 cellspacing=0 cellpadding=5 align="center" width=75% style="background-color:#E1E1FD;border:1px dashed #111111;">
-		<tr>
-			<td align=center class=small>
-			<b>vtigercrm-5.0.0 is all set to go!</b>
-			<hr noshade size=1>
-			<div style="width:100%;padding:10px; "align=left>
-			<ul>
-			<li>Your install.php file has been renamed to <?echo $renamefile;?>install.php.txt.
-			<li>Your install folder too has been renamed to <?echo $renamefile;?>install/.  
-			<li>Please log in using the "admin" user name and the password you entered in step 2.
-			</ul>
-			</div>
-
-			</td>
-		</tr>
-		</table>
-		<br>	
-		<table border=0 cellspacing=0 cellpadding=10 width=100%>
-		<tr><td colspan=2 align="center">
-				 <form action="index.php" method="post" name="form" id="form">
-				 <input type="hidden" name="default_user_name" value="admin">
-			 	 <input  type="image" src="include/install/images/cwBtnFinish.gif" name="next" title="Finish" value="Finish" />
-				 </form>
-		</td></tr>
-		</table>		
-		</td>
-
-		</tr>
-		</table>
-		<!-- Master display stops -->
-		
-	</td>
-	</tr>
-	</table>
-	</td>
-	</tr>
-	</table>
-
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-
-		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
-	</tr>
-	</table>
-	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-	<tr>
-		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
-	</tr>
-	</table>
-    <table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
-
-      <tr>
-        <td class=small align=center> <a href="#">www.vtiger.com</a></td>
-      </tr>
-    </table>
-</body>
-</html>	
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
+ * Description:  Executes a step in the installation process.
+ ********************************************************************************/
+set_time_limit(600);
+
+if (isset($_REQUEST['db_name'])) $db_name  				= $_REQUEST['db_name'];
+if (isset($_REQUEST['db_drop_tables'])) $db_drop_tables 	= $_REQUEST['db_drop_tables'];
+if (isset($_REQUEST['db_create'])) $db_create 			= $_REQUEST['db_create'];
+if (isset($_REQUEST['db_populate'])) $db_populate		= $_REQUEST['db_populate'];
+if (isset($_REQUEST['admin_email'])) $admin_email		= $_REQUEST['admin_email'];
+if (isset($_REQUEST['admin_password'])) $admin_password	= $_REQUEST['admin_password'];
+if (isset($_REQUEST['currency_name'])) $currency_name	= $_REQUEST['currency_name'];
+if (isset($_REQUEST['currency_code'])) $currency_code	= $_REQUEST['currency_code'];
+if (isset($_REQUEST['currency_symbol'])) $currency_symbol	= $_REQUEST['currency_symbol'];
+
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>vtiger CRM 5 - Configuration Wizard - Finish</title>
+
+
+<link href="include/install/install.css" rel="stylesheet" type="text/css">
+</head>
+
+<body class="small cwPageBg" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+
+	<br><br><br>
+	<!-- Table for cfgwiz starts -->
+
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td class="cwHeadBg" align=left><img src="include/install/images/configwizard.gif" alt="Configuration Wizard" hspace="20" title="Configuration Wizard"></td>
+		<td class="cwHeadBg" align=right><img src="include/install/images/vtigercrm5.gif" alt="vtiger CRM 5" title="vtiger CRM 5"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td background="include/install/images/topInnerShadow.gif" align=left><img src="include/install/images/topInnerShadow.gif" ></td>
+
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=10 width=80% align=center>
+	<tr>
+		<td class="small" bgcolor="#4572BE" align=center>
+			<!-- Master display -->
+			<table border=0 cellspacing=0 cellpadding=0 width=97%>
+			<tr>
+				<td width=20% valign=top>
+
+				<!-- Left side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Welcome</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Installation Check</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">System Configuration</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Confirm Settings</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Config File Creation</div></td></tr>
+					<tr><td class="small cwUnSelectedTab" align=right><div align="left">Database Generation</div></td></tr>
+					<tr><td class="small cwSelectedTab" align=right><div align="left"><b>Finish</b></div></td></tr>
+					</table>
+					
+				</td>
+				<td width=80% valign=top class="cwContentDisplay" align=left>
+				<!-- Right side tabs -->
+					<table border=0 cellspacing=0 cellpadding=10 width=100%>
+					<tr><td class=small align=left><img src="include/install/images/confWizFinish.gif" alt="Configuration Completed" title="Configuration Completed"><br>
+					  <hr noshade size=1></td></tr>
+
+					<tr>
+					<td align=center class="small" style="height:250px;"> 
+
+<?php
+
+	// Output html instead of plain text for the web
+	$useHtmlEntities = true;
+
+	require_once('install/5createTables.inc.php');
+
+	
+//populating forums data
+
+//this is to rename the installation file and folder so that no one destroys the setup
+$renamefile = uniqid(rand(), true);
+
+//@rename("install.php", $renamefile."install.php.txt");
+if(!rename("install.php", $renamefile."install.php.txt"))
+{
+	if (copy ("install.php", $renamefile."install.php.txt"))
+       	{
+        	 unlink($renamefile."install.php.txt");
+     	}
+}
+
+//@rename("install/", $renamefile."install/");
+if(!rename("install/", $renamefile."install/"))
+{
+	if (copy ("install/", $renamefile."install/"))
+       	{
+        	 unlink($renamefile."install/");
+     	}
+}
+//populate Calendar data
+
+
+?>
+		<table border=0 cellspacing=0 cellpadding=5 align="center" width=75% style="background-color:#E1E1FD;border:1px dashed #111111;">
+		<tr>
+			<td align=center class=small>
+			<b>vtigercrm-5.0.2 is all set to go!</b>
+			<hr noshade size=1>
+			<div style="width:100%;padding:10px; "align=left>
+			<ul>
+			<li>Your install.php file has been renamed to <?echo $renamefile;?>install.php.txt.
+			<li>Your install folder too has been renamed to <?echo $renamefile;?>install/.  
+			<li>Please log in using the "admin" user name and the password you entered in step 2.
+			</ul>
+			</div>
+
+			</td>
+		</tr>
+		</table>
+		<br>	
+		<table border=0 cellspacing=0 cellpadding=10 width=100%>
+		<tr><td colspan=2 align="center">
+				 <form action="index.php" method="post" name="form" id="form">
+				 <input type="hidden" name="default_user_name" value="admin">
+			 	 <input  type="image" src="include/install/images/cwBtnFinish.gif" name="next" title="Finish" value="Finish" />
+				 </form>
+		</td></tr>
+		</table>		
+		</td>
+
+		</tr>
+		</table>
+		<!-- Master display stops -->
+		
+	</td>
+	</tr>
+	</table>
+	</td>
+	</tr>
+	</table>
+
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+
+		<td background="include/install/images/bottomGradient.gif"><img src="include/install/images/bottomGradient.gif"></td>
+	</tr>
+	</table>
+	<table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+	<tr>
+		<td align=center><img src="include/install/images/bottomShadow.jpg"></td>
+	</tr>
+	</table>
+    <table border=0 cellspacing=0 cellpadding=0 width=80% align=center>
+
+      <tr>
+        <td class=small align=center> <a href="#">www.vtiger.com</a></td>
+      </tr>
+    </table>
+</body>
+</html>	

Modified: vtigercrm/branches/5.1_jens/install/populateSeedData.php
==============================================================================
--- vtigercrm/branches/5.1_jens/install/populateSeedData.php (original)
+++ vtigercrm/branches/5.1_jens/install/populateSeedData.php Tue Nov 14 03:16:10 2006
@@ -1,1171 +1,1171 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the 
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/populateSeedData.php,v 1.17 2005/03/25 20:13:52 simian Exp $
- * Description:  Executes a step in the installation process.
- ********************************************************************************/
-
-require_once('config.php');
-
-require_once('modules/Leads/Lead.php');
-require_once('modules/Contacts/contactSeedData.php');
-require_once('modules/Contacts/Contact.php');
-require_once('modules/Accounts/Account.php');
-require_once('modules/Campaigns/Campaign.php');
-require_once('modules/Potentials/Opportunity.php');
-require_once('modules/Calendar/Activity.php');
-require_once('include/database/PearDatabase.php');
-require_once('include/utils/utils.php');
-require_once('include/language/en_us.lang.php');
-require_once('include/ComboStrings.php');
-require_once('include/ComboUtil.php');
-require_once('modules/Products/Product.php');
-require_once('modules/PriceBooks/PriceBook.php');
-require_once('modules/Vendors/Vendor.php');
-require_once('modules/Faq/Faq.php');
-require_once('modules/HelpDesk/HelpDesk.php');
-require_once('modules/Notes/Note.php');
-require_once('modules/Quotes/Quote.php');
-require_once('modules/SalesOrder/SalesOrder.php');
-require_once('modules/PurchaseOrder/PurchaseOrder.php');
-require_once('modules/Invoice/Invoice.php');
-require_once('modules/Emails/Email.php');
-require_once('include/utils/InventoryUtils.php'); //Included to save inventory related products in demo data
-
-global $first_name_array;
-global $first_name_count;
-global $last_name_array;
-global $last_name_count;
-global $company_name_array;
-global $company_name_count;
-global $street_address_array;
-global $street_address_count;
-global $city_array;
-global $city_array_count;
-global $campaign_name_array,$campaign_type_array,$campaign_status_array;
-global $adb;
- $db = new PearDatabase();
-
-function add_digits($quantity, &$string, $min = 0, $max = 9)
-{
-	for($i=0; $i < $quantity; $i++)
-	{
-		$string .= rand($min,$max);
-	}
-}
-
-function create_phone_number()
-{
-	$phone = "(";
-$phone = $phone; // This line is useless, but gets around a code analyzer warning.  Bug submitted 4/28/04
-	add_digits(3, $phone);
-	$phone .= ") ";
-	add_digits(3, $phone);
-	$phone .= "-";
-	add_digits(4, $phone);
-	
-	return $phone;
-}
-
-function create_date()
-{
-	$date = "";
-	$date .= "2006";
-	$date .= "-";
-	$date .= rand(1,9);
-	$date .= "-";
-	$date .= rand(1,28);
-	
-	return $date;
-}
-
-//$adb->println("PSD dumping started");
-
-$account_ids = Array();
-$opportunity_ids = Array();
-$vendor_ids = Array();
-$contact_ids = Array();
-$product_ids = Array();
-$pricebook_ids = Array();
-$quote_ids = Array();
-$salesorder_ids = Array();
-$purchaseorder_ids = Array();
-$invoice_ids = Array();
-$email_ids = Array();
-
-// Determine the assigned user for all demo data.  This is the default user if set, or admin
-$assigned_user_name = "admin";
-if(isset($default_user_name) && $default_user_name != '' && isset($create_default_user) && $create_default_user)
-{
-	$assigned_user_name = $default_user_name;
-}
-
-// Look up the user id for the assigned user
-$seed_user = new User();
-
-//$adb->println("PSD assignname=".$assigned_user_name);
-
-$assigned_user_id = $seed_user->retrieve_user_id($assigned_user_name);
-
-global $current_user;
-
-$current_user = new User();
-$result = $current_user->retrieve_entity_info($assigned_user_id,'Users');
-
-$tagkey = 1;
-
-// Get _dom arrays
-$comboFieldNames = Array('leadsource'=>'leadsource_dom'
-		      ,'leadstatus'=>'lead_status_dom'
-		      ,'industry'=>'industry_dom'
-		      ,'rating'=>'rating_dom'
-                      ,'opportunity_type'=>'opportunity_type_dom'
-                      ,'sales_stage'=>'sales_stage_dom');
-$comboFieldArray = getComboArray($comboFieldNames);
-
-//$adb->println("PSD assignid=".$assigned_user_id);
-$adb->println("company_name_array");
-$adb->println($company_name_array);
-
-$cloudtag = Array ('SO_vendtl', 'X-CEED', 'X-CEED', 'vtiger_50usr');
-
-for($i = 0; $i < $company_name_count; $i++)
-{
-	
-	$account_name = $company_name_array[$i];
-
-	// Create new accounts.
-	$account = new Account();
-	$account->column_fields["accountname"] = $account_name;
-	$account->column_fields["phone"] = create_phone_number();
-	$account->column_fields["assigned_user_id"] = $assigned_user_id;
-
-	$whitespace = array(" ", ".", "&", "\/");
-	$website = str_replace($whitespace, "", strtolower($account->column_fields["accountname"]));
-	$account->column_fields["website"] = "www.".$website.".com";
-	
-	$account->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
-	$account->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
-	$account->column_fields["bill_state"] = "CA";
-	$account->column_fields["bill_code"] = rand(10000, 99999);
-	$account->column_fields["bill_country"] = 'USA';	
-
-	$account->column_fields["ship_street"] = $account->column_fields["bill_street"];
-	$account->column_fields["ship_city"] = $account->column_fields["bill_city"];
-	$account->column_fields["ship_state"] = $account->column_fields["bill_state"];
-	$account->column_fields["ship_code"] = $account->column_fields["bill_code"];
-	$account->column_fields["ship_country"] = $account->column_fields["bill_country"];	
-
-//      $key = array_rand($app_list_strings['industry_dom']);
-//      $account->industry = $app_list_strings['industry_dom'][$key];
-	$key = array_rand($comboFieldArray['industry_dom']);
-	$account->column_fields["industry"] = $comboFieldArray['industry_dom'][$key];
-
-	$account->column_fields["account_type"] = "Customer";
-
-	//$account->saveentity("Accounts");
-	$account->save("Accounts");
-	
-	$account_ids[] = $account->id;
-	
-	if ($i > 3)
-	{
-		$freetag = $adb->getUniqueId('vtiger_freetags');
-		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[1]', '$cloudtag[1]')";
-		$res = $adb->query($query);
-
-		$date = $adb->formatDate(date('YmdHis')); 
-		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$account->id.", $date, 'Accounts')";
-		$result = $adb->query($query_tag);
-	}
-
-
-//	$adb->println("PSD Account [".$account->id."] - ".$account_name);
-
-		
-//Create new opportunities
-	$opp = new Potential();
-
-	$opp->column_fields["assigned_user_id"] = $assigned_user_id;
-	$opp->column_fields["potentialname"] = $account_name." - 1000 units";
-	$opp->column_fields["closingdate"] = & create_date();
-
-//      $key = array_rand($app_list_strings['lead_source_dom']);
-//      $opp->lead_source = $app_list_strings['lead_source_dom'][$key];
-	$key = array_rand($comboFieldArray['leadsource_dom']);
-	$opp->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
-
-//      $key = array_rand($app_list_strings['sales_stage_dom']);
-//      $opp->sales_stage = $app_list_strings['sales_stage_dom'][$key];
-	$comboSalesStageArray = Array ("Closed Won");
-	$key = array_rand($comboSalesStageArray);
-	$opp->column_fields["sales_stage"] = $comboSalesStageArray[$key];
-	
-//      $key = array_rand($app_list_strings['opportunity_type_dom']);
-//      $opp->opportunity_type = $app_list_strings['opportunity_type_dom'][$key];
-	$key = array_rand($comboFieldArray['opportunity_type_dom']);
-	$opp->column_fields["opportunity_type"] = $comboFieldArray['opportunity_type_dom'][$key];
-
-	$amount = array("10000", "25000", "50000", "75000"); 
-	$key = array_rand($amount);
-	$opp->column_fields["amount"] = $amount[$key];
-	$opp->column_fields["account_id"] = $account->id;
-
-	//$opp->saveentity("Potentials");
-	$opp->save("Potentials");
-	
-	$opportunity_ids[] = $opp->id;
-
-//	$adb->println("PSD Potential [".$opp->id."] - account[".$account->id."]");
-	
-}
-
-
-for($i=0; $i<10; $i++)
-{
-	$contact = new Contact();
-	$contact->column_fields["firstname"] = ucfirst(strtolower($first_name_array[$i]));
-	$contact->column_fields["lastname"] = ucfirst(strtolower($last_name_array[$i]));
-	$contact->column_fields["assigned_user_id"] = $assigned_user_id;
-	
-	$contact->column_fields["email"] = strtolower($contact->column_fields["firstname"])."_".strtolower($contact->column_fields["lastname"])."@company.com";
-
-	$contact->column_fields["phone"] = create_phone_number();
-	$contact->column_fields["homephone"] = create_phone_number();
-	$contact->column_fields["mobile"] = create_phone_number();
-	
-	// Fill in a bogus address
-	$key = array_rand($street_address_array);
-	$contact->column_fields["mailingstreet"] = $street_address_array[$key];
-	$key = array_rand($city_array);
-	$contact->column_fields["mailingcity"] = $city_array[$key];
-	$contact->column_fields["mailingstate"] = "CA";
-	$contact->column_fields["mailingzip"] = '99999';
-	$contact->column_fields["mailingcountry"] = 'USA';	
-	if ($contact->column_fields["mailingcity"] == "San Mateo") 
-		$contact->column_fields["yahooid"] = "clint_oram";
-	elseif ($contact->column_fields["mailingcity"] == "San Francisco") 
-		$contact->column_fields["yahooid"] = "not_a_real_id";
-
-//      $key = array_rand($app_list_strings['lead_source_dom']);
-//      $contact->lead_source = $app_list_strings['lead_source_dom'][$key];
-	$key = array_rand($comboFieldArray['leadsource_dom']);
-	$contact->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
-
-	$titles = array("President", 
-					"VP Operations", 
-					"VP Sales", 
-					"Director Operations", 
-					"Director Sales", 
-					"Mgr Operations", 
-					"IT Developer", 
-					"");
-	$key = array_rand($titles);
-	$contact->column_fields["title"] = $titles[$key];
-	
-	$account_key = array_rand($account_ids);
-	$contact->column_fields["account_id"] = $account_ids[$account_key];
-
-	//$contact->saveentity("Contacts");
-	$contact->save("Contacts");
-	$contact_ids[] = $contact->id;
-
-	
-	if ($i > 8)
-	{
-		$freetag = $adb->getUniqueId('vtiger_freetags');
-		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[2]', '$cloudtag[2]')";
-		$res1 = $adb->query($query);
-
-		$date = $adb->formatDate(date('YmdHis')); 
-		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$contact->id.", $date, 'Contacts')";
-		$result1 = $adb->query($query_tag);
-	}
-	// This assumes that there will be one opportunity per company in the seed data.
-	$opportunity_key = array_rand($opportunity_ids);
-	//$query = "insert into opportunities_contacts set id='".create_guid()."', contact_id='$contact->id', contact_role='".$app_list_strings['opportunity_relationship_type_default_key']."', opportunity_id='".$opportunity_ids[$opportunity_key]."'";
-	//$db->query($query, true, "unable to create seed links between opportunities and contacts");
-
-	$query = "insert into vtiger_contpotentialrel ( contactid, potentialid ) values (".$contact->id.",".$opportunity_ids[$opportunity_key].")";
-	$db->query($query);
-
-//	$adb->println("PSD Contact [".$contact->id."] - account[".$account_ids[$account_key]."] - potential[".$opportunity_ids[$opportunity_key]."]");
-
-	//Create new tasks
-	/*$task = new Task();
-
-	$key = array_rand($task->default_task_name_values);
-	$task->name = $task->default_task_name_values[$key];
-	$task->date_due = & create_date();
-	$task->time_due = date("H:i:s",time());
-	$task->date_due_flag = 'off';
-	$task->assigned_user_id = $assigned_user_id;
-	
-	$key = array_rand($app_list_strings['task_status_dom']);
-	$task->status = $app_list_strings['task_status_dom'][$key];
-	$task->contact_id = $contact->id;
-	if ($contact->primary_address_city == "San Mateo") {
-		$task->parent_id = $account_ids[$account_key];
-		$task->parent_type = 'Accounts';
-		$task->save();
-	}*/
-
-}
-
-	$company_count=0;
-for($i=0; $i<10; $i++)
-{
-	$lead = new Lead();
-	$lead->column_fields["firstname"] = ucfirst(strtolower($first_name_array[$i]));
-	$lead->column_fields["lastname"] = ucfirst(strtolower($last_name_array[$i]));
-
-	if($i<5)
-       	{
-        	$lead->column_fields["company"] = ucfirst(strtolower($company_name_array[$i]));
-       	}
-       	else
-       	{
-               	$lead->column_fields["company"] = ucfirst(strtolower($company_name_array[$company_count]));
-               	$company_count++;
-       	}
-
-	$lead->column_fields["assigned_user_id"] = $assigned_user_id;
-	
-	$lead->column_fields["email"] = strtolower($lead->column_fields["firstname"])."_".strtolower($lead->column_fields["lastname"])."@company.com";
-	
-	$website = str_replace($whitespace, "", strtolower(ucfirst(strtolower($company_name_array[$i]))));
-        $lead->column_fields["website"] = "www.".$website.".com";
-	
-	$lead->column_fields["phone"] = create_phone_number();
-	$lead->column_fields["mobile"] = create_phone_number();
-	
-	// Fill in a bogus address
-	$key = array_rand($street_address_array);
-	//$lead->address_street = $street_address_array[$key];
-	$lead->column_fields["lane"] = $street_address_array[$key];
-	$key = array_rand($city_array);
-	$lead->column_fields["city"] = $city_array[$key];
-	$lead->column_fields["state"] = "CA";
-	$lead->column_fields["code"] = '99999';
-	$lead->column_fields["country"] = 'USA';	
-	if ($lead->column_fields["city"] == "San Mateo") 
-		$lead->column_fields["yahooid"] = "clint_oram";
-	elseif ($lead->column_fields["city"] == "San Francisco") 
-		$lead->column_fields["yahooid"] = "not_a_real_id";
-
-//      $key = array_rand($app_list_strings['lead_source_dom']);
-//      $lead->lead_source = $app_list_strings['lead_source_dom'][$key];
-	$key = array_rand($comboFieldArray['leadsource_dom']);
-	$lead->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
-
-//      $key = array_rand($app_list_strings['lead_status_dom']);
-//      $lead->lead_status = $app_list_strings['lead_status_dom'][$key];
-	$key = array_rand($comboFieldArray['lead_status_dom']);
-	$lead->column_fields["leadstatus"] = $comboFieldArray['lead_status_dom'][$key];
-
-//      $key = array_rand($app_list_strings['rating_dom']);
-//      $lead->rating = $app_list_strings['rating_dom'][$key];
-	$key = array_rand($comboFieldArray['rating_dom']);
-	$lead->column_fields["rating"] = $comboFieldArray['rating_dom'][$key];	
-
-	$titles = array("President", 
-					"VP Operations", 
-					"VP Sales", 
-					"Director Operations", 
-					"Director Sales", 
-					"Mgr Operations", 
-					"IT Developer", 
-					"");
-	$key = array_rand($titles);
-	$lead->column_fields["designation"] = $titles[$key];
-
-	//$lead->saveentity("Leads");
-	$lead->save("Leads");
-
-//	$adb->println("PSD Lead [".$lead->id."] - name=".$lead->column_fields["lastname"]);
-
-}
-
-// Temp fix since user is not logged in while populating data updating creatorid in crmentity - GS
-
-
-//Populating Vendor Data
-for($i=0; $i<10; $i++)
-{
-	$vendor = new Vendor();
-	$vendor->column_fields["vendorname"] = ucfirst(strtolower($first_name_array[$i]));
-	$vendor->column_fields["phone"] = create_phone_number();
-	$vendor->column_fields["email"] = strtolower($vendor->column_fields["vendorname"])."@company.com";
-	$website = str_replace($whitespace, "", strtolower(ucfirst(strtolower($company_name_array[$i]))));
-        $vendor->column_fields["website"] = "www.".$website.".com";
-
-	$vendor->column_fields["assigned_user_id"] = $assigned_user_id;
-	
-
-	
-	// Fill in a bogus address
-	$vendor->column_fields["street"] = $street_address_array[rand(0,$street_address_count-1)]; 
-	$key = array_rand($city_array);
-	$vendor->column_fields["city"] = $city_array[$key];
-	$vendor->column_fields["state"] = "CA";
-	$vendor->column_fields["postalcode"] = '99999';
-	$vendor->column_fields["country"] = 'USA';	
-
-	$vendor->save("Vendors");
-	$vendor_ids[] = $vendor->id;
-
-
-}
-
-
-//Populating Product Data
-
-$product_name_array= array( "Vtiger Single User Pack", "Vtiger 5 Users Pack", "Vtiger 10 Users Pack",
-        "Vtiger 25 Users Pack", "Vtiger 50 Users Pack", "Double Panel See-thru Clipboard",
-        "abcd1234", "Cd-R CD Recordable", "Sharp - Plain Paper Fax" , "Brother Ink Jet Cartridge"); 
-$product_code_array= array("001","002","003","023","005","sg-106","1324356","sg-108","sg-119","sg-125");
-$subscription_rate=array("149","699","1299","2999","4995");
-//added by jeri to populate product images
-$product_image_array = array("product1.jpeg###","product2.jpeg###product3.jpeg###","product4.jpeg###product5.jpeg###product6
-.jpeg###","product7.jpeg###product8.jpeg###product9.jpeg###product10.jpeg###");
-for($i=0; $i<10; $i++)
-{
-        $product = new Product();
-	if($i>4)
-	{
-		$parent_key = array_rand($opportunity_ids);
-		$product->column_fields["parent_id"]=$opportunity_ids[$parent_key];
-
-		$usageunit	=	"Each";
-		$qty_per_unit	=	1;
-		$qty_in_stock	=	rand(10000, 99999);
-		$category 	= 	"Hardware";		
-		$website 	=	"";
-		$manufacturer	= 	"";
-		$commission_rate=	rand(10,20);
-		$unit_price	=	rand(100,999);
-		$product_image_name = '';
-	}
-	else
-	{
-		$account_key = array_rand($account_ids);
-		$product->column_fields["parent_id"]=$account_ids[$account_key];
-
-		$usageunit	=	"Each";
-		$qty_per_unit	=	1;
-		$qty_in_stock	=	rand(10000, 99999);
-		$category 	= 	"Software";	
-		$website 	=	"www.vtiger.com";
-		$manufacturer	= 	"vtiger";
-		$commission_rate=	rand(1,10);
-		$unit_price	=	$subscription_rate[$i];
-		$product_image_name = $product_image_array[$i];
-	}
-
-        $product->column_fields["productname"] 	= 	$product_name_array[$i];
-        $product->column_fields["productcode"] 	= 	$product_code_array[$i];
-        $product->column_fields["manufacturer"]	= 	$manufacturer;
-
-	$product->column_fields["productcategory"] = 	$category;
-        $product->column_fields["website"] 	=	$website;
-        $product->column_fields["productsheet"] =	"";
-
-	$vendor_key = array_rand($vendor_ids);
-        $product->column_fields["vendor_id"] 	= 	$vendor_ids[$vendor_key];
-	$contact_key = array_rand($contact_ids);
-        $product->column_fields["contact_id"] 	= 	$contact_ids[$contact_key];
-
-        $product->column_fields["start_date"] 	= 	& create_date();
-        $product->column_fields["sales_start_date"] 	= & create_date();
-
-        $product->column_fields["unit_price"] 	= 	$unit_price;
-        $product->column_fields["commissionrate"] = 	$commission_rate;
-        $product->column_fields["taxclass"] 	= 	'SalesTax';
-        $product->column_fields["usageunit"]	= 	$usageunit;
-     	$product->column_fields["qty_per_unit"] = 	$qty_per_unit;
-        $product->column_fields["qtyinstock"] 	= 	$qty_in_stock;
-	$product->column_fields["imagename"] =  $product_image_name;
-
-	$product->save("Products");
-	$product_ids[] = $product ->id;
-}
-
-
-//Populating HelpDesk- FAQ Data
-
-	$status_array=array ("Draft","Reviewed","Published","Draft","Reviewed","Draft","Reviewed","Draft","Reviewed","Draft","Reviewed","Draft");
-	$question_array=array (
-	"How to migrate data from previous versions to the latest version?",
-	"Error message: The file is damaged and could not be repaired.",
-	"A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No when trying to add Email to vitger CRM ",
-	"When trying to merge a template with a contact, First I was asked allow installation of ActiveX control. I accepted. After it appears a message that it will not be installed because it can't verify the publisher. Do you have a workarround for this issue ?",
-	" Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?",
-	"How to migrate data from previous versions to the latest version?",
-	"A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No when trying to add Email to vitger CRM ",
-	" Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?",
-	"Error message: The file is damaged and could not be repaired.",
-	"When trying to merge a template with a contact, First I was asked allow installation of ActiveX control. I accepted. After it appears a message that it will not be installed because it can't verify the publisher. Do you have a workarround for this issue ?",
-	" Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?",
-	"How to migrate data from previous versions to the latest version?",
-	
-	);
-
-
-	$answer_array=array (
-	"Database migration scripts are available to migrate from the following versions:
-
-	1.0 to 2.0
-
-	2.0 to 2.1
-
-	2.1 to 3.0
-
-	3.0 to 3.2
-
-	3.2 to 4.0
-
-	4.0 to 4.0.1
-
-	4.0.1 to 4.2",
-	
-	"The above error message is due to version incompatibility between FPDF and PHP5. Use PHP 4.3.X version","Published",
-	"The above error message is displayed if you have installed the Microsoft(R) Outlook(R) E-mail Security Update. Please refer to the following URL for complete details:
-
-http://support.microsoft.com/default.aspx?scid=kb%3BEN-US%3B263074
-
-If you want to continue working with vtiger Outlook Plug-in, select the Allow access for check box and select the time from drop-down box.",
-	" Since, vtigerCRM & all plugins are open source, it is not signed up with third party vendors and IE will ask to download even though the plugin are not signed.
-
-This message if produced by Microsoft Windows XP. I English Windows XP with the SP2 and the last updates. I told IE to accept installation of the ActiveX, but after it, this message has appeared. Provably there is a place where to tall to WinXP to not validate if the code is signed... but I don\'t know where.
-
-In IE from Tools->Internet Options->Security->Custom Level, there you can see various options for downloading plugins which are not signed and you can adjust according to your need, so relax your security settings for a while and give a try to vtiger Office Plugin.",
-	"Before modifying any templates, please ensure that you don\'t have any documents open and only one instance of word is available in your memory."
-	);
-
-$num_array=array(0,1,2,3,4,6,7,8,9,10,11,12);
-for($i=0;$i<12;$i++)
-{
-
-	$faq = new Faq();
-	
-	$rand=array_rand($num_array);
-	$faq->column_fields["product_id"]	= $product_ids[$i];
-	$faq->column_fields["faqcategories"]	= "General";
-	$faq->column_fields["faqstatus"] 	= $status_array[$i];
-	$faq->column_fields["question"]		= $question_array[$i];
-	$faq->column_fields["faq_answer"]	= $answer_array[$i];
-
-	$faq->save("Faq");
-	$faq_ids[] = $faq ->id;
-}
-
-//Populate Quote Data
-
-$sub_array = array ("Prod_Quote", "Cont_Quote", "SO_Quote", "PO_Quote", "Vendor_Quote");
-$stage_array = array ("Created", "Reviewed", "Delivered", "Accepted" , "Rejected");
-$carrier_array = array ("FedEx", "UPS", "USPS", "DHL", "BlueDart");
-$validtill_array = array ("2006-09-21", "2006-10-29", "2006-12-11", "2006-10-09", "2006-11-18");
-for($i=0;$i<5;$i++)
-{
-	$quote = new Quote();
-	
-	$quote->column_fields["assigned_user_id"] = $assigned_user_id;
-	$account_key = array_rand($account_ids);
-	$quote->column_fields["account_id"] = $account_ids[$account_key];
-	$op_key = array_rand($opportunity_ids);
-	$quote->column_fields["potential_id"] = $opportunity_ids[$op_key];
-	$contact_key = array_rand($contact_ids);
-        $quote->column_fields["contact_id"] = $contact_ids[$contact_key];
-	$rand = array_rand($num_array);
-	$quote->column_fields["subject"] = $sub_array[$i];
-	$quote->column_fields["quotestage"] = $stage_array[$i];	
-	$quote->column_fields["carrier"] = $carrier_array[$i];
-	$quote->column_fields["validtill"] = $validtill_array[$i];
-
-	$quote->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
-	$quote->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
-	$quote->column_fields["bill_state"] = "CA";
-	$quote->column_fields["bill_code"] = rand(10000, 99999);
-	$quote->column_fields["bill_country"] = 'USA';	
-
-	$quote->column_fields["ship_street"] = $account->column_fields["bill_street"];
-	$quote->column_fields["ship_city"] = $account->column_fields["bill_city"];
-	$quote->column_fields["ship_state"] = $account->column_fields["bill_state"];
-	$quote->column_fields["ship_code"] = $account->column_fields["bill_code"];
-	$quote->column_fields["ship_country"] = $account->column_fields["bill_country"];	
-
-	
-	$quote->save("Quotes");
-
-	$quote_ids[] = $quote->id;
-
-	$product_key = array_rand($product_ids); 
-	$productid = $product_ids[$product_key];
-
-	//set the inventory product details in request then just call the saveInventoryProductDetails function 
-	$_REQUEST['totalProductCount']	 = 1;
-
-	$_REQUEST['hdnProductId1'] = $productid;
-	$_REQUEST['qty1'] = $qty = 1;
-	$_REQUEST['listPrice1'] = $listprice = 130;
-	$_REQUEST['comment1'] = "This is test comment for product of Quotes";
-	
-	$_REQUEST['deleted1'] = 0;
-	$_REQUEST['discount_type1'] = 'amount';
-	$_REQUEST['discount_amount1'] = $discount_amount = '20';
-
-	$_REQUEST['taxtype'] = $taxtype = 'individual';
-	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
-	$_REQUEST['discount_type_final'] = 'amount';
-	$_REQUEST['discount_amount_final'] = $discount_amount_final = '10';
-	
-	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
-	$_REQUEST['adjustmenttype'] = '+';
-	$_REQUEST['adjustment'] = $adjustment = '10';
-
-	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
-
-	//Upto this added to set the request values which will be used to save the inventory product details
-
-	//Now call the saveInventoryProductDetails function
-	saveInventoryProductDetails(&$quote, 'Quotes');
-}
-
-//Populate SalesOrder Data
-
-$subj_array = array ("SO_vtiger", "SO_zoho", "SO_vtiger5usrp", "SO_vt100usrpk", "SO_vendtl");
-$status_array = array ("Created",  "Delivered", "Approved" , "Cancelled" , "Created");
-$carrier_array = array ("FedEx", "UPS", "USPS", "DHL", "BlueDart");
-$duedate_array = array ("2006-09-21", "2006-10-29", "2006-12-11", "2006-10-09", "2006-11-18");
-
-for($i=0;$i<5;$i++)
-{
-	$so = new SalesOrder();
-	
-	$so->column_fields["assigned_user_id"] = $assigned_user_id;
-	$account_key = array_rand($account_ids);
-	$so->column_fields["account_id"] = $account_ids[$account_key];
-	$quote_key = array_rand($quote_ids);
-	$so->column_fields["quote_id"] = $quote_ids[$quote_key];
-	$contact_key = array_rand($contact_ids);
-        $so->column_fields["contact_id"] = $contact_ids[$contact_key];
-	$rand = array_rand($num_array);
-	$so->column_fields["subject"] = $subj_array[$i];
-	$so->column_fields["sostatus"] = $status_array[$i];	
-	$so->column_fields["hdnGrandTotal"] = $sototal_array[$i];
-	$so->column_fields["carrier"] = $carrier_array[$i];
-	$so->column_fields["duedate"] = $duedate_array[$i];
-
-	$so->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
-	$so->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
-	$so->column_fields["bill_state"] = "CA";
-	$so->column_fields["bill_code"] = rand(10000, 99999);
-	$so->column_fields["bill_country"] = 'USA';	
-
-	$so->column_fields["ship_street"] = $account->column_fields["bill_street"];
-	$so->column_fields["ship_city"] = $account->column_fields["bill_city"];
-	$so->column_fields["ship_state"] = $account->column_fields["bill_state"];
-	$so->column_fields["ship_code"] = $account->column_fields["bill_code"];
-	$so->column_fields["ship_country"] = $account->column_fields["bill_country"];	
-
-	
-	$so->save("SalesOrder");
-
-	$salesorder_ids[] = $so->id;
-
-	$product_key = array_rand($product_ids); 
-	$productid = $product_ids[$product_key];
-
-	//set the inventory product details in request then just call the saveInventoryProductDetails function 
-	$_REQUEST['totalProductCount']	 = 1;
-
-	$_REQUEST['hdnProductId1'] = $productid;
-	$_REQUEST['qty1'] = $qty = 1;
-	$_REQUEST['listPrice1'] = $listprice = 1230;
-	$_REQUEST['comment1'] = "This is test comment for product of SalesOrder";
-	
-	$_REQUEST['deleted1'] = 0;
-	$_REQUEST['discount_type1'] = 'amount';
-	$_REQUEST['discount_amount1'] = $discount_amount = '200';
-
-	$_REQUEST['taxtype'] = $taxtype = 'individual';
-	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
-	$_REQUEST['discount_type_final'] = 'amount';
-	$_REQUEST['discount_amount_final'] = $discount_amount_final = '100';
-	
-	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
-	$_REQUEST['adjustmenttype'] = '+';
-	$_REQUEST['adjustment'] = $adjustment = '100';
-
-	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
-
-	//Upto this added to set the request values which will be used to save the inventory product details
-
-	//Now call the saveInventoryProductDetails function
-	saveInventoryProductDetails(&$so, 'SalesOrder');
-
-
-}
-
-
-//Populate PurchaseOrder Data
-
-$psubj_array = array ("PO_vtiger", "PO_zoho", "PO_vtiger5usrp", "PO_vt100usrpk", "PO_vendtl");
-$pstatus_array = array ("Created",  "Delivered", "Approved" , "Cancelled", "Recieved Shipment");
-$carrier_array = array ("FedEx", "UPS", "USPS", "DHL", "BlueDart");
-$trkno_array = array ("po1425", "po2587", "po7974", "po7979", "po6411"); 
-$duedate_array = array ("2006-09-21", "2006-10-29", "2006-12-11", "2006-10-09", "2006-11-18");
-
-for($i=0;$i<5;$i++)
-{
-	$po = new Order();
-	
-	$po->column_fields["assigned_user_id"] = $assigned_user_id;
-	$vendor_key = array_rand($vendor_ids);
-	$po->column_fields["vendor_id"] = $vendor_ids[$vendor_key];
-	$contact_key = array_rand($contact_ids);
-        $po->column_fields["contact_id"] = $contact_ids[$contact_key];
-	$rand = array_rand($num_array);
-	$po->column_fields["subject"] = $psubj_array[$i];
-	$po->column_fields["postatus"] = $pstatus_array[$i];	
-	$po->column_fields["carrier"] = $carrier_array[$i];
-	$po->column_fields["tracking_no"] = $trkno_array[$i];
-	$po->column_fields["duedate"] = $duedate_array[$i];
-
-	$po->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
-	$po->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
-	$po->column_fields["bill_state"] = "CA";
-	$po->column_fields["bill_code"] = rand(10000, 99999);
-	$po->column_fields["bill_country"] = 'USA';	
-
-	$po->column_fields["ship_street"] = $account->column_fields["bill_street"];
-	$po->column_fields["ship_city"] = $account->column_fields["bill_city"];
-	$po->column_fields["ship_state"] = $account->column_fields["bill_state"];
-	$po->column_fields["ship_code"] = $account->column_fields["bill_code"];
-	$po->column_fields["ship_country"] = $account->column_fields["bill_country"];	
-		
-	
-	$po->save("PurchaseOrder");
-
-	$purchaseorder_ids[] = $po->id;
-
-	$product_key = array_rand($product_ids); 
-	$productid = $product_ids[$product_key];
-
-	//set the inventory product details in request then just call the saveInventoryProductDetails function 
-	$_REQUEST['totalProductCount']	 = 1;
-
-	$_REQUEST['hdnProductId1'] = $productid;
-	$_REQUEST['qty1'] = $qty = 1;
-	$_REQUEST['listPrice1'] = $listprice = 2200;
-	$_REQUEST['comment1'] = "This is test comment for product of PurchaseOrder";
-	
-	$_REQUEST['deleted1'] = 0;
-	$_REQUEST['discount_type1'] = 'amount';
-	$_REQUEST['discount_amount1'] = $discount_amount = '200';
-
-	$_REQUEST['taxtype'] = $taxtype = 'individual';
-	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
-	$_REQUEST['discount_type_final'] = 'amount';
-	$_REQUEST['discount_amount_final'] = $discount_amount_final = '100';
-	
-	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
-	$_REQUEST['adjustmenttype'] = '+';
-	$_REQUEST['adjustment'] = $adjustment = '100';
-
-	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
-
-	//Upto this added to set the request values which will be used to save the inventory product details
-
-	//Now call the saveInventoryProductDetails function
-	saveInventoryProductDetails(&$po, 'PurchaseOrder');
-
-
-}
-
-//Populate Invoice Data
-
-$isubj_array = array ("vtiger_invoice201", "zoho_inv7841", "vtiger5usrp_invoice71134", "vt100usrpk_inv113", "vendtl_inv214");
-$istatus_array = array ("Created",  "Sent", "Approved" , "Credit Invoice", "Paid");
-$itotal_array = array ("4842.000", "4842.000", "4842.000", "4842.000", "4842.000");
-
-for($i=0;$i<5;$i++)
-{
-	$invoice = new Invoice();
-	
-	$invoice->column_fields["assigned_user_id"] = $assigned_user_id;
-	$account_key = array_rand($account_ids);
-	$invoice->column_fields["account_id"] = $account_ids[$account_key];
-	$so_key = array_rand($salesorder_ids);
-	$invoice->column_fields["salesorder_id"] = $salesorder_ids[$so_key];
-	$contact_key = array_rand($contact_ids);
-        $invoice->column_fields["contactid"] = $contact_ids[$contact_key];
-	$rand = array_rand($num_array);
-	$invoice->column_fields["subject"] = $isubj_array[$i];
-	$invoice->column_fields["invoicestatus"] = $istatus_array[$i];	
-	$invoice->column_fields["hdnGrandTotal"] = $itotal_array[$i];
-
-	$invoice->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
-	$invoice->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
-	$invoice->column_fields["bill_state"] = "CA";
-	$invoice->column_fields["bill_code"] = rand(10000, 99999);
-	$invoice->column_fields["bill_country"] = 'USA';	
-
-	$invoice->column_fields["ship_street"] = $account->column_fields["bill_street"];
-	$invoice->column_fields["ship_city"] = $account->column_fields["bill_city"];
-	$invoice->column_fields["ship_state"] = $account->column_fields["bill_state"];
-	$invoice->column_fields["ship_code"] = $account->column_fields["bill_code"];
-	$invoice->column_fields["ship_country"] = $account->column_fields["bill_country"];	
-	
-	
-	$invoice->save("Invoice");
-
-	$invoice_ids[] = $invoice->id;
-	if ($i > 3)
-	{
-		$freetag = $adb->getUniqueId('vtiger_freetags');
-		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[0]', '$cloudtag[0]')";
-		$res_inv = $adb->query($query);
-
-		$date = $adb->formatDate(date('YmdHis')); 
-		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$invoice->id.", $date, 'Invoice')";
-		$result_inv = $adb->query($query_tag);
-	}
-
-	$product_key = array_rand($product_ids); 
-	$productid = $product_ids[$product_key];
-
-	//set the inventory product details in request then just call the saveInventoryProductDetails function 
-	$_REQUEST['totalProductCount']	 = 1;
-
-	$_REQUEST['hdnProductId1'] = $productid;
-	$_REQUEST['qty1'] = $qty = 1;
-	$_REQUEST['listPrice1'] = $listprice = 4300;
-	$_REQUEST['comment1'] = "This is test comment for product of Invoice";
-	
-	$_REQUEST['deleted1'] = 0;
-	$_REQUEST['discount_type1'] = 'amount';
-	$_REQUEST['discount_amount1'] = $discount_amount = '300';
-
-	$_REQUEST['taxtype'] = $taxtype = 'individual';
-	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
-	$_REQUEST['discount_type_final'] = 'amount';
-	$_REQUEST['discount_amount_final'] = $discount_amount_final = '100';
-	
-	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
-	$_REQUEST['adjustmenttype'] = '+';
-	$_REQUEST['adjustment'] = $adjustment = '100';
-
-	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
-
-	//Upto this added to set the request values which will be used to save the inventory product details
-
-	//Now call the saveInventoryProductDetails function
-	saveInventoryProductDetails(&$invoice, 'Invoice');
-
-}
-
-//Populate RSS Data
-
-
-
-
-//Populate Email Data
-
-$esubj_array =  array ("Vtiger 5 Released", "Try vtigercrm!", "Hi There!!!", "Welcome to Open Source", "Help needed in customization of Vtiger");
-$startdate_array =  array ("2006-1-2","2003-3-4","2003-4-5","2001-2-1","2005-8-8");
-$filename_array = array ("vtiger5alpha.tar.gz", "zohowriter.zip", "hi.doc", "welcome.pps", "sos.doc");
-
-$to_array = array("a at a.com","b at b.com", "tester at testvtiger.com","xanth at yaz.com","violet at bing.com");
-$cc_array = array("andrewa at a.com","casterb at b.com", "indomine at variancevtiger.com","becker at nosbest.com","electra at violet.com");
-$bcc_array = array("nathan at nathantests.com","jeff at karl1.com", "isotope at uranium.com","bunny at bugs.com","explosive at dud.com");
-$from_array = array("harvest at zss.com","rain at sunshine.com", "gloom at rainyday.com");
-$body_array = array("This is a good product! Have a go at it! ","Nice to have you visit us, very nice of you. Stay for sometime and have a look at our product. I am sure you will like it", "This will take some time to fix. Can you provide me more details please?","What a cool tool! I wish I had found it earlier. Oh it has a lot of my friends name in it too! I too can contribute. But how?","Urgent. I need this done last week! Guys, you are the ones I am depending on. Do something!");
-
-for($i=0;$i<5;$i++)
-{
-	$email = new Email();
-
-	$email->column_fields["assigned_user_id"] = $assigned_user_id;
-	
-	$rand = array_rand($num_array);
-	$email->column_fields["subject"] = $esubj_array[$i];
-	$email->column_fields["filename"] = $filename_array[$i];	
-	$email->column_fields["date_start"] = $startdate_array[$i];
-	$email->column_fields["semodule"] = 'Tasks';
-	$email->column_fields["activitytype"] = 'Emails';
-	$email->column_fields["description"] = $body_array[$i];	
-	$email->save("Emails");
-	$email_ids[] = $email->id;
-	
-	$query = "insert into vtiger_emaildetails(emailid,from_email,to_email,cc_email,bcc_email) values (".$email->id.", '".$from_array[$i]."', '".$to_array[$i]."','".$cc_array[$i]."','".$bcc_array[$i] ."')";
-		$res = $adb->query($query);
-}
-
-
-//Populate PriceBook data
-
-$PB_array = array ("Cd-R PB", "Vtiger PB", "Gator PB", "Kyple PB", "Pastor PB", "Zoho PB", "PB_100", "Per_PB", "CST_PB", "GATE_PB", "Chevron_PB", "Pizza_PB");
-$Active_array = array ("0", "1", "1", "0", "1","0", "1", "1", "0", "1","0","1");
-
-//$num_array = array(0,1,2,3,4);
-for($i=0;$i<12;$i++)
-{
-	$pricebook = new PriceBook();
-
-	$rand = array_rand($num_array);
-	$pricebook->column_fields["bookname"]   = $PB_array[$i];
-	$pricebook->column_fields["active"]     = $Active_array[$i];
-
-	$pricebook->save("PriceBooks");
-	$pricebook_ids[] = $pricebook ->id;
-}
-
-
-//Populate Notes Data
-
-$notes_array = array ("Cont_Notes", "Prod_Notes", "Vendor_Notes", "Invoice_Notes", "Task_Notes", "Event_Notes", "Email_Notes");
-
-for($i=0;$i<7;$i++)
-{
-	$notes = new Note();
-
-	$rand = array_rand($num_array);
-	$contact_key = array_rand($contact_ids);
-        $notes->column_fields["contact_id"] 	= 	$contact_ids[$contact_key];
-	$notes->column_fields["notes_title"]		=	$notes_array[$i];
-
-	$notes->save("Notes");
-	$notes_ids[] = $notes ->id;
-	
-	$product_key = array_rand($product_ids);
-        $query = "insert into vtiger_senotesrel (crmid, notesid) values (".$product_ids[$product_key].", ".$notes->id.")";
-	$db->query($query);
-		
-}
-
-
-
-// Populate Ticket data
-
-
-//$severity_array=array("Minor","Major","Critical","");
-$status_array=array("Open","In Progress","Wait For Response","Open","Closed");
-$category_array=array("Big Problem ","Small Problem","Other Problem","Small Problem","Other Problem");
-$ticket_title_array=array("Upload Attachment problem",
-			"Individual Customization -Menu and RSS","Export Output query",
-		"Import Error CSV Leads","How to automatically add a lead from a web form to VTiger");
-
-for($i=0;$i<5;$i++)
-{
-	$helpdesk= new HelpDesk();
-	
-	$rand=array_rand($num_array);
-	$contact_key = array_rand($contact_ids);
-        $helpdesk->column_fields["parent_id"] 	= 	$contact_ids[$contact_key];
-
-	$helpdesk->column_fields["ticketpriorities"]= "Normal";
-	$helpdesk->column_fields["product_id"]	= 	$product_ids[$i];
-
-	$helpdesk->column_fields["ticketseverities"]	= "Minor";
-	$helpdesk->column_fields["ticketstatus"]	= $status_array[$i];
-	$helpdesk->column_fields["ticketcategories"]	= $category_array[$i];
-	//$rand_key = array_rand($s);$contact_key = array_rand($contact_ids);
-        $notes->column_fields["contact_id"] 	= 	$contact_ids[$contact_key];
-	$helpdesk->column_fields["ticket_title"]	= $ticket_title_array[$i];
-        $helpdesk->column_fields["assigned_user_id"] = $assigned_user_id;
-	
-	$helpdesk->save("HelpDesk");
-	$helpdesk_ids[] = $helpdesk->id;
-	
-	if ($i > 3)
-	{
-		$freetag = $adb->getUniqueId('vtiger_freetags');
-		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[3]', '$cloudtag[3]')";
-		$res_tkt = $adb->query($query);
-
-		$date = $adb->formatDate(date('YmdHis')); 
-		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$helpdesk->id.", $date, 'HelpDesk')";
-		$result_tkt = $adb->query($query_tag);
-	}
-
-}
-
-// Populate Activities Data
-$task_array=array("Tele Conference","Call user - John","Send Fax to Mary Smith");
-$event_array=array("","","Call Smith","Team Meeting","Call Richie","Meeting with Don");
-$task_status_array=array("Planned","In Progress","Completed");
-$task_priority_array=array("High","Medium","Low");
-$visibility=array("","","Private","Public","Private","Public");
-
-for($i=0;$i<6;$i++)
-{
-	$event = new Activity();
-	
-	$rand_num=array_rand($num_array);
-
-	$rand_date = & create_date();
-	$en=explode("-",$rand_date);
-	if($en[1]<10)
-		$en[1]="0".$en[1];
-	if($en[2]<10)
-		$en[2]="0".$en[2];
-	$recur_daily_date=date('Y-m-d',mktime(0,0,0,date($en[1]),date($en[2])+5,date($en[0])));
-	$recur_week_date=date('Y-m-d',mktime(0,0,0,date($en[1]),date($en[2])+30,date($en[0])));
-
-
-	$start_time_hr=rand(00,23);
-	$start_time_min=rand(00,59);
-	$end_time_hr=rand(00,23);
-	$end_time_min=rand(00,59);
-	if($start_time_hr<10)
-		$start_time_hr="0".$start_time_hr;
-	if($start_time_min<10)
-		$start_time_min="0".$start_time_min;
-	if($end_time_hr<10)
-		$end_time_hr="0".$end_time_hr;
-	if($end_time_min<10)
-		$end_time_min="0".$end_time_min;
-	$end_time=$end_time_hr.":".$end_time_min;
-	$start_time=$start_time_hr.":".$start_time_min;
-	if($i<2)
-	{
-		$event->column_fields["subject"]	= $task_array[$i];	
-		if($i==1)
-		{
-			$account_key = array_rand($account_ids);
-			$event->column_fields["parent_id"]	= $account_ids[$account_key];;	
-		}
-		$event->column_fields["taskstatus"]	= $task_status_array[$i];	
-		$event->column_fields["taskpriority"]	= $task_priority_array[$i];	
-		$event->column_fields["activitytype"]	= "Task";
-		$event->column_fields["visibility"] = $visibility[$i];	
-				
-	}
-	else
-	{
-		$event->column_fields["subject"]	= $event_array[$i];	
-		$event->column_fields["visibility"] = $visibility[$i];
-		$event->column_fields["duration_hours"]	= rand(0,3);	
-		$event->column_fields["duration_minutes"]= rand(0,59);	
-		$event->column_fields["eventstatus"]	= "Planned";	
-		$event->column_fields["time_end"]     = $end_time;
-	}
-	$event->column_fields["date_start"]	= $rand_date;	
-	$_REQUEST["date_start"] = $rand_date;
-	$event->column_fields["time_start"]	= $start_time;	
-	$event->column_fields["due_date"]	= $rand_date;	
-	$_REQUEST["due_date"] = $rand_date;
-	$contact_key = array_rand($contact_ids);
-        $event->column_fields["contact_id"]	= 	$contact_ids[$contact_key];
-	if($i==4)
-	{
-        	$event->column_fields["recurringtype"] 	= "Daily";
-		$_REQUEST["recurringtype"]  = "Daily";
-		$event->column_fields["activitytype"]	= "Meeting";	
-		$event->column_fields["due_date"]	= $recur_daily_date;	
-	}
-	elseif($i==5)
-	{	
-        	$event->column_fields["recurringtype"] 	= "Weekly";
-		$_REQUEST["recurringtype"]  = "Weekly";
-		$event->column_fields["activitytype"]	= "Meeting";	
-		$event->column_fields["due_date"]	= $recur_week_date;	
-	}
-	elseif($i>1) 
-	{
-		$event->column_fields["activitytype"]	= "Call";	
-	}
-	$event->column_fields["assigned_user_id"] = $assigned_user_id;
-	$event->save("Calendar");
-        $event_ids[] = $event->id;
-
-}
-
-
-$adb->query("update vtiger_crmentity set smcreatorid=".$assigned_user_id);
-
-$expected_revenue = Array("250000","750000","500000");
-$budget_cost = Array("25000","50000","90000");
-$actual_cost = Array("23500","45000","80000");
-$num_sent = Array("2000","2500","3000");
-$clo_date = Array('2003-1-2','2004-2-3','2005-4-12');
-
-$expected_response_count = Array("2500","7500","5000");
-$expected_sales_count = Array("25000","50000","90000");
-$expected_roi = Array("23","45","82");
-
-$actual_response_count = Array("250","750","1500");
-$actual_sales_count = Array("1250","5200","2390");
-$actual_roi = Array("21","14","12");
-
-$sponsor = Array("Finace","Marketing","Sales");
-$targetsize = Array("210000","13390","187424");
-$targetaudience = Array("Managers","CEOs","Rookies");
-
-//$expected_response = Array(null,null,null);
-for($i=0;$i<count($campaign_name_array);$i++)
-{
-	$campaign = new Campaign();
-	$campaign_name = $campaign_name_array[$i];
-	$campaign->column_fields["campaignname"] = $campaign_name;
-	$campaign->column_fields["campaigntype"] = $campaign_type_array[$i];
-	$campaign->column_fields["campaignstatus"] = $campaign_status_array[$i];
-	$campaign->column_fields["numsent"] = $num_sent[$i];
-	$campaign->column_fields["expectedrevenue"] = $expected_revenue[$i];
-	$campaign->column_fields["budgetcost"] = $budget_cost[$i];
-	$campaign->column_fields["actualcost"] = $actual_cost[$i];
-	$campaign->column_fields["closingdate"] = $clo_date[$i];
-	$campaign->column_fields["expectedresponse"] = $expected_response[$i];
-	$campaign->column_fields["assigned_user_id"] = $assigned_user_id;
-	
-	$campaign->column_fields["expectedresponsecount"] = $expected_response_count[$i];
-	$campaign->column_fields["expectedsalescount"] = $expected_sales_count[$i];
-	$campaign->column_fields["expectedroi"] = $expected_roi[$i];
-	$campaign->column_fields["actualresponsecount"] = $actual_response_count[$i];
-	$campaign->column_fields["actualsalescount"] = $actual_sales_count[$i];
-	$campaign->column_fields["actualroi"] = $actual_roi[$i];
-	$campaign->column_fields["sponsor"] = $sponsor[$i];
-	$campaign->column_fields["targetsize"] = $targetsize[$i];
-	$campaign->column_fields["targetaudience"] = $targetaudience[$i];
-
-
-	
-	$campaign->save("Campaigns");
-}
-
-//Populate My Sites Data 
-
-$portalname = array ("Vtiger", "Vtiger Blogs", "Vtiger Forums", "VtigerForge", "Vtiger Docs");
-$portalurl = array ("http://vtiger.com", "http://blogs.vtiger.com", "http://forums.vtiger.com", "http://vtigerforge.com", "http://wiki.vtiger.com");
-
-for($i=0;$i<5;$i++)
-{
-	$portalid = $adb->getUniqueId('vtiger_portal');
-	$portal_qry = "insert into vtiger_portal values (".$portalid.", '".$portalname[$i]."','".$portalurl[$i]."',0)";
-	$result_qry = $adb->query($portal_qry);
-}
-
-//Populate RSS Data
-$rssname = array("vtiger - Forums","vtiger development - Active Tickets");
-$rssurl = array("http://forums.vtiger.com/rss.php?name=forums&file=rss","http://vtiger.fosslabs.com/cgi-bin/trac.cgi/report/1?format=rss&USER=anonymous");
-
-for($i=0;$i<2;$i++)
-{
-	$rssid = $adb->getUniqueId('vtiger_rss');
-	$rss_qry = "insert into vtiger_rss values (".$rssid.", '".$rssurl[$i]."','".$rssname[$i]."',0,0)";
-	$result_qry = $adb->query($rss_qry);
-}
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the 
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/populateSeedData.php,v 1.17 2005/03/25 20:13:52 simian Exp $
+ * Description:  Executes a step in the installation process.
+ ********************************************************************************/
+
+require_once('config.php');
+
+require_once('modules/Leads/Leads.php');
+require_once('modules/Contacts/contactSeedData.php');
+require_once('modules/Contacts/Contacts.php');
+require_once('modules/Accounts/Accounts.php');
+require_once('modules/Campaigns/Campaigns.php');
+require_once('modules/Potentials/Potentials.php');
+require_once('modules/Calendar/Activity.php');
+require_once('include/database/PearDatabase.php');
+require_once('include/utils/utils.php');
+require_once('include/language/en_us.lang.php');
+require_once('include/ComboStrings.php');
+require_once('include/ComboUtil.php');
+require_once('modules/Products/Products.php');
+require_once('modules/PriceBooks/PriceBooks.php');
+require_once('modules/Vendors/Vendors.php');
+require_once('modules/Faq/Faq.php');
+require_once('modules/HelpDesk/HelpDesk.php');
+require_once('modules/Notes/Notes.php');
+require_once('modules/Quotes/Quotes.php');
+require_once('modules/SalesOrder/SalesOrder.php');
+require_once('modules/PurchaseOrder/PurchaseOrder.php');
+require_once('modules/Invoice/Invoice.php');
+require_once('modules/Emails/Emails.php');
+require_once('include/utils/InventoryUtils.php'); //Included to save inventory related products in demo data
+
+global $first_name_array;
+global $first_name_count;
+global $last_name_array;
+global $last_name_count;
+global $company_name_array;
+global $company_name_count;
+global $street_address_array;
+global $street_address_count;
+global $city_array;
+global $city_array_count;
+global $campaign_name_array,$campaign_type_array,$campaign_status_array;
+global $adb;
+ $db = new PearDatabase();
+
+function add_digits($quantity, &$string, $min = 0, $max = 9)
+{
+	for($i=0; $i < $quantity; $i++)
+	{
+		$string .= rand($min,$max);
+	}
+}
+
+function create_phone_number()
+{
+	$phone = "(";
+$phone = $phone; // This line is useless, but gets around a code analyzer warning.  Bug submitted 4/28/04
+	add_digits(3, $phone);
+	$phone .= ") ";
+	add_digits(3, $phone);
+	$phone .= "-";
+	add_digits(4, $phone);
+	
+	return $phone;
+}
+
+function create_date()
+{
+	$date = "";
+	$date .= "2006";
+	$date .= "-";
+	$date .= rand(1,9);
+	$date .= "-";
+	$date .= rand(1,28);
+	
+	return $date;
+}
+
+//$adb->println("PSD dumping started");
+
+$account_ids = Array();
+$opportunity_ids = Array();
+$vendor_ids = Array();
+$contact_ids = Array();
+$product_ids = Array();
+$pricebook_ids = Array();
+$quote_ids = Array();
+$salesorder_ids = Array();
+$purchaseorder_ids = Array();
+$invoice_ids = Array();
+$email_ids = Array();
+
+// Determine the assigned user for all demo data.  This is the default user if set, or admin
+$assigned_user_name = "admin";
+if(isset($default_user_name) && $default_user_name != '' && isset($create_default_user) && $create_default_user)
+{
+	$assigned_user_name = $default_user_name;
+}
+
+// Look up the user id for the assigned user
+$seed_user = new Users();
+
+//$adb->println("PSD assignname=".$assigned_user_name);
+
+$assigned_user_id = $seed_user->retrieve_user_id($assigned_user_name);
+
+global $current_user;
+
+$current_user = new Users();
+$result = $current_user->retrieve_entity_info($assigned_user_id,'Users');
+
+$tagkey = 1;
+
+// Get _dom arrays
+$comboFieldNames = Array('leadsource'=>'leadsource_dom'
+		      ,'leadstatus'=>'lead_status_dom'
+		      ,'industry'=>'industry_dom'
+		      ,'rating'=>'rating_dom'
+                      ,'opportunity_type'=>'opportunity_type_dom'
+                      ,'sales_stage'=>'sales_stage_dom');
+$comboFieldArray = getComboArray($comboFieldNames);
+
+//$adb->println("PSD assignid=".$assigned_user_id);
+$adb->println("company_name_array");
+$adb->println($company_name_array);
+
+$cloudtag = Array ('SO_vendtl', 'X-CEED', 'X-CEED', 'vtiger_50usr');
+
+for($i = 0; $i < $company_name_count; $i++)
+{
+	
+	$account_name = $company_name_array[$i];
+
+	// Create new accounts.
+	$account = new Accounts();
+	$account->column_fields["accountname"] = $account_name;
+	$account->column_fields["phone"] = create_phone_number();
+	$account->column_fields["assigned_user_id"] = $assigned_user_id;
+
+	$whitespace = array(" ", ".", "&", "\/");
+	$website = str_replace($whitespace, "", strtolower($account->column_fields["accountname"]));
+	$account->column_fields["website"] = "www.".$website.".com";
+	
+	$account->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
+	$account->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
+	$account->column_fields["bill_state"] = "CA";
+	$account->column_fields["bill_code"] = rand(10000, 99999);
+	$account->column_fields["bill_country"] = 'USA';	
+
+	$account->column_fields["ship_street"] = $account->column_fields["bill_street"];
+	$account->column_fields["ship_city"] = $account->column_fields["bill_city"];
+	$account->column_fields["ship_state"] = $account->column_fields["bill_state"];
+	$account->column_fields["ship_code"] = $account->column_fields["bill_code"];
+	$account->column_fields["ship_country"] = $account->column_fields["bill_country"];	
+
+//      $key = array_rand($app_list_strings['industry_dom']);
+//      $account->industry = $app_list_strings['industry_dom'][$key];
+	$key = array_rand($comboFieldArray['industry_dom']);
+	$account->column_fields["industry"] = $comboFieldArray['industry_dom'][$key];
+
+	$account->column_fields["account_type"] = "Customer";
+
+	//$account->saveentity("Accounts");
+	$account->save("Accounts");
+	
+	$account_ids[] = $account->id;
+	
+	if ($i > 3)
+	{
+		$freetag = $adb->getUniqueId('vtiger_freetags');
+		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[1]', '$cloudtag[1]')";
+		$res = $adb->query($query);
+
+		$date = $adb->formatDate(date('YmdHis')); 
+		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$account->id.", $date, 'Accounts')";
+		$result = $adb->query($query_tag);
+	}
+
+
+//	$adb->println("PSD Account [".$account->id."] - ".$account_name);
+
+		
+//Create new opportunities
+	$opp = new Potentials();
+
+	$opp->column_fields["assigned_user_id"] = $assigned_user_id;
+	$opp->column_fields["potentialname"] = $account_name." - 1000 units";
+	$opp->column_fields["closingdate"] = & create_date();
+
+//      $key = array_rand($app_list_strings['lead_source_dom']);
+//      $opp->lead_source = $app_list_strings['lead_source_dom'][$key];
+	$key = array_rand($comboFieldArray['leadsource_dom']);
+	$opp->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
+
+//      $key = array_rand($app_list_strings['sales_stage_dom']);
+//      $opp->sales_stage = $app_list_strings['sales_stage_dom'][$key];
+	$comboSalesStageArray = Array ("Closed Won");
+	$key = array_rand($comboSalesStageArray);
+	$opp->column_fields["sales_stage"] = $comboSalesStageArray[$key];
+	
+//      $key = array_rand($app_list_strings['opportunity_type_dom']);
+//      $opp->opportunity_type = $app_list_strings['opportunity_type_dom'][$key];
+	$key = array_rand($comboFieldArray['opportunity_type_dom']);
+	$opp->column_fields["opportunity_type"] = $comboFieldArray['opportunity_type_dom'][$key];
+
+	$amount = array("10000", "25000", "50000", "75000"); 
+	$key = array_rand($amount);
+	$opp->column_fields["amount"] = $amount[$key];
+	$opp->column_fields["account_id"] = $account->id;
+
+	//$opp->saveentity("Potentials");
+	$opp->save("Potentials");
+	
+	$opportunity_ids[] = $opp->id;
+
+//	$adb->println("PSD Potential [".$opp->id."] - account[".$account->id."]");
+	
+}
+
+
+for($i=0; $i<10; $i++)
+{
+	$contact = new Contacts();
+	$contact->column_fields["firstname"] = ucfirst(strtolower($first_name_array[$i]));
+	$contact->column_fields["lastname"] = ucfirst(strtolower($last_name_array[$i]));
+	$contact->column_fields["assigned_user_id"] = $assigned_user_id;
+	
+	$contact->column_fields["email"] = strtolower($contact->column_fields["firstname"])."_".strtolower($contact->column_fields["lastname"])."@company.com";
+
+	$contact->column_fields["phone"] = create_phone_number();
+	$contact->column_fields["homephone"] = create_phone_number();
+	$contact->column_fields["mobile"] = create_phone_number();
+	
+	// Fill in a bogus address
+	$key = array_rand($street_address_array);
+	$contact->column_fields["mailingstreet"] = $street_address_array[$key];
+	$key = array_rand($city_array);
+	$contact->column_fields["mailingcity"] = $city_array[$key];
+	$contact->column_fields["mailingstate"] = "CA";
+	$contact->column_fields["mailingzip"] = '99999';
+	$contact->column_fields["mailingcountry"] = 'USA';	
+	if ($contact->column_fields["mailingcity"] == "San Mateo") 
+		$contact->column_fields["yahooid"] = "clint_oram";
+	elseif ($contact->column_fields["mailingcity"] == "San Francisco") 
+		$contact->column_fields["yahooid"] = "not_a_real_id";
+
+//      $key = array_rand($app_list_strings['lead_source_dom']);
+//      $contact->lead_source = $app_list_strings['lead_source_dom'][$key];
+	$key = array_rand($comboFieldArray['leadsource_dom']);
+	$contact->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
+
+	$titles = array("President", 
+					"VP Operations", 
+					"VP Sales", 
+					"Director Operations", 
+					"Director Sales", 
+					"Mgr Operations", 
+					"IT Developer", 
+					"");
+	$key = array_rand($titles);
+	$contact->column_fields["title"] = $titles[$key];
+	
+	$account_key = array_rand($account_ids);
+	$contact->column_fields["account_id"] = $account_ids[$account_key];
+
+	//$contact->saveentity("Contacts");
+	$contact->save("Contacts");
+	$contact_ids[] = $contact->id;
+
+	
+	if ($i > 8)
+	{
+		$freetag = $adb->getUniqueId('vtiger_freetags');
+		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[2]', '$cloudtag[2]')";
+		$res1 = $adb->query($query);
+
+		$date = $adb->formatDate(date('YmdHis')); 
+		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$contact->id.", $date, 'Contacts')";
+		$result1 = $adb->query($query_tag);
+	}
+	// This assumes that there will be one opportunity per company in the seed data.
+	$opportunity_key = array_rand($opportunity_ids);
+	//$query = "insert into opportunities_contacts set id='".create_guid()."', contact_id='$contact->id', contact_role='".$app_list_strings['opportunity_relationship_type_default_key']."', opportunity_id='".$opportunity_ids[$opportunity_key]."'";
+	//$db->query($query, true, "unable to create seed links between opportunities and contacts");
+
+	$query = "insert into vtiger_contpotentialrel ( contactid, potentialid ) values (".$contact->id.",".$opportunity_ids[$opportunity_key].")";
+	$db->query($query);
+
+//	$adb->println("PSD Contact [".$contact->id."] - account[".$account_ids[$account_key]."] - potential[".$opportunity_ids[$opportunity_key]."]");
+
+	//Create new tasks
+	/*$task = new Task();
+
+	$key = array_rand($task->default_task_name_values);
+	$task->name = $task->default_task_name_values[$key];
+	$task->date_due = & create_date();
+	$task->time_due = date("H:i:s",time());
+	$task->date_due_flag = 'off';
+	$task->assigned_user_id = $assigned_user_id;
+	
+	$key = array_rand($app_list_strings['task_status_dom']);
+	$task->status = $app_list_strings['task_status_dom'][$key];
+	$task->contact_id = $contact->id;
+	if ($contact->primary_address_city == "San Mateo") {
+		$task->parent_id = $account_ids[$account_key];
+		$task->parent_type = 'Accounts';
+		$task->save();
+	}*/
+
+}
+
+	$company_count=0;
+for($i=0; $i<10; $i++)
+{
+	$lead = new Leads();
+	$lead->column_fields["firstname"] = ucfirst(strtolower($first_name_array[$i]));
+	$lead->column_fields["lastname"] = ucfirst(strtolower($last_name_array[$i]));
+
+	if($i<5)
+       	{
+        	$lead->column_fields["company"] = ucfirst(strtolower($company_name_array[$i]));
+       	}
+       	else
+       	{
+               	$lead->column_fields["company"] = ucfirst(strtolower($company_name_array[$company_count]));
+               	$company_count++;
+       	}
+
+	$lead->column_fields["assigned_user_id"] = $assigned_user_id;
+	
+	$lead->column_fields["email"] = strtolower($lead->column_fields["firstname"])."_".strtolower($lead->column_fields["lastname"])."@company.com";
+	
+	$website = str_replace($whitespace, "", strtolower(ucfirst(strtolower($company_name_array[$i]))));
+        $lead->column_fields["website"] = "www.".$website.".com";
+	
+	$lead->column_fields["phone"] = create_phone_number();
+	$lead->column_fields["mobile"] = create_phone_number();
+	
+	// Fill in a bogus address
+	$key = array_rand($street_address_array);
+	//$lead->address_street = $street_address_array[$key];
+	$lead->column_fields["lane"] = $street_address_array[$key];
+	$key = array_rand($city_array);
+	$lead->column_fields["city"] = $city_array[$key];
+	$lead->column_fields["state"] = "CA";
+	$lead->column_fields["code"] = '99999';
+	$lead->column_fields["country"] = 'USA';	
+	if ($lead->column_fields["city"] == "San Mateo") 
+		$lead->column_fields["yahooid"] = "clint_oram";
+	elseif ($lead->column_fields["city"] == "San Francisco") 
+		$lead->column_fields["yahooid"] = "not_a_real_id";
+
+//      $key = array_rand($app_list_strings['lead_source_dom']);
+//      $lead->lead_source = $app_list_strings['lead_source_dom'][$key];
+	$key = array_rand($comboFieldArray['leadsource_dom']);
+	$lead->column_fields["leadsource"] = $comboFieldArray['leadsource_dom'][$key];
+
+//      $key = array_rand($app_list_strings['lead_status_dom']);
+//      $lead->lead_status = $app_list_strings['lead_status_dom'][$key];
+	$key = array_rand($comboFieldArray['lead_status_dom']);
+	$lead->column_fields["leadstatus"] = $comboFieldArray['lead_status_dom'][$key];
+
+//      $key = array_rand($app_list_strings['rating_dom']);
+//      $lead->rating = $app_list_strings['rating_dom'][$key];
+	$key = array_rand($comboFieldArray['rating_dom']);
+	$lead->column_fields["rating"] = $comboFieldArray['rating_dom'][$key];	
+
+	$titles = array("President", 
+					"VP Operations", 
+					"VP Sales", 
+					"Director Operations", 
+					"Director Sales", 
+					"Mgr Operations", 
+					"IT Developer", 
+					"");
+	$key = array_rand($titles);
+	$lead->column_fields["designation"] = $titles[$key];
+
+	//$lead->saveentity("Leads");
+	$lead->save("Leads");
+
+//	$adb->println("PSD Lead [".$lead->id."] - name=".$lead->column_fields["lastname"]);
+
+}
+
+// Temp fix since user is not logged in while populating data updating creatorid in crmentity - GS
+
+
+//Populating Vendor Data
+for($i=0; $i<10; $i++)
+{
+	$vendor = new Vendors();
+	$vendor->column_fields["vendorname"] = ucfirst(strtolower($first_name_array[$i]));
+	$vendor->column_fields["phone"] = create_phone_number();
+	$vendor->column_fields["email"] = strtolower($vendor->column_fields["vendorname"])."@company.com";
+	$website = str_replace($whitespace, "", strtolower(ucfirst(strtolower($company_name_array[$i]))));
+        $vendor->column_fields["website"] = "www.".$website.".com";
+
+	$vendor->column_fields["assigned_user_id"] = $assigned_user_id;
+	
+
+	
+	// Fill in a bogus address
+	$vendor->column_fields["street"] = $street_address_array[rand(0,$street_address_count-1)]; 
+	$key = array_rand($city_array);
+	$vendor->column_fields["city"] = $city_array[$key];
+	$vendor->column_fields["state"] = "CA";
+	$vendor->column_fields["postalcode"] = '99999';
+	$vendor->column_fields["country"] = 'USA';	
+
+	$vendor->save("Vendors");
+	$vendor_ids[] = $vendor->id;
+
+
+}
+
+
+//Populating Product Data
+
+$product_name_array= array( "Vtiger Single User Pack", "Vtiger 5 Users Pack", "Vtiger 10 Users Pack",
+        "Vtiger 25 Users Pack", "Vtiger 50 Users Pack", "Double Panel See-thru Clipboard",
+        "abcd1234", "Cd-R CD Recordable", "Sharp - Plain Paper Fax" , "Brother Ink Jet Cartridge"); 
+$product_code_array= array("001","002","003","023","005","sg-106","1324356","sg-108","sg-119","sg-125");
+$subscription_rate=array("149","699","1299","2999","4995");
+//added by jeri to populate product images
+$product_image_array = array("product1.jpeg###","product2.jpeg###product3.jpeg###","product4.jpeg###product5.jpeg###product6
+.jpeg###","product7.jpeg###product8.jpeg###product9.jpeg###product10.jpeg###");
+for($i=0; $i<10; $i++)
+{
+        $product = new Products();
+	if($i>4)
+	{
+		$parent_key = array_rand($opportunity_ids);
+		$product->column_fields["parent_id"]=$opportunity_ids[$parent_key];
+
+		$usageunit	=	"Each";
+		$qty_per_unit	=	1;
+		$qty_in_stock	=	rand(10000, 99999);
+		$category 	= 	"Hardware";		
+		$website 	=	"";
+		$manufacturer	= 	"";
+		$commission_rate=	rand(10,20);
+		$unit_price	=	rand(100,999);
+		$product_image_name = '';
+	}
+	else
+	{
+		$account_key = array_rand($account_ids);
+		$product->column_fields["parent_id"]=$account_ids[$account_key];
+
+		$usageunit	=	"Each";
+		$qty_per_unit	=	1;
+		$qty_in_stock	=	rand(10000, 99999);
+		$category 	= 	"Software";	
+		$website 	=	"www.vtiger.com";
+		$manufacturer	= 	"vtiger";
+		$commission_rate=	rand(1,10);
+		$unit_price	=	$subscription_rate[$i];
+		$product_image_name = $product_image_array[$i];
+	}
+
+        $product->column_fields["productname"] 	= 	$product_name_array[$i];
+        $product->column_fields["productcode"] 	= 	$product_code_array[$i];
+        $product->column_fields["manufacturer"]	= 	$manufacturer;
+
+	$product->column_fields["productcategory"] = 	$category;
+        $product->column_fields["website"] 	=	$website;
+        $product->column_fields["productsheet"] =	"";
+
+	$vendor_key = array_rand($vendor_ids);
+        $product->column_fields["vendor_id"] 	= 	$vendor_ids[$vendor_key];
+	$contact_key = array_rand($contact_ids);
+        $product->column_fields["contact_id"] 	= 	$contact_ids[$contact_key];
+
+        $product->column_fields["start_date"] 	= 	& create_date();
+        $product->column_fields["sales_start_date"] 	= & create_date();
+
+        $product->column_fields["unit_price"] 	= 	$unit_price;
+        $product->column_fields["commissionrate"] = 	$commission_rate;
+        $product->column_fields["taxclass"] 	= 	'SalesTax';
+        $product->column_fields["usageunit"]	= 	$usageunit;
+     	$product->column_fields["qty_per_unit"] = 	$qty_per_unit;
+        $product->column_fields["qtyinstock"] 	= 	$qty_in_stock;
+	$product->column_fields["imagename"] =  $product_image_name;
+
+	$product->save("Products");
+	$product_ids[] = $product ->id;
+}
+
+
+//Populating HelpDesk- FAQ Data
+
+	$status_array=array ("Draft","Reviewed","Published","Draft","Reviewed","Draft","Reviewed","Draft","Reviewed","Draft","Reviewed","Draft");
+	$question_array=array (
+	"How to migrate data from previous versions to the latest version?",
+	"Error message: The file is damaged and could not be repaired.",
+	"A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No when trying to add Email to vitger CRM ",
+	"When trying to merge a template with a contact, First I was asked allow installation of ActiveX control. I accepted. After it appears a message that it will not be installed because it can't verify the publisher. Do you have a workarround for this issue ?",
+	" Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?",
+	"How to migrate data from previous versions to the latest version?",
+	"A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose No when trying to add Email to vitger CRM ",
+	" Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?",
+	"Error message: The file is damaged and could not be repaired.",
+	"When trying to merge a template with a contact, First I was asked allow installation of ActiveX control. I accepted. After it appears a message that it will not be installed because it can't verify the publisher. Do you have a workarround for this issue ?",
+	" Error message - please close all instances of word before using the vtiger word plugin. Do I need to close all Word and Outlook instances first before I can reopen Word and sign in?",
+	"How to migrate data from previous versions to the latest version?",
+	
+	);
+
+
+	$answer_array=array (
+	"Database migration scripts are available to migrate from the following versions:
+
+	1.0 to 2.0
+
+	2.0 to 2.1
+
+	2.1 to 3.0
+
+	3.0 to 3.2
+
+	3.2 to 4.0
+
+	4.0 to 4.0.1
+
+	4.0.1 to 4.2",
+	
+	"The above error message is due to version incompatibility between FPDF and PHP5. Use PHP 4.3.X version","Published",
+	"The above error message is displayed if you have installed the Microsoft(R) Outlook(R) E-mail Security Update. Please refer to the following URL for complete details:
+
+http://support.microsoft.com/default.aspx?scid=kb%3BEN-US%3B263074
+
+If you want to continue working with vtiger Outlook Plug-in, select the Allow access for check box and select the time from drop-down box.",
+	" Since, vtigerCRM & all plugins are open source, it is not signed up with third party vendors and IE will ask to download even though the plugin are not signed.
+
+This message if produced by Microsoft Windows XP. I English Windows XP with the SP2 and the last updates. I told IE to accept installation of the ActiveX, but after it, this message has appeared. Provably there is a place where to tall to WinXP to not validate if the code is signed... but I don\'t know where.
+
+In IE from Tools->Internet Options->Security->Custom Level, there you can see various options for downloading plugins which are not signed and you can adjust according to your need, so relax your security settings for a while and give a try to vtiger Office Plugin.",
+	"Before modifying any templates, please ensure that you don\'t have any documents open and only one instance of word is available in your memory."
+	);
+
+$num_array=array(0,1,2,3,4,6,7,8,9,10,11,12);
+for($i=0;$i<12;$i++)
+{
+
+	$faq = new Faq();
+	
+	$rand=array_rand($num_array);
+	$faq->column_fields["product_id"]	= $product_ids[$i];
+	$faq->column_fields["faqcategories"]	= "General";
+	$faq->column_fields["faqstatus"] 	= $status_array[$i];
+	$faq->column_fields["question"]		= $question_array[$i];
+	$faq->column_fields["faq_answer"]	= $answer_array[$i];
+
+	$faq->save("Faq");
+	$faq_ids[] = $faq ->id;
+}
+
+//Populate Quote Data
+
+$sub_array = array ("Prod_Quote", "Cont_Quote", "SO_Quote", "PO_Quote", "Vendor_Quote");
+$stage_array = array ("Created", "Reviewed", "Delivered", "Accepted" , "Rejected");
+$carrier_array = array ("FedEx", "UPS", "USPS", "DHL", "BlueDart");
+$validtill_array = array ("2006-09-21", "2006-10-29", "2006-12-11", "2006-10-09", "2006-11-18");
+for($i=0;$i<5;$i++)
+{
+	$quote = new Quotes();
+	
+	$quote->column_fields["assigned_user_id"] = $assigned_user_id;
+	$account_key = array_rand($account_ids);
+	$quote->column_fields["account_id"] = $account_ids[$account_key];
+	$op_key = array_rand($opportunity_ids);
+	$quote->column_fields["potential_id"] = $opportunity_ids[$op_key];
+	$contact_key = array_rand($contact_ids);
+        $quote->column_fields["contact_id"] = $contact_ids[$contact_key];
+	$rand = array_rand($num_array);
+	$quote->column_fields["subject"] = $sub_array[$i];
+	$quote->column_fields["quotestage"] = $stage_array[$i];	
+	$quote->column_fields["carrier"] = $carrier_array[$i];
+	$quote->column_fields["validtill"] = $validtill_array[$i];
+
+	$quote->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
+	$quote->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
+	$quote->column_fields["bill_state"] = "CA";
+	$quote->column_fields["bill_code"] = rand(10000, 99999);
+	$quote->column_fields["bill_country"] = 'USA';	
+
+	$quote->column_fields["ship_street"] = $account->column_fields["bill_street"];
+	$quote->column_fields["ship_city"] = $account->column_fields["bill_city"];
+	$quote->column_fields["ship_state"] = $account->column_fields["bill_state"];
+	$quote->column_fields["ship_code"] = $account->column_fields["bill_code"];
+	$quote->column_fields["ship_country"] = $account->column_fields["bill_country"];	
+
+	
+	$quote->save("Quotes");
+
+	$quote_ids[] = $quote->id;
+
+	$product_key = array_rand($product_ids); 
+	$productid = $product_ids[$product_key];
+
+	//set the inventory product details in request then just call the saveInventoryProductDetails function 
+	$_REQUEST['totalProductCount']	 = 1;
+
+	$_REQUEST['hdnProductId1'] = $productid;
+	$_REQUEST['qty1'] = $qty = 1;
+	$_REQUEST['listPrice1'] = $listprice = 130;
+	$_REQUEST['comment1'] = "This is test comment for product of Quotes";
+	
+	$_REQUEST['deleted1'] = 0;
+	$_REQUEST['discount_type1'] = 'amount';
+	$_REQUEST['discount_amount1'] = $discount_amount = '20';
+
+	$_REQUEST['taxtype'] = $taxtype = 'individual';
+	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
+	$_REQUEST['discount_type_final'] = 'amount';
+	$_REQUEST['discount_amount_final'] = $discount_amount_final = '10';
+	
+	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
+	$_REQUEST['adjustmenttype'] = '+';
+	$_REQUEST['adjustment'] = $adjustment = '10';
+
+	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
+
+	//Upto this added to set the request values which will be used to save the inventory product details
+
+	//Now call the saveInventoryProductDetails function
+	saveInventoryProductDetails(&$quote, 'Quotes');
+}
+
+//Populate SalesOrder Data
+
+$subj_array = array ("SO_vtiger", "SO_zoho", "SO_vtiger5usrp", "SO_vt100usrpk", "SO_vendtl");
+$status_array = array ("Created",  "Delivered", "Approved" , "Cancelled" , "Created");
+$carrier_array = array ("FedEx", "UPS", "USPS", "DHL", "BlueDart");
+$duedate_array = array ("2006-09-21", "2006-10-29", "2006-12-11", "2006-10-09", "2006-11-18");
+
+for($i=0;$i<5;$i++)
+{
+	$so = new SalesOrder();
+	
+	$so->column_fields["assigned_user_id"] = $assigned_user_id;
+	$account_key = array_rand($account_ids);
+	$so->column_fields["account_id"] = $account_ids[$account_key];
+	$quote_key = array_rand($quote_ids);
+	$so->column_fields["quote_id"] = $quote_ids[$quote_key];
+	$contact_key = array_rand($contact_ids);
+        $so->column_fields["contact_id"] = $contact_ids[$contact_key];
+	$rand = array_rand($num_array);
+	$so->column_fields["subject"] = $subj_array[$i];
+	$so->column_fields["sostatus"] = $status_array[$i];	
+	$so->column_fields["hdnGrandTotal"] = $sototal_array[$i];
+	$so->column_fields["carrier"] = $carrier_array[$i];
+	$so->column_fields["duedate"] = $duedate_array[$i];
+
+	$so->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
+	$so->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
+	$so->column_fields["bill_state"] = "CA";
+	$so->column_fields["bill_code"] = rand(10000, 99999);
+	$so->column_fields["bill_country"] = 'USA';	
+
+	$so->column_fields["ship_street"] = $account->column_fields["bill_street"];
+	$so->column_fields["ship_city"] = $account->column_fields["bill_city"];
+	$so->column_fields["ship_state"] = $account->column_fields["bill_state"];
+	$so->column_fields["ship_code"] = $account->column_fields["bill_code"];
+	$so->column_fields["ship_country"] = $account->column_fields["bill_country"];	
+
+	
+	$so->save("SalesOrder");
+
+	$salesorder_ids[] = $so->id;
+
+	$product_key = array_rand($product_ids); 
+	$productid = $product_ids[$product_key];
+
+	//set the inventory product details in request then just call the saveInventoryProductDetails function 
+	$_REQUEST['totalProductCount']	 = 1;
+
+	$_REQUEST['hdnProductId1'] = $productid;
+	$_REQUEST['qty1'] = $qty = 1;
+	$_REQUEST['listPrice1'] = $listprice = 1230;
+	$_REQUEST['comment1'] = "This is test comment for product of SalesOrder";
+	
+	$_REQUEST['deleted1'] = 0;
+	$_REQUEST['discount_type1'] = 'amount';
+	$_REQUEST['discount_amount1'] = $discount_amount = '200';
+
+	$_REQUEST['taxtype'] = $taxtype = 'individual';
+	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
+	$_REQUEST['discount_type_final'] = 'amount';
+	$_REQUEST['discount_amount_final'] = $discount_amount_final = '100';
+	
+	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
+	$_REQUEST['adjustmenttype'] = '+';
+	$_REQUEST['adjustment'] = $adjustment = '100';
+
+	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
+
+	//Upto this added to set the request values which will be used to save the inventory product details
+
+	//Now call the saveInventoryProductDetails function
+	saveInventoryProductDetails(&$so, 'SalesOrder');
+
+
+}
+
+
+//Populate PurchaseOrder Data
+
+$psubj_array = array ("PO_vtiger", "PO_zoho", "PO_vtiger5usrp", "PO_vt100usrpk", "PO_vendtl");
+$pstatus_array = array ("Created",  "Delivered", "Approved" , "Cancelled", "Recieved Shipment");
+$carrier_array = array ("FedEx", "UPS", "USPS", "DHL", "BlueDart");
+$trkno_array = array ("po1425", "po2587", "po7974", "po7979", "po6411"); 
+$duedate_array = array ("2006-09-21", "2006-10-29", "2006-12-11", "2006-10-09", "2006-11-18");
+
+for($i=0;$i<5;$i++)
+{
+	$po = new PurchaseOrder();
+	
+	$po->column_fields["assigned_user_id"] = $assigned_user_id;
+	$vendor_key = array_rand($vendor_ids);
+	$po->column_fields["vendor_id"] = $vendor_ids[$vendor_key];
+	$contact_key = array_rand($contact_ids);
+        $po->column_fields["contact_id"] = $contact_ids[$contact_key];
+	$rand = array_rand($num_array);
+	$po->column_fields["subject"] = $psubj_array[$i];
+	$po->column_fields["postatus"] = $pstatus_array[$i];	
+	$po->column_fields["carrier"] = $carrier_array[$i];
+	$po->column_fields["tracking_no"] = $trkno_array[$i];
+	$po->column_fields["duedate"] = $duedate_array[$i];
+
+	$po->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
+	$po->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
+	$po->column_fields["bill_state"] = "CA";
+	$po->column_fields["bill_code"] = rand(10000, 99999);
+	$po->column_fields["bill_country"] = 'USA';	
+
+	$po->column_fields["ship_street"] = $account->column_fields["bill_street"];
+	$po->column_fields["ship_city"] = $account->column_fields["bill_city"];
+	$po->column_fields["ship_state"] = $account->column_fields["bill_state"];
+	$po->column_fields["ship_code"] = $account->column_fields["bill_code"];
+	$po->column_fields["ship_country"] = $account->column_fields["bill_country"];	
+		
+	
+	$po->save("PurchaseOrder");
+
+	$purchaseorder_ids[] = $po->id;
+
+	$product_key = array_rand($product_ids); 
+	$productid = $product_ids[$product_key];
+
+	//set the inventory product details in request then just call the saveInventoryProductDetails function 
+	$_REQUEST['totalProductCount']	 = 1;
+
+	$_REQUEST['hdnProductId1'] = $productid;
+	$_REQUEST['qty1'] = $qty = 1;
+	$_REQUEST['listPrice1'] = $listprice = 2200;
+	$_REQUEST['comment1'] = "This is test comment for product of PurchaseOrder";
+	
+	$_REQUEST['deleted1'] = 0;
+	$_REQUEST['discount_type1'] = 'amount';
+	$_REQUEST['discount_amount1'] = $discount_amount = '200';
+
+	$_REQUEST['taxtype'] = $taxtype = 'individual';
+	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
+	$_REQUEST['discount_type_final'] = 'amount';
+	$_REQUEST['discount_amount_final'] = $discount_amount_final = '100';
+	
+	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
+	$_REQUEST['adjustmenttype'] = '+';
+	$_REQUEST['adjustment'] = $adjustment = '100';
+
+	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
+
+	//Upto this added to set the request values which will be used to save the inventory product details
+
+	//Now call the saveInventoryProductDetails function
+	saveInventoryProductDetails(&$po, 'PurchaseOrder');
+
+
+}
+
+//Populate Invoice Data
+
+$isubj_array = array ("vtiger_invoice201", "zoho_inv7841", "vtiger5usrp_invoice71134", "vt100usrpk_inv113", "vendtl_inv214");
+$istatus_array = array ("Created",  "Sent", "Approved" , "Credit Invoice", "Paid");
+$itotal_array = array ("4842.000", "4842.000", "4842.000", "4842.000", "4842.000");
+
+for($i=0;$i<5;$i++)
+{
+	$invoice = new Invoice();
+	
+	$invoice->column_fields["assigned_user_id"] = $assigned_user_id;
+	$account_key = array_rand($account_ids);
+	$invoice->column_fields["account_id"] = $account_ids[$account_key];
+	$so_key = array_rand($salesorder_ids);
+	$invoice->column_fields["salesorder_id"] = $salesorder_ids[$so_key];
+	$contact_key = array_rand($contact_ids);
+        $invoice->column_fields["contactid"] = $contact_ids[$contact_key];
+	$rand = array_rand($num_array);
+	$invoice->column_fields["subject"] = $isubj_array[$i];
+	$invoice->column_fields["invoicestatus"] = $istatus_array[$i];	
+	$invoice->column_fields["hdnGrandTotal"] = $itotal_array[$i];
+
+	$invoice->column_fields["bill_street"] = $street_address_array[rand(0,$street_address_count-1)];
+	$invoice->column_fields["bill_city"] = $city_array[rand(0,$city_array_count-1)];
+	$invoice->column_fields["bill_state"] = "CA";
+	$invoice->column_fields["bill_code"] = rand(10000, 99999);
+	$invoice->column_fields["bill_country"] = 'USA';	
+
+	$invoice->column_fields["ship_street"] = $account->column_fields["bill_street"];
+	$invoice->column_fields["ship_city"] = $account->column_fields["bill_city"];
+	$invoice->column_fields["ship_state"] = $account->column_fields["bill_state"];
+	$invoice->column_fields["ship_code"] = $account->column_fields["bill_code"];
+	$invoice->column_fields["ship_country"] = $account->column_fields["bill_country"];	
+	
+	
+	$invoice->save("Invoice");
+
+	$invoice_ids[] = $invoice->id;
+	if ($i > 3)
+	{
+		$freetag = $adb->getUniqueId('vtiger_freetags');
+		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[0]', '$cloudtag[0]')";
+		$res_inv = $adb->query($query);
+
+		$date = $adb->formatDate(date('YmdHis')); 
+		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$invoice->id.", $date, 'Invoice')";
+		$result_inv = $adb->query($query_tag);
+	}
+
+	$product_key = array_rand($product_ids); 
+	$productid = $product_ids[$product_key];
+
+	//set the inventory product details in request then just call the saveInventoryProductDetails function 
+	$_REQUEST['totalProductCount']	 = 1;
+
+	$_REQUEST['hdnProductId1'] = $productid;
+	$_REQUEST['qty1'] = $qty = 1;
+	$_REQUEST['listPrice1'] = $listprice = 4300;
+	$_REQUEST['comment1'] = "This is test comment for product of Invoice";
+	
+	$_REQUEST['deleted1'] = 0;
+	$_REQUEST['discount_type1'] = 'amount';
+	$_REQUEST['discount_amount1'] = $discount_amount = '300';
+
+	$_REQUEST['taxtype'] = $taxtype = 'individual';
+	$_REQUEST['subtotal'] = $subtotal = $qty*$listprice-$discount_amount;
+	$_REQUEST['discount_type_final'] = 'amount';
+	$_REQUEST['discount_amount_final'] = $discount_amount_final = '100';
+	
+	$_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50';
+	$_REQUEST['adjustmenttype'] = '+';
+	$_REQUEST['adjustment'] = $adjustment = '100';
+
+	$_REQUEST['total'] = $subtotal-$discount_amount_final+$shipping_handling_charge+$adjustment;
+
+	//Upto this added to set the request values which will be used to save the inventory product details
+
+	//Now call the saveInventoryProductDetails function
+	saveInventoryProductDetails(&$invoice, 'Invoice');
+
+}
+
+//Populate RSS Data
+
+
+
+
+//Populate Email Data
+
+$esubj_array =  array ("Vtiger 5 Released", "Try vtigercrm!", "Hi There!!!", "Welcome to Open Source", "Help needed in customization of Vtiger");
+$startdate_array =  array ("2006-1-2","2003-3-4","2003-4-5","2001-2-1","2005-8-8");
+$filename_array = array ("vtiger5alpha.tar.gz", "zohowriter.zip", "hi.doc", "welcome.pps", "sos.doc");
+
+$to_array = array("a at a.com","b at b.com", "tester at testvtiger.com","xanth at yaz.com","violet at bing.com");
+$cc_array = array("andrewa at a.com","casterb at b.com", "indomine at variancevtiger.com","becker at nosbest.com","electra at violet.com");
+$bcc_array = array("nathan at nathantests.com","jeff at karl1.com", "isotope at uranium.com","bunny at bugs.com","explosive at dud.com");
+$from_array = array("harvest at zss.com","rain at sunshine.com", "gloom at rainyday.com");
+$body_array = array("This is a good product! Have a go at it! ","Nice to have you visit us, very nice of you. Stay for sometime and have a look at our product. I am sure you will like it", "This will take some time to fix. Can you provide me more details please?","What a cool tool! I wish I had found it earlier. Oh it has a lot of my friends name in it too! I too can contribute. But how?","Urgent. I need this done last week! Guys, you are the ones I am depending on. Do something!");
+
+for($i=0;$i<5;$i++)
+{
+	$email = new Emails();
+
+	$email->column_fields["assigned_user_id"] = $assigned_user_id;
+	
+	$rand = array_rand($num_array);
+	$email->column_fields["subject"] = $esubj_array[$i];
+	$email->column_fields["filename"] = $filename_array[$i];	
+	$email->column_fields["date_start"] = $startdate_array[$i];
+	$email->column_fields["semodule"] = 'Tasks';
+	$email->column_fields["activitytype"] = 'Emails';
+	$email->column_fields["description"] = $body_array[$i];	
+	$email->save("Emails");
+	$email_ids[] = $email->id;
+	
+	$query = "insert into vtiger_emaildetails(emailid,from_email,to_email,cc_email,bcc_email) values (".$email->id.", '".$from_array[$i]."', '".$to_array[$i]."','".$cc_array[$i]."','".$bcc_array[$i] ."')";
+		$res = $adb->query($query);
+}
+
+
+//Populate PriceBook data
+
+$PB_array = array ("Cd-R PB", "Vtiger PB", "Gator PB", "Kyple PB", "Pastor PB", "Zoho PB", "PB_100", "Per_PB", "CST_PB", "GATE_PB", "Chevron_PB", "Pizza_PB");
+$Active_array = array ("0", "1", "1", "0", "1","0", "1", "1", "0", "1","0","1");
+
+//$num_array = array(0,1,2,3,4);
+for($i=0;$i<12;$i++)
+{
+	$pricebook = new PriceBooks();
+
+	$rand = array_rand($num_array);
+	$pricebook->column_fields["bookname"]   = $PB_array[$i];
+	$pricebook->column_fields["active"]     = $Active_array[$i];
+
+	$pricebook->save("PriceBooks");
+	$pricebook_ids[] = $pricebook ->id;
+}
+
+
+//Populate Notes Data
+
+$notes_array = array ("Cont_Notes", "Prod_Notes", "Vendor_Notes", "Invoice_Notes", "Task_Notes", "Event_Notes", "Email_Notes");
+
+for($i=0;$i<7;$i++)
+{
+	$notes = new Notes();
+
+	$rand = array_rand($num_array);
+	$contact_key = array_rand($contact_ids);
+        $notes->column_fields["contact_id"] 	= 	$contact_ids[$contact_key];
+	$notes->column_fields["notes_title"]		=	$notes_array[$i];
+
+	$notes->save("Notes");
+	$notes_ids[] = $notes ->id;
+	
+	$product_key = array_rand($product_ids);
+        $query = "insert into vtiger_senotesrel (crmid, notesid) values (".$product_ids[$product_key].", ".$notes->id.")";
+	$db->query($query);
+		
+}
+
+
+
+// Populate Ticket data
+
+
+//$severity_array=array("Minor","Major","Critical","");
+$status_array=array("Open","In Progress","Wait For Response","Open","Closed");
+$category_array=array("Big Problem ","Small Problem","Other Problem","Small Problem","Other Problem");
+$ticket_title_array=array("Upload Attachment problem",
+			"Individual Customization -Menu and RSS","Export Output query",
+		"Import Error CSV Leads","How to automatically add a lead from a web form to VTiger");
+
+for($i=0;$i<5;$i++)
+{
+	$helpdesk= new HelpDesk();
+	
+	$rand=array_rand($num_array);
+	$contact_key = array_rand($contact_ids);
+        $helpdesk->column_fields["parent_id"] 	= 	$contact_ids[$contact_key];
+
+	$helpdesk->column_fields["ticketpriorities"]= "Normal";
+	$helpdesk->column_fields["product_id"]	= 	$product_ids[$i];
+
+	$helpdesk->column_fields["ticketseverities"]	= "Minor";
+	$helpdesk->column_fields["ticketstatus"]	= $status_array[$i];
+	$helpdesk->column_fields["ticketcategories"]	= $category_array[$i];
+	//$rand_key = array_rand($s);$contact_key = array_rand($contact_ids);
+        $notes->column_fields["contact_id"] 	= 	$contact_ids[$contact_key];
+	$helpdesk->column_fields["ticket_title"]	= $ticket_title_array[$i];
+        $helpdesk->column_fields["assigned_user_id"] = $assigned_user_id;
+	
+	$helpdesk->save("HelpDesk");
+	$helpdesk_ids[] = $helpdesk->id;
+	
+	if ($i > 3)
+	{
+		$freetag = $adb->getUniqueId('vtiger_freetags');
+		$query = "insert into vtiger_freetags values ($freetag, '$cloudtag[3]', '$cloudtag[3]')";
+		$res_tkt = $adb->query($query);
+
+		$date = $adb->formatDate(date('YmdHis')); 
+		$query_tag = "insert into vtiger_freetagged_objects values ($freetag, 1,".$helpdesk->id.", $date, 'HelpDesk')";
+		$result_tkt = $adb->query($query_tag);
+	}
+
+}
+
+// Populate Activities Data
+$task_array=array("Tele Conference","Call user - John","Send Fax to Mary Smith");
+$event_array=array("","","Call Smith","Team Meeting","Call Richie","Meeting with Don");
+$task_status_array=array("Planned","In Progress","Completed");
+$task_priority_array=array("High","Medium","Low");
+$visibility=array("","","Private","Public","Private","Public");
+
+for($i=0;$i<6;$i++)
+{
+	$event = new Activity();
+	
+	$rand_num=array_rand($num_array);
+
+	$rand_date = & create_date();
+	$en=explode("-",$rand_date);
+	if($en[1]<10)
+		$en[1]="0".$en[1];
+	if($en[2]<10)
+		$en[2]="0".$en[2];
+	$recur_daily_date=date('Y-m-d',mktime(0,0,0,date($en[1]),date($en[2])+5,date($en[0])));
+	$recur_week_date=date('Y-m-d',mktime(0,0,0,date($en[1]),date($en[2])+30,date($en[0])));
+
+
+	$start_time_hr=rand(00,23);
+	$start_time_min=rand(00,59);
+	$end_time_hr=rand(00,23);
+	$end_time_min=rand(00,59);
+	if($start_time_hr<10)
+		$start_time_hr="0".$start_time_hr;
+	if($start_time_min<10)
+		$start_time_min="0".$start_time_min;
+	if($end_time_hr<10)
+		$end_time_hr="0".$end_time_hr;
+	if($end_time_min<10)
+		$end_time_min="0".$end_time_min;
+	$end_time=$end_time_hr.":".$end_time_min;
+	$start_time=$start_time_hr.":".$start_time_min;
+	if($i<2)
+	{
+		$event->column_fields["subject"]	= $task_array[$i];	
+		if($i==1)
+		{
+			$account_key = array_rand($account_ids);
+			$event->column_fields["parent_id"]	= $account_ids[$account_key];;	
+		}
+		$event->column_fields["taskstatus"]	= $task_status_array[$i];	
+		$event->column_fields["taskpriority"]	= $task_priority_array[$i];	
+		$event->column_fields["activitytype"]	= "Task";
+		$event->column_fields["visibility"] = $visibility[$i];	
+				
+	}
+	else
+	{
+		$event->column_fields["subject"]	= $event_array[$i];	
+		$event->column_fields["visibility"] = $visibility[$i];
+		$event->column_fields["duration_hours"]	= rand(0,3);	
+		$event->column_fields["duration_minutes"]= rand(0,59);	
+		$event->column_fields["eventstatus"]	= "Planned";	
+		$event->column_fields["time_end"]     = $end_time;
+	}
+	$event->column_fields["date_start"]	= $rand_date;	
+	$_REQUEST["date_start"] = $rand_date;
+	$event->column_fields["time_start"]	= $start_time;	
+	$event->column_fields["due_date"]	= $rand_date;	
+	$_REQUEST["due_date"] = $rand_date;
+	$contact_key = array_rand($contact_ids);
+        $event->column_fields["contact_id"]	= 	$contact_ids[$contact_key];
+	if($i==4)
+	{
+        	$event->column_fields["recurringtype"] 	= "Daily";
+		$_REQUEST["recurringtype"]  = "Daily";
+		$event->column_fields["activitytype"]	= "Meeting";	
+		$event->column_fields["due_date"]	= $recur_daily_date;	
+	}
+	elseif($i==5)
+	{	
+        	$event->column_fields["recurringtype"] 	= "Weekly";
+		$_REQUEST["recurringtype"]  = "Weekly";
+		$event->column_fields["activitytype"]	= "Meeting";	
+		$event->column_fields["due_date"]	= $recur_week_date;	
+	}
+	elseif($i>1) 
+	{
+		$event->column_fields["activitytype"]	= "Call";	
+	}
+	$event->column_fields["assigned_user_id"] = $assigned_user_id;
+	$event->save("Calendar");
+        $event_ids[] = $event->id;
+
+}
+
+
+$adb->query("update vtiger_crmentity set smcreatorid=".$assigned_user_id);
+
+$expected_revenue = Array("250000","750000","500000");
+$budget_cost = Array("25000","50000","90000");
+$actual_cost = Array("23500","45000","80000");
+$num_sent = Array("2000","2500","3000");
+$clo_date = Array('2003-1-2','2004-2-3','2005-4-12');
+
+$expected_response_count = Array("2500","7500","5000");
+$expected_sales_count = Array("25000","50000","90000");
+$expected_roi = Array("23","45","82");
+
+$actual_response_count = Array("250","750","1500");
+$actual_sales_count = Array("1250","5200","2390");
+$actual_roi = Array("21","14","12");
+
+$sponsor = Array("Finace","Marketing","Sales");
+$targetsize = Array("210000","13390","187424");
+$targetaudience = Array("Managers","CEOs","Rookies");
+
+//$expected_response = Array(null,null,null);
+for($i=0;$i<count($campaign_name_array);$i++)
+{
+	$campaign = new Campaigns();
+	$campaign_name = $campaign_name_array[$i];
+	$campaign->column_fields["campaignname"] = $campaign_name;
+	$campaign->column_fields["campaigntype"] = $campaign_type_array[$i];
+	$campaign->column_fields["campaignstatus"] = $campaign_status_array[$i];
+	$campaign->column_fields["numsent"] = $num_sent[$i];
+	$campaign->column_fields["expectedrevenue"] = $expected_revenue[$i];
+	$campaign->column_fields["budgetcost"] = $budget_cost[$i];
+	$campaign->column_fields["actualcost"] = $actual_cost[$i];
+	$campaign->column_fields["closingdate"] = $clo_date[$i];
+	$campaign->column_fields["expectedresponse"] = $expected_response[$i];
+	$campaign->column_fields["assigned_user_id"] = $assigned_user_id;
+	
+	$campaign->column_fields["expectedresponsecount"] = $expected_response_count[$i];
+	$campaign->column_fields["expectedsalescount"] = $expected_sales_count[$i];
+	$campaign->column_fields["expectedroi"] = $expected_roi[$i];
+	$campaign->column_fields["actualresponsecount"] = $actual_response_count[$i];
+	$campaign->column_fields["actualsalescount"] = $actual_sales_count[$i];
+	$campaign->column_fields["actualroi"] = $actual_roi[$i];
+	$campaign->column_fields["sponsor"] = $sponsor[$i];
+	$campaign->column_fields["targetsize"] = $targetsize[$i];
+	$campaign->column_fields["targetaudience"] = $targetaudience[$i];
+
+
+	
+	$campaign->save("Campaigns");
+}
+
+//Populate My Sites Data 
+
+$portalname = array ("Vtiger", "Vtiger Blogs", "Vtiger Forums", "VtigerForge", "Vtiger Docs");
+$portalurl = array ("http://vtiger.com", "http://blogs.vtiger.com", "http://forums.vtiger.com", "http://vtigerforge.com", "http://wiki.vtiger.com");
+
+for($i=0;$i<5;$i++)
+{
+	$portalid = $adb->getUniqueId('vtiger_portal');
+	$portal_qry = "insert into vtiger_portal values (".$portalid.", '".$portalname[$i]."','".$portalurl[$i]."',0)";
+	$result_qry = $adb->query($portal_qry);
+}
+
+//Populate RSS Data
+$rssname = array("vtiger - Forums","vtiger development - Active Tickets");
+$rssurl = array("http://forums.vtiger.com/rss.php?name=forums&file=rss","http://vtiger.fosslabs.com/cgi-bin/trac.cgi/report/1?format=rss&USER=anonymous");
+
+for($i=0;$i<2;$i++)
+{
+	$rssid = $adb->getUniqueId('vtiger_rss');
+	$rss_qry = "insert into vtiger_rss values (".$rssid.", '".$rssurl[$i]."','".$rssname[$i]."',0,0)";
+	$result_qry = $adb->query($rss_qry);
+}
+?>

Modified: vtigercrm/branches/5.1_jens/jscalendar/calendar.js
==============================================================================
--- vtigercrm/branches/5.1_jens/jscalendar/calendar.js (original)
+++ vtigercrm/branches/5.1_jens/jscalendar/calendar.js Tue Nov 14 03:16:10 2006
@@ -1703,7 +1703,9 @@
 	return str;
 };
 
+if ( Date.prototype.__msh_oldSetFullYear == null ) {
 Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
+}
 Date.prototype.setFullYear = function(y) {
 	var d = new Date(this);
 	d.__msh_oldSetFullYear(y);

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/Account.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/Account.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/Account.php Tue Nov 14 03:16:10 2006
@@ -1,778 +1,758 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/Account.php,v 1.53 2005/04/28 08:06:45 rank Exp $
- * Description:  Defines the Account SugarBean Account entity with the necessary
- * methods and variables.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- ********************************************************************************/
-
-include_once('config.php');
-require_once('include/logging.php');
-require_once('include/database/PearDatabase.php');
-require_once('data/SugarBean.php');
-require_once('data/CRMEntity.php');
-require_once('modules/Contacts/Contact.php');
-require_once('modules/Potentials/Opportunity.php');
-require_once('modules/Calendar/Activity.php');
-require_once('modules/Notes/Note.php');
-require_once('modules/Emails/Email.php');
-require_once('include/utils/utils.php');
-require_once('user_privileges/default_module_view.php');
-
-// Account is used to store vtiger_account information.
-class Account extends CRMEntity {
-	var $log;
-	var $db;
-
-	var $table_name = "vtiger_account";
-	var $tab_name = Array('vtiger_crmentity','vtiger_account','vtiger_accountbillads','vtiger_accountshipads','vtiger_accountscf');
-	var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_account'=>'accountid','vtiger_accountbillads'=>'accountaddressid','vtiger_accountshipads'=>'accountaddressid','vtiger_accountscf'=>'accountid');
-
-	var $entity_table = "vtiger_crmentity";
-
-	var $billadr_table = "vtiger_accountbillads";
-
-	var $object_name = "Accounts";
-	// Mike Crowe Mod --------------------------------------------------------added for general search
-	var $base_table_name = "vtiger_account";
-	var $cf_table_name = "vtiger_accountscf";
-
-	var $new_schema = true;
-
-	var $module_id = "accountid";
-
-	var $column_fields = Array();
-
-	var $sortby_fields = Array('accountname','city','website','phone','smownerid');		
-
-
-	// This is the list of vtiger_fields that are in the lists.
-	var $list_fields = Array(
-			'Account Name'=>Array('vtiger_account'=>'accountname'),
-			'City'=>Array('vtiger_accountbillads'=>'city'), 
-			'Website'=>Array('vtiger_account'=>'website'),
-			'Phone'=>Array('vtiger_account'=> 'phone'),
-			'Assigned To'=>Array('vtiger_crmentity'=>'smownerid')
-			);
-
-	var $list_fields_name = Array(
-			'Account Name'=>'accountname',
-			'City'=>'bill_city',
-			'Website'=>'website',
-			'Phone'=>'phone',
-			'Assigned To'=>'assigned_user_id'
-			);
-	var $list_link_field= 'accountname';
-
-	var $search_fields = Array(
-			'Account Name'=>Array('vtiger_account'=>'accountname'),
-			'City'=>Array('vtiger_accountbillads'=>'city'), 
-			);
-
-	var $search_fields_name = Array(
-			'Account Name'=>'accountname',
-			'City'=>'bill_city',
-			);
-
-	// This is the list of vtiger_fields that are required.
-	var $required_fields =  array("accountname"=>1);
-
-	//Added these variables which are used as default order by and sortorder in ListView
-	var $default_order_by = 'accountname';
-	var $default_sort_order = 'ASC';
-
-	function Account() {
-		$this->log =LoggerManager::getLogger('account');
-		$this->db = new PearDatabase();
-		$this->column_fields = getColumnFields('Accounts');
-	}
-
-	// Mike Crowe Mod --------------------------------------------------------Default ordering for us
-	/**
-	 * Function to get sort order
- 	 * return string  $sorder    - sortorder string either 'ASC' or 'DESC'
-	 */
-	function getSortOrder()
-	{
-		global $log;
-                $log->debug("Entering getSortOrder() method ...");	
-		if(isset($_REQUEST['sorder'])) 
-			$sorder = $_REQUEST['sorder'];
-		else
-			$sorder = (($_SESSION['ACCOUNTS_SORT_ORDER'] != '')?($_SESSION['ACCOUNTS_SORT_ORDER']):($this->default_sort_order));
-		$log->debug("Exiting getSortOrder() method ...");
-		return $sorder;
-	}
-	/**
-	 * Function to get order by
-	 * return string  $order_by    - fieldname(eg: 'accountname')
- 	 */
-	function getOrderBy()
-	{
-		global $log;
-                $log->debug("Entering getOrderBy() method ...");
-		if (isset($_REQUEST['order_by'])) 
-			$order_by = $_REQUEST['order_by'];
-		else
-			$order_by = (($_SESSION['ACCOUNTS_ORDER_BY'] != '')?($_SESSION['ACCOUNTS_ORDER_BY']):($this->default_order_by));
-		$log->debug("Exiting getOrderBy method ...");
-		return $order_by;
-	}	
-	// Mike Crowe Mod --------------------------------------------------------
-
-
-	/** Returns a list of the associated contacts
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function get_contacts($id)
-	{	
-		global $log, $singlepane_view;
-                $log->debug("Entering get_contacts(".$id.") method ...");
-		global $mod_strings;
-
-		$focus = new Contact();
-
-		$button = '';
-		if(isPermitted("Contacts",1,"") == 'yes')
-		{
-			$button .= '<input title="New Contact" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Contacts\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_CONTACT'].'">&nbsp;</td>';
-		}
-
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		//SQL
-		$query = "SELECT vtiger_contactdetails.*,
-			vtiger_crmentity.crmid,
-                        vtiger_crmentity.smownerid,
-			vtiger_users.user_name
-			FROM vtiger_contactdetails
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
-			LEFT JOIN vtiger_contactgrouprelation
-				ON vtiger_contactdetails.contactid = vtiger_contactgrouprelation.contactid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_contactgrouprelation.groupname
-			LEFT JOIN vtiger_users
-				ON vtiger_crmentity.smownerid = vtiger_users.id
-			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_contactdetails.accountid = ".$id;
-		$log->debug("Exiting get_contacts method ...");
-		return GetRelatedList('Accounts','Contacts',$focus,$query,$button,$returnset);
-	}
-
-	/** Returns a list of the associated opportunities
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function get_opportunities($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_opportunities(".$id.") method ...");
-		global $mod_strings;
-
-		$focus = new Potential();
-		$button = '';
-
-		if(isPermitted("Potentials",1,"") == 'yes')
-		{
-			$button .= '<input title="New Potential" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Potentials\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_POTENTIAL'].'">';
-		}
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_potential.potentialid, vtiger_potential.accountid,
-			vtiger_potential.potentialname, vtiger_potential.sales_stage,
-			vtiger_potential.potentialtype, vtiger_potential.amount,
-			vtiger_potential.closingdate, vtiger_potential.potentialtype,
-			vtiger_users.user_name,
-			vtiger_crmentity.crmid, vtiger_crmentity.smownerid
-			FROM vtiger_potential
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_potential.potentialid
-			LEFT JOIN vtiger_users
-				ON vtiger_crmentity.smownerid = vtiger_users.id
-			LEFT JOIN vtiger_potentialgrouprelation
-				ON vtiger_potential.potentialid = vtiger_potentialgrouprelation.potentialid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_potentialgrouprelation.groupname
-			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_potential.accountid = ".$id;
-		$log->debug("Exiting get_opportunities method ...");
-
-		return GetRelatedList('Accounts','Potentials',$focus,$query,$button,$returnset);
-	}
-
-	/** Returns a list of the associated tasks
-	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
-	 * All Rights Reserved..
-	 * Contributor(s): ______________________________________..
-	 */
-	function get_activities($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_activities(".$id.") method ...");
-		global $mod_strings;
-
-		$focus = new Activity();
-		$button = '';
-		if(isPermitted("Calendar",1,"") == 'yes')
-		{
-
-			$button .= '<input title="New Task" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Accounts\';this.form.activity_mode.value=\'Task\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_TASK'].'">&nbsp;';
-			$button .= '<input title="New Event" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Accounts\';this.form.activity_mode.value=\'Events\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_EVENT'].'">&nbsp;</td>';
-		}
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_activity.*,
-			vtiger_seactivityrel.*,
-			vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
-			vtiger_crmentity.modifiedtime,
-			vtiger_users.user_name,
-			vtiger_recurringevents.recurringtype
-			FROM vtiger_activity
-			INNER JOIN vtiger_seactivityrel
-				ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_activity.activityid
-			LEFT JOIN vtiger_users
-				ON vtiger_users.id = vtiger_crmentity.smownerid
-			LEFT OUTER JOIN vtiger_recurringevents
-				ON vtiger_recurringevents.activityid = vtiger_activity.activityid
-			LEFT JOIN vtiger_activitygrouprelation
-				ON vtiger_activitygrouprelation.activityid = vtiger_crmentity.crmid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_activitygrouprelation.groupname
-			WHERE vtiger_seactivityrel.crmid = ".$id."
-			AND (activitytype='Task'
-				OR activitytype='Call'
-				OR activitytype='Meeting')
-			AND vtiger_crmentity.deleted = 0
-			AND ((vtiger_activity.status IS NOT NULL
-					AND vtiger_activity.status != 'Completed')
-				AND (vtiger_activity.status IS NOT NULL
-					AND vtiger_activity.status != 'Deferred')
-				OR (vtiger_activity.eventstatus !=''
-					AND  vtiger_activity.eventstatus != 'Held'))";
-		$log->debug("Exiting get_activities method ...");
-		return GetRelatedList('Accounts','Calendar',$focus,$query,$button,$returnset);
-
-	}
-	/**
-	 * Function to get Account related Task & Event which have activity type Held, Completed or Deferred.
- 	 * @param  integer   $id      - accountid
- 	 * returns related Task or Event record in array format
- 	 */
-	function get_history($id)
-	{
-		global $log;
-                $log->debug("Entering get_history(".$id.") method ...");
-		$query = "SELECT vtiger_activity.activityid, vtiger_activity.subject,
-			vtiger_activity.status, vtiger_activity.eventstatus,
-			vtiger_activity.activitytype,
-			vtiger_crmentity.modifiedtime, vtiger_crmentity.createdtime,
-			vtiger_crmentity.description,
-			vtiger_users.user_name
-			FROM vtiger_activity
-			INNER JOIN vtiger_seactivityrel
-				ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_activity.activityid
-			LEFT JOIN vtiger_activitygrouprelation
-				ON vtiger_activitygrouprelation.activityid = vtiger_activity.activityid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_activitygrouprelation.groupname
-			INNER JOIN vtiger_users
-				ON vtiger_crmentity.smcreatorid = vtiger_users.id
-			WHERE (vtiger_activity.activitytype = 'Meeting'
-				OR vtiger_activity.activitytype = 'Call'
-				OR vtiger_activity.activitytype = 'Task')
-			AND (vtiger_activity.status = 'Completed'
-				OR vtiger_activity.status = 'Deferred'
-				OR (vtiger_activity.eventstatus = 'Held'
-					AND vtiger_activity.eventstatus != ''))
-			AND vtiger_seactivityrel.crmid = ".$id;
-		//Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php
-		$log->debug("Exiting get_history method ...");
-		return getHistory('Accounts',$query,$id);
-	}
-	/**
-	 * Function to get Account related Attachments
- 	 * @param  integer   $id      - accountid
- 	 * returns related Attachment record in array format
- 	 */
-	function get_attachments($id)
-	{
-		 global $log;
-                 $log->debug("Entering get_attachments(".$id.") method ...");
-		// Armando Lüscher 18.10.2005 -> §visibleDescription
-		// Desc: Inserted crm2.createdtime, vtiger_notes.notecontent description, vtiger_users.user_name
-		// Inserted inner join vtiger_users on crm2.smcreatorid= vtiger_users.id
-		$query = "SELECT vtiger_notes.title, vtiger_notes.notecontent AS description,
-			vtiger_notes.filename, vtiger_notes.notesid AS crmid,
-				'Notes      ' AS ActivityType,
-			vtiger_attachments.type AS FileType,
-				crm2.modifiedtime AS lastmodified, crm2.createdtime,
-			vtiger_seattachmentsrel.attachmentsid,
-			vtiger_users.user_name
-			FROM vtiger_notes
-			INNER JOIN vtiger_senotesrel
-				ON vtiger_senotesrel.notesid = vtiger_notes.notesid
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_senotesrel.crmid
-			INNER JOIN vtiger_crmentity crm2
-				ON crm2.crmid = vtiger_notes.notesid
-				AND crm2.deleted = 0
-			LEFT JOIN vtiger_seattachmentsrel
-				ON vtiger_seattachmentsrel.crmid = vtiger_notes.notesid
-			LEFT JOIN vtiger_attachments
-				ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid
-			INNER JOIN vtiger_users
-				ON crm2.smcreatorid = vtiger_users.id
-			WHERE vtiger_crmentity.crmid = ".$id."
-		 UNION ALL
-			SELECT vtiger_attachments.description AS title, vtiger_attachments.description,
-			vtiger_attachments.name AS filename,
-			vtiger_seattachmentsrel.attachmentsid AS crmid,
-				'Attachments' AS ActivityType,
-			vtiger_attachments.type AS FileType,
-				crm2.modifiedtime AS lastmodified, crm2.createdtime,
-			vtiger_attachments.attachmentsid,
-			vtiger_users.user_name
-			FROM vtiger_attachments
-			INNER JOIN vtiger_seattachmentsrel
-				ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_seattachmentsrel.crmid
-			INNER JOIN vtiger_crmentity crm2
-				ON crm2.crmid = vtiger_attachments.attachmentsid
-			INNER JOIN vtiger_users
-				ON crm2.smcreatorid = vtiger_users.id
-			WHERE vtiger_crmentity.crmid = ".$id."
-			ORDER BY createdtime DESC";
-		$log->debug("Exiting get_attachments method ...");
-		return getAttachmentsAndNotes('Accounts',$query,$id);
-	}
-	/**
-	* Function to get Account related Quotes
-	* @param  integer   $id      - accountid
-	* returns related Quotes record in array format
-	*/
-	function get_quotes($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_quotes(".$id.") method ...");
-		global $app_strings;
-		require_once('modules/Quotes/Quote.php');
-
-		$focus = new Quote();
-
-		$button = '';
-		if(isPermitted("Quotes",1,"") == 'yes')
-		{
-			$button .= '<input title="'.$app_strings['LBL_NEW_QUOTE_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_QUOTE_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Quotes\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_QUOTE_BUTTON'].'">&nbsp;</td>';
-		}
-
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_users.user_name,
-			vtiger_groups.groupname,
-			vtiger_crmentity.*,
-			vtiger_quotes.*,
-			vtiger_potential.potentialname,
-			vtiger_account.accountname
-			FROM vtiger_quotes
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_quotes.quoteid
-			LEFT OUTER JOIN vtiger_account
-				ON vtiger_account.accountid = vtiger_quotes.accountid
-			LEFT OUTER JOIN vtiger_potential
-				ON vtiger_potential.potentialid = vtiger_quotes.potentialid
-			LEFT JOIN vtiger_quotegrouprelation
-				ON vtiger_quotes.quoteid = vtiger_quotegrouprelation.quoteid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_quotegrouprelation.groupname
-			LEFT JOIN vtiger_users
-				ON vtiger_crmentity.smownerid = vtiger_users.id
-			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_account.accountid = ".$id;
-		$log->debug("Exiting get_quotes method ...");
-		return GetRelatedList('Accounts','Quotes',$focus,$query,$button,$returnset);
-	}
-	/**
-	* Function to get Account related Invoices 
-	* @param  integer   $id      - accountid
-	* returns related Invoices record in array format
-	*/
-	function get_invoices($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_invoices(".$id.") method ...");
-		global $app_strings;
-		require_once('modules/Invoice/Invoice.php');
-
-		$focus = new Invoice();
-
-		$button = '';
-		if(isPermitted("Invoice",1,"") == 'yes')
-		{
-			$button .= '<input title="'.$app_strings['LBL_NEW_INVOICE_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_INVOICE_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Invoice\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_INVOICE_BUTTON'].'">&nbsp;</td>';
-		}
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_users.user_name,
-			vtiger_groups.groupname,
-			vtiger_crmentity.*,
-			vtiger_invoice.*,
-			vtiger_account.accountname,
-			vtiger_salesorder.subject AS salessubject
-			FROM vtiger_invoice
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_invoice.invoiceid
-			LEFT OUTER JOIN vtiger_account
-				ON vtiger_account.accountid = vtiger_invoice.accountid
-			LEFT OUTER JOIN vtiger_salesorder
-				ON vtiger_salesorder.salesorderid = vtiger_invoice.salesorderid
-			LEFT JOIN vtiger_invoicegrouprelation
-				ON vtiger_invoice.invoiceid = vtiger_invoicegrouprelation.invoiceid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_invoicegrouprelation.groupname
-			LEFT JOIN vtiger_users
-				ON vtiger_crmentity.smownerid = vtiger_users.id
-			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_account.accountid = ".$id;
-		$log->debug("Exiting get_invoices method ...");
-		return GetRelatedList('Accounts','Invoice',$focus,$query,$button,$returnset);
-	}
-
-	/**
-	* Function to get Account related SalesOrder 
-	* @param  integer   $id      - accountid
-	* returns related SalesOrder record in array format
-	*/
-	function get_salesorder($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_salesorder(".$id.") method ...");
-		require_once('modules/SalesOrder/SalesOrder.php');
-		global $app_strings;
-
-		$focus = new SalesOrder();
-
-		$button = '';
-		if(isPermitted("SalesOrder",1,"") == 'yes')
-		{
-			$button .= '<input title="'.$app_strings['LBL_NEW_SORDER_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_SORDER_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'SalesOrder\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_SORDER_BUTTON'].'">&nbsp;</td>';
-		}
-
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_crmentity.*,
-			vtiger_salesorder.*,
-			vtiger_quotes.subject AS quotename,
-			vtiger_account.accountname,
-			vtiger_users.user_name,
-			vtiger_groups.groupname
-			FROM vtiger_salesorder
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_salesorder.salesorderid
-			LEFT OUTER JOIN vtiger_quotes
-				ON vtiger_quotes.quoteid = vtiger_salesorder.quoteid
-			LEFT OUTER JOIN vtiger_account
-				ON vtiger_account.accountid = vtiger_salesorder.accountid
-			LEFT JOIN vtiger_sogrouprelation
-				ON vtiger_salesorder.salesorderid = vtiger_sogrouprelation.salesorderid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_sogrouprelation.groupname
-			LEFT JOIN vtiger_users
-				ON vtiger_crmentity.smownerid = vtiger_users.id
-			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_salesorder.accountid = ".$id;
-		$log->debug("Exiting get_salesorder method ...");		
-		return GetRelatedList('Accounts','SalesOrder',$focus,$query,$button,$returnset);
-	}
-	/**
-	* Function to get Account related Tickets
-	* @param  integer   $id      - accountid
-	* returns related Ticket record in array format
-	*/
-	function get_tickets($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_tickets(".$id.") method ...");
-		global $app_strings;
-
-		$focus = new HelpDesk();
-		$button = '';
-
-		$button .= '<td valign="bottom" align="right"><input title="New TICKET" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'HelpDesk\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_TICKET'].'">&nbsp;</td>';
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_users.user_name, vtiger_users.id,
-			vtiger_troubletickets.title, vtiger_troubletickets.ticketid AS crmid,
-			vtiger_troubletickets.status, vtiger_troubletickets.priority,
-			vtiger_troubletickets.parent_id,
-			vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime
-			FROM vtiger_troubletickets
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
-			LEFT JOIN vtiger_account
-				ON vtiger_account.accountid = vtiger_troubletickets.parent_id
-			LEFT JOIN vtiger_contactdetails
-			        ON vtiger_contactdetails.contactid=vtiger_troubletickets.parent_id
-			LEFT JOIN vtiger_users
-				ON vtiger_users.id=vtiger_crmentity.smownerid
-			LEFT JOIN vtiger_ticketgrouprelation
-				ON vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_ticketgrouprelation.groupname
-			WHERE  vtiger_troubletickets.parent_id=".$id." or " ;
-
-		$query .= "vtiger_troubletickets.parent_id in(SELECT vtiger_contactdetails.contactid
-			FROM vtiger_contactdetails
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
-			LEFT JOIN vtiger_contactgrouprelation
-				ON vtiger_contactdetails.contactid = vtiger_contactgrouprelation.contactid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_contactgrouprelation.groupname
-			LEFT JOIN vtiger_users
-				ON vtiger_crmentity.smownerid = vtiger_users.id
-			WHERE vtiger_crmentity.deleted = 0
-			AND vtiger_contactdetails.accountid = ".$id;
-
-			
-		//Appending the security parameter
-		global $current_user;
-		require('user_privileges/user_privileges_'.$current_user->id.'.php');
-		require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-		$tab_id=getTabid('Contacts');
-		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
-		{
-			$sec_parameter=getListViewSecurityParameter('Contacts');
-			$query .= ' '.$sec_parameter;
-
-		}
-
-		$query .= ") ";
-		
-		/*
-		$query .= " UNION ALL
-			SELECT vtiger_users.user_name, vtiger_users.id,
-			vtiger_troubletickets.title, vtiger_troubletickets.ticketid AS crmid,
-			vtiger_troubletickets.status, vtiger_troubletickets.priority,
-			vtiger_troubletickets.parent_id,
-			vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime
-			FROM vtiger_troubletickets
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
-			LEFT JOIN vtiger_contactdetails
-				ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id
-			LEFT JOIN vtiger_account
-				ON vtiger_account.accountid = vtiger_contactdetails.accountid
-			LEFT JOIN vtiger_users
-				ON vtiger_users.id = vtiger_crmentity.smownerid
-			LEFT JOIN vtiger_ticketgrouprelation
-				ON vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
-			LEFT JOIN vtiger_groups
-				ON vtiger_groups.groupname = vtiger_ticketgrouprelation.groupname
-			WHERE vtiger_account.accountid = ".$id;
-		*/	
-		$log->debug("Exiting get_tickets method ...");
-		return GetRelatedList('Accounts','HelpDesk',$focus,$query,$button,$returnset);
-	}
-	/**
-	* Function to get Account related Products 
-	* @param  integer   $id      - accountid
-	* returns related Products record in array format
-	*/
-	function get_products($id)
-	{
-		global $log, $singlepane_view;
-                $log->debug("Entering get_products(".$id.") method ...");
-		require_once('modules/Products/Product.php');
-		global $app_strings;
-
-		$focus = new Product();
-
-		$button = '';
-
-		if(isPermitted("Products",1,"") == 'yes')
-		{
-
-
-			$button .= '<input title="New Product" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Accounts\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_PRODUCT'].'">&nbsp;';
-		}
-		if($singlepane_view == 'true')
-			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
-		else
-			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
-
-		$query = "SELECT vtiger_products.productid, vtiger_products.productname,
-			vtiger_products.productcode, vtiger_products.commissionrate,
-			vtiger_products.qty_per_unit, vtiger_products.unit_price,
-			vtiger_crmentity.crmid, vtiger_crmentity.smownerid
-			FROM vtiger_products
-			INNER JOIN vtiger_seproductsrel
-				ON vtiger_products.productid = vtiger_seproductsrel.productid
-			INNER JOIN vtiger_crmentity
-				ON vtiger_crmentity.crmid = vtiger_products.productid
-			INNER JOIN vtiger_account
-				ON vtiger_account.accountid = vtiger_seproductsrel.crmid
-			WHERE vtiger_account.accountid = ".$id."
-			AND vtiger_crmentity.deleted = 0";
-		$log->debug("Exiting get_products method ...");
-		return GetRelatedList('Accounts','Products',$focus,$query,$button,$returnset);
-	}
-
-	/** Function to export the account records in CSV Format
-	* @param reference variable - order by is passed when the query is executed
-	* @param reference variable - where condition is passed when the query is executed
-	* Returns Export Accounts Query.
-	*/
-	function create_export_query(&$order_by, &$where)
-	{
-		global $log;
-                $log->debug("Entering create_export_query(".$order_by.",".$where.") method ...");
-		if($this->checkIfCustomTableExists('vtiger_accountscf'))
-		{
-
-			$query = $this->constructCustomQueryAddendum('vtiger_accountscf','Accounts') . "
-				vtiger_account.*,
-					".$this->entity_table.".*,
-				vtiger_accountbillads.city AS billing_city,
-				vtiger_accountbillads.country AS billing_country,
-				vtiger_accountbillads.code AS billing_code,
-				vtiger_accountbillads.state AS billing_state,
-				vtiger_accountbillads.street AS billing_street,
-				vtiger_accountshipads.city AS shipping_city,
-				vtiger_accountshipads.country AS shipping_country,
-				vtiger_accountshipads.code AS shipping_code,
-				vtiger_accountshipads.state AS shipping_state,
-				vtiger_accountshipads.street AS shipping_street,
-				vtiger_users.user_name,
-				vtiger_users.status AS user_status
-				FROM ".$this->entity_table."
-				INNER JOIN vtiger_account
-					ON vtiger_crmentity.crmid = vtiger_account.accountid
-				LEFT JOIN vtiger_accountbillads
-					ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid
-				LEFT JOIN vtiger_accountshipads
-					ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid
-				LEFT JOIN vtiger_accountscf 
-					ON vtiger_accountscf.accountid = vtiger_account.accountid
-				LEFT JOIN vtiger_users
-					ON vtiger_crmentity.smownerid = vtiger_users.id ";
-
-		}
-		else
-		{
-			$query = "SELECT vtiger_account.*,
-					".$this->entity_table.".*,
-				vtiger_accountbillads.city AS billing_city,
-				vtiger_accountbillads.country AS billing_country,
-				vtiger_accountbillads.code AS billing_code,
-				vtiger_accountbillads.state AS billing_state,
-				vtiger_accountbillads.street AS billing_street,
-				vtiger_accountshipads.city AS shipping_city,
-				vtiger_accountshipads.country AS shipping_country,
-				vtiger_accountshipads.code AS shipping_code,
-				vtiger_accountshipads.state AS shipping_state,
-				vtiger_accountshipads.street AS shipping_street,
-				vtiger_users.user_name,
-				vtiger_users.status AS user_status
-				FROM ".$this->entity_table."
-				INNER JOIN vtiger_account
-					ON vtiger_crmentity.crmid = vtiger_account.accountid
-				LEFT JOIN vtiger_accountbillads
-					ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid
-				LEFT JOIN vtiger_accountshipads
-					ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid
-				LEFT JOIN vtiger_users
-					ON vtiger_crmentity.smownerid = vtiger_users.id ";
-		}
-
-		$where_auto = " vtiger_users.status = 'Active'
-			AND vtiger_crmentity.deleted = 0 ";
-
-		if($where != "")
-			$query .= "WHERE ($where) AND ".$where_auto;
-		else
-			$query .= "WHERE ".$where_auto;
-
-		if(!empty($order_by))
-			$query .= " ORDER BY $order_by";
-		$log->debug("Exiting create_export_query method ...");
-		return $query;
-	}
-
-	/** Function to get the Columnnames of the Account Record
-	* Used By vtigerCRM Word Plugin
-	* Returns the Merge Fields for Word Plugin
-	*/
-	function getColumnNames_Acnt()
-	{
-		global $log,$current_user;
-		$log->debug("Entering getColumnNames_Acnt() method ...");
-		require('user_privileges/user_privileges_'.$current_user->id.'.php');
-		if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
-		{
-			$sql1 = "SELECT fieldlabel FROM vtiger_field WHERE tabid = 6";
-		}else
-		{
-			$profileList = getCurrentUserProfileList();
-			$sql1 = "select fieldlabel from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=6 and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList;
-		} 
-		$result = $this->db->query($sql1);
-		$numRows = $this->db->num_rows($result);
-		for($i=0; $i < $numRows;$i++)
-		{
-			$custom_fields[$i] = $this->db->query_result($result,$i,"fieldlabel");
-			$custom_fields[$i] = ereg_replace(" ","",$custom_fields[$i]);
-			$custom_fields[$i] = strtoupper($custom_fields[$i]);
-		}
-		$mergeflds = $custom_fields;
-		$log->debug("Exiting getColumnNames_Acnt method ...");
-		return $mergeflds;
-	}
-
-}
-
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/Account.php,v 1.53 2005/04/28 08:06:45 rank Exp $
+ * Description:  Defines the Account SugarBean Account entity with the necessary
+ * methods and variables.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+ ********************************************************************************/
+
+include_once('config.php');
+require_once('include/logging.php');
+require_once('include/database/PearDatabase.php');
+require_once('data/SugarBean.php');
+require_once('data/CRMEntity.php');
+require_once('modules/Contacts/Contact.php');
+require_once('modules/Potentials/Opportunity.php');
+require_once('modules/Calendar/Activity.php');
+require_once('modules/Notes/Note.php');
+require_once('modules/Emails/Email.php');
+require_once('include/utils/utils.php');
+require_once('user_privileges/default_module_view.php');
+
+// Account is used to store vtiger_account information.
+class Account extends CRMEntity {
+	var $log;
+	var $db;
+
+	var $table_name = "vtiger_account";
+	var $tab_name = Array('vtiger_crmentity','vtiger_account','vtiger_accountbillads','vtiger_accountshipads','vtiger_accountscf','vtiger_entity2org');
+	var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_account'=>'accountid','vtiger_accountbillads'=>'accountaddressid','vtiger_accountshipads'=>'accountaddressid','vtiger_accountscf'=>'accountid','vtiger_entity2org'=>'crmid');
+
+	var $entity_table = "vtiger_crmentity";
+
+	var $billadr_table = "vtiger_accountbillads";
+
+	var $object_name = "Accounts";
+	// Mike Crowe Mod --------------------------------------------------------added for general search
+	var $base_table_name = "vtiger_account";
+	var $cf_table_name = "vtiger_accountscf";
+
+	var $new_schema = true;
+
+	var $module_id = "accountid";
+
+	var $column_fields = Array();
+
+	var $sortby_fields = Array('accountname','city','website','phone','smownerid');		
+
+
+	// This is the list of vtiger_fields that are in the lists.
+	var $list_fields = Array(
+			'Account Name'=>Array('vtiger_account'=>'accountname'),
+			'City'=>Array('vtiger_accountbillads'=>'city'), 
+			'Website'=>Array('vtiger_account'=>'website'),
+			'Phone'=>Array('vtiger_account'=> 'phone'),
+			'Assigned To'=>Array('vtiger_crmentity'=>'smownerid')
+			);
+
+	var $list_fields_name = Array(
+			'Account Name'=>'accountname',
+			'City'=>'bill_city',
+			'Website'=>'website',
+			'Phone'=>'phone',
+			'Assigned To'=>'assigned_user_id'
+			);
+	var $list_link_field= 'accountname';
+
+	var $search_fields = Array(
+			'Account Name'=>Array('vtiger_account'=>'accountname'),
+			'City'=>Array('vtiger_accountbillads'=>'city'), 
+			);
+
+	var $search_fields_name = Array(
+			'Account Name'=>'accountname',
+			'City'=>'bill_city',
+			);
+
+	// This is the list of vtiger_fields that are required.
+	var $required_fields =  array("accountname"=>1);
+
+	//Added these variables which are used as default order by and sortorder in ListView
+	var $default_order_by = 'accountname';
+	var $default_sort_order = 'ASC';
+
+	function Account() {
+		$this->log =LoggerManager::getLogger('account');
+		$this->db = new PearDatabase();
+		$this->column_fields = getColumnFields('Accounts');
+	}
+
+	// Mike Crowe Mod --------------------------------------------------------Default ordering for us
+	/**
+	 * Function to get sort order
+ 	 * return string  $sorder    - sortorder string either 'ASC' or 'DESC'
+	 */
+	function getSortOrder()
+	{
+		global $log;
+                $log->debug("Entering getSortOrder() method ...");	
+		if(isset($_REQUEST['sorder'])) 
+			$sorder = $_REQUEST['sorder'];
+		else
+			$sorder = (($_SESSION['ACCOUNTS_SORT_ORDER'] != '')?($_SESSION['ACCOUNTS_SORT_ORDER']):($this->default_sort_order));
+		$log->debug("Exiting getSortOrder() method ...");
+		return $sorder;
+	}
+	/**
+	 * Function to get order by
+	 * return string  $order_by    - fieldname(eg: 'accountname')
+ 	 */
+	function getOrderBy()
+	{
+		global $log;
+                $log->debug("Entering getOrderBy() method ...");
+		if (isset($_REQUEST['order_by'])) 
+			$order_by = $_REQUEST['order_by'];
+		else
+			$order_by = (($_SESSION['ACCOUNTS_ORDER_BY'] != '')?($_SESSION['ACCOUNTS_ORDER_BY']):($this->default_order_by));
+		$log->debug("Exiting getOrderBy method ...");
+		return $order_by;
+	}	
+	// Mike Crowe Mod --------------------------------------------------------
+
+
+	/** Returns a list of the associated contacts
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function get_contacts($id)
+	{	
+		global $log, $singlepane_view;
+                $log->debug("Entering get_contacts(".$id.") method ...");
+		global $mod_strings;
+
+		$focus = new Contact();
+
+		$button = '';
+		if(isPermitted("Contacts",1,"") == 'yes')
+		{
+			$button .= '<input title="New Contact" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Contacts\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_CONTACT'].'">&nbsp;</td>';
+		}
+
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		//SQL
+		$query = "SELECT vtiger_contactdetails.*,
+			vtiger_crmentity.crmid,
+                        vtiger_crmentity.smownerid,
+			vtiger_users.user_name
+			FROM vtiger_contactdetails
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
+			LEFT JOIN vtiger_contactgrouprelation
+				ON vtiger_contactdetails.contactid = vtiger_contactgrouprelation.contactid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_contactgrouprelation.groupname
+			LEFT JOIN vtiger_users
+				ON vtiger_crmentity.smownerid = vtiger_users.id
+			WHERE vtiger_crmentity.deleted = 0
+			AND vtiger_contactdetails.accountid = ".$id;
+		$log->debug("Exiting get_contacts method ...");
+		return GetRelatedList('Accounts','Contacts',$focus,$query,$button,$returnset);
+	}
+
+	/** Returns a list of the associated opportunities
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function get_opportunities($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_opportunities(".$id.") method ...");
+		global $mod_strings;
+
+		$focus = new Potential();
+		$button = '';
+
+		if(isPermitted("Potentials",1,"") == 'yes')
+		{
+			$button .= '<input title="New Potential" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Potentials\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_POTENTIAL'].'">';
+		}
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_potential.potentialid, vtiger_potential.accountid,
+			vtiger_potential.potentialname, vtiger_potential.sales_stage,
+			vtiger_potential.potentialtype, vtiger_potential.amount,
+			vtiger_potential.closingdate, vtiger_potential.potentialtype,
+			vtiger_users.user_name,
+			vtiger_crmentity.crmid, vtiger_crmentity.smownerid
+			FROM vtiger_potential
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_potential.potentialid
+			LEFT JOIN vtiger_users
+				ON vtiger_crmentity.smownerid = vtiger_users.id
+			LEFT JOIN vtiger_potentialgrouprelation
+				ON vtiger_potential.potentialid = vtiger_potentialgrouprelation.potentialid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_potentialgrouprelation.groupname
+			WHERE vtiger_crmentity.deleted = 0
+			AND vtiger_potential.accountid = ".$id;
+		$log->debug("Exiting get_opportunities method ...");
+
+		return GetRelatedList('Accounts','Potentials',$focus,$query,$button,$returnset);
+	}
+
+	/** Returns a list of the associated tasks
+	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
+	 * All Rights Reserved..
+	 * Contributor(s): ______________________________________..
+	 */
+	function get_activities($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_activities(".$id.") method ...");
+		global $mod_strings;
+
+		$focus = new Activity();
+		$button = '';
+		if(isPermitted("Calendar",1,"") == 'yes')
+		{
+
+			$button .= '<input title="New Task" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Accounts\';this.form.activity_mode.value=\'Task\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_TASK'].'">&nbsp;';
+			$button .= '<input title="New Event" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Accounts\';this.form.activity_mode.value=\'Events\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_EVENT'].'">&nbsp;</td>';
+		}
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_activity.*,
+			vtiger_seactivityrel.*,
+			vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
+			vtiger_crmentity.modifiedtime,
+			vtiger_users.user_name,
+			vtiger_recurringevents.recurringtype
+			FROM vtiger_activity
+			INNER JOIN vtiger_seactivityrel
+				ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_activity.activityid
+			LEFT JOIN vtiger_users
+				ON vtiger_users.id = vtiger_crmentity.smownerid
+			LEFT OUTER JOIN vtiger_recurringevents
+				ON vtiger_recurringevents.activityid = vtiger_activity.activityid
+			LEFT JOIN vtiger_activitygrouprelation
+				ON vtiger_activitygrouprelation.activityid = vtiger_crmentity.crmid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_activitygrouprelation.groupname
+			WHERE vtiger_seactivityrel.crmid = ".$id."
+			AND (activitytype='Task'
+				OR activitytype='Call'
+				OR activitytype='Meeting')
+			AND vtiger_crmentity.deleted = 0
+			AND ((vtiger_activity.status IS NOT NULL
+					AND vtiger_activity.status != 'Completed')
+				AND (vtiger_activity.status IS NOT NULL
+					AND vtiger_activity.status != 'Deferred')
+				OR (vtiger_activity.eventstatus !=''
+					AND  vtiger_activity.eventstatus != 'Held'))";
+		$log->debug("Exiting get_activities method ...");
+		return GetRelatedList('Accounts','Calendar',$focus,$query,$button,$returnset);
+
+	}
+	/**
+	 * Function to get Account related Task & Event which have activity type Held, Completed or Deferred.
+ 	 * @param  integer   $id      - accountid
+ 	 * returns related Task or Event record in array format
+ 	 */
+	function get_history($id)
+	{
+		global $log;
+                $log->debug("Entering get_history(".$id.") method ...");
+		$query = "SELECT vtiger_activity.activityid, vtiger_activity.subject,
+			vtiger_activity.status, vtiger_activity.eventstatus,
+			vtiger_activity.activitytype,
+			vtiger_crmentity.modifiedtime, vtiger_crmentity.createdtime,
+			vtiger_crmentity.description,
+			vtiger_users.user_name
+			FROM vtiger_activity
+			INNER JOIN vtiger_seactivityrel
+				ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_activity.activityid
+			LEFT JOIN vtiger_activitygrouprelation
+				ON vtiger_activitygrouprelation.activityid = vtiger_activity.activityid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_activitygrouprelation.groupname
+			INNER JOIN vtiger_users
+				ON vtiger_crmentity.smcreatorid = vtiger_users.id
+			WHERE (vtiger_activity.activitytype = 'Meeting'
+				OR vtiger_activity.activitytype = 'Call'
+				OR vtiger_activity.activitytype = 'Task')
+			AND (vtiger_activity.status = 'Completed'
+				OR vtiger_activity.status = 'Deferred'
+				OR (vtiger_activity.eventstatus = 'Held'
+					AND vtiger_activity.eventstatus != ''))
+			AND vtiger_seactivityrel.crmid = ".$id;
+		//Don't add order by, because, for security, one more condition will be added with this query in include/RelatedListView.php
+		$log->debug("Exiting get_history method ...");
+		return getHistory('Accounts',$query,$id);
+	}
+	/**
+	 * Function to get Account related Attachments
+ 	 * @param  integer   $id      - accountid
+ 	 * returns related Attachment record in array format
+ 	 */
+	function get_attachments($id)
+	{
+		 global $log;
+                 $log->debug("Entering get_attachments(".$id.") method ...");
+		// Armando Lüscher 18.10.2005 -> §visibleDescription
+		// Desc: Inserted crm2.createdtime, vtiger_notes.notecontent description, vtiger_users.user_name
+		// Inserted inner join vtiger_users on crm2.smcreatorid= vtiger_users.id
+		$query = "SELECT vtiger_notes.title, vtiger_notes.notecontent AS description,
+			vtiger_notes.filename, vtiger_notes.notesid AS crmid,
+				'Notes      ' AS ActivityType,
+			vtiger_attachments.type AS FileType,
+				crm2.modifiedtime AS lastmodified, crm2.createdtime,
+			vtiger_seattachmentsrel.attachmentsid,
+			vtiger_users.user_name
+			FROM vtiger_notes
+			INNER JOIN vtiger_senotesrel
+				ON vtiger_senotesrel.notesid = vtiger_notes.notesid
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_senotesrel.crmid
+			INNER JOIN vtiger_crmentity crm2
+				ON crm2.crmid = vtiger_notes.notesid
+				AND crm2.deleted = 0
+			LEFT JOIN vtiger_seattachmentsrel
+				ON vtiger_seattachmentsrel.crmid = vtiger_notes.notesid
+			LEFT JOIN vtiger_attachments
+				ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid
+			INNER JOIN vtiger_users
+				ON crm2.smcreatorid = vtiger_users.id
+			WHERE vtiger_crmentity.crmid = ".$id."
+		 UNION ALL
+			SELECT vtiger_attachments.description AS title, vtiger_attachments.description,
+			vtiger_attachments.name AS filename,
+			vtiger_seattachmentsrel.attachmentsid AS crmid,
+				'Attachments' AS ActivityType,
+			vtiger_attachments.type AS FileType,
+				crm2.modifiedtime AS lastmodified, crm2.createdtime,
+			vtiger_attachments.attachmentsid,
+			vtiger_users.user_name
+			FROM vtiger_attachments
+			INNER JOIN vtiger_seattachmentsrel
+				ON vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_seattachmentsrel.crmid
+			INNER JOIN vtiger_crmentity crm2
+				ON crm2.crmid = vtiger_attachments.attachmentsid
+			INNER JOIN vtiger_users
+				ON crm2.smcreatorid = vtiger_users.id
+			WHERE vtiger_crmentity.crmid = ".$id."
+			ORDER BY createdtime DESC";
+		$log->debug("Exiting get_attachments method ...");
+		return getAttachmentsAndNotes('Accounts',$query,$id);
+	}
+	/**
+	* Function to get Account related Quotes
+	* @param  integer   $id      - accountid
+	* returns related Quotes record in array format
+	*/
+	function get_quotes($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_quotes(".$id.") method ...");
+		global $app_strings;
+		require_once('modules/Quotes/Quote.php');
+
+		$focus = new Quote();
+
+		$button = '';
+		if(isPermitted("Quotes",1,"") == 'yes')
+		{
+			$button .= '<input title="'.$app_strings['LBL_NEW_QUOTE_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_QUOTE_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Quotes\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_QUOTE_BUTTON'].'">&nbsp;</td>';
+		}
+
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_users.user_name,
+			vtiger_groups.groupname,
+			vtiger_crmentity.*,
+			vtiger_quotes.*,
+			vtiger_potential.potentialname,
+			vtiger_account.accountname
+			FROM vtiger_quotes
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_quotes.quoteid
+			LEFT OUTER JOIN vtiger_account
+				ON vtiger_account.accountid = vtiger_quotes.accountid
+			LEFT OUTER JOIN vtiger_potential
+				ON vtiger_potential.potentialid = vtiger_quotes.potentialid
+			LEFT JOIN vtiger_quotegrouprelation
+				ON vtiger_quotes.quoteid = vtiger_quotegrouprelation.quoteid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_quotegrouprelation.groupname
+			LEFT JOIN vtiger_users
+				ON vtiger_crmentity.smownerid = vtiger_users.id
+			WHERE vtiger_crmentity.deleted = 0
+			AND vtiger_account.accountid = ".$id;
+		$log->debug("Exiting get_quotes method ...");
+		return GetRelatedList('Accounts','Quotes',$focus,$query,$button,$returnset);
+	}
+	/**
+	* Function to get Account related Invoices 
+	* @param  integer   $id      - accountid
+	* returns related Invoices record in array format
+	*/
+	function get_invoices($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_invoices(".$id.") method ...");
+		global $app_strings;
+		require_once('modules/Invoice/Invoice.php');
+
+		$focus = new Invoice();
+
+		$button = '';
+		if(isPermitted("Invoice",1,"") == 'yes')
+		{
+			$button .= '<input title="'.$app_strings['LBL_NEW_INVOICE_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_INVOICE_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Invoice\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_INVOICE_BUTTON'].'">&nbsp;</td>';
+		}
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_users.user_name,
+			vtiger_groups.groupname,
+			vtiger_crmentity.*,
+			vtiger_invoice.*,
+			vtiger_account.accountname,
+			vtiger_salesorder.subject AS salessubject
+			FROM vtiger_invoice
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_invoice.invoiceid
+			LEFT OUTER JOIN vtiger_account
+				ON vtiger_account.accountid = vtiger_invoice.accountid
+			LEFT OUTER JOIN vtiger_salesorder
+				ON vtiger_salesorder.salesorderid = vtiger_invoice.salesorderid
+			LEFT JOIN vtiger_invoicegrouprelation
+				ON vtiger_invoice.invoiceid = vtiger_invoicegrouprelation.invoiceid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_invoicegrouprelation.groupname
+			LEFT JOIN vtiger_users
+				ON vtiger_crmentity.smownerid = vtiger_users.id
+			WHERE vtiger_crmentity.deleted = 0
+			AND vtiger_account.accountid = ".$id;
+		$log->debug("Exiting get_invoices method ...");
+		return GetRelatedList('Accounts','Invoice',$focus,$query,$button,$returnset);
+	}
+
+	/**
+	* Function to get Account related SalesOrder 
+	* @param  integer   $id      - accountid
+	* returns related SalesOrder record in array format
+	*/
+	function get_salesorder($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_salesorder(".$id.") method ...");
+		require_once('modules/SalesOrder/SalesOrder.php');
+		global $app_strings;
+
+		$focus = new SalesOrder();
+
+		$button = '';
+		if(isPermitted("SalesOrder",1,"") == 'yes')
+		{
+			$button .= '<input title="'.$app_strings['LBL_NEW_SORDER_BUTTON_TITLE'].'" accessyKey="'.$app_strings['LBL_NEW_SORDER_BUTTON_KEY'].'" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'SalesOrder\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_SORDER_BUTTON'].'">&nbsp;</td>';
+		}
+
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_crmentity.*,
+			vtiger_salesorder.*,
+			vtiger_quotes.subject AS quotename,
+			vtiger_account.accountname,
+			vtiger_users.user_name,
+			vtiger_groups.groupname
+			FROM vtiger_salesorder
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_salesorder.salesorderid
+			LEFT OUTER JOIN vtiger_quotes
+				ON vtiger_quotes.quoteid = vtiger_salesorder.quoteid
+			LEFT OUTER JOIN vtiger_account
+				ON vtiger_account.accountid = vtiger_salesorder.accountid
+			LEFT JOIN vtiger_sogrouprelation
+				ON vtiger_salesorder.salesorderid = vtiger_sogrouprelation.salesorderid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_sogrouprelation.groupname
+			LEFT JOIN vtiger_users
+				ON vtiger_crmentity.smownerid = vtiger_users.id
+			WHERE vtiger_crmentity.deleted = 0
+			AND vtiger_salesorder.accountid = ".$id;
+		$log->debug("Exiting get_salesorder method ...");		
+		return GetRelatedList('Accounts','SalesOrder',$focus,$query,$button,$returnset);
+	}
+	/**
+	* Function to get Account related Tickets
+	* @param  integer   $id      - accountid
+	* returns related Ticket record in array format
+	*/
+	function get_tickets($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_tickets(".$id.") method ...");
+		global $app_strings;
+
+		$focus = new HelpDesk();
+		$button = '';
+
+		$button .= '<td valign="bottom" align="right"><input title="New TICKET" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'HelpDesk\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_TICKET'].'">&nbsp;</td>';
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_users.user_name, vtiger_users.id,
+			vtiger_troubletickets.title, vtiger_troubletickets.ticketid AS crmid,
+			vtiger_troubletickets.status, vtiger_troubletickets.priority,
+			vtiger_troubletickets.parent_id,
+			vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime
+			FROM vtiger_troubletickets
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
+			LEFT JOIN vtiger_account
+				ON vtiger_account.accountid = vtiger_troubletickets.parent_id
+			LEFT JOIN vtiger_contactdetails
+			        ON vtiger_contactdetails.contactid=vtiger_troubletickets.parent_id
+			LEFT JOIN vtiger_users
+				ON vtiger_users.id=vtiger_crmentity.smownerid
+			LEFT JOIN vtiger_ticketgrouprelation
+				ON vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_ticketgrouprelation.groupname
+			WHERE  vtiger_troubletickets.parent_id=".$id." or " ;
+
+		$query .= "vtiger_troubletickets.parent_id in(SELECT vtiger_contactdetails.contactid
+			FROM vtiger_contactdetails
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
+			LEFT JOIN vtiger_contactgrouprelation
+				ON vtiger_contactdetails.contactid = vtiger_contactgrouprelation.contactid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_contactgrouprelation.groupname
+			LEFT JOIN vtiger_users
+				ON vtiger_crmentity.smownerid = vtiger_users.id
+			WHERE vtiger_crmentity.deleted = 0
+			AND vtiger_contactdetails.accountid = ".$id;
+
+			
+		//Appending the security parameter
+		global $current_user;
+		require('user_privileges/user_privileges_'.$current_user->id.'.php');
+		require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+		$tab_id=getTabid('Contacts');
+		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3)
+		{
+			$sec_parameter=getListViewSecurityParameter('Contacts');
+			$query .= ' '.$sec_parameter;
+
+		}
+
+		$query .= ") ";
+		
+		/*
+		$query .= " UNION ALL
+			SELECT vtiger_users.user_name, vtiger_users.id,
+			vtiger_troubletickets.title, vtiger_troubletickets.ticketid AS crmid,
+			vtiger_troubletickets.status, vtiger_troubletickets.priority,
+			vtiger_troubletickets.parent_id,
+			vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime
+			FROM vtiger_troubletickets
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid
+			LEFT JOIN vtiger_contactdetails
+				ON vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id
+			LEFT JOIN vtiger_account
+				ON vtiger_account.accountid = vtiger_contactdetails.accountid
+			LEFT JOIN vtiger_users
+				ON vtiger_users.id = vtiger_crmentity.smownerid
+			LEFT JOIN vtiger_ticketgrouprelation
+				ON vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
+			LEFT JOIN vtiger_groups
+				ON vtiger_groups.groupname = vtiger_ticketgrouprelation.groupname
+			WHERE vtiger_account.accountid = ".$id;
+		*/	
+		$log->debug("Exiting get_tickets method ...");
+		return GetRelatedList('Accounts','HelpDesk',$focus,$query,$button,$returnset);
+	}
+	/**
+	* Function to get Account related Products 
+	* @param  integer   $id      - accountid
+	* returns related Products record in array format
+	*/
+	function get_products($id)
+	{
+		global $log, $singlepane_view;
+                $log->debug("Entering get_products(".$id.") method ...");
+		require_once('modules/Products/Product.php');
+		global $app_strings;
+
+		$focus = new Product();
+
+		$button = '';
+
+		if(isPermitted("Products",1,"") == 'yes')
+		{
+
+
+			$button .= '<input title="New Product" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Accounts\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_PRODUCT'].'">&nbsp;';
+		}
+		if($singlepane_view == 'true')
+			$returnset = '&return_module=Accounts&return_action=DetailView&return_id='.$id;
+		else
+			$returnset = '&return_module=Accounts&return_action=CallRelatedList&return_id='.$id;
+
+		$query = "SELECT vtiger_products.productid, vtiger_products.productname,
+			vtiger_products.productcode, vtiger_products.commissionrate,
+			vtiger_products.qty_per_unit, vtiger_products.unit_price,
+			vtiger_crmentity.crmid, vtiger_crmentity.smownerid
+			FROM vtiger_products
+			INNER JOIN vtiger_seproductsrel
+				ON vtiger_products.productid = vtiger_seproductsrel.productid
+			INNER JOIN vtiger_crmentity
+				ON vtiger_crmentity.crmid = vtiger_products.productid
+			INNER JOIN vtiger_account
+				ON vtiger_account.accountid = vtiger_seproductsrel.crmid
+			WHERE vtiger_account.accountid = ".$id."
+			AND vtiger_crmentity.deleted = 0";
+		$log->debug("Exiting get_products method ...");
+		return GetRelatedList('Accounts','Products',$focus,$query,$button,$returnset);
+	}
+
+	/** Function to export the account records in CSV Format
+	* @param reference variable - order by is passed when the query is executed
+	* @param reference variable - where condition is passed when the query is executed
+	* Returns Export Accounts Query.
+	*/
+	function create_export_query(&$order_by, &$where)
+	{
+		global $log;
+		global $current_user;
+                $log->debug("Entering create_export_query(".$order_by.",".$where.") method ...");
+
+		include("include/utils/ExportUtils.php");
+
+		//To get the Permitted fields query and the permitted fields list
+		$sql = getPermittedFieldsQuery("Accounts", "detail_view");
+		$fields_list = getFieldsListFromQuery($sql);
+
+		$query = "SELECT $fields_list FROM ".$this->entity_table."
+				INNER JOIN vtiger_account
+					ON vtiger_crmentity.crmid = vtiger_account.accountid
+				LEFT JOIN vtiger_accountbillads
+					ON vtiger_account.accountid = vtiger_accountbillads.accountaddressid
+				LEFT JOIN vtiger_accountshipads
+					ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid
+				LEFT JOIN vtiger_accountscf
+					ON vtiger_accountscf.accountid = vtiger_account.accountid
+				LEFT JOIN vtiger_accountgrouprelation
+                	                ON vtiger_accountscf.accountid = vtiger_accountgrouprelation.accountid
+	                        LEFT JOIN vtiger_groups
+                        	        ON vtiger_groups.groupname = vtiger_accountgrouprelation.groupname
+				LEFT JOIN vtiger_users
+					ON vtiger_crmentity.smownerid = vtiger_users.id 
+				LEFT JOIN vtiger_account vtiger_account2 
+					ON vtiger_account2.accountid = vtiger_account.parentid
+				";//vtiger_account2 is added to get the Member of account
+
+
+		$where_auto = " vtiger_users.status = 'Active'
+			AND vtiger_crmentity.deleted = 0 ";
+
+		if($where != "")
+			$query .= "WHERE ($where) AND ".$where_auto;
+		else
+			$query .= "WHERE ".$where_auto;
+
+		require('user_privileges/user_privileges_'.$current_user->id.'.php');
+		require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+		//we should add security check when the user has Private Access
+		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[6] == 3)
+		{
+			//Added security check to get the permitted records only
+			$query = $query." ".getListViewSecurityParameter("Accounts");
+		}
+
+		if(!empty($order_by))
+			$query .= " ORDER BY $order_by";
+
+		$log->debug("Exiting create_export_query method ...");
+		return $query;
+	}
+
+	/** Function to get the Columnnames of the Account Record
+	* Used By vtigerCRM Word Plugin
+	* Returns the Merge Fields for Word Plugin
+	*/
+	function getColumnNames_Acnt()
+	{
+		global $log,$current_user;
+		$log->debug("Entering getColumnNames_Acnt() method ...");
+		require('user_privileges/user_privileges_'.$current_user->id.'.php');
+		if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
+		{
+			$sql1 = "SELECT fieldlabel FROM vtiger_field WHERE tabid = 6";
+		}else
+		{
+			$profileList = getCurrentUserProfileList();
+			$sql1 = "select fieldlabel from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=6 and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList;
+		} 
+		$result = $this->db->query($sql1);
+		$numRows = $this->db->num_rows($result);
+		for($i=0; $i < $numRows;$i++)
+		{
+			$custom_fields[$i] = $this->db->query_result($result,$i,"fieldlabel");
+			$custom_fields[$i] = ereg_replace(" ","",$custom_fields[$i]);
+			$custom_fields[$i] = strtoupper($custom_fields[$i]);
+		}
+		$mergeflds = $custom_fields;
+		$log->debug("Exiting getColumnNames_Acnt method ...");
+		return $mergeflds;
+	}
+
+}
+
+?>

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/CallRelatedList.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/CallRelatedList.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/CallRelatedList.php Tue Nov 14 03:16:10 2006
@@ -11,7 +11,7 @@
 
 
 require_once('Smarty_setup.php');
-require_once('modules/Accounts/Account.php');
+require_once('modules/Accounts/Accounts.php');
 require_once('include/utils/utils.php');
 //Redirecting Header for single page layout
 require_once('user_privileges/default_module_view.php');
@@ -22,7 +22,7 @@
 }
 else
 {
-$focus = new Account();
+$focus = new Accounts();
 $currentmodule = $_REQUEST['module'];
 $RECORD = $_REQUEST['record'];
 if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/Delete.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/Delete.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/Delete.php Tue Nov 14 03:16:10 2006
@@ -1,37 +1,37 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the 
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/Delete.php,v 1.5 2005/03/10 09:28:34 shaw Exp $
- * Description:  Deletes an Account record and then redirects the browser to the 
- * defined return URL.
- ********************************************************************************/
-
-require_once('modules/Accounts/Account.php');
-global $mod_strings;
-
-require_once('include/logging.php');
-$log = LoggerManager::getLogger('contact_delete');
-
-$focus = new Account();
-
-if(!isset($_REQUEST['record']))
-	die($mod_strings['ERR_DELETE_RECORD']);
-
-DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
-
-if(isset($_REQUEST['parenttab']) && $_REQUEST['parenttab'] != "") $parenttab = $_REQUEST['parenttab'];
-
-header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']."&parenttab=".$parenttab."&relmodule=".$_REQUEST['module']);
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the 
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/Delete.php,v 1.5 2005/03/10 09:28:34 shaw Exp $
+ * Description:  Deletes an Account record and then redirects the browser to the 
+ * defined return URL.
+ ********************************************************************************/
+
+require_once('modules/Accounts/Accounts.php');
+global $mod_strings;
+
+require_once('include/logging.php');
+$log = LoggerManager::getLogger('contact_delete');
+
+$focus = new Accounts();
+
+if(!isset($_REQUEST['record']))
+	die($mod_strings['ERR_DELETE_RECORD']);
+
+DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
+
+if(isset($_REQUEST['parenttab']) && $_REQUEST['parenttab'] != "") $parenttab = $_REQUEST['parenttab'];
+
+header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']."&parenttab=".$parenttab."&relmodule=".$_REQUEST['module']);
+?>

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/DetailView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/DetailView.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/DetailView.php Tue Nov 14 03:16:10 2006
@@ -22,7 +22,7 @@
 
 require_once('Smarty_setup.php');
 require_once('data/Tracker.php');
-require_once('modules/Accounts/Account.php');
+require_once('modules/Accounts/Accounts.php');
 require_once('include/CustomFieldUtil.php');
 require_once('include/database/PearDatabase.php');
 require_once('include/utils/utils.php');
@@ -32,7 +32,10 @@
 global $app_list_strings;
 global $log, $currentModule, $singlepane_view;
 
-$focus = new Account();
+global $current_organization;
+global $user_organizations;
+
+$focus = new Accounts();
 if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
     $focus->retrieve_entity_info($_REQUEST['record'],"Accounts");
     $focus->id = $_REQUEST['record'];	
@@ -118,5 +121,15 @@
 }
 $smarty->assign("SinglePane_View", $singlepane_view);
 
+// Assigned organizations
+$smarty->assign("CURRENT_ORGANIZATION",$current_organization);
+$org_array=array();
+$org=strtok( $user_organizations, "|");
+while( $org !== false) {
+    $org_array[$org] = 1;
+    $org=strtok( "|");
+}
+$smarty->assign("USER_ORGANIZATIONS",$org_array);
+
 $smarty->display("DetailView.tpl");
 ?>

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/DetailViewAjax.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/DetailViewAjax.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/DetailViewAjax.php Tue Nov 14 03:16:10 2006
@@ -1,50 +1,50 @@
-<?php
-/*********************************************************************************
- ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
-  * ("License"); You may not use this file except in compliance with the License
-  * The Original Code is:  vtiger CRM Open Source
-  * The Initial Developer of the Original Code is vtiger.
-  * Portions created by vtiger are Copyright (C) vtiger.
-  * All Rights Reserved.
- *
-  ********************************************************************************/
-
-require_once('include/logging.php');
-require_once('modules/Accounts/Account.php');
-require_once('include/database/PearDatabase.php');
-global $adb;
-
-$local_log =& LoggerManager::getLogger('AccountsAjax');
-
-$ajaxaction = $_REQUEST["ajxaction"];
-if($ajaxaction == "DETAILVIEW")
-{
-     $crmid = $_REQUEST["recordid"];
-     $tablename = $_REQUEST["tableName"];
-     $fieldname = $_REQUEST["fldName"];
-     $fieldvalue = $_REQUEST["fieldValue"];
-     if($crmid != "")
-	 {
-	     $acntObj = new Account();
-	     $acntObj->retrieve_entity_info($crmid,"Accounts");
-	     $acntObj->column_fields[$fieldname] = $fieldvalue;
-	     if($fieldname == 'annual_revenue')//annual revenue converted to dollar value while saving
-	     {
-		     $acntObj->column_fields[$fieldname] = getConvertedPrice($fieldvalue);
-	     }	     
-	     $acntObj->id = $crmid;
-  	     $acntObj->mode = "edit";
-       	     $acntObj->save("Accounts");
-             if($acntObj->id != "")
-	     {
-			echo ":#:SUCCESS";
-	     }else
-	     {
-			echo ":#:FAILURE";
-	     }   
-	}else
-	{
-         echo ":#:FAILURE";
-    }
-}
-?>
+<?php
+/*********************************************************************************
+ ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+  * ("License"); You may not use this file except in compliance with the License
+  * The Original Code is:  vtiger CRM Open Source
+  * The Initial Developer of the Original Code is vtiger.
+  * Portions created by vtiger are Copyright (C) vtiger.
+  * All Rights Reserved.
+ *
+  ********************************************************************************/
+
+require_once('include/logging.php');
+require_once('modules/Accounts/Accounts.php');
+require_once('include/database/PearDatabase.php');
+global $adb;
+
+$local_log =& LoggerManager::getLogger('AccountsAjax');
+
+$ajaxaction = $_REQUEST["ajxaction"];
+if($ajaxaction == "DETAILVIEW")
+{
+     $crmid = $_REQUEST["recordid"];
+     $tablename = $_REQUEST["tableName"];
+     $fieldname = $_REQUEST["fldName"];
+     $fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]); 
+     if($crmid != "")
+	 {
+	     $acntObj = new Accounts();
+	     $acntObj->retrieve_entity_info($crmid,"Accounts");
+	     $acntObj->column_fields[$fieldname] = $fieldvalue;
+	     if($fieldname == 'annual_revenue')//annual revenue converted to dollar value while saving
+	     {
+		     $acntObj->column_fields[$fieldname] = getConvertedPrice($fieldvalue);
+	     }	     
+	     $acntObj->id = $crmid;
+  	     $acntObj->mode = "edit";
+       	     $acntObj->save("Accounts");
+             if($acntObj->id != "")
+	     {
+			echo ":#:SUCCESS";
+	     }else
+	     {
+			echo ":#:FAILURE";
+	     }   
+	}else
+	{
+         echo ":#:FAILURE";
+    }
+}
+?>

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/EditView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/EditView.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/EditView.php Tue Nov 14 03:16:10 2006
@@ -22,16 +22,18 @@
 
 require_once('Smarty_setup.php');
 require_once('data/Tracker.php');
-require_once('modules/Accounts/Account.php');
+require_once('modules/Accounts/Accounts.php');
 require_once('include/CustomFieldUtil.php');
 require_once('include/ComboUtil.php');
 require_once('include/utils/utils.php');
 require_once('include/FormValidationUtil.php');
 
 global $app_strings,$mod_strings,$currentModule,$theme;
+global $current_organization;
+global $user_organizations;
 $smarty=new vtigerCRM_Smarty;
 
-$focus = new Account();
+$focus = new Accounts();
 
 if(isset($_REQUEST['record'])) 
 {
@@ -39,7 +41,10 @@
     $focus->mode = 'edit'; 	
     $focus->retrieve_entity_info($_REQUEST['record'],"Accounts");		
     $focus->name=$focus->column_fields['accountname']; 
+} else {
+    $focus->column_fields["otherorgs"][$current_organization]=1;
 }
+
 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
 	$focus->id = "";
     	$focus->mode = ''; 	
@@ -95,7 +100,7 @@
 $smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
 $smarty->assign("ID", $focus->id);
 $smarty->assign("MODULE",$currentModule);
-$smarty->assign("SINGLE_MOD",$app_strings['Account']);
+$smarty->assign("SINGLE_MOD",'Account');
 
 $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
 $smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
@@ -111,6 +116,16 @@
 $check_button = Button_Check($module);
 $smarty->assign("CHECK", $check_button);
  
+// Assigned organizations
+$smarty->assign("CURRENT_ORGANIZATION",$current_organization);
+$org_array=array();
+$org=strtok( $user_organizations, "|");
+while( $org !== false) {
+    $org_array[$org] = 1;
+    $org=strtok( "|");
+}
+$smarty->assign("USER_ORGANIZATIONS",$org_array);
+
 if ($focus->mode == 'edit')
 $smarty->display('salesEditView.tpl');
 else

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/HeadLines.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/HeadLines.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/HeadLines.php Tue Nov 14 03:16:10 2006
@@ -8,7 +8,7 @@
  * All Rights Reserved.
 *
  ********************************************************************************/
-include("modules/Accounts/Account.php");
+include("modules/Accounts/Accounts.php");
 include("getCompanyProfile.php");
 $variable = $_REQUEST['tickersymbol'];
 $url = "http://finance.yahoo.com/q?s=".$variable;

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/ListView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/ListView.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/ListView.php Tue Nov 14 03:16:10 2006
@@ -15,7 +15,7 @@
 
 require_once('Smarty_setup.php');
 require_once("data/Tracker.php");
-require_once('modules/Accounts/Account.php');
+require_once('modules/Accounts/Accounts.php');
 require_once('themes/'.$theme.'/layout_utils.php');
 require_once('include/logging.php');
 require_once('include/ListView/ListView.php');
@@ -43,7 +43,7 @@
 
 $url_string = '';
 
-$focus = new Account();
+$focus = new Accounts();
 $smarty = new vtigerCRM_Smarty;
 $other_text = Array();
 
@@ -80,6 +80,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
 {
 	list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/ListViewTop.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/ListViewTop.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/ListViewTop.php Tue Nov 14 03:16:10 2006
@@ -28,7 +28,7 @@
 	$log = LoggerManager::getLogger('top accounts_list');
 	$log->debug("Entering getTopAccounts() method ...");
 	require_once("data/Tracker.php");
-	require_once('modules/Potentials/Opportunity.php');
+	require_once('modules/Potentials/Potentials.php');
 	require_once('include/logging.php');
 	require_once('include/ListView/ListView.php');
 	global $app_strings;

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/Merge.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/Merge.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/Merge.php Tue Nov 14 03:16:10 2006
@@ -108,7 +108,7 @@
   {
   	if($modulename == "Contacts")
   	{
-  		$tablename = "crmentityContacts";
+  		$tablename = "vtiger_crmentityContacts";
   	}
   }
   $querycolumns[$x] = $tablename.".".$columnname;
@@ -120,20 +120,20 @@
       }
   		if($modulename == "Contacts")
       {
-      	$querycolumns[$x] = "concat(usersContacts.last_name,' ',usersContacts.first_name) as userjoincname";
+      	$querycolumns[$x] = "concat(vtiger_usersContacts.last_name,' ',vtiger_usersContacts.first_name) as userjoincname";
       }
   }
 	if($columnname == "parentid")
 	{
-		$querycolumns[$x] = "accountAccount.accountname";
+		$querycolumns[$x] = "vtiger_accountAccount.accountname";
 	}
 	if($columnname == "accountid")
 	{
-		$querycolumns[$x] = "accountContacts.accountname";
+		$querycolumns[$x] = "vtiger_accountContacts.accountname";
 	}
 	if($columnname == "reportsto")
 	{
-		$querycolumns[$x] = "contactdetailsContacts.lastname";
+		$querycolumns[$x] = "vtiger_contactdetailsContacts.lastname";
 	}
 
 	if($modulename == "Accounts")
@@ -174,7 +174,7 @@
 				left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
 				left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid 
 				left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid
-				where vtiger_crmentity.deleted=0 and (crmentityContacts.deleted=0 || vtiger_crmentityContacts.deleted is null) and vtiger_account.accountid in(".$mass_merge.")";
+				where vtiger_crmentity.deleted=0 and (vtiger_crmentityContacts.deleted=0 || vtiger_crmentityContacts.deleted is null) and vtiger_account.accountid in(".$mass_merge.")";
 //echo $query;
 //die;	
 $result = $adb->query($query);

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/Save.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/Save.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/Save.php Tue Nov 14 03:16:10 2006
@@ -21,14 +21,14 @@
  * Contributor(s): ______________________________________..
  ********************************************************************************/
 
-require_once('modules/Accounts/Account.php');
+require_once('modules/Accounts/Accounts.php');
 require_once('include/logging.php');
 //require_once('database/DatabaseConnection.php');
 require_once('include/database/PearDatabase.php');
 
 $local_log =& LoggerManager::getLogger('index');
 global $log;
-$focus = new Account();
+$focus = new Accounts();
 global $current_user;
 $currencyid=fetchCurrency($current_user->id);
 $rate_symbol = getCurrencySymbolandCRate($currencyid);

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/Tickerdetail.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/Tickerdetail.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/Tickerdetail.php Tue Nov 14 03:16:10 2006
@@ -8,7 +8,7 @@
  * All Rights Reserved.
 *
  ********************************************************************************/
-require_once("modules/Accounts/Account.php");
+require_once("modules/Accounts/Accounts.php");
 require_once("getCompanyProfile.php");
 $variable = $_REQUEST['tickersymbol'];
 $url = "http://moneycentral.msn.com/investor/research/profile.asp?Symbol=".trim($variable);

Modified: vtigercrm/branches/5.1_jens/modules/Accounts/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Accounts/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Accounts/language/en_us.lang.php Tue Nov 14 03:16:10 2006
@@ -1,214 +1,217 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/language/en_us.lang.php,v 1.18 2005/03/19 08:59:20 rank Exp $
- * Description:  Defines the English language pack 
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- ********************************************************************************/
- 
-$mod_strings = Array(
-'LBL_MODULE_NAME'=>'Accounts',
-'LBL_MODULE_TITLE'=>'Accounts: Home',
-'LBL_SEARCH_FORM_TITLE'=>'Account Search',
-'LBL_LIST_FORM_TITLE'=>'Account List',
-'LBL_NEW_FORM_TITLE'=>'New Account',
-'LBL_MEMBER_ORG_FORM_TITLE'=>'Member Organizations',
-// Label for Top Accounts in Home Page, added for 4.2 GA
-'LBL_TOP_ACCOUNTS'=>'My Top Accounts', 
-'LBL_TOP_AMOUNT'=>'Amount',
-'LBL_LIST_ACCOUNT_NAME'=>'Account Name',
-'LBL_LIST_CITY'=>'City',
-'LBL_LIST_WEBSITE'=>'Website',
-'LBL_LIST_STATE'=>'State',
-'LBL_LIST_PHONE'=>'Phone',
-'LBL_LIST_EMAIL_ADDRESS'=>'Email Address',
-'LBL_LIST_CONTACT_NAME'=>'Contact Name',
-'LBL_LIST_AMOUNT' => 'Total Opportunities',
-
-//DON'T CONVERT THESE THEY ARE MAPPINGS
-'db_name' => 'LBL_LIST_ACCOUNT_NAME',
-'db_website' => 'LBL_LIST_WEBSITE',
-'db_billing_address_city' => 'LBL_LIST_CITY',
-
-//END DON'T CONVERT
-
-'LBL_ACCOUNT'=>'Account:',
-'LBL_ACCOUNT_NAME'=>'Account Name:',
-'LBL_PHONE'=>'Phone:',
-'LBL_WEBSITE'=>'Website:',
-'LBL_FAX'=>'Fax:',
-'LBL_TICKER_SYMBOL'=>'Ticker Symbol:',
-'LBL_OTHER_PHONE'=>'Other Phone:',
-'LBL_ANY_PHONE'=>'Any Phone:',
-'LBL_MEMBER_OF'=>'Member of:',
-'LBL_EMAIL'=>'Email:',
-'LBL_EMPLOYEES'=>'Employees:',
-'LBL_OTHER_EMAIL_ADDRESS'=>'Other Email:',
-'LBL_ANY_EMAIL'=>'Any Email:',
-'LBL_OWNERSHIP'=>'Ownership:',
-'LBL_RATING'=>'Rating:',
-'LBL_INDUSTRY'=>'Industry:',
-'LBL_SIC_CODE'=>'SIC Code:',
-'LBL_TYPE'=>'Type:',
-'LBL_ANNUAL_REVENUE'=>'Annual Revenue:',
-'LBL_ADDRESS_INFORMATION'=>'Address Information',
-'LBL_ACCOUNT_INFORMATION'=>'Account Information',
-'LBL_CUSTOM_INFORMATION'=>'Custom Information',
-'LBL_BILLING_ADDRESS'=>'Billing Address:',
-'LBL_SHIPPING_ADDRESS'=>'Shipping Address:',
-'LBL_ANY_ADDRESS'=>'Any Address:',
-'LBL_CITY'=>'City:',
-'LBL_STATE'=>'State:',
-'LBL_POSTAL_CODE'=>'Postal Code:',
-'LBL_COUNTRY'=>'Country:',
-'LBL_DESCRIPTION_INFORMATION'=>'Description Information',
-'LBL_DESCRIPTION'=>'Description:',
-'NTC_COPY_BILLING_ADDRESS'=>'Copy billing address to shipping address',
-'NTC_COPY_SHIPPING_ADDRESS'=>'Copy shipping address to billing address',
-'NTC_REMOVE_MEMBER_ORG_CONFIRMATION'=>'Are you sure you want to remove this record as a member organization?',
-'LBL_DUPLICATE'=>'Potential Duplicate Accounts',
-'MSG_DUPLICATE' => 'Creating this vtiger_account may vtiger_potentialy create a duplicate vtiger_account. You may either select an vtiger_account from the list below or you may click on Create New Account to continue creating a new vtiger_account with the previously entered data.',
-
-'LBL_INVITEE'=>'Contacts',
-'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.",
-
-'LBL_SELECT_ACCOUNT'=>'Select Account',
-'LBL_GENERAL_INFORMATION'=>'General Information',
-
-//for v4 release added
-'LBL_NEW_POTENTIAL'=>'New Potential',
-'LBL_POTENTIAL_TITLE'=>'Potentials',
-
-'LBL_NEW_TASK'=>'New Task',
-'LBL_TASK_TITLE'=>'Tasks',
-'LBL_NEW_CALL'=>'New Call',
-'LBL_CALL_TITLE'=>'Calls',
-'LBL_NEW_MEETING'=>'New Meeting',
-'LBL_MEETING_TITLE'=>'Meetings',
-'LBL_NEW_EMAIL'=>'New Email',
-'LBL_EMAIL_TITLE'=>'Emails',
-'LBL_NEW_CONTACT'=>'New Contact',
-'LBL_CONTACT_TITLE'=>'Contacts',
-
-//Added vtiger_fields after RC1 - Release
-'LBL_ALL'=>'All',
-'LBL_PROSPECT'=>'Prospect',
-'LBL_INVESTOR'=>'Investor',
-'LBL_RESELLER'=>'Reseller',
-'LBL_PARTNER'=>'Partner',
-
-// Added for 4GA
-'LBL_TOOL_FORM_TITLE'=>'Account Tools',
-//Added for 4GA
-'Account Name'=>'Account Name',
-'Phone'=>'Phone',
-'Website'=>'Website',
-'Fax'=>'Fax',
-'Ticker Symbol'=>'Ticker Symbol',
-'Other Phone'=>'Other Phone',
-'Member Of'=>'Member Of',
-'Email'=>'Email',
-'Employees'=>'Employees',
-'Other Email'=>'Other Email',
-'Ownership'=>'Ownership',
-'Rating'=>'Rating',
-'industry'=>'Industry',
-'SIC Code'=>'SIC Code',
-'Type'=>'Type',
-'Annual Revenue'=>'Annual Revenue',
-'Assigned To'=>'Assigned To',
-'Billing Address'=>'Billing Address',
-'Shipping Address'=>'Shipping Address',
-'Billing City'=>'Billing City',
-'Shipping City'=>'Shipping City',
-'Billing State'=>'Billing State',
-'Shipping State'=>'Shipping State',
-'Billing Code'=>'Billing Postal Code',
-'Shipping Code'=>'Shipping Postal Code',
-'Billing Country'=>'Billing Country',
-'Shipping Country'=>'Shipping Country',
-'Created Time'=>'Created Time',
-'Modified Time'=>'Modified Time',
-'Description'=>'Description',
-'Shipping Po Box'=>'Shipping Po Box',
-'Billing Po Box'=>'Billing Po Box',
-
-//Added after 4.2 patch 2
-'Email Opt Out'=>'Email Opt Out',
-'LBL_EMAIL_OPT_OUT'=>'Email Opt Out:',
-
-//Added after 5Alpha5
-'Notify Owner'=>'Notify Owner',
-
-//Added for existing picklist entries
-
-'--None--'=>'--None--',
-
-'Acquired'=>'Acquired',
-'Active'=>'Active',
-'Market Failed'=>'Market Failed',
-'Project Cancelled'=>'Project Cancelled',
-'Shutdown'=>'Shutdown',
-
-'Apparel'=>'Apparel',
-'Banking'=>'Banking',
-'Biotechnology'=>'Biotechnology',
-'Chemicals'=>'Chemicals',
-'Communications'=>'Communications',
-'Construction'=>'Construction',
-'Consulting'=>'Consulting',
-'Education'=>'Education',
-'Electronics'=>'Electronics',
-'Energy'=>'Energy',
-'Engineering'=>'Engineering',
-'Entertainment'=>'Entertainment',
-'Environmental'=>'Environmental',
-'Finance'=>'Finance',
-'Food & Beverage'=>'Food & Beverage',
-'Government'=>'Government',
-'Healthcare'=>'Healthcare',
-'Hospitality'=>'Hospitality',
-'Insurance'=>'Insurance',
-'Machinery'=>'Machinery',
-'Manufacturing'=>'Manufacturing',
-'Media'=>'Media',
-'Not For Profit'=>'Not For Profit',
-'Recreation'=>'Recreation',
-'Retail'=>'Retail',
-'Shipping'=>'Shipping',
-'Technology'=>'Technology',
-'Telecommunications'=>'Telecommunications',
-'Transportation'=>'Transportation',
-'Utilities'=>'Utilities',
-'Other'=>'Other',
-
-'Analyst'=>'Analyst',
-'Competitor'=>'Competitor',
-'Customer'=>'Customer',
-'Integrator'=>'Integrator',
-'Investor'=>'Investor',
-'Partner'=>'Partner',
-'Press'=>'Press',
-'Prospect'=>'Prospect',
-'Reseller'=>'Reseller',
-
-
-
-
-);
-
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/language/en_us.lang.php,v 1.18 2005/03/19 08:59:20 rank Exp $
+ * Description:  Defines the English language pack 
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+ ********************************************************************************/
+ 
+$mod_strings = Array(
+'LBL_MODULE_NAME'=>'Accounts',
+'LBL_MODULE_TITLE'=>'Accounts: Home',
+'LBL_SEARCH_FORM_TITLE'=>'Account Search',
+'LBL_LIST_FORM_TITLE'=>'Account List',
+'LBL_NEW_FORM_TITLE'=>'New Account',
+'LBL_MEMBER_ORG_FORM_TITLE'=>'Member Organizations',
+// Label for Top Accounts in Home Page, added for 4.2 GA
+'LBL_TOP_ACCOUNTS'=>'My Top Accounts', 
+'LBL_TOP_AMOUNT'=>'Amount',
+'LBL_LIST_ACCOUNT_NAME'=>'Account Name',
+'LBL_LIST_CITY'=>'City',
+'LBL_LIST_WEBSITE'=>'Website',
+'LBL_LIST_STATE'=>'State',
+'LBL_LIST_PHONE'=>'Phone',
+'LBL_LIST_EMAIL_ADDRESS'=>'Email Address',
+'LBL_LIST_CONTACT_NAME'=>'Contact Name',
+'LBL_LIST_AMOUNT' => 'Total Opportunities',
+
+//DON'T CONVERT THESE THEY ARE MAPPINGS
+'db_name' => 'LBL_LIST_ACCOUNT_NAME',
+'db_website' => 'LBL_LIST_WEBSITE',
+'db_billing_address_city' => 'LBL_LIST_CITY',
+
+//END DON'T CONVERT
+
+'LBL_ACCOUNT'=>'Account:',
+'LBL_ACCOUNT_NAME'=>'Account Name:',
+'LBL_PHONE'=>'Phone:',
+'LBL_WEBSITE'=>'Website:',
+'LBL_FAX'=>'Fax:',
+'LBL_TICKER_SYMBOL'=>'Ticker Symbol:',
+'LBL_OTHER_PHONE'=>'Other Phone:',
+'LBL_ANY_PHONE'=>'Any Phone:',
+'LBL_MEMBER_OF'=>'Member of:',
+'LBL_EMAIL'=>'Email:',
+'LBL_EMPLOYEES'=>'Employees:',
+'LBL_OTHER_EMAIL_ADDRESS'=>'Other Email:',
+'LBL_ANY_EMAIL'=>'Any Email:',
+'LBL_OWNERSHIP'=>'Ownership:',
+'LBL_RATING'=>'Rating:',
+'LBL_INDUSTRY'=>'Industry:',
+'LBL_SIC_CODE'=>'SIC Code:',
+'LBL_TYPE'=>'Type:',
+'LBL_ANNUAL_REVENUE'=>'Annual Revenue:',
+'LBL_ADDRESS_INFORMATION'=>'Address Information',
+'LBL_ACCOUNT_INFORMATION'=>'Account Information',
+'LBL_CUSTOM_INFORMATION'=>'Custom Information',
+'LBL_BILLING_ADDRESS'=>'Billing Address:',
+'LBL_SHIPPING_ADDRESS'=>'Shipping Address:',
+'LBL_ANY_ADDRESS'=>'Any Address:',
+'LBL_CITY'=>'City:',
+'LBL_STATE'=>'State:',
+'LBL_POSTAL_CODE'=>'Postal Code:',
+'LBL_COUNTRY'=>'Country:',
+'LBL_DESCRIPTION_INFORMATION'=>'Description Information',
+'LBL_DESCRIPTION'=>'Description:',
+'NTC_COPY_BILLING_ADDRESS'=>'Copy billing address to shipping address',
+'NTC_COPY_SHIPPING_ADDRESS'=>'Copy shipping address to billing address',
+'NTC_REMOVE_MEMBER_ORG_CONFIRMATION'=>'Are you sure you want to remove this record as a member organization?',
+'LBL_DUPLICATE'=>'Potential Duplicate Accounts',
+'MSG_DUPLICATE' => 'Creating this vtiger_account may vtiger_potentialy create a duplicate vtiger_account. You may either select an vtiger_account from the list below or you may click on Create New Account to continue creating a new vtiger_account with the previously entered data.',
+
+'LBL_INVITEE'=>'Contacts',
+'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.",
+
+'LBL_SELECT_ACCOUNT'=>'Select Account',
+'LBL_GENERAL_INFORMATION'=>'General Information',
+
+//for v4 release added
+'LBL_NEW_POTENTIAL'=>'New Potential',
+'LBL_POTENTIAL_TITLE'=>'Potentials',
+
+'LBL_NEW_TASK'=>'New Task',
+'LBL_TASK_TITLE'=>'Tasks',
+'LBL_NEW_CALL'=>'New Call',
+'LBL_CALL_TITLE'=>'Calls',
+'LBL_NEW_MEETING'=>'New Meeting',
+'LBL_MEETING_TITLE'=>'Meetings',
+'LBL_NEW_EMAIL'=>'New Email',
+'LBL_EMAIL_TITLE'=>'Emails',
+'LBL_NEW_CONTACT'=>'New Contact',
+'LBL_CONTACT_TITLE'=>'Contacts',
+
+//Added vtiger_fields after RC1 - Release
+'LBL_ALL'=>'All',
+'LBL_PROSPECT'=>'Prospect',
+'LBL_INVESTOR'=>'Investor',
+'LBL_RESELLER'=>'Reseller',
+'LBL_PARTNER'=>'Partner',
+
+// Added for 4GA
+'LBL_TOOL_FORM_TITLE'=>'Account Tools',
+//Added for 4GA
+'Account Name'=>'Account Name',
+'Phone'=>'Phone',
+'Website'=>'Website',
+'Fax'=>'Fax',
+'Ticker Symbol'=>'Ticker Symbol',
+'Other Phone'=>'Other Phone',
+'Member Of'=>'Member Of',
+'Email'=>'Email',
+'Employees'=>'Employees',
+'Other Email'=>'Other Email',
+'Ownership'=>'Ownership',
+'Rating'=>'Rating',
+'industry'=>'Industry',
+'SIC Code'=>'SIC Code',
+'Type'=>'Type',
+'Annual Revenue'=>'Annual Revenue',
+'Assigned To'=>'Assigned To',
+'Billing Address'=>'Billing Address',
+'Shipping Address'=>'Shipping Address',
+'Billing City'=>'Billing City',
+'Shipping City'=>'Shipping City',
+'Billing State'=>'Billing State',
+'Shipping State'=>'Shipping State',
+'Billing Code'=>'Billing Postal Code',
+'Shipping Code'=>'Shipping Postal Code',
+'Billing Country'=>'Billing Country',
+'Shipping Country'=>'Shipping Country',
+'Created Time'=>'Created Time',
+'Modified Time'=>'Modified Time',
+'Description'=>'Description',
+'Shipping Po Box'=>'Shipping PO Box',
+'Billing Po Box'=>'Billing PO Box',
+
+//Added after 4.2 patch 2
+'Email Opt Out'=>'Email Opt Out',
+'LBL_EMAIL_OPT_OUT'=>'Email Opt Out:',
+
+//Added after 5Alpha5
+'Notify Owner'=>'Notify Owner',
+
+//Added for existing picklist entries
+
+'--None--'=>'--None--',
+
+'Acquired'=>'Acquired',
+'Active'=>'Active',
+'Market Failed'=>'Market Failed',
+'Project Cancelled'=>'Project Cancelled',
+'Shutdown'=>'Shutdown',
+
+'Apparel'=>'Apparel',
+'Banking'=>'Banking',
+'Biotechnology'=>'Biotechnology',
+'Chemicals'=>'Chemicals',
+'Communications'=>'Communications',
+'Construction'=>'Construction',
+'Consulting'=>'Consulting',
+'Education'=>'Education',
+'Electronics'=>'Electronics',
+'Energy'=>'Energy',
+'Engineering'=>'Engineering',
+'Entertainment'=>'Entertainment',
+'Environmental'=>'Environmental',
+'Finance'=>'Finance',
+'Food & Beverage'=>'Food & Beverage',
+'Government'=>'Government',
+'Healthcare'=>'Healthcare',
+'Hospitality'=>'Hospitality',
+'Insurance'=>'Insurance',
+'Machinery'=>'Machinery',
+'Manufacturing'=>'Manufacturing',
+'Media'=>'Media',
+'Not For Profit'=>'Not For Profit',
+'Recreation'=>'Recreation',
+'Retail'=>'Retail',
+'Shipping'=>'Shipping',
+'Technology'=>'Technology',
+'Telecommunications'=>'Telecommunications',
+'Transportation'=>'Transportation',
+'Utilities'=>'Utilities',
+'Other'=>'Other',
+
+'Analyst'=>'Analyst',
+'Competitor'=>'Competitor',
+'Customer'=>'Customer',
+'Integrator'=>'Integrator',
+'Investor'=>'Investor',
+'Partner'=>'Partner',
+'Press'=>'Press',
+'Prospect'=>'Prospect',
+'Reseller'=>'Reseller',
+'LBL_START_DATE' => 'Start Date',
+'LBL_END_DATE' => 'End Date',
+
+// Added for multi organization support TRAC #2035
+'LBL_COMPANY_ASSIGNMENT'=>'Organization Assignment',
+'Organization Assignment'=>'Assigned to',
+
+);
+
+?>

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/Activity.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/Activity.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/Activity.php Tue Nov 14 03:16:10 2006
@@ -1,498 +1,740 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/Activity.php,v 1.26 2005/03/26 10:42:13 rank Exp $
- * Description:  TODO: To be written.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- ********************************************************************************/
-
-include_once('config.php');
-require_once('include/logging.php');
-require_once('include/database/PearDatabase.php');
-require_once('modules/Calendar/RenderRelatedListUI.php');
-require_once('data/CRMEntity.php');
-
-// Task is used to store customer information.
-class Activity extends CRMEntity {
-	var $log;
-	var $db;
-
-	var $table_name = "vtiger_activity";
-	#var $object_name = "activity";	
-		// Mike Crowe Mod --------------------------------------------------------Renamed to match vtiger_tab
-	var $object_name = "Activities";
-	// Mike Crowe Mod --------------------------------------------------------added for general search
-    var $base_table_name = "vtiger_activity";
-    var $cf_table_name = "";
-	var $module_id = "activityid";
-	
-	var $reminder_table = "vtiger_activity_reminder";
-	
-	var $tab_name = Array('vtiger_crmentity','vtiger_activity','vtiger_seactivityrel','vtiger_cntactivityrel','vtiger_salesmanactivityrel','vtiger_activity_reminder','vtiger_recurringevents','vtiger_invitees');
-
-	var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_activity'=>'activityid','vtiger_seactivityrel'=>'activityid','vtiger_cntactivityrel'=>'activityid','vtiger_salesmanactivityrel'=>'activityid','vtiger_activity_reminder'=>'activity_id','vtiger_recurringevents'=>'activityid');
-
-	var $column_fields = Array();
-	var $sortby_fields = Array('subject','due_date','date_start','smownerid','activitytype');	//Sorting is added for due date and start date	
-
-	// This is used to retrieve related vtiger_fields from form posts.
-	var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'contactname', 'contact_phone', 'contact_email', 'parent_name');
-
-	// This is the list of vtiger_fields that are in the lists.
-	var $list_fields = Array(
-       'Close'=>Array('activity'=>'status'),
-       'Type'=>Array('activity'=>'activitytype'),
-       'Subject'=>Array('activity'=>'subject'),
-       'Related to'=>Array('seactivityrel'=>'activityid'),
-       'Start Date'=>Array('activity'=>'date_start'),
-       'End Date'=>Array('activity'=>'due_date'),
-       'Recurring Type'=>Array('recurringevents'=>'recurringtype'),
-       'Assigned To'=>Array('crmentity'=>'smownerid')
-       );
-
-       var $range_fields = Array(
-	'name',
-	'date_modified',
-	'start_date',
-	'id',
-	'status',
-	'date_due',
-	'time_start',
-	'description',
-	'contact_name',
-	'priority',
-	'duehours',
-	'dueminutes',
-	'location'
-	);
-       
-
-       var $list_fields_name = Array(
-       'Close'=>'status',
-       'Type'=>'activitytype',
-       'Subject'=>'subject',
-       'Contact Name'=>'lastname',
-       'Related to'=>'activityid',
-       'Start Date'=>'date_start',
-       'End Date'=>'due_date',
-	'Recurring Type'=>'recurringtype',	
-       'Assigned To'=>'assigned_user_id');
-
-       var $list_link_field= 'subject';
-	
-	//Added these variables which are used as default order by and sortorder in ListView
-	var $default_order_by = 'due_date';
-	var $default_sort_order = 'ASC';
-
-	function Activity() {
-		$this->log = LoggerManager::getLogger('Calendar');
-		$this->db = new PearDatabase();
-		$this->column_fields = getColumnFields('Calendar');
-	}
-
-	var $new_schema = true;
-
-	
-	// Mike Crowe Mod --------------------------------------------------------Default ordering for us
-	/**
-	 * Function to get sort order
-	 * return string  $sorder    - sortorder string either 'ASC' or 'DESC'
-	 */
-	function getSortOrder()
-	{	
-		global $log;                                                                                                  $log->debug("Entering getSortOrder() method ...");
-		if(isset($_REQUEST['sorder'])) 
-			$sorder = $_REQUEST['sorder'];
-		else
-			$sorder = (($_SESSION['ACTIVITIES_SORT_ORDER'] != '')?($_SESSION['ACTIVITIES_SORT_ORDER']):($this->default_sort_order));
-		$log->debug("Exiting getSortOrder method ...");
-		return $sorder;
-	}
-	
-	/**
-	 * Function to get order by
-	 * return string  $order_by    - fieldname(eg: 'subject')
-	 */
-	function getOrderBy()
-	{
-		global $log;
-                 $log->debug("Entering getOrderBy() method ...");
-		if (isset($_REQUEST['order_by'])) 
-			$order_by = $_REQUEST['order_by'];
-		else
-			$order_by = (($_SESSION['ACTIVITIES_ORDER_BY'] != '')?($_SESSION['ACTIVITIES_ORDER_BY']):($this->default_order_by));
-		$log->debug("Exiting getOrderBy method ...");
-		return $order_by;
-	}	
-	// Mike Crowe Mod --------------------------------------------------------
-
-
-
-//Function Call for Related List -- Start
-	/**
-	 * Function to get Activity related Contacts
-	 * @param  integer   $id      - activityid
-	 * returns related Contacts record in array format
-	 */
-        function get_contacts($id)
-	{
-			global $log;
-                        $log->debug("Entering get_contacts(".$id.") method ...");
-			global $app_strings;
-
-			$focus = new Contact();
-
-			$button = '';
-
-			$returnset = '&return_module=Calendar&return_action=CallRelatedList&activity_mode=Events&return_id='.$id;
-
-			$query = 'select vtiger_users.user_name,vtiger_contactdetails.accountid,vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_contactdetails.department, vtiger_contactdetails.title, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_contactdetails inner join vtiger_cntactivityrel on vtiger_cntactivityrel.contactid=vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_cntactivityrel.activityid = vtiger_activitygrouprelation.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname where vtiger_cntactivityrel.activityid='.$id.' and vtiger_crmentity.deleted=0';
-			$log->debug("Exiting get_contacts method ...");
-			return GetRelatedList('Calendar','Contacts',$focus,$query,$button,$returnset);
-        }
-	
-	/**
-	 * Function to get Activity related Users
-	 * @param  integer   $id      - activityid
-	 * returns related Users record in array format
-	 */
-
-        function get_users($id)
-	{	
-		global $log;
-                $log->debug("Entering get_contacts(".$id.") method ...");
-		global $app_strings;
-
-		$focus = new User();
-
-		$button = '';
-
-		$returnset = '&return_module=Calendar&return_action=CallRelatedList&return_id='.$id;
-
-		$query = 'SELECT vtiger_users.id, vtiger_users.first_name,vtiger_users.last_name, vtiger_users.user_name, vtiger_users.email1, vtiger_users.email2, vtiger_users.status, vtiger_users.is_admin, vtiger_user2role.roleid, vtiger_users.yahoo_id, vtiger_users.phone_home, vtiger_users.phone_work, vtiger_users.phone_mobile, vtiger_users.phone_other, vtiger_users.phone_fax,vtiger_activity.date_start,vtiger_activity.due_date,vtiger_activity.time_start,vtiger_activity.duration_hours,vtiger_activity.duration_minutes from vtiger_users inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.smid=vtiger_users.id  inner join vtiger_activity on vtiger_activity.activityid=vtiger_salesmanactivityrel.activityid inner join vtiger_user2role on vtiger_user2role.userid=vtiger_users.id where vtiger_activity.activityid='.$id;
-		$log->debug("Exiting get_users method ...");
-		return GetRelatedList('Calendar','Users',$focus,$query,$button,$returnset);
-
-
-	}
-
-	/**
-         * Function to get activities for given criteria
-	 * @param   string   $criteria     - query string
-	 * returns  activity records in array format($list) or null value
-         */	 
-  	function get_full_list($criteria)
-  	{
-	 global $log;
-         $log->debug("Entering get_full_list(".$criteria.") method ...");
-    $query = "select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.setype, vtiger_activity.*, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid WHERE vtiger_crmentity.deleted=0 ".$criteria;
-    $result =& $this->db->query($query);
-        
-    if($this->db->getRowCount($result) > 0){
-		
-      // We have some data.
-      while ($row = $this->db->fetchByAssoc($result)) {
-        foreach($this->list_fields_name as $field)
-        {
-          if (isset($row[$field])) {
-            $this->$field = $row[$field];
-          }
-          else {
-            $this->$field = '';   
-          }
-        }
-        $list[] = $this;
-      }
-    }
-    if (isset($list))
-    	{
-		$log->debug("Exiting get_full_list method ...");
-	    return $list;
-	}
-	else
-	{
-		$log->debug("Exiting get_full_list method ...");
-	    return null;
-	}
-
-  }
-
-	
-//calendarsync
-    /**
-     * Function to get meeting count
-     * @param  string   $user_name        - User Name
-     * return  integer  $row["count(*)"]  - count
-     */
-    function getCount_Meeting($user_name) 
-	{
-		global $log;
-	        $log->debug("Entering getCount_Meeting(".$user_name.") method ...");
-      $query = "select count(*) from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Meeting'";
-
-      $result = $this->db->query($query,true,"Error retrieving contacts count");
-      $rows_found =  $this->db->getRowCount($result);
-      $row = $this->db->fetchByAssoc($result, 0);
-	$log->debug("Exiting getCount_Meeting method ...");
-      return $row["count(*)"];
-    }
-   
-    function get_calendars($user_name,$from_index,$offset)
-    {   
-	    global $log;
-            $log->debug("Entering get_calendars(".$user_name.",".$from_index.",".$offset.") method ...");
-		$query = "select vtiger_activity.location as location,vtiger_activity.duration_hours as duehours, vtiger_activity.duration_minutes as dueminutes,vtiger_activity.time_start as time_start, vtiger_activity.subject as name,vtiger_crmentity.modifiedtime as date_modified, vtiger_activity.date_start start_date,vtiger_activity.activityid as id,vtiger_activity.status as status, vtiger_crmentity.description as description, vtiger_activity.priority as vtiger_priority, vtiger_activity.due_date as date_due ,vtiger_contactdetails.firstname cfn, vtiger_contactdetails.lastname cln from vtiger_activity inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Meeting' limit " .$from_index ."," .$offset;
-	$log->debug("Exiting get_calendars method ...");
-	    return $this->process_list_query1($query);   
-    }       
-//calendarsync
-	/**
-	 * Function to get task count
-	 * @param  string   $user_name        - User Name
-	 * return  integer  $row["count(*)"]  - count
-	 */
-    function getCount($user_name) 
-    {
-	    global $log;
-            $log->debug("Entering getCount(".$user_name.") method ...");
-        $query = "select count(*) from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Task'";
-
-        $result = $this->db->query($query,true,"Error retrieving contacts count");
-        $rows_found =  $this->db->getRowCount($result);
-        $row = $this->db->fetchByAssoc($result, 0);
-
-	$log->debug("Exiting getCount method ...");    
-        return $row["count(*)"];
-    }       
-
-    /**
-     * Function to get list of task for user with given limit
-     * @param  string   $user_name        - User Name
-     * @param  string   $from_index       - query string
-     * @param  string   $offset           - query string 
-     * returns tasks in array format
-     */
-    function get_tasks($user_name,$from_index,$offset)
-    {   
-	global $log;
-        $log->debug("Entering get_tasks(".$user_name.",".$from_index.",".$offset.") method ...");
-	 $query = "select vtiger_activity.subject as name,vtiger_crmentity.modifiedtime as date_modified, vtiger_activity.date_start start_date,vtiger_activity.activityid as id,vtiger_activity.status as status, vtiger_crmentity.description as description, vtiger_activity.priority as priority, vtiger_activity.due_date as date_due ,vtiger_contactdetails.firstname cfn, vtiger_contactdetails.lastname cln from vtiger_activity inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Task' limit " .$from_index ."," .$offset;
-	 $log->debug("Exiting get_tasks method ...");
-    return $this->process_list_query1($query);
-    
-    }
-	
-    /**
-     * Function to process the activity list query
-     * @param  string   $query     - query string
-     * return  array    $response  - activity lists
-     */
-    function process_list_query1($query)
-    {
-	    global $log;
-            $log->debug("Entering process_list_query1(".$query.") method ...");
-        $result =& $this->db->query($query,true,"Error retrieving $this->object_name list: ");
-        $list = Array();
-        $rows_found =  $this->db->getRowCount($result);
-        if($rows_found != 0)
-        {
-            $task = Array();
-              for($index = 0 , $row = $this->db->fetchByAssoc($result, $index); $row && $index <$rows_found;$index++, $row = $this->db->fetchByAssoc($result, $index))
-            
-             {
-                foreach($this->range_fields as $columnName)
-                {
-                    if (isset($row[$columnName])) {
-			    
-                        $task[$columnName] = $row[$columnName];
-                    }   
-                    else     
-                    {   
-                            $task[$columnName] = "";
-                    }   
-	            }	
-    
-                $task[contact_name] = return_name($row, 'cfn', 'cln');    
-
-                    $list[] = $task;
-                }
-         }
-
-        $response = Array();
-        $response['list'] = $list;
-        $response['row_count'] = $rows_found;
-        $response['next_offset'] = $next_offset;
-        $response['previous_offset'] = $previous_offset;
-
-
-	$log->debug("Exiting process_list_query1 method ...");
-        return $response;
-    }
-
-    	/**
-	 * Function to get reminder for activity
-	 * @param  integer   $activity_id     - activity id
-	 * @param  string    $reminder_time   - reminder time
-	 * @param  integer   $reminder_sent   - 0 or 1
-	 * @param  integer   $recurid         - recuring eventid
-	 * @param  string    $remindermode    - string like 'edit'	 
-	 */	
-	function activity_reminder($activity_id,$reminder_time,$reminder_sent=0,$recurid,$remindermode='')
-	{
-		global $log;
-		$log->debug("Entering vtiger_activity_reminder(".$activity_id.",".$reminder_time.",".$reminder_sent.",".$recurid.",".$remindermode.") method ...");
-		//Check for vtiger_activityid already present in the reminder_table
-		$query_exist = "SELECT activity_id FROM ".$this->reminder_table." WHERE activity_id = ".$activity_id;
-		$result_exist = $this->db->query($query_exist);
-
-		if($remindermode == 'edit')
-		{
-			if($this->db->num_rows($result_exist) == 1)
-			{
-				$query = "UPDATE ".$this->reminder_table." SET";
-				$query .=" reminder_sent = ".$reminder_sent.",";
-				$query .=" reminder_time = ".$reminder_time." WHERE activity_id =".$activity_id; 
-			}
-			else
-			{
-				$query = "INSERT INTO ".$this->reminder_table." VALUES (".$activity_id.",".$reminder_time.",0,'".$recurid."')";
-			}
-		}
-		elseif(($remindermode == 'delete') && ($this->db->num_rows($result_exist) == 1))
-		{
-			$query = "DELETE FROM ".$this->reminder_table." WHERE activity_id = ".$activity_id;
-		}
-		else
-		{
-			$query = "INSERT INTO ".$this->reminder_table." VALUES (".$activity_id.",".$reminder_time.",0,'".$recurid."')";
-		}
-      		$this->db->query($query,true,"Error in processing vtiger_table $this->reminder_table");
-		$log->debug("Exiting vtiger_activity_reminder method ...");
-	}
-
-//Used for vtigerCRM Outlook Add-In
-/**
- * Function to get tasks to display in outlookplugin
- * @param   string    $username     -  User name
- * return   string    $query        -  sql query 
- */
-function get_tasksforol($username)
-{
-	global $log,$adb;
-	$log->debug("Entering get_tasksforol(".$username.") method ...");
-	global $current_user;
-	require_once("modules/Users/User.php");
-	$seed_user=new User();
-	$user_id=$seed_user->retrieve_user_id($username);
-	$current_user=$seed_user;
-	$current_user->retrieve_entity_info($user_id, 'Users');
-	require('user_privileges/user_privileges_'.$current_user->id.'.php');
-	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-	
-	if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
-  {
-    $sql1 = "select tablename,columnname from vtiger_field where tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder'";
-  }else
-  {
-    $profileList = getCurrentUserProfileList();
-    $sql1 = "select tablename,columnname from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder' and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList;
-  }
-  $result1 = $adb->query($sql1);
-  for($i=0;$i < $adb->num_rows($result1);$i++)
-  {
-      $permitted_lists[] = $adb->query_result($result1,$i,'tablename');
-      $permitted_lists[] = $adb->query_result($result1,$i,'columnname');
-      /*if($adb->query_result($result1,$i,'columnname') == "parentid")
-      {
-        $permitted_lists[] = 'vtiger_account';
-        $permitted_lists[] = 'accountname';
-      }*/
-  }
-	$permitted_lists = array_chunk($permitted_lists,2);
-	$column_table_lists = array();
-	for($i=0;$i < count($permitted_lists);$i++)
-	{
-	   $column_table_lists[] = implode(".",$permitted_lists[$i]);
-  }
-   
-	$query = "select vtiger_activity.activityid as taskid, ".implode(',',$column_table_lists)." from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid 
-			 inner join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid 
-			 left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid 
-			 left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid 
-			 left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid 
-			 where vtiger_users.user_name='".$username."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Task'";
-	$log->debug("Exiting get_tasksforol method ...");		 
-	return $query;
-}
-
-/**
- * Function to get calendar query for outlookplugin
- * @param   string    $username     -  User name                                                                            * return   string    $query        -  sql query                                                                            */ 
-function get_calendarsforol($user_name)
-{
-	global $log,$adb;
-	$log->debug("Entering get_calendarsforol(".$user_name.") method ...");
-	global $current_user;
-	require_once("modules/Users/User.php");
-	$seed_user=new User();
-	$user_id=$seed_user->retrieve_user_id($user_name);
-	$current_user=$seed_user;
-	$current_user->retrieve_entity_info($user_id, 'Users');
-	require('user_privileges/user_privileges_'.$current_user->id.'.php');
-	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
-	
-	if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
-  {
-    $sql1 = "select tablename,columnname from vtiger_field where tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder'";
-  }else
-  {
-    $profileList = getCurrentUserProfileList();
-    $sql1 = "select tablename,columnname from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder' and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList;
-  }
-  $result1 = $adb->query($sql1);
-  for($i=0;$i < $adb->num_rows($result1);$i++)
-  {
-      $permitted_lists[] = $adb->query_result($result1,$i,'tablename');
-      $permitted_lists[] = $adb->query_result($result1,$i,'columnname');
-      /*if($adb->query_result($result1,$i,'columnname') == "parentid")
-      {
-        $permitted_lists[] = 'vtiger_account';
-        $permitted_lists[] = 'accountname';
-      }*/
-  }
-	$permitted_lists = array_chunk($permitted_lists,2);
-	$column_table_lists = array();
-	for($i=0;$i < count($permitted_lists);$i++)
-	{
-	   $column_table_lists[] = implode(".",$permitted_lists[$i]);
-  }
-   
-	  $query = "select vtiger_activity.activityid as clndrid, ".implode(',',$column_table_lists)." from vtiger_activity 
-				inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid 
-				inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid 
-				left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid 
-				left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid 
-				left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid 
-				inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid 
-				where vtiger_users.user_name='".$user_name."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Meeting'";
-	$log->debug("Exiting get_calendarsforol method ...");
-	return $query;
-}
-//End
-
-}
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/Activity.php,v 1.26 2005/03/26 10:42:13 rank Exp $
+ * Description:  TODO: To be written.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+ ********************************************************************************/
+
+include_once('config.php');
+require_once('include/logging.php');
+require_once('include/database/PearDatabase.php');
+require_once('modules/Calendar/RenderRelatedListUI.php');
+require_once('data/CRMEntity.php');
+
+// Task is used to store customer information.
+class Activity extends CRMEntity {
+	var $log;
+	var $db;
+	var $reminder_table = 'vtiger_activity_reminder';
+	var $tab_name = Array('vtiger_crmentity','vtiger_activity');
+
+	var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_activity'=>'activityid','vtiger_seactivityrel'=>'activityid','vtiger_cntactivityrel'=>'activityid','vtiger_salesmanactivityrel'=>'activityid','vtiger_activity_reminder'=>'activity_id','vtiger_recurringevents'=>'activityid');
+
+	var $column_fields = Array();
+	var $sortby_fields = Array('subject','due_date','date_start','smownerid','activitytype');	//Sorting is added for due date and start date	
+
+	// This is used to retrieve related vtiger_fields from form posts.
+	var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'contactname', 'contact_phone', 'contact_email', 'parent_name');
+
+	// This is the list of vtiger_fields that are in the lists.
+	var $list_fields = Array(
+       'Close'=>Array('activity'=>'status'),
+       'Type'=>Array('activity'=>'activitytype'),
+       'Subject'=>Array('activity'=>'subject'),
+       'Related to'=>Array('seactivityrel'=>'activityid'),
+       'Start Date'=>Array('activity'=>'date_start'),
+       'End Date'=>Array('activity'=>'due_date'),
+       'Recurring Type'=>Array('recurringevents'=>'recurringtype'),
+       'Assigned To'=>Array('crmentity'=>'smownerid')
+       );
+
+       var $range_fields = Array(
+	'name',
+	'date_modified',
+	'start_date',
+	'id',
+	'status',
+	'date_due',
+	'time_start',
+	'description',
+	'contact_name',
+	'priority',
+	'duehours',
+	'dueminutes',
+	'location'
+	);
+       
+
+       var $list_fields_name = Array(
+       'Close'=>'status',
+       'Type'=>'activitytype',
+       'Subject'=>'subject',
+       'Contact Name'=>'lastname',
+       'Related to'=>'activityid',
+       'Start Date'=>'date_start',
+       'End Date'=>'due_date',
+	'Recurring Type'=>'recurringtype',	
+       'Assigned To'=>'assigned_user_id');
+
+       var $list_link_field= 'subject';
+	
+	//Added these variables which are used as default order by and sortorder in ListView
+	var $default_order_by = 'due_date';
+	var $default_sort_order = 'ASC';
+
+	function Activity() {
+		$this->log = LoggerManager::getLogger('Calendar');
+		$this->db = new PearDatabase();
+		$this->column_fields = getColumnFields('Calendar');
+	}
+
+
+	function save_module($module)
+	{
+		//Handling module specific save
+		//Insert into seactivity rel			
+				if(isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '')
+				{
+					$this->insertIntoEntityTable("vtiger_seactivityrel", $module);
+				}
+				elseif($this->column_fields['parent_id']=='' && $insertion_mode=="edit")
+				{
+					$this->deleteRelation("vtiger_seactivityrel");
+				}
+		//Insert into cntactivity rel		
+
+			if(isset($this->column_fields['contact_id']) && $this->column_fields['contact_id'] != '')
+			{
+				$this->insertIntoEntityTable('vtiger_cntactivityrel', $module);
+			}
+			elseif($this->column_fields['contact_id'] =='' && $insertion_mode=="edit")
+			{
+				$this->deleteRelation('vtiger_cntactivityrel');
+			}
+		
+		//Handling for recurring type
+			//Insert into vtiger_activity_remainder table
+			if(isset($this->column_fields['recurringtype']) && $this->column_fields['recurringtype']!='')
+				$recur_type = trim($this->column_fields['recurringtype']);
+			else
+    				$recur_type='';	
+		
+			if($recur_type == "--None--")
+			{
+				$this->insertIntoReminderTable('vtiger_activity_reminder',$module,"");
+			}
+
+			//Insert into vtiger_recurring event table
+			$recur_type = trim($this->column_fields['recurringtype']);
+			if($recur_type != "--None--"  && $recur_type != '')
+		      	{		   
+				$recur_data = getrecurringObjValue();
+				if(is_object($recur_data))
+	      				$this->insertIntoRecurringTable($recur_data);
+			}
+
+		//Handling for invitees
+		if(isset($_REQUEST['inviteesid']) && $_REQUEST['inviteesid']!='')
+		{
+			$selected_users_string =  $_REQUEST['inviteesid'];
+			$invitees_array = explode(';',$selected_users_string);
+			$this->insertIntoInviteeTable('vtiger_invitees',$module,$invitees_array);
+
+		}
+
+		//Inserting into sales man activity rel
+		$this->insertIntoSmActivityRel($module);
+
+
+			
+	}	
+
+
+	/** Function to insert values in vtiger_activity_remainder table for the specified module,
+  	  * @param $table_name -- table name:: Type varchar
+  	  * @param $module -- module:: Type varchar
+ 	 */
+	function insertIntoReminderTable($table_name,$module,$recurid)
+	{
+	 	global $log;
+		$log->info("in insertIntoReminderTable  ".$table_name."    module is  ".$module);
+		if($_REQUEST['set_reminder'] == 'Yes')
+		{
+			$log->debug("set reminder is set");
+			$rem_days = $_REQUEST['remdays'];
+			$log->debug("rem_days is ".$rem_days);
+			$rem_hrs = $_REQUEST['remhrs'];
+			$log->debug("rem_hrs is ".$rem_hrs);
+			$rem_min = $_REQUEST['remmin'];
+			$log->debug("rem_minutes is ".$rem_min);
+			$reminder_time = $rem_days * 24 * 60 + $rem_hrs * 60 + $rem_min;
+			$log->debug("reminder_time is ".$reminder_time);
+			if ($recurid == "")
+			{
+				if($_REQUEST['mode'] == 'edit')
+				{
+					$this->activity_reminder($this->id,$reminder_time,0,$recurid,'edit');
+				}
+				else
+				{
+					$this->activity_reminder($this->id,$reminder_time,0,$recurid,'');
+				}
+			}
+			else
+			{
+				$this->activity_reminder($this->id,$reminder_time,0,$recurid,'');
+			}
+		}
+		elseif($_REQUEST['set_reminder'] == 'No')
+		{
+			$this->activity_reminder($this->id,'0',0,$recurid,'delete');
+		}
+	}
+	
+
+	// Code included by Jaguar - starts
+	/** Function to insert values in vtiger_recurringevents table for the specified tablename,module
+  	  * @param $recurObj -- Recurring Object:: Type varchar
+ 	 */	
+function insertIntoRecurringTable(& $recurObj)
+{
+	global $log,$adb;
+	$log->info("in insertIntoRecurringTable  ");
+	$st_date = $recurObj->startdate->get_formatted_date();
+	$log->debug("st_date ".$st_date);
+	$end_date = $recurObj->enddate->get_formatted_date();
+	$log->debug("end_date is set ".$end_date);
+	$type = $recurObj->recur_type;
+	$log->debug("type is ".$type);
+        $flag="true";
+
+	if($_REQUEST['mode'] == 'edit')
+	{
+		$activity_id=$this->id;
+
+		$sql='select min(recurringdate) AS min_date,max(recurringdate) AS max_date, recurringtype, activityid from vtiger_recurringevents where activityid='. $activity_id.' group by activityid, recurringtype';
+		
+		$result = $adb->query($sql);
+		$noofrows = $adb->num_rows($result);
+		for($i=0; $i<$noofrows; $i++)
+		{
+			$recur_type_b4_edit = $adb->query_result($result,$i,"recurringtype");
+			$date_start_b4edit = $adb->query_result($result,$i,"min_date");
+			$end_date_b4edit = $adb->query_result($result,$i,"max_date");
+		}
+		if(($st_date == $date_start_b4edit) && ($end_date==$end_date_b4edit) && ($type == $recur_type_b4_edit))
+		{
+			if($_REQUEST['set_reminder'] == 'Yes')
+			{
+				$sql = 'delete from vtiger_activity_reminder where activity_id='.$activity_id;
+				$adb->query($sql);
+				$sql = 'delete  from vtiger_recurringevents where activityid='.$activity_id;
+				$adb->query($sql);
+				$flag="true";
+			}
+			elseif($_REQUEST['set_reminder'] == 'No')
+			{
+				$sql = 'delete  from vtiger_activity_reminder where activity_id='.$activity_id;
+				$adb->query($sql);
+				$flag="false";
+			}
+			else
+				$flag="false";
+		}
+		else
+		{
+			$sql = 'delete from vtiger_activity_reminder where activity_id='.$activity_id;
+			$adb->query($sql);
+			$sql = 'delete  from vtiger_recurringevents where activityid='.$activity_id;
+			$adb->query($sql);
+		}
+	}
+	$date_array = $recurObj->recurringdates;
+	if(isset($recurObj->recur_freq) && $recurObj->recur_freq != null)
+		$recur_freq = $recurObj->recur_freq;
+	else
+		$recur_freq = 1;
+	if($recurObj->recur_type == 'Daily' || $recurObj->recur_type == 'Yearly')
+		$recurringinfo = $recurObj->recur_type;
+	elseif($recurObj->recur_type == 'Weekly')
+	{
+		$recurringinfo = $recurObj->recur_type;
+		if($recurObj->dayofweek_to_rpt != null)
+			$recurringinfo = $recurringinfo.'::'.implode('::',$recurObj->dayofweek_to_rpt);
+	}
+	elseif($recurObj->recur_type == 'Monthly')
+	{
+		$recurringinfo =  $recurObj->recur_type.'::'.$recurObj->repeat_monthby;
+		if($recurObj->repeat_monthby == 'date')
+			$recurringinfo = $recurringinfo.'::'.$recurObj->rptmonth_datevalue;
+		else
+			$recurringinfo = $recurringinfo.'::'.$recurObj->rptmonth_daytype.'::'.$recurObj->dayofweek_to_rpt[0];
+	}
+	else
+	{
+		$recurringinfo = '';
+	}
+	if($flag=="true")
+	{
+		for($k=0; $k< count($date_array); $k++)
+		{
+			$tdate=$date_array[$k];
+			if($tdate <= $end_date)
+			{
+				$max_recurid_qry = 'select max(recurringid) AS recurid from vtiger_recurringevents;';
+				$result = $adb->query($max_recurid_qry);
+				$noofrows = $adb->num_rows($result);
+				for($i=0; $i<$noofrows; $i++)
+				{
+					$recur_id = $adb->query_result($result,$i,"recurid");
+				}
+				$current_id =$recur_id+1;
+				$recurring_insert = "insert into vtiger_recurringevents values ('".$current_id."','".$this->id."','".$tdate."','".$type."','".$recur_freq."','".$recurringinfo."')";
+				$adb->query($recurring_insert);
+				if($_REQUEST['set_reminder'] == 'Yes')
+				{
+					$this->insertIntoReminderTable("vtiger_activity_reminder",$module,$current_id,'');
+				}
+			}
+		}
+	}
+}
+
+
+	/** Function to insert values in vtiger_invitees table for the specified module,tablename ,invitees_array
+  	  * @param $table_name -- table name:: Type varchar
+  	  * @param $module -- module:: Type varchar
+	  * @param $invitees_array Array
+ 	 */
+	function insertIntoInviteeTable($table_name,$module,$invitees_array)
+	{
+		global $log,$adb;
+		$log->debug("Entering insertIntoInviteeTable(".$table_name.",".$module.",".$invitees_array.") method ...");
+		foreach($invitees_array as $inviteeid)
+		{
+			if($inviteeid != '')
+			{
+				$query="insert into vtiger_invitees values(".$this->id.",".$inviteeid.")";
+				$adb->query($query);
+			}
+		}
+		$log->debug("Exiting insertIntoInviteeTable method ...");
+
+	}
+
+
+	/** Function to insert values in vtiger_salesmanactivityrel table for the specified module
+  	  * @param $module -- module:: Type varchar
+ 	 */
+
+  	function insertIntoSmActivityRel($module)
+  	{
+    		global $adb;
+    		global $current_user;
+    		if($this->mode == 'edit')
+    		{
+
+      			$sql = "delete from vtiger_salesmanactivityrel where activityid=".$this->id." and smid = ".$this->column_fields['assigned_user_id']."";
+      			$adb->query($sql);
+
+    		}
+		$sql_qry = "insert into vtiger_salesmanactivityrel (smid,activityid) values(".$this->column_fields['assigned_user_id'].",".$this->id.")";
+    		$adb->query($sql_qry);
+
+  	}
+	
+	
+	// Mike Crowe Mod --------------------------------------------------------Default ordering for us
+	/**
+	 * Function to get sort order
+	 * return string  $sorder    - sortorder string either 'ASC' or 'DESC'
+	 */
+	function getSortOrder()
+	{	
+		global $log;                                                                                                  $log->debug("Entering getSortOrder() method ...");
+		if(isset($_REQUEST['sorder'])) 
+			$sorder = $_REQUEST['sorder'];
+		else
+			$sorder = (($_SESSION['ACTIVITIES_SORT_ORDER'] != '')?($_SESSION['ACTIVITIES_SORT_ORDER']):($this->default_sort_order));
+		$log->debug("Exiting getSortOrder method ...");
+		return $sorder;
+	}
+	
+	/**
+	 * Function to get order by
+	 * return string  $order_by    - fieldname(eg: 'subject')
+	 */
+	function getOrderBy()
+	{
+		global $log;
+                 $log->debug("Entering getOrderBy() method ...");
+		if (isset($_REQUEST['order_by'])) 
+			$order_by = $_REQUEST['order_by'];
+		else
+			$order_by = (($_SESSION['ACTIVITIES_ORDER_BY'] != '')?($_SESSION['ACTIVITIES_ORDER_BY']):($this->default_order_by));
+		$log->debug("Exiting getOrderBy method ...");
+		return $order_by;
+	}	
+	// Mike Crowe Mod --------------------------------------------------------
+
+
+
+//Function Call for Related List -- Start
+	/**
+	 * Function to get Activity related Contacts
+	 * @param  integer   $id      - activityid
+	 * returns related Contacts record in array format
+	 */
+        function get_contacts($id)
+	{
+			global $log;
+                        $log->debug("Entering get_contacts(".$id.") method ...");
+			global $app_strings;
+
+			$focus = new Contacts();
+
+			$button = '';
+
+			$returnset = '&return_module=Calendar&return_action=CallRelatedList&activity_mode=Events&return_id='.$id;
+
+			$query = 'select vtiger_users.user_name,vtiger_contactdetails.accountid,vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_contactdetails.department, vtiger_contactdetails.title, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_contactdetails inner join vtiger_cntactivityrel on vtiger_cntactivityrel.contactid=vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_cntactivityrel.activityid = vtiger_activitygrouprelation.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname where vtiger_cntactivityrel.activityid='.$id.' and vtiger_crmentity.deleted=0';
+			$log->debug("Exiting get_contacts method ...");
+			return GetRelatedList('Calendar','Contacts',$focus,$query,$button,$returnset);
+        }
+	
+	/**
+	 * Function to get Activity related Users
+	 * @param  integer   $id      - activityid
+	 * returns related Users record in array format
+	 */
+
+        function get_users($id)
+	{	
+		global $log;
+                $log->debug("Entering get_contacts(".$id.") method ...");
+		global $app_strings;
+
+		$focus = new Users();
+
+		$button = '';
+
+		$returnset = '&return_module=Calendar&return_action=CallRelatedList&return_id='.$id;
+
+		$query = 'SELECT vtiger_users.id, vtiger_users.first_name,vtiger_users.last_name, vtiger_users.user_name, vtiger_users.email1, vtiger_users.email2, vtiger_users.status, vtiger_users.is_admin, vtiger_user2role.roleid, vtiger_users.yahoo_id, vtiger_users.phone_home, vtiger_users.phone_work, vtiger_users.phone_mobile, vtiger_users.phone_other, vtiger_users.phone_fax,vtiger_activity.date_start,vtiger_activity.due_date,vtiger_activity.time_start,vtiger_activity.duration_hours,vtiger_activity.duration_minutes from vtiger_users inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.smid=vtiger_users.id  inner join vtiger_activity on vtiger_activity.activityid=vtiger_salesmanactivityrel.activityid inner join vtiger_user2role on vtiger_user2role.userid=vtiger_users.id where vtiger_activity.activityid='.$id;
+		$log->debug("Exiting get_users method ...");
+		return GetRelatedList('Calendar','Users',$focus,$query,$button,$returnset);
+
+
+	}
+
+	/**
+         * Function to get activities for given criteria
+	 * @param   string   $criteria     - query string
+	 * returns  activity records in array format($list) or null value
+         */	 
+  	function get_full_list($criteria)
+  	{
+	 global $log;
+         $log->debug("Entering get_full_list(".$criteria.") method ...");
+    $query = "select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.setype, vtiger_activity.*, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid WHERE vtiger_crmentity.deleted=0 ".$criteria;
+    $result =& $this->db->query($query);
+        
+    if($this->db->getRowCount($result) > 0){
+		
+      // We have some data.
+      while ($row = $this->db->fetchByAssoc($result)) {
+        foreach($this->list_fields_name as $field)
+        {
+          if (isset($row[$field])) {
+            $this->$field = $row[$field];
+          }
+          else {
+            $this->$field = '';   
+          }
+        }
+        $list[] = $this;
+      }
+    }
+    if (isset($list))
+    	{
+		$log->debug("Exiting get_full_list method ...");
+	    return $list;
+	}
+	else
+	{
+		$log->debug("Exiting get_full_list method ...");
+	    return null;
+	}
+
+  }
+
+	
+//calendarsync
+    /**
+     * Function to get meeting count
+     * @param  string   $user_name        - User Name
+     * return  integer  $row["count(*)"]  - count
+     */
+    function getCount_Meeting($user_name) 
+	{
+		global $log;
+	        $log->debug("Entering getCount_Meeting(".$user_name.") method ...");
+      $query = "select count(*) from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Meeting'";
+
+      $result = $this->db->query($query,true,"Error retrieving contacts count");
+      $rows_found =  $this->db->getRowCount($result);
+      $row = $this->db->fetchByAssoc($result, 0);
+	$log->debug("Exiting getCount_Meeting method ...");
+      return $row["count(*)"];
+    }
+   
+    function get_calendars($user_name,$from_index,$offset)
+    {   
+	    global $log;
+            $log->debug("Entering get_calendars(".$user_name.",".$from_index.",".$offset.") method ...");
+		$query = "select vtiger_activity.location as location,vtiger_activity.duration_hours as duehours, vtiger_activity.duration_minutes as dueminutes,vtiger_activity.time_start as time_start, vtiger_activity.subject as name,vtiger_crmentity.modifiedtime as date_modified, vtiger_activity.date_start start_date,vtiger_activity.activityid as id,vtiger_activity.status as status, vtiger_crmentity.description as description, vtiger_activity.priority as vtiger_priority, vtiger_activity.due_date as date_due ,vtiger_contactdetails.firstname cfn, vtiger_contactdetails.lastname cln from vtiger_activity inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Meeting' limit " .$from_index ."," .$offset;
+	$log->debug("Exiting get_calendars method ...");
+	    return $this->process_list_query1($query);   
+    }       
+//calendarsync
+	/**
+	 * Function to get task count
+	 * @param  string   $user_name        - User Name
+	 * return  integer  $row["count(*)"]  - count
+	 */
+    function getCount($user_name) 
+    {
+	    global $log;
+            $log->debug("Entering getCount(".$user_name.") method ...");
+        $query = "select count(*) from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Task'";
+
+        $result = $this->db->query($query,true,"Error retrieving contacts count");
+        $rows_found =  $this->db->getRowCount($result);
+        $row = $this->db->fetchByAssoc($result, 0);
+
+	$log->debug("Exiting getCount method ...");    
+        return $row["count(*)"];
+    }       
+
+    /**
+     * Function to get list of task for user with given limit
+     * @param  string   $user_name        - User Name
+     * @param  string   $from_index       - query string
+     * @param  string   $offset           - query string 
+     * returns tasks in array format
+     */
+    function get_tasks($user_name,$from_index,$offset)
+    {   
+	global $log;
+        $log->debug("Entering get_tasks(".$user_name.",".$from_index.",".$offset.") method ...");
+	 $query = "select vtiger_activity.subject as name,vtiger_crmentity.modifiedtime as date_modified, vtiger_activity.date_start start_date,vtiger_activity.activityid as id,vtiger_activity.status as status, vtiger_crmentity.description as description, vtiger_activity.priority as priority, vtiger_activity.due_date as date_due ,vtiger_contactdetails.firstname cfn, vtiger_contactdetails.lastname cln from vtiger_activity inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid where user_name='" .$user_name ."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Task' limit " .$from_index ."," .$offset;
+	 $log->debug("Exiting get_tasks method ...");
+    return $this->process_list_query1($query);
+    
+    }
+	
+    /**
+     * Function to process the activity list query
+     * @param  string   $query     - query string
+     * return  array    $response  - activity lists
+     */
+    function process_list_query1($query)
+    {
+	    global $log;
+            $log->debug("Entering process_list_query1(".$query.") method ...");
+        $result =& $this->db->query($query,true,"Error retrieving $this->object_name list: ");
+        $list = Array();
+        $rows_found =  $this->db->getRowCount($result);
+        if($rows_found != 0)
+        {
+            $task = Array();
+              for($index = 0 , $row = $this->db->fetchByAssoc($result, $index); $row && $index <$rows_found;$index++, $row = $this->db->fetchByAssoc($result, $index))
+            
+             {
+                foreach($this->range_fields as $columnName)
+                {
+                    if (isset($row[$columnName])) {
+			    
+                        $task[$columnName] = $row[$columnName];
+                    }   
+                    else     
+                    {   
+                            $task[$columnName] = "";
+                    }   
+	            }	
+    
+                $task[contact_name] = return_name($row, 'cfn', 'cln');    
+
+                    $list[] = $task;
+                }
+         }
+
+        $response = Array();
+        $response['list'] = $list;
+        $response['row_count'] = $rows_found;
+        $response['next_offset'] = $next_offset;
+        $response['previous_offset'] = $previous_offset;
+
+
+	$log->debug("Exiting process_list_query1 method ...");
+        return $response;
+    }
+
+    	/**
+	 * Function to get reminder for activity
+	 * @param  integer   $activity_id     - activity id
+	 * @param  string    $reminder_time   - reminder time
+	 * @param  integer   $reminder_sent   - 0 or 1
+	 * @param  integer   $recurid         - recuring eventid
+	 * @param  string    $remindermode    - string like 'edit'	 
+	 */	
+	function activity_reminder($activity_id,$reminder_time,$reminder_sent=0,$recurid,$remindermode='')
+	{
+		global $log;
+		$log->debug("Entering vtiger_activity_reminder(".$activity_id.",".$reminder_time.",".$reminder_sent.",".$recurid.",".$remindermode.") method ...");
+		//Check for vtiger_activityid already present in the reminder_table
+		$query_exist = "SELECT activity_id FROM ".$this->reminder_table." WHERE activity_id = ".$activity_id;
+		$result_exist = $this->db->query($query_exist);
+
+		if($remindermode == 'edit')
+		{
+			if($this->db->num_rows($result_exist) == 1)
+			{
+				$query = "UPDATE ".$this->reminder_table." SET";
+				$query .=" reminder_sent = ".$reminder_sent.",";
+				$query .=" reminder_time = ".$reminder_time." WHERE activity_id =".$activity_id; 
+			}
+			else
+			{
+				$query = "INSERT INTO ".$this->reminder_table." VALUES (".$activity_id.",".$reminder_time.",0,'".$recurid."')";
+			}
+		}
+		elseif(($remindermode == 'delete') && ($this->db->num_rows($result_exist) == 1))
+		{
+			$query = "DELETE FROM ".$this->reminder_table." WHERE activity_id = ".$activity_id;
+		}
+		else
+		{
+			$query = "INSERT INTO ".$this->reminder_table." VALUES (".$activity_id.",".$reminder_time.",0,'".$recurid."')";
+		}
+      		$this->db->query($query,true,"Error in processing vtiger_table $this->reminder_table");
+		$log->debug("Exiting vtiger_activity_reminder method ...");
+	}
+
+//Used for vtigerCRM Outlook Add-In
+/**
+ * Function to get tasks to display in outlookplugin
+ * @param   string    $username     -  User name
+ * return   string    $query        -  sql query 
+ */
+function get_tasksforol($username)
+{
+	global $log,$adb;
+	$log->debug("Entering get_tasksforol(".$username.") method ...");
+	global $current_user;
+	require_once("modules/Users/Users.php");
+	$seed_user=new Users();
+	$user_id=$seed_user->retrieve_user_id($username);
+	$current_user=$seed_user;
+	$current_user->retrieve_entity_info($user_id, 'Users');
+	require('user_privileges/user_privileges_'.$current_user->id.'.php');
+	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+	
+	if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
+  {
+    $sql1 = "select tablename,columnname from vtiger_field where tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder'";
+  }else
+  {
+    $profileList = getCurrentUserProfileList();
+    $sql1 = "select tablename,columnname from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder' and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList;
+  }
+  $result1 = $adb->query($sql1);
+  for($i=0;$i < $adb->num_rows($result1);$i++)
+  {
+      $permitted_lists[] = $adb->query_result($result1,$i,'tablename');
+      $permitted_lists[] = $adb->query_result($result1,$i,'columnname');
+      /*if($adb->query_result($result1,$i,'columnname') == "parentid")
+      {
+        $permitted_lists[] = 'vtiger_account';
+        $permitted_lists[] = 'accountname';
+      }*/
+  }
+	$permitted_lists = array_chunk($permitted_lists,2);
+	$column_table_lists = array();
+	for($i=0;$i < count($permitted_lists);$i++)
+	{
+	   $column_table_lists[] = implode(".",$permitted_lists[$i]);
+  }
+   
+	$query = "select vtiger_activity.activityid as taskid, ".implode(',',$column_table_lists)." from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid 
+			 inner join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid 
+			 left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid 
+			 left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid 
+			 left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid 
+			 where vtiger_users.user_name='".$username."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Task'";
+	$log->debug("Exiting get_tasksforol method ...");		 
+	return $query;
+}
+
+/**
+ * Function to get calendar query for outlookplugin
+ * @param   string    $username     -  User name                                                                            * return   string    $query        -  sql query                                                                            */ 
+function get_calendarsforol($user_name)
+{
+	global $log,$adb;
+	$log->debug("Entering get_calendarsforol(".$user_name.") method ...");
+	global $current_user;
+	require_once("modules/Users/Users.php");
+	$seed_user=new Users();
+	$user_id=$seed_user->retrieve_user_id($user_name);
+	$current_user=$seed_user;
+	$current_user->retrieve_entity_info($user_id, 'Users');
+	require('user_privileges/user_privileges_'.$current_user->id.'.php');
+	require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
+	
+	if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)
+  {
+    $sql1 = "select tablename,columnname from vtiger_field where tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder'";
+  }else
+  {
+    $profileList = getCurrentUserProfileList();
+    $sql1 = "select tablename,columnname from vtiger_field inner join vtiger_profile2field on vtiger_profile2field.fieldid=vtiger_field.fieldid inner join vtiger_def_org_field on vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid=9 and tablename <> 'vtiger_recurringevents' and tablename <> 'vtiger_activity_reminder' and vtiger_field.displaytype in (1,2,4) and vtiger_profile2field.visible=0 and vtiger_def_org_field.visible=0 and vtiger_profile2field.profileid in ".$profileList;
+  }
+  $result1 = $adb->query($sql1);
+  for($i=0;$i < $adb->num_rows($result1);$i++)
+  {
+      $permitted_lists[] = $adb->query_result($result1,$i,'tablename');
+      $permitted_lists[] = $adb->query_result($result1,$i,'columnname');
+      /*if($adb->query_result($result1,$i,'columnname') == "parentid")
+      {
+        $permitted_lists[] = 'vtiger_account';
+        $permitted_lists[] = 'accountname';
+      }*/
+  }
+	$permitted_lists = array_chunk($permitted_lists,2);
+	$column_table_lists = array();
+	for($i=0;$i < count($permitted_lists);$i++)
+	{
+	   $column_table_lists[] = implode(".",$permitted_lists[$i]);
+  }
+   
+	  $query = "select vtiger_activity.activityid as clndrid, ".implode(',',$column_table_lists)." from vtiger_activity 
+				inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid 
+				inner join vtiger_users on vtiger_users.id=vtiger_salesmanactivityrel.smid 
+				left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid=vtiger_activity.activityid 
+				left join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_cntactivityrel.contactid 
+				left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid 
+				inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid 
+				where vtiger_users.user_name='".$user_name."' and vtiger_crmentity.deleted=0 and vtiger_activity.activitytype='Meeting'";
+	$log->debug("Exiting get_calendarsforol method ...");
+	return $query;
+}
+//End
+
+}
+?>

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/ActivityAjax.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/ActivityAjax.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/ActivityAjax.php Tue Nov 14 03:16:10 2006
@@ -19,6 +19,27 @@
 $cal_log =& LoggerManager::getLogger('calendar');
 $cal_log->debug("In CalendarAjax file");
 $mysel = $_REQUEST['view'];
+if($_REQUEST['file'] == 'OpenListView')
+{
+	require_once('Smarty_setup.php');
+	$smarty = new vtigerCRM_Smarty;
+	require_once("modules/Calendar/OpenListView.php");
+	$smarty->assign("APP",$app_strings);
+	$smarty->assign("IMAGE_PATH",$image_path);
+	if($_REQUEST['mode'] == '0')
+	{
+		$activities[0] = getPendingActivities(0);
+		$smarty->assign("ACTIVITIES",$activities);
+		$smarty->display("upcomingActivities.tpl");
+	}
+	else if($_REQUEST['mode'] == '1')
+	{
+		$activities[1] = getPendingActivities(1);
+		$smarty->assign("ACTIVITIES",$activities);
+		$smarty->display("pendingActivities.tpl");
+	}
+	die();
+}
 $calendar_arr = Array();
 $calendar_arr['IMAGE_PATH'] = $image_path;
 $date_data = array();

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/Appointment.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/Appointment.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/Appointment.php Tue Nov 14 03:16:10 2006
@@ -12,6 +12,7 @@
 require_once('include/utils/CommonUtils.php');
 require_once('include/utils/UserInfoUtil.php');
 require_once('include/database/PearDatabase.php');
+require_once('include/database/Postgres8.php');
 require_once('modules/Calendar/Activity.php');
 class Appointment
 {
@@ -56,11 +57,11 @@
 	
 	function readAppointment($userid, &$from_datetime, &$to_datetime, $view)
 	{
-		global $current_user,$adb;
+		global $current_user,$adb,$log;
 		require('user_privileges/user_privileges_'.$current_user->id.'.php');
 		require('user_privileges/sharing_privileges_'.$current_user->id.'.php');
 		$shared_ids = getSharedCalendarId($current_user->id);
-                $q= "select vtiger_activity.*, vtiger_crmentity.*, vtiger_activitygrouprelation.groupname FROM vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid left join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype in ('Call','Meeting') AND (vtiger_activity.date_start < '". $to_datetime->get_formatted_date() ."' AND vtiger_activity.date_start >= '". $from_datetime->get_formatted_date()."') ";
+                $q= "select vtiger_activity.*, vtiger_crmentity.*, vtiger_activitygrouprelation.groupname FROM vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid left join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname WHERE vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype in ('Call','Meeting') AND (vtiger_activity.date_start < '". $to_datetime->get_formatted_date() ."' AND vtiger_activity.date_start >= '". $from_datetime->get_formatted_date()."') ";
 		if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[16] == 3)
 		{
 			$sec_parameter=getListViewSecurityParameter('Calendar');
@@ -68,7 +69,10 @@
 		}
 									
                 $q .= " AND vtiger_recurringevents.activityid is NULL ";
-                $q .= " group by vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
+                $q .= " GROUP BY vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
+		//Postgres 8 fixes
+		if( $adb->dbType == "pgsql")
+		    $q = fixPostgresQuery( $q, $log, 0);
 		$r = $adb->query($q);
                 $n = $adb->getRowCount($r);
                 $a = 0;
@@ -83,7 +87,7 @@
                         unset($obj);
                 }
 		//Get Recurring events
-		$q = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.activitytype, vtiger_crmentity.description, vtiger_activity.time_start,vtiger_activity.time_end, vtiger_activity.duration_hours, vtiger_activity.duration_minutes,vtiger_activity.due_date, vtiger_activity.priority, vtiger_activity.location,vtiger_activity.eventstatus, vtiger_crmentity.*, vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_activitygrouprelation.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid";
+		$q = "SELECT vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.activitytype, vtiger_crmentity.description, vtiger_activity.time_start,vtiger_activity.time_end, vtiger_activity.duration_hours, vtiger_activity.duration_minutes,vtiger_activity.due_date, vtiger_activity.priority, vtiger_activity.location,vtiger_activity.eventstatus, vtiger_crmentity.*, vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_activitygrouprelation.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupname = vtiger_activitygrouprelation.groupname ";
 
                 $q.=" where vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype in ('Call','Meeting') AND (recurringdate < '".$to_datetime->get_formatted_date()."' AND recurringdate >= '".$from_datetime->get_formatted_date(). "') ";
 
@@ -93,7 +97,7 @@
 			$q .= $sec_parameter;
 		}
 													
-                $q .= " ORDER by recurringid";
+                $q .= " ORDER by vtiger_recurringevents.recurringid";
                 $r = $adb->query($q);
                 $n = $adb->getRowCount($r);
                 $a = 0;

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/CalendarCommon.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/CalendarCommon.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/CalendarCommon.php Tue Nov 14 03:16:10 2006
@@ -182,6 +182,7 @@
 function getTimeCombo($format,$bimode,$hour='',$min='',$fmt='')
 {
 	$combo = '';
+	$min = $min - ($min%5);
 	if($format == 'am/pm')
 	{
 		$combo .= '<select class=small name="'.$bimode.'hr" id="'.$bimode.'hr">';
@@ -205,7 +206,7 @@
 				$hrsel = 'selected';
 			else
 				$hrsel = '';
-			$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$hrtext.'</option>';
+			$combo .= '<option value="'.$hrvalue.'" '.$hrsel.'>'.$hrtext.'</option>';
 		}
 		$combo .= '</select>&nbsp;';
 		$combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small>';
@@ -222,7 +223,7 @@
 				$minsel = 'selected';
 			else
 				$minsel = '';
-				$combo .= '<option value="'.$value.'" "'.$minsel.'">'.$value.'</option>';
+				$combo .= '<option value="'.$value.'" '.$minsel.'>'.$value.'</option>';
 		}
 		$combo .= '</select>&nbsp;';
 		$combo .= '<select name="'.$bimode.'fmt" id="'.$bimode.'fmt" class=small>';
@@ -254,7 +255,7 @@
 					$hrsel = 'selected';
 				else
 					$hrsel = '';
-				$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$hrvalue.'</option>';
+				$combo .= '<option value="'.$hrvalue.'" '.$hrsel.'>'.$hrvalue.'</option>';
 			}
 			$combo .= '</select>Hr&nbsp;';
 			$combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small>';
@@ -271,7 +272,7 @@
 					$minsel = 'selected';
 				else
 					$minsel = '';
-				$combo .= '<option value="'.$value.'" "'.$minsel.'">'.$value.'</option>';
+				$combo .= '<option value="'.$value.'" '.$minsel.'>'.$value.'</option>';
 			}
 			$combo .= '</select>&nbsp;min<input type="hidden" name="'.$bimode.'fmt" id="'.$bimode.'fmt">';
 		}
@@ -298,7 +299,7 @@
 	for($i = 0; $i < $noofrows; $i++)
 	{
 		$value = $adb->query_result($Res,$i,$fieldname);
-		$combo .= '<option value="'.$value.'">'.$mod_strings[$value].'</option>';
+		$combo .= '<option value="'.$value.'">'.$value.'</option>';
 	}
 
 	$combo .= '</select>';

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/DetailView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/DetailView.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/DetailView.php Tue Nov 14 03:16:10 2006
@@ -1,306 +1,306 @@
-<?php
-/*********************************************************************************
- * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
- * ("License"); You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
- * Software distributed under the License is distributed on an  "AS IS"  basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- * The Original Code is:  SugarCRM Open Source
- * The Initial Developer of the Original Code is SugarCRM, Inc.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
- ********************************************************************************/
-/*********************************************************************************
- * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/DetailView.php,v 1.12 2005/03/17 11:26:49 ray Exp $
- * Description:  TODO: To be written.
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- ********************************************************************************/
-
-require_once('Smarty_setup.php');
-require_once('data/Tracker.php');
-require_once('modules/Calendar/Activity.php');
-require_once('include/CustomFieldUtil.php');
-require_once('include/database/PearDatabase.php');
-require_once('include/utils/utils.php');
-require_once('modules/Calendar/calendarLayout.php');
-include_once 'modules/Calendar/header.php';
-global $mod_strings, $currentModule;
-if( $_SESSION['mail_send_error']!="")
-{
-	echo '<b><font color=red>'. $mod_strings{"LBL_NOTIFICATION_ERROR"}.'</font></b><br>';
-}
-session_unregister('mail_send_error');
-$focus = new Activity();
-$smarty =  new vtigerCRM_Smarty();
-$activity_mode = $_REQUEST['activity_mode'];
-//If activity_mode == null
-
-if($activity_mode =='' || strlen($activity_mode) < 1)
-{
-	$query = "select activitytype from vtiger_activity where activityid=".$_REQUEST['record'];
-	$result = $adb->query($query);
-	$actType = $adb->query_result($result,0,'activitytype');
-	if( $actType == 'Task')
-	{
-		$activity_mode = $actType;	
-	}
-	elseif($actType == 'Meeting' || $actType == 'Call')
-	{
-		$activity_mode = 'Events';
-	}		
-}	
-
-
-
-if($activity_mode == 'Task')
-{
-        $tab_type = 'Calendar';
-	$smarty->assign("SINGLE_MOD",$mod_strings['LBL_TODO']);
-}
-elseif($activity_mode == 'Events')
-{
-        $tab_type = 'Events';
-	$smarty->assign("SINGLE_MOD",$mod_strings['LBL_EVENT']);
-}
-$tab_id=getTabid($tab_type);
-
-
-if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
-    $focus->retrieve_entity_info($_REQUEST['record'],$tab_type);
-    $focus->id = $_REQUEST['record'];	
-    $focus->name=$focus->column_fields['subject'];
-}
-
-if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
-	$focus->id = "";
-} 
-
-//needed when creating a new task with default values passed in
-if (isset($_REQUEST['contactname']) && is_null($focus->contactname)) {
-	$focus->contactname = $_REQUEST['contactname'];
-}
-if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) {
-	$focus->contact_id = $_REQUEST['contact_id'];
-}
-if (isset($_REQUEST['opportunity_name']) && is_null($focus->parent_name)) {
-	$focus->parent_name = $_REQUEST['opportunity_name'];
-}
-if (isset($_REQUEST['opportunity_id']) && is_null($focus->parent_id)) {
-	$focus->parent_id = $_REQUEST['opportunity_id'];
-}
-if (isset($_REQUEST['accountname']) && is_null($focus->parent_name)) {
-	$focus->parent_name = $_REQUEST['accountname'];
-}
-if (isset($_REQUEST['accountid']) && is_null($focus->parent_id)) {
-	$focus->parent_id = $_REQUEST['accountid'];
-}
-
-$act_data = getBlocks($tab_type,"detail_view",'',$focus->column_fields);
-foreach($act_data as $block=>$entry)
-{
-	foreach($entry as $key=>$value)
-	{
-		foreach($value as $label=>$field)
-		{
-			$fldlabel[$field['fldname']] = $label;
-			$finaldata[$field['fldname']] = $field['value'];
-		}
-	}
-}
-
-//Start
-//To set user selected hour format
-if($current_user->hour_format == '')
-	$format = 'am/pm';
-else
-	$format = $current_user->hour_format;
-list($stdate,$sttime) = split('&nbsp;',$finaldata['date_start']);
-list($enddate,$endtime) = split('&nbsp;',$finaldata['due_date']);
-$time_arr = getaddEventPopupTime($sttime,$endtime,$format);
-$data['starthr'] = $time_arr['starthour'];
-$data['startmin'] = $time_arr['startmin'];
-$data['startfmt'] = $time_arr['startfmt'];
-$data['endhr'] = $time_arr['endhour'];
-$data['endmin'] = $time_arr['endmin'];
-$data['endfmt'] = $time_arr['endfmt'];
-$data['record'] = $focus->id;
-if(isset($finaldata['sendnotification']) && $finaldata['sendnotification'] == 'yes')
-        $data['sendnotification'] = 'Yes';
-else
-        $data['sendnotification'] = 'No';
-$data['subject'] = $finaldata['subject'];
-$data['date_start'] = $stdate;
-$data['due_date'] = $enddate;
-$data['assigned_user_id'] = $finaldata['assigned_user_id'];
-$data['taskpriority'] = $finaldata['taskpriority'];
-$data['modifiedtime'] = $finaldata['modifiedtime'];
-$data['createdtime'] = $finaldata['createdtime'];
-$data['parent_name'] = $finaldata['parent_id'];
-$data['description'] = $finaldata['description'];
-if($activity_mode == 'Task')
-{
-	$data['taskstatus'] = $finaldata['taskstatus'];
-	$data['activitytype'] = $activity_mode;
-	$data['contact_id'] = $finaldata['contact_id'];
-}
-elseif($activity_mode == 'Events')
-{
-	$data['visibility'] = $finaldata['visibility'];
-	$data['eventstatus'] = $finaldata['eventstatus'];
-	$data['activitytype'] = $finaldata['activitytype'];
-	$data['location'] = $finaldata['location'];
-	//Calculating reminder time
-	$rem_days = 0;
-	$rem_hrs = 0;
-	$rem_min = 0;
-	if($focus->column_fields['reminder_time'] != null)
-	{
-		$data['set_reminder'] = 'Yes';
-		$data['reminder_str'] = $finaldata['reminder_time'];
-	}
-	else
-		$data['set_reminder'] = 'No';
-	//To set recurring details
-	$query = 'select vtiger_recurringevents.recurringfreq,vtiger_recurringevents.recurringinfo from vtiger_recurringevents where vtiger_recurringevents.activityid = '.$focus->id;
-	$res = $adb->query($query);
-	$rows = $adb->num_rows($res);
-	if($rows != 0)
-	{
-		$data['recurringcheck'] = 'Yes';
-		$data['repeat_frequency'] = $adb->query_result($res,0,'recurringfreq');
-		$recurringinfo =  explode("::",$adb->query_result($res,0,'recurringinfo'));
-		$data['recurringtype'] = $recurringinfo[0];
-		if($recurringinfo[0] == 'Weekly')
-		{
-			$weekrpt_str = '';
-			if(count($recurringinfo) > 1)
-			{
-				$weekrpt_str .= 'on ';
-				for($i=1;$i<count($recurringinfo);$i++)
-				{
-					$label = 'LBL_DAY'.$recurringinfo[$i];
-					if($i != 1)
-						$weekrpt_str .= ', ';
-					$weekrpt_str .= $mod_strings[$label];
-				}
-			}
-			$data['repeat_str'] = $weekrpt_str;
-		}
-		elseif($recurringinfo[0] == 'Monthly')
-		{   
-			$monthrpt_str = '';
-			$data['repeatMonth'] = $recurringinfo[1];  
-			if($recurringinfo[1] == 'date')
-			{
-				$data['repeatMonth_date'] = $recurringinfo[2];
-				$monthrpt_str .= 'on '.$recurringinfo[2].' day of the month';
-			}
-			else 
-			{ 
-				$data['repeatMonth_daytype'] = $recurringinfo[2];
-				$data['repeatMonth_day'] = $recurringinfo[3];
-				switch($data['repeatMonth_day'])
-				{
-					case 0 :
-						$day = $mod_strings['LBL_DAY0'];
-						break;
-					case 1 :
-						$day = $mod_strings['LBL_DAY1'];
-						break;
-					case 2 :
-						$day = $mod_strings['LBL_DAY2'];
-						break;
-					case 3 :
-						$day = $mod_strings['LBL_DAY3'];
-						break;
-					case 4 :
-						$day = $mod_strings['LBL_DAY4'];
-						break;
-					case 5 :
-						$day = $mod_strings['LBL_DAY5'];
-						break;
-					case 6 :
-						$day = $mod_strings['LBL_DAY6'];
-						break;
-				}
-
-				$monthrpt_str .= 'on '.$mod_strings[$recurringinfo[2]].' '.$day;
-			}
-			$data['repeat_str'] = $monthrpt_str;
-		}
-	}
-	else 
-	{   
-		$data['recurringcheck'] = 'No';
-		$data['repeat_month_str'] = '';
-	}
-	$related_array = getRelatedLists("Calendar", $focus);
-	$smarty->assign("INVITEDUSERS",$related_array['Users']['entries']);
-	$smarty->assign("CONTACTS",$related_array['Contacts']['entries']);
-
-
-}
-
-global $theme;
-$theme_path="themes/".$theme."/";
-$image_path=$theme_path."images/";
-require_once($theme_path.'layout_utils.php');
-
-$log->info("Calendar-Activities detail view");
-$category = getParentTab();
-$smarty->assign("CATEGORY",$category);
-
-$smarty->assign("MOD", $mod_strings);
-$smarty->assign("APP", $app_strings);
-$smarty->assign("ACTIVITY_MODE", $activity_mode);
-
-if (isset($focus->name)) 
-$smarty->assign("NAME", $focus->name);
-else 
-$smarty->assign("NAME", "");
-$smarty->assign("UPDATEINFO",updateInfo($focus->id));
-if (isset($_REQUEST['return_module'])) 
-$smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
-if (isset($_REQUEST['return_action'])) 
-$smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
-if (isset($_REQUEST['return_id'])) 
-$smarty->assign("RETURN_ID", $_REQUEST['return_id']);
-$smarty->assign("THEME", $theme);
-$smarty->assign("IMAGE_PATH", $image_path);
-$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string'].'&activity_mode='.$activity_mode);
-$smarty->assign("ID", $focus->id);
-$smarty->assign("NAME", $focus->name);
-$smarty->assign("BLOCKS", $act_data);
-$smarty->assign("LABEL", $fldlabel);
-$smarty->assign("VIEWTYPE", $_REQUEST['viewtype']);
-$smarty->assign("CUSTOMFIELD", $cust_fld);
-$smarty->assign("ACTIVITYDATA", $data);
-$smarty->assign("ID", $_REQUEST['record']);
-
-//get Description Information
-if(isPermitted("Calendar","EditView",$_REQUEST['record']) == 'yes')
-	$smarty->assign("EDIT_DUPLICATE","permitted");
-
-if(isPermitted("Calendar","Delete",$_REQUEST['record']) == 'yes')
-	$smarty->assign("DELETE","permitted");
-  
-$check_button = Button_Check($module);
-$smarty->assign("CHECK", $check_button);
-
- $tabid = getTabid($tab_type);
- $validationData = getDBValidationData($focus->tab_name,$tabid);
- $data2 = split_validationdataArray($validationData);
-
- $smarty->assign("VALIDATION_DATA_FIELDNAME",$data2['fieldname']);
- $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data2['datatype']);
- $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data2['fieldlabel']);
-
-$smarty->assign("MODULE",$currentModule);
-$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST[record]));
-$smarty->display("ActivityDetailView.tpl");
-
-?>
+<?php
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an  "AS IS"  basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is:  SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Activities/DetailView.php,v 1.12 2005/03/17 11:26:49 ray Exp $
+ * Description:  TODO: To be written.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+ ********************************************************************************/
+
+require_once('Smarty_setup.php');
+require_once('data/Tracker.php');
+require_once('modules/Calendar/Activity.php');
+require_once('include/CustomFieldUtil.php');
+require_once('include/database/PearDatabase.php');
+require_once('include/utils/utils.php');
+require_once('modules/Calendar/calendarLayout.php');
+include_once 'modules/Calendar/header.php';
+global $mod_strings, $currentModule;
+if( $_SESSION['mail_send_error']!="")
+{
+	echo '<b><font color=red>'. $mod_strings{"LBL_NOTIFICATION_ERROR"}.'</font></b><br>';
+}
+session_unregister('mail_send_error');
+$focus = new Activity();
+$smarty =  new vtigerCRM_Smarty();
+$activity_mode = $_REQUEST['activity_mode'];
+//If activity_mode == null
+
+if($activity_mode =='' || strlen($activity_mode) < 1)
+{
+	$query = "select activitytype from vtiger_activity where activityid=".$_REQUEST['record'];
+	$result = $adb->query($query);
+	$actType = $adb->query_result($result,0,'activitytype');
+	if( $actType == 'Task')
+	{
+		$activity_mode = $actType;	
+	}
+	elseif($actType == 'Meeting' || $actType == 'Call')
+	{
+		$activity_mode = 'Events';
+	}		
+}	
+
+
+
+if($activity_mode == 'Task')
+{
+        $tab_type = 'Calendar';
+	$smarty->assign("SINGLE_MOD",$mod_strings['LBL_TODO']);
+}
+elseif($activity_mode == 'Events')
+{
+        $tab_type = 'Events';
+	$smarty->assign("SINGLE_MOD",$mod_strings['LBL_EVENT']);
+}
+$tab_id=getTabid($tab_type);
+
+
+if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
+    $focus->retrieve_entity_info($_REQUEST['record'],$tab_type);
+    $focus->id = $_REQUEST['record'];	
+    $focus->name=$focus->column_fields['subject'];
+}
+
+if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
+	$focus->id = "";
+} 
+
+//needed when creating a new task with default values passed in
+if (isset($_REQUEST['contactname']) && is_null($focus->contactname)) {
+	$focus->contactname = $_REQUEST['contactname'];
+}
+if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) {
+	$focus->contact_id = $_REQUEST['contact_id'];
+}
+if (isset($_REQUEST['opportunity_name']) && is_null($focus->parent_name)) {
+	$focus->parent_name = $_REQUEST['opportunity_name'];
+}
+if (isset($_REQUEST['opportunity_id']) && is_null($focus->parent_id)) {
+	$focus->parent_id = $_REQUEST['opportunity_id'];
+}
+if (isset($_REQUEST['accountname']) && is_null($focus->parent_name)) {
+	$focus->parent_name = $_REQUEST['accountname'];
+}
+if (isset($_REQUEST['accountid']) && is_null($focus->parent_id)) {
+	$focus->parent_id = $_REQUEST['accountid'];
+}
+
+$act_data = getBlocks($tab_type,"detail_view",'',$focus->column_fields);
+foreach($act_data as $block=>$entry)
+{
+	foreach($entry as $key=>$value)
+	{
+		foreach($value as $label=>$field)
+		{
+			$fldlabel[$field['fldname']] = $label;
+			$finaldata[$field['fldname']] = $field['value'];
+		}
+	}
+}
+
+//Start
+//To set user selected hour format
+if($current_user->hour_format == '')
+	$format = 'am/pm';
+else
+	$format = $current_user->hour_format;
+list($stdate,$sttime) = split('&nbsp;',$finaldata['date_start']);
+list($enddate,$endtime) = split('&nbsp;',$finaldata['due_date']);
+$time_arr = getaddEventPopupTime($sttime,$endtime,$format);
+$data['starthr'] = $time_arr['starthour'];
+$data['startmin'] = $time_arr['startmin'];
+$data['startfmt'] = $time_arr['startfmt'];
+$data['endhr'] = $time_arr['endhour'];
+$data['endmin'] = $time_arr['endmin'];
+$data['endfmt'] = $time_arr['endfmt'];
+$data['record'] = $focus->id;
+if(isset($finaldata['sendnotification']) && $finaldata['sendnotification'] == 'yes')
+        $data['sendnotification'] = 'Yes';
+else
+        $data['sendnotification'] = 'No';
+$data['subject'] = $finaldata['subject'];
+$data['date_start'] = $stdate;
+$data['due_date'] = $enddate;
+$data['assigned_user_id'] = $finaldata['assigned_user_id'];
+$data['taskpriority'] = $mod_strings[$finaldata['taskpriority']];
+$data['modifiedtime'] = $finaldata['modifiedtime'];
+$data['createdtime'] = $finaldata['createdtime'];
+$data['parent_name'] = $finaldata['parent_id'];
+$data['description'] = $finaldata['description'];
+if($activity_mode == 'Task')
+{
+	$data['taskstatus'] = $mod_strings[$finaldata['taskstatus']];
+	$data['activitytype'] = $activity_mode;
+	$data['contact_id'] = $finaldata['contact_id'];
+}
+elseif($activity_mode == 'Events')
+{
+	$data['visibility'] = $finaldata['visibility'];
+	$data['eventstatus'] = $mod_strings[$finaldata['eventstatus']];
+	$data['activitytype'] = $finaldata['activitytype'];
+	$data['location'] = $finaldata['location'];
+	//Calculating reminder time
+	$rem_days = 0;
+	$rem_hrs = 0;
+	$rem_min = 0;
+	if($focus->column_fields['reminder_time'] != null)
+	{
+		$data['set_reminder'] = 'Yes';
+		$data['reminder_str'] = $finaldata['reminder_time'];
+	}
+	else
+		$data['set_reminder'] = 'No';
+	//To set recurring details
+	$query = 'select vtiger_recurringevents.recurringfreq,vtiger_recurringevents.recurringinfo from vtiger_recurringevents where vtiger_recurringevents.activityid = '.$focus->id;
+	$res = $adb->query($query);
+	$rows = $adb->num_rows($res);
+	if($rows != 0)
+	{
+		$data['recurringcheck'] = 'Yes';
+		$data['repeat_frequency'] = $adb->query_result($res,0,'recurringfreq');
+		$recurringinfo =  explode("::",$adb->query_result($res,0,'recurringinfo'));
+		$data['recurringtype'] = $recurringinfo[0];
+		if($recurringinfo[0] == 'Weekly')
+		{
+			$weekrpt_str = '';
+			if(count($recurringinfo) > 1)
+			{
+				$weekrpt_str .= 'on ';
+				for($i=1;$i<count($recurringinfo);$i++)
+				{
+					$label = 'LBL_DAY'.$recurringinfo[$i];
+					if($i != 1)
+						$weekrpt_str .= ', ';
+					$weekrpt_str .= $mod_strings[$label];
+				}
+			}
+			$data['repeat_str'] = $weekrpt_str;
+		}
+		elseif($recurringinfo[0] == 'Monthly')
+		{   
+			$monthrpt_str = '';
+			$data['repeatMonth'] = $recurringinfo[1];  
+			if($recurringinfo[1] == 'date')
+			{
+				$data['repeatMonth_date'] = $recurringinfo[2];
+				$monthrpt_str .= 'on '.$recurringinfo[2].' day of the month';
+			}
+			else 
+			{ 
+				$data['repeatMonth_daytype'] = $recurringinfo[2];
+				$data['repeatMonth_day'] = $recurringinfo[3];
+				switch($data['repeatMonth_day'])
+				{
+					case 0 :
+						$day = $mod_strings['LBL_DAY0'];
+						break;
+					case 1 :
+						$day = $mod_strings['LBL_DAY1'];
+						break;
+					case 2 :
+						$day = $mod_strings['LBL_DAY2'];
+						break;
+					case 3 :
+						$day = $mod_strings['LBL_DAY3'];
+						break;
+					case 4 :
+						$day = $mod_strings['LBL_DAY4'];
+						break;
+					case 5 :
+						$day = $mod_strings['LBL_DAY5'];
+						break;
+					case 6 :
+						$day = $mod_strings['LBL_DAY6'];
+						break;
+				}
+
+				$monthrpt_str .= 'on '.$mod_strings[$recurringinfo[2]].' '.$day;
+			}
+			$data['repeat_str'] = $monthrpt_str;
+		}
+	}
+	else 
+	{   
+		$data['recurringcheck'] = 'No';
+		$data['repeat_month_str'] = '';
+	}
+	$related_array = getRelatedLists("Calendar", $focus);
+	$smarty->assign("INVITEDUSERS",$related_array['Users']['entries']);
+	$smarty->assign("CONTACTS",$related_array['Contacts']['entries']);
+
+
+}
+
+global $theme;
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+require_once($theme_path.'layout_utils.php');
+
+$log->info("Calendar-Activities detail view");
+$category = getParentTab();
+$smarty->assign("CATEGORY",$category);
+
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("ACTIVITY_MODE", $activity_mode);
+
+if (isset($focus->name)) 
+$smarty->assign("NAME", $focus->name);
+else 
+$smarty->assign("NAME", "");
+$smarty->assign("UPDATEINFO",updateInfo($focus->id));
+if (isset($_REQUEST['return_module'])) 
+$smarty->assign("RETURN_MODULE", $_REQUEST['return_module']);
+if (isset($_REQUEST['return_action'])) 
+$smarty->assign("RETURN_ACTION", $_REQUEST['return_action']);
+if (isset($_REQUEST['return_id'])) 
+$smarty->assign("RETURN_ID", $_REQUEST['return_id']);
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string'].'&activity_mode='.$activity_mode);
+$smarty->assign("ID", $focus->id);
+$smarty->assign("NAME", $focus->name);
+$smarty->assign("BLOCKS", $act_data);
+$smarty->assign("LABEL", $fldlabel);
+$smarty->assign("VIEWTYPE", $_REQUEST['viewtype']);
+$smarty->assign("CUSTOMFIELD", $cust_fld);
+$smarty->assign("ACTIVITYDATA", $data);
+$smarty->assign("ID", $_REQUEST['record']);
+
+//get Description Information
+if(isPermitted("Calendar","EditView",$_REQUEST['record']) == 'yes')
+	$smarty->assign("EDIT_DUPLICATE","permitted");
+
+if(isPermitted("Calendar","Delete",$_REQUEST['record']) == 'yes')
+	$smarty->assign("DELETE","permitted");
+  
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+
+ $tabid = getTabid($tab_type);
+ $validationData = getDBValidationData($focus->tab_name,$tabid);
+ $data2 = split_validationdataArray($validationData);
+
+ $smarty->assign("VALIDATION_DATA_FIELDNAME",$data2['fieldname']);
+ $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data2['datatype']);
+ $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data2['fieldlabel']);
+
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST[record]));
+$smarty->display("ActivityDetailView.tpl");
+
+?>

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/ListView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/ListView.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/ListView.php Tue Nov 14 03:16:10 2006
@@ -76,6 +76,7 @@
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
 $where = "";
 
 $url_string = ''; // assigning http url string

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/OpenListView.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/OpenListView.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/OpenListView.php Tue Nov 14 03:16:10 2006
@@ -49,82 +49,67 @@
 	//code added to customize upcomming and pending activities
 	if($_REQUEST['activity_view']=='')
 	{	
-		$query = "select activity_view from vtiger_users where id ='$current_user->id'";
-		$result=$adb->query($query);
-		$activity_view=$adb->query_result($result,0,'activity_view');
+		$activity_view='today';
 	}
 	else
 		$activity_view=$_REQUEST['activity_view'];
 
 	$today = date("Y-m-d", time());
 
-	if($activity_view == 'Today')
-	{	
-		$later = date("Y-m-d",strtotime("$today +1 day"));
-	}	
-	else if($activity_view == 'This Week')
-	{
-		$later = date("Y-m-d", strtotime("$today +7 days"));
-	}
-	else if($activity_view == 'This Month')
-	{	
-		$later = date("Y-m-d", strtotime("$today +1 month"));
-	}	
-	else if($activity_view == 'This Year')	
-	{
-		$later = date("Y-m-d", strtotime("$today +1 year"));
-	}
-	else if($activity_view == 'OverDue')	
-	{
-		$later = date("Y-m-d", strtotime("$today +1 day"));
-	}
-	$last_tendays = date("Y-m-d",strtotime("$today -10 days"));
+	if($activity_view == 'today')
+	{	
+		$upcoming_condition = " AND (date_start = '$today' OR vtiger_recurringevents.recurringdate = '$today')";
+		$pending_condition = " AND (due_date = '$today' OR vtiger_recurringevents.recurringdate = '$today')";
+	}	
+	else if($activity_view == 'all')
+	{
+		$upcoming_condition = " AND (date_start >= '$today' OR vtiger_recurringevents.recurringdate >= '$today')";
+		$pending_condition = " AND (due_date <= '$today' OR vtiger_recurringevents.recurringdate <= '$today')";
+	}
 	if($mode != 1)
 	{
 		//for upcoming avtivities
-		$list_query = " select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.setype, vtiger_activity.*, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_account.accountid, vtiger_account.accountname, vtiger_recurringevents.recurringtype,vtiger_recurringevents.recurringdate from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid left outer join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task') AND ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Completed' ) and ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Deferred') and  (  vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Held') and (vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Not Held' ) AND ((date_start > '$today' AND date_start < '$later')  OR (vtiger_recurringevents.recurringdate between '$today' and '$later') ) AND vtiger_crmentity.smownerid !=0 AND vtiger_salesmanactivityrel.smid ='$current_user->id'";
+		$list_query = " select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.setype, vtiger_activity.*, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_account.accountid, vtiger_account.accountname, vtiger_recurringevents.recurringtype,vtiger_recurringevents.recurringdate from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid left outer join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task') AND ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Completed' ) and ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Deferred') and  (  vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Held') and (vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Not Held' ) ".$upcoming_condition." AND vtiger_crmentity.smownerid !=0 AND vtiger_salesmanactivityrel.smid ='$current_user->id'";
 	}	
 	else
 	{
-		//for pending activities for the last 10 days
-		$list_query = " select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.setype, vtiger_activity.*, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_account.accountid, vtiger_account.accountname, vtiger_recurringevents.recurringtype,vtiger_recurringevents.recurringdate from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid left outer join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task') AND ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Completed' ) and ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Deferred') and (  vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Held') and (vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Not Held' ) AND ((due_date > '$last_tendays' AND due_date <= '$today') OR (vtiger_recurringevents.recurringdate > '$last_tendays' AND vtiger_recurringevents.recurringdate <= '$today')) AND vtiger_crmentity.smownerid !=0 AND vtiger_salesmanactivityrel.smid ='$current_user->id'";
-	}
+		//for pending activities
+		$list_query = " select vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.setype, vtiger_activity.*, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_account.accountid, vtiger_account.accountname, vtiger_recurringevents.recurringtype,vtiger_recurringevents.recurringdate from vtiger_activity inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid= vtiger_cntactivityrel.contactid left join vtiger_seactivityrel on vtiger_seactivityrel.activityid = vtiger_activity.activityid left outer join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_crmentity.deleted=0 and (vtiger_activity.activitytype = 'Meeting' or vtiger_activity.activitytype='Call' or vtiger_activity.activitytype='Task') AND ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Completed' ) and ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Deferred') and (  vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Held') and (vtiger_activity.eventstatus is NULL OR  vtiger_activity.eventstatus != 'Not Held' ) ".$pending_condition." AND vtiger_crmentity.smownerid !=0 AND vtiger_salesmanactivityrel.smid ='$current_user->id'";
+	}
+	
 	$res = $adb->query($list_query);
 	$noofrecords = $adb->num_rows($res);
-	$list_result = $adb->limitQuery($list_query,0,5);
 	$open_activity_list = array();
-	$noofrows = $adb->num_rows($list_result);
-	if (count($list_result)>0)
+	$noofrows = $adb->num_rows($res);
+	if (count($res)>0)
 		for($i=0;$i<$noofrows;$i++) 
 		{
-			$parent_name=getRelatedTo("Calendar",$list_result,$i);
-			$open_activity_list[] = Array('name' => $adb->query_result($list_result,$i,'subject'),
-					'id' => $adb->query_result($list_result,$i,'activityid'),
-					'type' => $adb->query_result($list_result,$i,'activitytype'),
-					'module' => $adb->query_result($list_result,$i,'setype'),
-					'status' => $adb->query_result($list_result,$i,'status'),
-					'firstname' => $adb->query_result($list_result,$i,'firstname'),
-					'lastname' => $adb->query_result($list_result,$i,'lastname'),
-					'accountname' => $adb->query_result($list_result,$i,'accountname'),
-					'accountid' => $adb->query_result($list_result, $i, 'accountid'),
-					'contactid' => $adb->query_result($list_result,$i,'contactid'),
-					'date_start' => getDisplayDate($adb->query_result($list_result,$i,'date_start')),
-					'due_date' => getDisplayDate($adb->query_result($list_result,$i,'due_date')),
-					'recurringtype' => getDisplayDate($adb->query_result($list_result,$i,'recurringtype')),
-					'recurringdate' => getDisplayDate($adb->query_result($list_result,$i,'recurringdate')),
+			$parent_name=getRelatedTo("Calendar",$res,$i);
+			$open_activity_list[] = Array('name' => $adb->query_result($res,$i,'subject'),
+					'id' => $adb->query_result($res,$i,'activityid'),
+					'type' => $adb->query_result($res,$i,'activitytype'),
+					'module' => $adb->query_result($res,$i,'setype'),
+					'status' => $adb->query_result($res,$i,'status'),
+					'firstname' => $adb->query_result($res,$i,'firstname'),
+					'lastname' => $adb->query_result($res,$i,'lastname'),
+					'accountname' => $adb->query_result($res,$i,'accountname'),
+					'accountid' => $adb->query_result($res, $i, 'accountid'),
+					'contactid' => $adb->query_result($res,$i,'contactid'),
+					'date_start' => getDisplayDate($adb->query_result($res,$i,'date_start')),
+					'due_date' => getDisplayDate($adb->query_result($res,$i,'due_date')),
+					'recurringtype' => getDisplayDate($adb->query_result($res,$i,'recurringtype')),
+					'recurringdate' => getDisplayDate($adb->query_result($res,$i,'recurringdate')),
 					'parent'=> $parent_name,
 					// Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
-					'priority' => $adb->query_result($list_result,$i,'priority'), // Armando Lüscher 04.07.2005 -> §priority -> Desc: Get vtiger_priority from db
+					'priority' => $adb->query_result($res,$i,'priority'), // Armando Lüscher 04.07.2005 -> §priority -> Desc: Get vtiger_priority from db
 					);
 		}
-	$later_day = getDisplayDate(date("Y-m-d", strtotime("$later -1 day ")));
 	
 	$title=array();
 	$title[]=$activity_view;
 	$title[]='myUpcoPendAct.gif';
-	//.'('.$current_module_strings["LBL_TODAY"].' '.$later_day.')';
 	$title[]='home_myact';
-	$title[]=getActivityView($activity_view);
+	//$title[]=getActivityView($activity_view);
 	$title[]='showActivityView';		
 	$title[]='MyUpcumingFrm';
 	$title[]='activity_view';
@@ -229,7 +214,6 @@
 			}
 		}
 		// Code by Jaguar Ends
-		$entries['noofactivities'] = $noofrecords;
 		$entries[$event['id']] = array(
 				'0' => '<a href="index.php?action=DetailView&module='.$event["module"].'&activity_mode='.$activity_type.'&record='.$event["id"].''.$return_url.'" style="'.$font_color.';">'.$event["name"].'</a>',
 				'IMAGE' => '<IMG src="'.$image_path.$event["type"].'s.gif">',
@@ -241,7 +225,7 @@
 				'RECURRINGTYPE' => ereg_replace('--','',$event['recurringtype']),
 				);
 	}
-	$values=Array('Title'=>$title,'Header'=>$header,'Entries'=>$entries);
+	$values=Array('noofactivities'=>$noofrecords,'Title'=>$title,'Header'=>$header,'Entries'=>$entries);
 	$log->debug("Exiting getPendingActivities method ...");
 		return $values;
 }

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/RenderRelatedListUI.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/RenderRelatedListUI.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/RenderRelatedListUI.php Tue Nov 14 03:16:10 2006
@@ -10,8 +10,8 @@
  ********************************************************************************/
 
 require_once('include/RelatedListView.php');
-require_once('modules/Contacts/Contact.php');
-require_once('modules/Products/Product.php');
+require_once('modules/Contacts/Contacts.php');
+require_once('modules/Products/Products.php');
 require_once('include/utils/UserInfoUtil.php');
 
 // functions added for group calendar	-Jaguar

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/addEventUI.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/addEventUI.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/addEventUI.php Tue Nov 14 03:16:10 2006
@@ -177,9 +177,9 @@
 	<script language="JavaScript" type="text/javascript" src="include/js/general.js"></script>
 	<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css">
 	<script type="text/javascript" src="jscalendar/calendar.js"></script>
-	<script type="text/javascript" src="jscalendar/lang/calendar-<? echo $app_strings['LBL_JSCALENDAR_LANG'] ?>.js"></script>
+	<script type="text/javascript" src="jscalendar/lang/calendar-<?php echo $app_strings['LBL_JSCALENDAR_LANG'] ?>.js"></script>
 	<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>
-	<div class="calAddEvent layerPopup" style="display:none;width:500px;left:200px;" id="addEvent" align=center>
+	<div class="calAddEvent layerPopup" style="display:none;width:550px;left:200px;" id="addEvent" align=center>
 	<form name="EditView" onSubmit="return check_form();" method="POST" action="index.php">
 	<input type="hidden" name="return_action" value="index">
 	<input type="hidden" name="return_module" value="Calendar">
@@ -202,8 +202,8 @@
 	<input type="hidden" name="subtab" value="">
 	<input type="hidden" name="maintab" value="Calendar">
 		<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerHeadingULine">
-		<tr>
-			<td class="layerPopupHeading"><?php echo $mod_strings['LBL_ADD_EVENT']?></b></td>
+		<tr style="cursor:move;">
+			<td class="layerPopupHeading" id="moveEvent"><?php echo $mod_strings['LBL_ADD_EVENT']?></b></td>
 				<td align=right><a href="javascript:ghide('addEvent');"><img src="<?php echo $image_path ?>close.gif" border="0"  align="absmiddle" /></a></td>
 		</tr>
 		</table>
@@ -288,12 +288,12 @@
 				<tr>
 				<td width=50% valign=top style="border-right:1px solid #dddddd">
 					<table border=0 cellspacing=0 cellpadding=2 width=90% align=center>
-					<tr><td colspan=3 ><b><?php echo $mod_strings['LBL_EVENTSTAT']?></b></td></tr>
-				        <tr><td colspan=3>
+					<tr><td colspan=3 align="left"><b><?php echo $mod_strings['LBL_EVENTSTAT']?></b></td></tr>
+				        <tr><td colspan=3 align="left">
 						<?php echo  getTimeCombo($calendar_arr['calendar']->hour_format,'start');?>
 					</td></tr>
-                                        <tr><td>
-					<input type="text" name="date_start" id="jscal_field_date_start" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>"></td><td width=50%><img border=0 src="<?echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
+                                        <tr><td align="left">
+					<input type="text" name="date_start" id="jscal_field_date_start" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>"></td><td width=50% align="left"><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_date_start">
 						<script type="text/javascript">
                 					Calendar.setup ({
 								inputField : "jscal_field_date_start", ifFormat : "<?php  echo $date_format; ?>", showsTime : false, button : "jscal_trigger_date_start", singleClick : true, step : 1
@@ -304,12 +304,12 @@
 				</td>
 				<td width=50% valign=top >
 					<table border=0 cellspacing=0 cellpadding=2 width=90% align=center>
-					<tr><td colspan=3><b><?echo $mod_strings['LBL_EVENTEDAT']?></b></td></tr>
-				        <tr><td colspan=3>
+					<tr><td colspan=3 align="left"><b><?php echo $mod_strings['LBL_EVENTEDAT']?></b></td></tr>
+				        <tr><td colspan=3 align="left">
                                                 <?php echo getTimeCombo($calendar_arr['calendar']->hour_format,'end');?>
 					</td></tr>
-				        <tr><td>
-					<input type="text" name="due_date" id="jscal_field_due_date" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>"></td><td width=100%><img border=0 src="<?php echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
+				        <tr><td align="left">
+					<input type="text" name="due_date" id="jscal_field_due_date" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>"></td><td width=100% align="left"><img border=0 src="<?php echo $image_path?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_due_date">
 					<script type="text/javascript">
                                                         Calendar.setup ({
                                                                 inputField : "jscal_field_due_date", ifFormat : "<?php echo $date_format; ?>", showsTime : false, button : "jscal_trigger_due_date", singleClick : true, step : 1
@@ -426,30 +426,30 @@
 								{
 							?>
 									<option value="<?php echo $m ?>"><?php echo $m ?></option>
-							<?
+							<?php
 								}
 							?>
-							</select>days 
+							</select><?php echo $mod_strings['LBL_REMAINDER_DAY']; ?> 
 							<select class=small name="remhrs">
                                                         <?php
                                                                 for($h=0;$h<=23;$h++)
                                                                 {
                                                         ?>
                                                                         <option value="<?php echo $h ?>"><?php echo $h ?></option>
-                                                        <?
+                                                        <?php
                                                                 }
                                                         ?>
-                                                        </select>hrs
+							</select><?php echo $mod_strings['LBL_REMAINDER_HRS']; ?>
 							<select class=small name="remmin">
                                                         <?php
                                                                 for($min=1;$min<=59;$min++)
                                                                 {
                                                         ?>
                                                                         <option value="<?php echo $min ?>"><?php echo $min ?></option>
-                                                        <?
+                                                        <?php
                                                                 }
                                                         ?>
-                                                        </select>minutes&nbsp;<?php echo $mod_strings['LBL_BEFOREEVENT'] ?>
+							</select><?php echo $mod_strings['LBL_MINUTES']; ?>&nbsp;<?php echo $mod_strings['LBL_BEFOREEVENT'] ?>
 						</td>
 						</tr>
 						</table>
@@ -649,7 +649,7 @@
 	<tr><td><a href='' id="addtodo" class='drop_down'><?php echo $mod_strings['LBL_ADDTODO']?></a></td></tr>
 </table>
 </div>
-<div class="calAddEvent layerPopup" style="display:none" id="createTodo" align=center>
+<div class="calAddEvent layerPopup" style="display:none;width:550px;left:200px;" id="createTodo" align=center>
 <form name="createTodo" onSubmit="task_check_form();return formValidate();" method="POST" action="index.php">
 <input type="hidden" name="return_action" value="index">
 <input type="hidden" name="return_module" value="Calendar">
@@ -669,8 +669,8 @@
   <input type="hidden" name="subtab" value="">
   <input type="hidden" name="maintab" value="Calendar">
 	<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerHeadingULine">
-		<tr>
-                	<td class="lvtHeaderText"><?php echo $mod_strings['LBL_ADD_TODO'] ?></b></td>
+		<tr style="cursor:move;">
+                	<td class="lvtHeaderText" id="moveTodo"><?php echo $mod_strings['LBL_ADD_TODO'] ?></b></td>
 			<td align=right><a href="javascript:ghide('createTodo');"><img src="<?php echo $image_path ?>close.gif" border="0"  align="absmiddle" /></a></td>
 		</tr>
         </table>
@@ -734,10 +734,10 @@
 			<table border="0" cellpadding="2" cellspacing="0" width="100%" align=center>
 				<tr><td width=50% valign=top style="border-right:1px solid #dddddd">
 					<table border=0 cellspacing=0 cellpadding=2 width=95% align=center>
-						<tr><td colspan=3 ><b><?php echo $mod_strings['LBL_TODODATETIME'] ?></b></td></tr>
-						<tr><td colspan=3><?php echo getTimeCombo($calendar_arr['calendar']->hour_format,'start'); ?></td></tr>
-						<tr><td>
-							<input type="text" name="task_date_start" id="task_date_start" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>" ></td><td width=100%><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_task_date_start">
+						<tr><td colspan=3 align="left"><b><?php echo $mod_strings['LBL_TODODATETIME'] ?></b></td></tr>
+						<tr><td colspan=3 align="left"><?php echo getTimeCombo($calendar_arr['calendar']->hour_format,'start'); ?></td></tr>
+						<tr><td align="left">
+							<input type="text" name="task_date_start" id="task_date_start" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>" ></td><td width=100% align="left"><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_task_date_start">
 						<script type="text/javascript">
 						Calendar.setup ({
 							inputField : "task_date_start", ifFormat : "<?php  echo $date_format; ?>", showsTime : false, button : "jscal_trigger_task_date_start", singleClick : true, step : 1
@@ -747,9 +747,9 @@
 					</table></td>	
 					<td width=50% valign="top">
 						<table border="0" cellpadding="2" cellspacing="0" width="95%" align=center>
-							<tr><td colspan=3><b><?php echo $mod_strings['Due Date'] ?></b></td></tr>
-							<tr><td>
-								<input type="text" name="task_due_date" id="task_due_date" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>" ></td><td width=100%><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_task_due_date">
+							<tr><td colspan=3 align="left"><b><?php echo $mod_strings['Due Date'] ?></b></td></tr>
+							<tr><td align="left">
+								<input type="text" name="task_due_date" id="task_due_date" class="textbox" style="width:90px" value="<?php echo getDisplayDate($calendar_arr['calendar']->date_time->get_formatted_date()) ?>" ></td><td width=100% align="left"><img border=0 src="<?php echo $image_path ?>btnL3Calendar.gif" alt="Set date.." title="Set date.." id="jscal_trigger_task_due_date">
 						<script type="text/javascript">
 						Calendar.setup ({
 							inputField : "task_due_date", ifFormat : "<?php  echo $date_format; ?>", showsTime : false, button : "jscal_trigger_task_due_date", singleClick : true, step : 1
@@ -767,9 +767,9 @@
 			<td>
 				<table border=0 cellspacing=0 cellpadding=3 width=100%>
 					<tr>
-						<td class="dvtTabCache" style="width:10px" nowrap>&nbsp;</td>
+						<td class="dvtTabCache" style="width:10px" nowrap="nowrap">&nbsp;</td>
 						<td id="cellTabNotification" class="dvtSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabNotification','on');switchClass('cellTabtodoRelatedto','off');gshow('addTaskAlarmUI','todo',document.createTodo.task_date_start.value,document.createTodo.task_due_date.value,document.createTodo.starthr.value,document.createTodo.startmin.value,document.createTodo.startfmt.value,'','','',document.createTodo.viewOption.value,document.createTodo.subtab.value);ghide('addTaskRelatedtoUI');"><?php echo $mod_strings['LBL_NOTIFICATION']?></a></td>
-						<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">
+						<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
 						<td id="cellTabtodoRelatedto" class="dvtUnSelectedCell" align=center nowrap><a href="javascript:doNothing()" onClick="switchClass('cellTabtodoRelatedto','on'); switchClass('cellTabNotification','off');gshow('addTaskRelatedtoUI','todo',document.createTodo.task_date_start.value,document.createTodo.task_due_date.value,document.createTodo.starthr.value,document.createTodo.startmin.value,document.createTodo.startfmt.value,'','','',document.createTodo.viewOption.value,document.createTodo.subtab.value);ghide('addTaskAlarmUI');"><?php echo $mod_strings['LBL_RELATEDTO']?></a></td>					
 						<td class="dvtTabCache" style="width: 100%;">&nbsp;</td>
 					</tr>
@@ -902,4 +902,14 @@
                 </tr>
         </table>
 </div>
-
+<script>
+	//for move addEventUI
+	var theEventHandle = document.getElementById("moveEvent");
+	var theEventRoot   = document.getElementById("addEvent");
+	Drag.init(theEventHandle, theEventRoot);
+
+	//for move addToDo
+	var theTodoHandle = document.getElementById("moveTodo");
+	var theTodoRoot   = document.getElementById("createTodo");
+	Drag.init(theTodoHandle, theTodoRoot);
+</script>

Modified: vtigercrm/branches/5.1_jens/modules/Calendar/calendarLayout.php
==============================================================================
--- vtigercrm/branches/5.1_jens/modules/Calendar/calendarLayout.php (original)
+++ vtigercrm/branches/5.1_jens/modules/Calendar/calendarLayout.php Tue Nov 14 03:16:10 2006
@@ -1,1959 +1,1968 @@
-<?php
-/*********************************************************************************
-** The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is:  vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
-*
- ********************************************************************************/
-
-require_once('include/database/PearDatabase.php');
-require_once('include/utils/CommonUtils.php');
-require_once('include/utils/UserInfoUtil.php');
-require_once('modules/Calendar/CalendarCommon.php');
-
-
-/**
- *  Function creates HTML to display Events and  Todos div tags
- *  @param array    $param_arr      - collection of objects and strings
- *  @param string   $viewBox        - string 'listview' or 'hourview' or may be empty. if 'listview' means get Events ListView.if 'hourview' means gets Events HourView. if empty means get Todos ListView
- *  @param string   $subtab         - string 'todo' or 'event'. if 'todo' means Todos View else Events View
- */
-function calendar_layout(& $param_arr,$viewBox='',$subtab='')
-{
-	global $mod_strings,$cal_log;
-	$category = getParentTab();
-	$cal_log->debug("Entering calendar_layout() method");
-	$cal_header = array ();
-	if (isset($param_arr['size']) && $param_arr['size'] == 'small')
-		$param_arr['calendar']->show_events = false;
-
-	$cal_header['view'] = $param_arr['view'];
-	$cal_header['IMAGE_PATH'] = $param_arr['IMAGE_PATH'];
-        $cal_header['calendar'] = $param_arr['calendar'];
-	$eventlabel = $mod_strings['LBL_EVENTS'];
-	$todolabel = $mod_strings['LBL_TODOS'];
-	//if $param_arr['size'] is set to 'small', get small(mini) calendar
-	if(isset($param_arr['size']) && $param_arr['size'] == 'small')
-	{
-		get_mini_calendar($param_arr);
-	}
-	else
-	{
-		//To differentiate selected subtab from unselected one - Starts
-		if($subtab == 'event')
-		{
-			$eventtab_class = 'dvtSelectedCell';
-			$todotab_class = 'dvtUnSelectedCell';
-		        $event_anchor = $eventlabel;
-			$todo_anchor = "<a href='index.php?module=Calendar&action=index&view=".$cal_header['view']."".$cal_header['calendar']->date_time->get_date_str()."&viewOption=".$viewBox."&subtab=todo&parenttab=".$category."'>".$todolabel."</a>";
-					
-		}
-		elseif($subtab == 'todo')
-		{
-			$eventtab_class = 'dvtUnSelectedCell';
-			$todotab_class = 'dvtSelectedCell';
-			$event_anchor = "<a href='index.php?module=Calendar&action=index&view=".$cal_header['view']."".$cal_header['calendar']->date_time->get_date_str()."&viewOption=".$viewBox."&subtab=event&parenttab=".$category."'>".$eventlabel."</a>";
-			$todo_anchor = $todolabel;
-		}
-		//Ends
-		//To get calendar header and its links(like Day,Week,Month,Year and etc.)
-		get_cal_header_tab($cal_header,$viewBox,$subtab);
-		$subheader = "";
-		$subheader .=<<<EOQ
-			<tr>
-				<td colspan="8" class="calBorder">
-					<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
-						<tr>
-							<td>
-							
-								<table class="small" border="0" cellpadding="3" cellspacing="0" width="100%">
-									<tr>
-										<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
-										<td class="$eventtab_class" id="pi" align="center" nowrap="nowrap" width="75">$event_anchor</td>
-										<td class="dvtTabCache" style="width: 10px;" nowrap="nowrap">&nbsp;</td>
-										<td class="$todotab_class" style="width:100px;" id="mi" align="center" nowrap="nowrap">$todo_anchor</td>
-										<td class="dvtTabCache" nowrap="nowrap">&nbsp;</td>
-									</tr>
-								</table>
-							</td>
-						</tr>
-						<tr>
-							<td class="calInnerBorder" align="left" bgcolor="#ffffff" valign="top">
-EOQ;
-		echo $subheader;
-		if($viewBox == 'hourview' && $subtab == 'event')
-		{
-			get_cal_header_data($param_arr,$viewBox,$subtab);
-			getHourView($param_arr);
-		}
-		elseif($viewBox == 'listview' && $subtab == 'event')
-		{
-			get_cal_header_data($param_arr,$viewBox,$subtab);
-			getEventListView($param_arr);
-		}
-		elseif($subtab == 'todo')
-		{
-			$todo_list = "";
-			$todo_list .= getTodosListView($param_arr,'',$subtab);
-			$todo_list .= '</td></tr></table></td></tr></table><br>';
-			echo $todo_list;
-		}
-	}
-	
-	$cal_log->debug("Exiting calendar_layout() method");	
-	
-}
-
-/**
- * Function creates HTML to display small(mini) Calendar 
- * @param array   $cal    - collection of objects and strings
- */
-function get_mini_calendar(& $cal)
-{
-	global $current_user,$adb,$cal_log;
-	$category = getParentTab();
-	$cal_log->debug('Entering get_mini_calendar() method...');
-	$count = 0;
-	//To decide number of rows(weeks) in a month
-	if ($cal['calendar']->month_array[$cal['calendar']->slices[35]]->start_time->month != $cal['calendar']->date_time->month) {
-                $rows = 5;
-        } else {
-                $rows = 6;
-        }
-	$minical = "";
-	$minical .= "<table class='mailClient ' bgcolor='white' border='0' cellpadding='2' cellspacing='0' width='98%'>
-                        <tr>
-				<td class='calHdr'>&nbsp;</td>
-				<td style='padding:5px' colspan='6' class='calHdr' align='center'>".get_previous_cal($cal)."&nbsp;";
-				$minical .= "<a style='text-decoration: none;' href='index.php?module=Calendar&action=index&view=".$cal['view']."".$cal['calendar']->date_time->get_date_str()."&parenttab=".$category."'><b>".display_date($cal['view'],$cal['calendar']->date_time)."</b></a>&nbsp;".get_next_cal($cal)."</td>";
-				$minical .= "<td class='calHdr' align='right'><a href='javascript:ghide(\"miniCal\");'><img src='".$cal['IMAGE_PATH']."close.gif' align='right' border='0'></a>
-	                     </td></tr>";
-	$minical .= "<tr class='hdrNameBg'>";
-	//To display days in week 
-	$minical .= '<th width="12%">Week</th>';
-	for ($i = 0; $i < 7; $i ++)
-        {
-                $weekdays_row = $cal['calendar']->month_array[$cal['calendar']->slices[$i]];
-                $weekday = $weekdays_row->start_time->getdayofWeek_inshort();
-                $minical .= '<th width="12%">'.$weekday.'</th>';
-        }
-	$minical .= "</tr>";	
-	$event_class = '';
-	$class = '';
-	for ($i = 0; $i < $rows; $i ++)
-        {
-                $minical .= "<tr>";
-                for ($j = 0; $j < 7; $j ++)
-                {
-			$cal['slice'] = $cal['calendar']->month_array[$cal['calendar']->slices[$count]];
-			$class = dateCheck($cal['slice']->start_time->get_formatted_date());
-			if($count%7 == 0)
-				$minical .= "<td style='text-align:center' ><a href='index.php?module=Calendar&action=index&view=week".$cal['slice']->start_time->get_date_str()."&parenttab=".$category."'>".$cal['slice']->start_time->week."</td>";
-			//To differentiate day having events from other days
-			if(count($cal['slice']->activities) != 0 && ($cal['slice']->start_time->get_formatted_date() == $cal['slice']->activities[0]->start_time->get_formatted_date()))
-			{
-					$event_class = 'class="eventDay"';
-			}
-			else
-			{
-                       		$event_class = '';
-                        }
-			//To differentiate current day from other days
-			if($class != '' )
-				$class = 'class="'.$class.'"';
-			else
-				$class = $event_class;
-			
-			//To display month dates
-                        if ($cal['slice']->start_time->getMonth() == $cal['calendar']->date_time->getMonth())
-                        {
-				$minical .= "<td ".$class." style='text-align:center' >";
-				$minical .= "<a href='index.php?module=Calendar&action=index&view=".$cal['slice']->getView()."".$cal['slice']->start_time->get_date_str()."&parenttab=".$category."'>";
-				$minical .= $cal['slice']->start_time->get_Date()."</a></td>";
-                        }
-			else
-			{
-				$minical .= "<td style='text-align:center' ></td>";
-			}
-                        $count++;
-                }
-                $minical .= '</tr>';
-	}
-	
-        $minical .= "</table>";
-	echo $minical;
-	$cal_log->debug("Exiting get_mini_calendar() method...");
-}
-
-/**
- * Function creates HTML to display Calendar Header and its Links
- * @param array    $header   - collection of objects and strings
- * @param string   $viewBox  - string 'listview' or 'hourview' or may be empty. if 'listview' means Events ListView.if 'hourview' means Events HourView. if empty means get Todos ListView
- * @param string   $subtab   - string 'todo' or 'event'. if 'todo' means Todos View else Events View
- */
-function get_cal_header_tab(& $header,$viewBox,$subtab)
-{
-	global $mod_strings,$cal_log;
-	$category = getParentTab();
-	$cal_log->debug("Entering get_cal_header_tab() method...");
-	$tabhtml = "";
-	$count = 1;
-	include_once 'modules/Calendar/addEventUI.php';
-	include_once 'modules/Calendar/header.php';
-	$eventlabel = $mod_strings['LBL_EVENTS'];
-	$todolabel = $mod_strings['LBL_TODOS'];
-	$div = "<div id='miniCal' style='width:300px; position:absolute; display:none; left:100px; top:100px; z-index:100000; background-color:white'></div>
-		<div id='calSettings' class='layerPopup calSettings' style='display:none;width:500px;' align=center ></div>
-		<div id='dataArray'></div>
-		";
-	echo $div;
-	$tabhtml .= "<table class='small calHdr' align='center' border='0' cellpadding='5' cellspacing='0' width='100%'><tr>";
-        $links = array ('day','week','month','year');
-	//To differentiate the selected link from unselected links
-	foreach ($links as $link)
-	{
-		if ($header['view'] == $link)
-		{
-			$class = 'calSel';
-			$anchor = $mod_strings["LBL_".$header['calendar']->getCalendarView($link)];
-		}
-		else
-		{
-			$class = 'calUnSel';
-			$anchor = "<a href='index.php?module=Calendar&action=index&view=".$link."".$header['calendar']->date_time->get_date_str()."&viewOption=".$viewBox."&subtab=".$subtab."&parenttab=".$category."'>".$mod_strings["LBL_".$header['calendar']->getCalendarView($link)]."</a>";
-		}
-	
-		if($count == 1)
-			$tabhtml .= "<!-- day week month buttons --> <td style='border-left: 1px solid #666666;' class=".$class.">".$anchor."</td>";
-		else
-			$tabhtml .= "<td class=".$class.">".$anchor."</td>";
-		$count++;
-	}
-	//To get Navigation(next&previous) links and display Date info
-	$tabhtml .= "<td width='30%'>
-			<table border='0' cellpadding='0' cellspacing='0'>
-			<tr>
-				<td>".get_previous_cal($header,$viewBox,$subtab)."
-				</td>";
-	$tabhtml .= "<td class='calendarNav'>".display_date($header['view'],$header['calendar']->date_time)."</td>";
-	$tabhtml .= "<td>".get_next_cal($header,$viewBox,$subtab)."
-		     </td></tr>
-		    </table>
-		</td>";
-		$tabhtml .= "<td width='2%'><img onClick='fnvshobj(this,\"miniCal\"); getMiniCal(\"view=".$header['calendar']->view."".$header['calendar']->date_time->get_date_str()."&viewOption=".$viewBox."&subtab=".$subtab."&parenttab=".$category."\");' src='".$header['IMAGE_PATH']."btnL3Calendar.gif' alt='".$mod_strings['LBL_OPENCAL']."...' title='".$mod_strings['LBL_OPENCAL']."...' align='absmiddle' border='0'></td>";
-		$tabhtml .= "<td width=20% ><img onClick='fnvshobj(this,\"calSettings\"); getCalSettings(\"view=".$header['calendar']->view."".$header['calendar']->date_time->get_date_str()."&viewOption=".$viewBox."&subtab=".$subtab."&parenttab=".$category."\");' src='".$header['IMAGE_PATH']."tbarSettings.gif' alt='".$mod_strings['LBL_SETTINGS']."' title='".$mod_strings['LBL_SETTINGS']."' align='absmiddle' border='0'></td>";
-	$tabhtml .= "<td class='calHdr calTopRight componentName'>".$app_strings[Calendar]."</td>";	
-	$tabhtml .= "</tr>";
-	echo $tabhtml;
-	$cal_log->debug("Exiting get_cal_header_tab() method...");
-}
-
-/**
- * Function creates HTML to display number of Events, Todos and pending list in calendar under header(Eg:Total Events : 5, 2 Pending / Total To Dos: 4, 1 Pending)
- * @param array  $cal_arr   - collection of objects and strings
- * @param string $viewBox   - string 'listview' or 'hourview'. if 'listview' means Events ListView.if 'hourview' means Events HourView.
- */
-function get_cal_header_data(& $cal_arr,$viewBox,$subtab)
-{
-	global $mod_strings,$cal_log;
-	$cal_log->debug("Entering get_cal_header_data() method...");
-	global $current_user,$app_strings;
-        $date_format = $current_user->date_format;
-	$format = $cal_arr['calendar']->hour_format;
-	$hour_startat = convertTime2UserSelectedFmt($format,$cal_arr['calendar']->day_start_hour,false); 
-	$hour_endat = convertTime2UserSelectedFmt($format,($cal_arr['calendar']->day_start_hour+1),false);
-	$time_arr = getaddEventPopupTime($hour_startat,$hour_endat,$format);
-	$temp_ts = $cal_arr['calendar']->date_time->ts;
-	//To get date in user selected format
-        $temp_date = (($date_format == 'dd-mm-yyyy')?(date('d-m-Y',$temp_ts)):(($date_format== 'mm-dd-yyyy')?(date('m-d-Y',$temp_ts)):(($date_format == 'yyyy-mm-dd')?(date('Y-m-d', $temp_ts)):(''))));
-	$headerdata = "";
-	$headerdata .="
-			<div style='display: block;' id='mnuTab'>
-			<form name='EventViewOption' method='POST' action='index.php'>
-			<table align='center' border='0' cellpadding='5' cellspacing='0' width='98%'>
-			<tr><td colspan='3'>&nbsp;</td></tr>";
-			if(isPermitted("Calendar","EditView") == "yes")
-			{
-			$headerdata .="<tr>
-				<td>
-				<table><tr><td class='calAddButton' style='cursor:pointer;height:30px' align='center' width='15%' onMouseOver='fnAddEvent(this,\"addEventDropDown\",\"".$temp_date."\",\"".$temp_date."\",\"".$time_arr['starthour']."\",\"".$time_arr['startmin']."\",\"".$time_arr['startfmt']."\",\"".$time_arr['endhour']."\",\"".$time_arr['endmin']."\",\"".$time_arr['endfmt']."\",\"".$viewBox."\",\"".$subtab."\");'>
-					".$mod_strings['LBL_ADD']."
-					<img src='".$cal_arr['IMAGE_PATH']."menuDnArrow.gif' style='padding-left: 5px;' border='0'>
-				</td></tr></table> </td>";
-			}
-			else
-			{
-				$headerdata .="<tr><td>&nbsp;</td>";
-			}
-			$headerdata .="<td align='center' width='53%'>";
-	$headerdata .= getEventTodoInfo($cal_arr,'listcnt'); 
-	$headerdata .= "	</td>
-				<td align='center' width='30%'><table border=0 cellspacing=0 cellpadding=2><tr><td class=small><b>".$mod_strings['LBL_VIEW']." : </b></td><td>";
-	$view_options = getEventViewOption($cal_arr,$viewBox);
-	$headerdata .=$view_options."</td></tr></form></table>
-				</td>
-			</tr>
-		</table>";
-	echo $headerdata;	
-	$cal_log->debug("Exiting get_cal_header_data() method...");
-}
-
-/**
- * Function creates HTML select statement to display View selection box
- * @param array  $cal     - collection of objects and strings 
- * @param string $viewBox - string 'listview' or 'hourview'. if 'listview' means get Events ListView.if 'hourview' means get Events HourView.
- * return string $view   - html selection box
- */
-function getEventViewOption(& $cal,$viewBox)
-{
-	global $mod_strings,$cal_log;
-	$category = getParentTab();
-	if($viewBox == 'listview')
-	{
-		$list_sel = 'selected';
-		$hr_sel = '';
-	}
-	else
-	{
-		$list_sel = '';
-		$hr_sel = 'selected';
-	}
-	$cal_log->debug("Entering getEventViewOption() method...");
-	$view = "<input type='hidden' name='view' value='".$cal['calendar']->view."'>
-			<input type='hidden' name='hour' value='".$cal['calendar']->date_time->hour."'>
-			<input type='hidden' name='day' value='".$cal['calendar']->date_time->day."'>
-			<input type='hidden' name='week' value='".$cal['calendar']->date_time->week."'>
-			<input type='hidden' name='month' value='".$cal['calendar']->date_time->month."'>
-			<input type='hidden' name='year' value='".$cal['calendar']->date_time->year."'>
-			<input type='hidden' name='parenttab' value='".$category."'>
-			<input type='hidden' name='module' value='Calendar'>
-			<input type='hidden' name='return_module' value='Calendar'>
-			<input type='hidden' name='action' value=''>
-			<input type='hidden' name='return_action' value=''>
-							 
-		        <select name='viewOption' class='importBox' id='view_Option' onChange='fnRedirect();'>";
-	if($cal['view'] == 'day')
-	{
-		$view .="<option value='listview' ".$list_sel.">".$mod_strings['LBL_LISTVIEW']."</option>
-			 <option value='hourview' ".$hr_sel.">".$mod_strings['LBL_HRVIEW']."</option>";	
-	}
-	elseif($cal['view'] == 'week')
-	{
-		$view .="<option value='listview' ".$list_sel.">".$mod_strings['LBL_LISTVIEW']."</option>
-			 <option value='hourview' ".$hr_sel.">".$mod_strings['LBL_WEEKVIEW']."</option>";
-	}
-	elseif($cal['view'] == 'month')
-	{
-		$view .="<option value='listview' ".$list_sel.">".$mod_strings['LBL_LISTVIEW']."</option>
-			 <option value='hourview' ".$hr_sel.">".$mod_strings['LBL_MONTHVIEW']."</option>";
-	}
-	elseif($cal['view'] == 'year')
-	{
-		$view .="<option value='listview' ".$list_sel.">".$mod_strings['LBL_LISTVIEW']."</option>
-			 <option value='hourview' ".$hr_sel.">".$mod_strings['LBL_YEARVIEW']."</option>";
-	}
-	else
-		die("view is not defined");
-	$view .="</select>
-		</form>";
-	$cal_log->debug("Exiting getEventViewOption() method...");
-	return $view;
-}
-
-/**
- * Function creates HTML anchor tag to get previous-day/week/month/year view
- * @param array  $cal        - collection of objects and strings
- * @param string $viewBox    - string 'listview' or 'hourview' or may be empty. if 'listview' means previous link in Events ListView.if 'hourview' means previous link in Events HourView. if empty means previous link in Todos ListView
- * @param string   $subtab   - string 'todo' or 'event' or may be empty. if 'todo' means Todos View. if 'event' means Events View. if empty means small calendar view. 
- * return string $link       - html tags in string format
- */
-function get_previous_cal(& $cal,$viewBox='',$subtab='')
-{
-	global $mod_strings,$cal_log;
-	$category = getParentTab();
-	$cal_log->debug("Entering get_previous_cal() method...");
-	if(isset($cal['size']) && $cal['size'] == 'small')
-        {
-		$link = "<a href='javascript:getMiniCal(\"view=".$cal['calendar']->view."".$cal['calendar']->get_datechange_info('prev')."&parenttab=".$category."\")'><img src='".$cal['IMAGE_PATH']."small_left.gif' border='0' align='absmiddle' /></a>";
-	}
-	else
-	{
-		$link = "<a href='index.php?action=index&module=Calendar&view=".$cal['calendar']->view."".$cal['calendar']->get_datechange_info('prev')."&viewOption=".$viewBox."&subtab=".$subtab."&parenttab=".$category."'><img src='".$cal['IMAGE_PATH']."cal_prev_nav.gif' border='0' align='absmiddle' /></a>";
-	}
-	$cal_log->debug("Exiting get_previous_cal() method...");
-	return $link;
-}
-
-/**
- * Function creates HTML anchor tag to get next-day/week/month/year view
- * @param array  $cal        - collection of objects and strings
- * @param string $viewBox    - string 'listview' or 'hourview' or may be empty. if 'listview' means next link in Events ListView.if 'hourview' means next link in Events HourView. if empty means next link in Todos ListView
- * @param string $subtab     - string 'todo' or 'event' or may be empty. if 'todo' means Todos View. if 'event' means Events View. if empty means small calendar view. 
- * return string $link       - html tags in string format
- */
-function get_next_cal(& $cal,$viewBox='',$subtab='')
-{
-	global $mod_strings,$cal_log;
-	$category = getParentTab();
-	$cal_log->debug("Entering get_next_cal() method...");
-	if(isset($cal['size']) && $cal['size'] == 'small')
-	{
-		$link = "<a href='javascript:getMiniCal(\"view=".$cal['calendar']->view."".$cal['calendar']->get_datechange_info('next')."&parenttab=".$category."\")' ><img src='".$cal['IMAGE_PATH']."small_right.gif' border='0' align='absmiddle' /></a>";
-	}
-	else
-	{
-		$link = "<a href='index.php?action=index&module=Calendar&view=".$cal['calendar']->view."".$cal['calendar']->get_datechange_info('next')."&viewOption=".$viewBox."&subtab=".$subtab."&parenttab=".$category."'><img src='".$cal['IMAGE_PATH']."cal_next_nav.gif' border='0' align='absmiddle' /></a>";
-	}
-	$cal_log->debug("Exiting get_next_cal() method...");
-	return $link;
-
-}
-
-/**
- * Function to get date info depending upon on the calendar view(Eg: 21 July 2000)
- * @param string  $view        - calendar view(day/week/month/year)
- * @param array   $date_time   - contains DateTime object
- * return string  $label       - date info(Eg for dayview : 13 July 2000)
- */
-function display_date($view,$date_time)
-{
-	global $cal_log;
-	$cal_log->debug("Entering display_date() method...");
-	if ($view == 'day')
-        {
-		//$label = $date_time->getdayofWeek()." ";
-		$label = $date_time->get_Date()." ";
-		$label .= $date_time->getmonthName()." ";
-		$label .= $date_time->year;
-		$cal_log->debug("Exiting display_date() method...");
-		return $label;
-        }
-	elseif ($view == 'week')
-        {
-                $week_start = $date_time->getThisweekDaysbyIndex(0);
-                $week_end = $date_time->getThisweekDaysbyIndex(6);
-                $label = $week_start->get_Date()." ";
-                $label .= $week_start->getmonthName()." ";
-                $label .= $week_start->year;
-                $label .= " - ";
-                $label .= $week_end->get_Date()." ";
-                $label .= $week_end->getmonthName()." ";
-                $label .= $week_end->year;
-		$cal_log->debug("Exiting display_date() method...");
-		return $label;
-        }
-
-	elseif ($view == 'month')
-	{
-		$label = $date_time->getmonthName()." ";
-		$label .= $date_time->year;
-		$cal_log->debug("Exiting display_date() method...");
-		return $label;
-        }
-	elseif ($view == 'year')
-	{
-		$cal_log->debug("Exiting display_date() method...");
-		return $date_time->year;
-        }
-
-}
-/**
- *  Function to get css class name for date
- *  @param   string  $slice_date    - date
- *  returns  string                 - css class name or empty string 
- */
-function dateCheck($slice_date)
-{
-	global $cal_log;
-	$cal_log->debug("Entering dateCheck() method...");
-	$today = date('Y-m-d');
-	if($today == $slice_date)
-	{
-		$cal_log->debug("Exiting dateCheck() method...");
-		//css class for day having event(s)
-		return 'currDay';
-	}
-	else
-	{
-		$cal_log->debug("Exiting dateCheck() method...");
-		return '';
-	}
-}
-
-/**
- * Function to construct respective calendar layout depends on the calendar view
- * @param  array     $view      -  collection of objects and strings
- */
-function getHourView(& $view)
-{
-	global $cal_log;
-	$hourview_layout = '';
-	$cal_log->debug("Entering getHourView() method...");
-	$hourview_layout .= '<br /><!-- HOUR VIEW LAYER STARTS HERE -->
-		<div id="hrView" align=center>';
-		
-	if($view['view'] == 'day')
-		$hourview_layout .= getDayViewLayout($view);
-	elseif($view['view'] == 'week')
-		$hourview_layout .= getWeekViewLayout($view);
-	elseif($view['view'] == 'month')
-		 $hourview_layout .= getMonthViewLayout($view);
-	elseif($view['view'] == 'year')
-		 $hourview_layout .= getYearViewLayout($view);
-	else
-		die("view:".$view['view']." is not defined");
-		
-	$hourview_layout .= '<br></div>
-		</div>';
-	$hourview_layout .= '<br></td></tr></table></td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</div>
-		</td>
-	        <td valign=top><img src="'.$view['IMAGE_PATH'].'showPanelTopRight.gif"></td>
-		</tr>
-		   </table>
-	<br>';
-	echo $hourview_layout;
-	$cal_log->debug("Exiting getHourView() method...");
-}
-
-/**
- * Fuction constructs Events ListView depends on the view
- * @param   array  $cal            - collection of objects and strings
- * @param   string $mode           - string 'listcnt' or empty. if empty means get Events ListView else get total no. of events and no. of pending events Info.
- * returns  string $activity_list  - total no. of events and no. of pending events Info(Eg: Total Events : 2, 1 Pending).
- */
-function getEventListView(& $cal,$mode='')
-{
-	global $cal_log;
-	$list_view = "";
-        $cal_log->debug("Entering getEventListView() method...");
-	if($cal['calendar']->view == 'day')
-	{
-		$start_date = $end_date = $cal['calendar']->date_time->get_formatted_date();
-	}
-	elseif($cal['calendar']->view == 'week')
-	{
-		$start_date = $cal['calendar']->slices[0];
-		$end_date = $cal['calendar']->slices[6];
-	}
-	elseif($cal['calendar']->view == 'month')
-        {
-		$start_date = $cal['calendar']->date_time->getThismonthDaysbyIndex(0);
-		$end_date = $cal['calendar']->date_time->getThismonthDaysbyIndex($cal['calendar']->date_time->daysinmonth - 1);
-		$start_date = $start_date->get_formatted_date();
-		$end_date = $end_date->get_formatted_date();
-        }
-	elseif($cal['calendar']->view == 'year')
-        {
-		$start_date = $cal['calendar']->date_time->getThisyearMonthsbyIndex(0);
-		$end_date = $cal['calendar']->date_time->get_first_day_of_changed_year('increment');
-		$start_date = $start_date->get_formatted_date();
-		$end_date = $end_date->get_formatted_date();
-	}
-	else
-        {
-		die("view:".$cal['calendar']->view." is not defined");
-        }
-	//if $mode value is empty means get Events list in array format else get the count of total events and pending events in array format.
-	$activity_list = getEventList($cal, $start_date, $end_date,$mode);
-	if($mode != '')
-	{
-		$cal_log->debug("Exiting getEventListView() method...");
-		return $activity_list;
-	}
-	//To get Events listView
-	$list_view .="<br><div id='listView'>";
-	$list_view .=constructEventListView($cal,$activity_list);
-	$list_view .="<br></div>
-		</div>";
-	$list_view .="<br></td></tr></table></td></tr></table>
-			</td></tr></table>
-		</td></tr></table>
-		</div>
-		</td></tr></table>
-		</td>
-		<td valign=top><img src='".$cal['IMAGE_PATH']."showPanelTopRight.gif'></td>
-		</tr>
-	</table>
-	<br>";
-	echo $list_view;
-	$cal_log->debug("Exiting getEventListView() method...");
-}
-
-
-/**
- * Fuction constructs Todos ListView depends on the view
- * @param   array  $cal            - collection of objects and strings
- * @param   string $check          - string 'listcnt' or empty. if empty means get Todos ListView else get total no. of Todos and no. of pending todos Info.
- * returns  string $todo_list      - total no. of todos and no. of pending todos Info(Eg: Total Todos : 2, 1 Pending).
- */
-function getTodosListView($cal, $check='',$subtab='')
-{
-	global $cal_log;
-	$list_view = "";
-        $cal_log->debug("Entering getTodosListView() method...");
-	if($cal['calendar']->view == 'day')
-        {
-                $start_date = $end_date = $cal['calendar']->date_time->get_formatted_date();
-        }
-	elseif($cal['calendar']->view == 'week')
-        {
-                $start_date = $cal['calendar']->slices[0];
-                $end_date = $cal['calendar']->slices[6];
-        }
-        elseif($cal['calendar']->view == 'month')
-        {
-                $start_date = $cal['calendar']->date_time->getThismonthDaysbyIndex(0);
-                $end_date = $cal['calendar']->date_time->getThismonthDaysbyIndex($cal['calendar']->date_time->daysinmonth - 1);
-		$start_date = $start_date->get_formatted_date();
-		$end_date = $end_date->get_formatted_date();
-        }
-	elseif($cal['calendar']->view == 'year')
-        {
-                $start_date = $cal['calendar']->date_time->getThisyearMonthsbyIndex(0);
-                $end_date = $cal['calendar']->date_time->get_first_day_of_changed_year('increment');
-		$start_date = $start_date->get_formatted_date();
-		$end_date = $end_date->get_formatted_date();
-        }
-        else
-        {
-                die("view:".$cal['calendar']->view." is not defined");
-        }
-	//if $check value is empty means get Todos list in array format else get the count of total todos and pending todos in array format.
-	$todo_list = getTodoList($cal, $start_date, $end_date,$check);
-	if($check != '')
-	{
-		$cal_log->debug("Exiting getTodosListView() method...");
-		return $todo_list;
-	}
-	$cal_log->debug("Exiting getTodosListView() method...");
-	$list_view .="<div id='mnuTab2' style='background-color: rgb(255, 255, 215); display:block;'>";
-	//To get Todos listView
-	$list_view .= constructTodoListView($todo_list,$cal,$subtab);
-	$list_view .="</div></div></td></tr></table></td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</td></tr></table>
-		</div>
-		</td>
-		<td valign=top><img src='".$cal['IMAGE_PATH']."showPanelTopRight.gif'></td>
-	</tr>
-	</table>
-
-	";
-	echo $list_view;
-}
-
-/**
- * Function creates HTML to display Calendar DayView
- * @param  array     $cal            - collections of objects and strings.
- * return  string    $dayview_layout - html tags in string format
- */
-function getDayViewLayout(& $cal)
-{
-	//echo '<pre>';print_r($cal);echo '</pre>';
-	global $current_user,$app_strings,$cal_log,$adb;
-	$no_of_rows = 1;
-	$cal_log->debug("Entering getDayViewLayout() method...");
-	$shared_ids = getSharedCalendarId($current_user->id);
-	$user_details = getAllUserName();
-	$usersid = $current_user->id.','.$shared_ids;
-	$userid_arr = explode(",",$usersid);
-        $date_format = $current_user->date_format;
-	$day_start_hour = $cal['calendar']->day_start_hour;
-	$day_end_hour = $cal['calendar']->day_end_hour;
-	$format = $cal['calendar']->hour_format;
-	$dayview_layout = '';
-	$dayview_layout .= '<!-- Day view layout starts here --> <table border="0" cellpadding="10" cellspacing="0" width="100%">';
-	$dayview_layout .= '<tr>
-				<td id="mainContent" style="border-top: 1px solid rgb(204, 204, 204);">
-					<table border="0" cellpadding="5" cellspacing="0" width="100%">';
-	for($j=0;$j<24;$j++)
-	{
-		$slice = $cal['calendar']->slices[$j];
-		$act = $cal['calendar']->day_slice[$slice]->activities;
-		if(!empty($act))
-		{
-			$temprows = count($act);
-			$no_of_rows = ($no_of_rows>$temprows)?$no_of_rows:$temprows;
-		}
-	}
-	for($i=$day_start_hour;$i<=$day_end_hour;$i++)
-	{
-		
-		if($cal['calendar']->hour_format == 'am/pm')
-		{
-			if($i == 12)
-			{
-				$hour = $i;
-				$sub_str = 'pm';
-			}
-			elseif($i>12)
-			{
-				$hour = $i - 12;
-				$sub_str = 'pm';
-			}
-			else
-			{
-				if($i == 0)
-					$hour = 12;
-				else
-					$hour = $i;
-				$sub_str = 'am';
-			}
-			
-		}
-		else
-		{
-			$hour = $i;
-			if($hour <= 9 && strlen(trim($hour)) < 2)
-				$hour = "0".$hour;
-			$sub_str = ':00';
-		}
-		$y = $i+1;
-		$hour_startat = convertTime2UserSelectedFmt($format,$i,false);
-		$hour_endat = convertTime2UserSelectedFmt($format,$y,false);
-		$time_arr = getaddEventPopupTime($hour_startat,$hour_endat,$format);
-		$temp_ts = $cal['calendar']->date_time->ts;
-		$sttemp_date = (($date_format == 'dd-mm-yyyy')?(date('d-m-Y',$temp_ts)):(($date_format== 'mm-dd-yyyy')?(date('m-d-Y',$temp_ts)):(($date_format == 'yyyy-mm-dd')?(date('Y-m-d', $temp_ts)):(''))));
-		if($i != 23)
-		{
-			$endtemp_date = $sttemp_date;
-		}
-		else
-		{
-			$addday = $temp_ts + (1 * 24 * 60 * 60);
-			$endtemp_date = (($date_format == 'dd-mm-yyyy')?(date('d-m-Y',$addday)):(($date_format== 'mm-dd-yyyy')?(date('m-d-Y',$addday)):(($date_format == 'yyyy-mm-dd')?(date('Y-m-d', $addday)):(''))));
-		}
-
-		$js_string = "";
-		if(isPermitted("Calendar","EditView") == "yes")
-		              $js_string = 'onClick="fnvshobj(this,\'addEvent\'); gshow(\'addEvent\',\'call\',\''.$sttemp_date.'\',\''.$endtemp_date.'\',\''.$time_arr['starthour'].'\',\''.$time_arr['startmin'].'\',\''.$time_arr['startfmt'].'\',\''.$time_arr['endhour'].'\',\''.$time_arr['endmin'].'\',\''.$time_arr['endfmt'].'\',\'hourview\',\'event\')"';
-		$dayview_layout .= '<tr>
-					<td style="cursor:pointer;" class="lvtCol" valign=top height="75"  width="10%" '.$js_string.'>'.$hour.''.$sub_str.'</td>';
-		//To display events in Dayview
-		$dayview_layout .= getdayEventLayer($cal,$cal['calendar']->slices[$i],$no_of_rows);
-		$dayview_layout .= '</tr>';
-	}
-	$dayview_layout .= '</table>
-			</td></tr></table>';
-	$cal_log->debug("Exiting getDayViewLayout() method...");
-	return $dayview_layout;		
-}
-
-/**
- * Function creates HTML to display Calendar WeekView
- * @param  array     $cal             - collections of objects and strings



More information about the vtigercrm-commits mailing list