Пример #1
0
 public function display()
 {
     global $sugar_config, $current_user, $app_list_strings;
     $aop_portal_enabled = !empty($sugar_config['aop']['enable_portal']) && !empty($sugar_config['aop']['enable_aop']);
     $this->ss->assign("AOP_PORTAL_ENABLED", $aop_portal_enabled);
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::DVPopupHtml('Contacts');
     require_once "custom/include/metrix/loadDynamicLists.php";
     //helper class to autopoluate the dropdowns
     require_once 'include/utils.php';
     /********************************************************************************************************/
     /*                                                   dynamic dd                                         */
     /********************************************************************************************************/
     //TODO
     $dynamic_dd_fileds = array("country_c" => array("tblname" => "ref_pays", "listname" => "country_list", "field" => "nom"));
     $list = new loadDynamicLists();
     foreach ($dynamic_dd_fileds as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $app_list_strings[$v['listname']] = $list->populate_list($v['tblname'], $v['field']);
     }
     //if the current user is not admin then hide the values of certain fields and make them non inline-editable
     if ($current_user->is_admin != 1) {
         echo "\n\t\t\t<script>\n\t\t\t\t\$('html').hide();\n\t\t\t\t\$(document).ready(\n\t\t\t\tfunction()\n\t\t\t\t{\n\n\t\t\t\tvar remove_fields =    \t['email1','phone_mobile','jjwg_maps_address_c','primary_address_postalcode','primary_address_state','primary_address_city','alt_address_city','primary_address_country','phone_work','phone_fax','description'];//you can add the fields you want to hide here\n\n\n\t\t\t\t\$.each( remove_fields, function( key, value ) {\n\n\n\t\t\t\t\$('td[field= ' + value + ']').html( '' );\n\n\t\t\t\t\$('td[field=' + value + ']').removeAttr('field');\n\t\t\t\t});\n\n\t\t\t\t\$('html').show(250);\n\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t</script>";
         //if the field modified_c is not 0 then the user cannot see this record until an Admin user sets it back to 0
         if ($this->bean->modified_c != 0) {
             echo "\n\t\t\t<script>\t\t\t\t\n\t\t\t\t\$(document).ready(\n\t\t\t\t\tfunction()\n\t\t\t\t\t{\n\t\t\t\t\t\$('#pagecontent').html('<div class=\\'alert alert-danger\\' role=\\'alert\\'>Vos modifications sont en attente de validation</div>');\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t</script>";
         }
     }
     if ($current_user->is_admin == 1 && $this->bean->modified_c == 1) {
         //function to uncheck the modified checkbox in order to give access to this Contact to non Admin users
         echo "\n\t\t\t<script>\t\t\t\t\n\t\t\t\t\$(document).ready(\n\t\t\t\t\tfunction()\n\t\t\t\t\t{\n\t\t\t\t\t\$('.subnav').prepend('<li><a href=\\'#\\' onclick=\\'uncheckBox();\\'>Valider</a></li>');\n\t\t\t\t\t}\n\t\t\t\t);\n\n            var uncheckBox = function(){\n                 \n\t\t\t\t\t\$.ajax({\n\t\t\t\t\turl: 'index.php?module=Contacts&action=untag&m=Contact&record=" . $this->bean->id . "',\n\t\t\t\t\tdata: {\n\t\t\t\t\tformat: 'text'\n\t\t\t\t\t},\n\n\t\t\t\t\tdataType: 'text',\n\t\t\t\t\tsuccess: function(data) {\n\t\t\t\t\t\$('#pagecontent').prepend('<div class=\\'alert alert-success\\' role=\\'alert\\'>You have successfully untagged this record.</div>');\n\t\t\t\t\t},\n\t\t\t\t\ttype: 'GET'\n\t\t\t\t\t});\n\n            }\n          \n\n\t\t\t</script>";
     }
     parent::display();
 }
Пример #2
0
 public function preDisplay()
 {
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::LVPopupHtml('Contacts');
     parent::preDisplay();
     $this->lv = new ContactsListViewSmarty();
     /************************************************************/
     //logic for the search dynamic dropdowns
     /************************************************************/
     require_once "custom/include/metrix/loadDynamicLists.php";
     //helper class to autopoluate the dropdowns
     require_once 'include/utils.php';
     global $current_user, $app_list_strings;
     $list = new loadDynamicLists();
     $dynamic_dd_fileds = array("country_c_basic" => array("tblname" => "ref_pays", "listname" => "country_list", "field" => "nom"));
     $list = new loadDynamicLists();
     foreach ($dynamic_dd_fileds as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $app_list_strings[$v['listname']] = $list->populate_list($v['tblname'], $v['field']);
     }
     /************************************************************/
     //end logic for the search dynamic dropdowns
     /************************************************************/
     //if the current user is not admin then hide the values of certain fields and make them non inline-editable
     if ($current_user->is_admin != 1) {
         echo "\n\n\t\t\t<script>\n\t\t\t\t\$('html').hide();\n\t\t\t\t\$(document).ready(\n\t\t\t\tfunction()\n\t\t\t\t{\n\n\t\t\t\tvar remove_fields =    \t['email1','phone_mobile','jjwg_maps_address_c','primary_address_postalcode','primary_address_state','primary_address_city','alt_address_city','primary_address_country','phone_work','phone_fax','description'];//you can add the fields you want to hide here\n\n\n\t\t\t\t\$.each( remove_fields, function( key, value ) {\n\n\n\t\t\t\t\$('td[field= ' + value + ']').html( '' );\n\n\t\t\t\t\$('td[field=' + value + ']').removeAttr('field');\n\t\t\t\t});\n\n\t\t\t\t\$('html').show(250);\n\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t</script>";
     }
 }
Пример #3
0
 function display()
 {
     require_once "custom/include/metrix/loadDynamicLists.php";
     //helper class to autopoluate the dropdowns
     require_once 'include/utils.php';
     global $current_user, $app_list_strings;
     /********************************************************************************************************/
     /*                                                   dynamic dd                                         */
     /********************************************************************************************************/
     $list = new loadDynamicLists();
     $domaine_c = $this->bean->domaine_c;
     $domaine_c = str_replace('^', '', $domaine_c);
     $selected = explode(',', $domaine_c);
     $dynamic_dd_fileds = array("pays_text_c" => array("tblname" => "ref_pays", "listname" => "pays_text_list", "field" => "nom"), "pays_iso2_c" => array("tblname" => "ref_pays", "listname" => "pays_iso2_c_list", "field" => "code"), "id_region_a_c" => array("tblname" => "ref_region", "listname" => "id_region_a_c_list", "field" => "nom"));
     ////special multi enum
     $dynamic_dd_fileds2 = array("domaine_c" => array("tblname" => "ref_discip", "listname" => "domaines_section_c_list", "field" => "Domaine", "field2" => "Discipline"));
     foreach ($dynamic_dd_fileds2 as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $edit_enum = $list->populate_list2($v['tblname'], $v['field'], $v['field2'], $selected);
     }
     foreach ($dynamic_dd_fileds as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $app_list_strings[$v['listname']] = $list->populate_list($v['tblname'], $v['field'], $v['pay']);
     }
     /********************************************************************************************************/
     /*                                                   Javascript                                         */
     /********************************************************************************************************/
     //echo $edit_enum['list_edit'];
     //if the orginisme is type_etablissement_c==faculte
     echo "\r\n\r\n\t\t\t<script>\r\n\t\t\t\t\r\n\t\t\t\t\$(document).ready(function()\r\n\t\t\t\t{     render();//init\r\n\t\t\t\t\t\$('#domaine_c').html('" . $edit_enum['list_edit'] . "');\r\n\r\n\t\t\t\t\t\$( '#type_etablissement_c' ).change(function() {                \r\n                      \r\n                      render();\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t  });\t\r\n\t\t\t\t});\r\n\r\n            //custom function\r\n            render = function(){\r\n\r\n            \tvar remove_fields =    \t['coda_name_c','coda_sname_c','prive_c','id_etat_c','date_effectif_c','date_maj_c','statut_c','commentaire2_c','code_hier_c','qualite_c','adhesion_c','sigle_c','historique','nb_etud_c','nb_ens_c','nb_cherch_c','rub_c','commentaire2_c','nb_etud_annee_obs_c','nb_ens_annee_obs_c','nb_cherch_annee_obs_c','chiffres_c'];//you can add the fields you want to hide here\r\n                       \r\n\r\n\t\t\t\t\t\t\$.each( remove_fields, function( key, value ) {\r\n                        var dd_val =\$( '#type_etablissement_c' ).val();\r\n\t\t                if(dd_val=='faculte'){\r\n\t\t                \t\$('#' + value ).hide();\r\n\t\t                \t\$('#' + value +'_label' ).css( 'color','white' );\r\n\t\t                \t\$('#date_effectif_c_date').parent().parent().hide();\r\n\t\t                \t\$('#date_maj_c_date').parent().parent().hide();\r\n\t\t                \t\$('#adhesion_c_date').parent().parent().hide();\r\n\t\t                \t\r\n\t\t                \t\r\n\t\t                \t\r\n\t\t                }\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\$('#' + value  ).show();\r\n\t\t\t\t\t\t\t\$('#' + value +'_label' ).show();\r\n\t\t\t\t\t\t\t\$('#' + value +'_label' ).css( 'color','black' );\r\n\t\t\t\t\t\t\t\$('#date_effectif_c_date').parent().parent().show();\r\n\t\t                \t\$('#date_maj_c_date').parent().parent().show();\r\n\t\t                \t\$('#adhesion_c_date').parent().parent().show();\r\n\t\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t\t\t});\r\n            }\r\n\r\n\t\t\t</script>";
     $this->ev->process();
     parent::display();
 }
Пример #4
0
 /**
  * @see ViewList::preDisplay()
  */
 public function preDisplay()
 {
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::LVPopupHtml('Accounts');
     parent::preDisplay();
     require_once "custom/include/metrix/loadDynamicLists.php";
     //helper class to autopoluate the dropdowns
     require_once 'include/utils.php';
     global $current_user, $app_list_strings;
     $list = new loadDynamicLists();
     $dynamic_dd_fileds = array("pays_text_c" => array("tblname" => "ref_pays", "listname" => "pays_text_list", "field" => "nom", "tag" => "0"), "id_region_a_c" => array("tblname" => "ref_region", "listname" => "id_region_a_c_list", "field" => "nom", "tag" => "0"));
     foreach ($dynamic_dd_fileds as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $app_list_strings[$v['listname']] = $list->populate_list($v['tblname'], $v['field'], $v['tag']);
     }
     //echo "<pre>";
     //var_dump($app_list_strings['id_region_a_c_list']);
     /* foreach($app_list_strings['id_region_a_c_list'] as $k=>$v){
     	  	echo "'".$k."'=>'".$v."',<br>";
     	  }*/
     //if the current user is not admin then hide the values of certain fields and make them non inline-editable
     if ($current_user->is_admin != 1) {
         echo "\n\n\t\t\t<script>\n\t\t\t\t\$('html').hide();\n\t\t\t\t\$(document).ready(\n\t\t\t\tfunction()\n\t\t\t\t{\n\n\t\t\t\tvar remove_fields =    \t['coda_name_c','coda_sname_c','prive_c','id_etat_c','date_effectif_c','date_maj_c','commentaire2_c','code_hier_c','adhesion_c','sigle_c','historique','nb_etud_c','nb_ens_c','nb_cherch_c','rub_c','commentaire2_c','nb_etud_annee_obs_c','nb_ens_annee_obs_c','nb_cherch_annee_obs_c','chiffres_c'];//you can add the fields you want to hide here\n\n\n\t\t\t\t\$.each( remove_fields, function( key, value ) {\n\n\n\t\t\t\t\$('td[field= ' + value + ']').html( '' );\n\n\t\t\t\t\$('td[field=' + value + ']').removeAttr('field');\n\t\t\t\t});\n\n\t\t\t\t\$('html').show(250);\n\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t</script>";
     }
     $this->lv = new AccountsListViewSmarty();
 }
Пример #5
0
 /**
  * display
  * Override the display method to support customization for the buttons that display
  * a popup and allow you to copy the account's address into the selected contacts.
  * The custom_code_billing and custom_code_shipping Smarty variables are found in
  * include/SugarFields/Fields/Address/DetailView.tpl (default).  If it's a English U.S.
  * locale then it'll use file include/SugarFields/Fields/Address/en_us.DetailView.tpl.
  */
 function display()
 {
     require_once "custom/include/metrix/loadDynamicLists.php";
     //helper class to autopoluate the dropdowns
     require_once 'include/utils.php';
     global $current_user, $app_list_strings;
     /********************************************************************************************************/
     /*                                                   dynamic dd                                         */
     /********************************************************************************************************/
     $list = new loadDynamicLists();
     $domaine_c = $this->bean->domaine_c;
     $domaine_c = str_replace('^', '', $domaine_c);
     $selected = explode(',', $domaine_c);
     ////special multi enum
     $dynamic_dd_fileds2 = array("domaine_c" => array("tblname" => "ref_discip", "listname" => "domaines_section_c_list", "field" => "Domaine", "field2" => "Discipline"));
     $detail_enum = '';
     foreach ($dynamic_dd_fileds2 as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $detail_enum = $list->populate_list2($v['tblname'], $v['field'], $v['field2'], $selected);
     }
     $dynamic_dd_fileds = array("pays_text_c" => array("tblname" => "ref_pays", "listname" => "pays_text_list", "field" => "nom"), "pays_iso2_c" => array("tblname" => "ref_pays", "listname" => "pays_iso2_c_list", "field" => "code"), "id_region_a_c" => array("tblname" => "ref_region", "listname" => "id_region_a_c_list", "field" => "nom"));
     foreach ($dynamic_dd_fileds as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         if (isset($v['tblname'], $v['field'], $v['pay'])) {
             $app_list_strings[$v['listname']] = $list->populate_list($v['tblname'], $v['field'], $v['pay']);
         }
     }
     if (empty($this->bean->id)) {
         sugar_die($app_strings['ERROR_NO_RECORD']);
     }
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::DVPopupHtml('Accounts');
     $this->dv->process();
     global $mod_strings;
     if (ACLController::checkAccess('Contacts', 'edit', true)) {
         $push_billing = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] . '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' . $this->bean->name . '&html=change_address' . '&primary_address_street=' . str_replace(array("\rn", "\r", "\n"), array('', '', '<br>'), urlencode($this->bean->billing_address_street)) . '&primary_address_city=' . $this->bean->billing_address_city . '&primary_address_state=' . $this->bean->billing_address_state . '&primary_address_postalcode=' . $this->bean->billing_address_postalcode . '&primary_address_country=' . $this->bean->billing_address_country . '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE'] . '">';
         $push_shipping = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] . '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' . $this->bean->name . '&html=change_address' . '&primary_address_street=' . str_replace(array("\rn", "\r", "\n"), array('', '', '<br>'), urlencode($this->bean->shipping_address_street)) . '&primary_address_city=' . $this->bean->shipping_address_city . '&primary_address_state=' . $this->bean->shipping_address_state . '&primary_address_postalcode=' . $this->bean->shipping_address_postalcode . '&primary_address_country=' . $this->bean->shipping_address_country . '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE'] . '">';
     } else {
         $push_billing = '';
         $push_shipping = '';
     }
     $this->ss->assign("custom_code_billing", $push_billing);
     $this->ss->assign("custom_code_shipping", $push_shipping);
     if (empty($this->bean->id)) {
         global $app_strings;
         sugar_die($app_strings['ERROR_NO_RECORD']);
     }
     //if the current user is not admin then hide the values of certain fields and make them non inline-editable
     echo "\r\n\r\n\t\t\t<script>\r\n\r\n\r\n\r\n\t\t\t\t\$(document).ready(function()\r\n\t\t\t\t{     render();//init\r\n\r\n\t\t\t\t\t\$('td[field=domaine_c]').html('" . $detail_enum['list_detail'] . "');\r\n\r\n\t\t\t\t\t\$( '#type_etablissement_c' ).change(function() {                \r\n                      \r\n                      render();\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t  });\t\r\n\t\t\t\t});\r\n\r\n            //custom function\r\n            render = function(){\r\n\r\n            \tvar remove_fields =    \t['coda_name_c','coda_sname_c','prive_c','id_etat_c','date_effectif_c','date_maj_c','statut_c','commentaire2_c','code_hier_c','qualite_c','adhesion_c','sigle_c','historique','nb_etud_c','nb_ens_c','nb_cherch_c','rub_c','commentaire2_c','nb_etud_annee_obs_c','nb_ens_annee_obs_c','nb_cherch_annee_obs_c','chiffres_c'];//you can add the fields you want to hide here\r\n                       \r\n\r\n\t\t\t\t\t\t\$.each( remove_fields, function( key, value ) {\r\n                        var dd_val =\$( '#type_etablissement_c' ).val();\r\n\t\t                if(dd_val=='faculte'){\r\n\t\t                \t\$('td[field= ' + value + ']').css( 'color','white' );\r\n\t\t                \t\$('td[field= ' + value + ']').prev().css( 'color','white' );\r\n\t\t                \t\$('td[field= ' + value + ']').removeClass('inlineEdit');\r\n\t\t                \t\$('td[field= ' + value + ']').html('');\r\n\r\n\r\n\t\t                }\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\$('td[field= ' + value + ']').css( 'color','black' );\r\n\t\t\t\t\t\t\t\$('td[field= ' + value + ']').prev().css( 'color','black' );\r\n\t\t\t\t\t\t\t\$('td[field= ' + value + ']').addClass('inlineEdit');\r\n\t\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t\t\t});\r\n            }\r\n\r\n\t\t\t</script>";
     echo $this->dv->display();
 }
Пример #6
0
 function display()
 {
     require_once "custom/include/metrix/loadDynamicLists.php";
     //helper class to autopoluate the dropdowns
     require_once 'include/utils.php';
     global $current_user, $app_list_strings;
     /********************************************************************************************************/
     /*                                                   dynamic dd                                         */
     /********************************************************************************************************/
     //TODO
     $dynamic_dd_fileds = array("country_c" => array("tblname" => "ref_pays", "listname" => "country_list", "field" => "nom"));
     $list = new loadDynamicLists();
     foreach ($dynamic_dd_fileds as $k => $v) {
         unset($app_list_strings[$v['listname']]);
         $app_list_strings[$v['listname']] = $list->populate_list($v['tblname'], $v['field']);
     }
     //if the current user is not admin then hide the values of certain fields and make them non inline-editable
     if ($current_user->is_admin != 1) {
         echo "\r\n\r\n\t\t\t<script>\r\n\t\t\t\t\$('html').hide();\r\n\t\t\t\t\$(document).ready(\r\n\t\t\t\tfunction()\r\n\t\t\t\t{\r\n\r\n\t\t\t\tvar remove_fields =    \t['ContactsemailAddressesTable0','phone_mobile','jjwg_maps_address_c','primary_address_postalcode','primary_address_state','primary_address_city','alt_address_city','primary_address_country','phone_work','phone_fax','description'];//you can add the fields you want to hide here\r\n\r\n\r\n\t\t\t\t\$.each( remove_fields, function( key, value ) {\r\n\r\n\r\n\t\t\t\t\$('#' + value  ).closest( 'td' ).html(' ');\r\n\r\n\t\t\t\t\r\n\t\t\t\t});\r\n                \r\n                \r\n\r\n\t\t\t\t\$('html').show(250);\r\n\t\t\t\t}\r\n\t\t\t\t);\r\n\r\n\t\t\t</script>";
     }
     $this->ev->process();
     parent::display();
 }