dolibarr  13.0.2
objectlinked_lineimport.tpl.php
1 <?php
2 /* Copyright (C) 2011-2013 Regis Houssin <regis.houssin@inodbox.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 // Protection to avoid direct call of template
19 if (empty($conf) || !is_object($conf))
20 {
21  print "Error, template page can't be called as URL";
22  exit;
23 }
24 
25 $objectUrl = $object->getNomUrl(0, '', 0, 1);
26 if ($object->element == 'propal')
27 {
28  $objectUrl = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id;
29 }
30 
31 ?>
32 
33 <!-- START TEMPLATE IMPORT OBJECT LINKED LINES -->
34 <script>
35 
36 $(document).ready(function(){
37  $('.objectlinked_importbtn').click(function (e) {
38 
39  e.preventDefault();
40  var page = $(this).attr("href");
41 
42  var fromelement = $(this).attr("data-element");
43  var fromelementid = $(this).attr("data-id");
44 
45  if( page != undefined && fromelement != undefined && fromelementid != undefined)
46  {
47  var windowWidth = $(window).width()*0.8; //retrieve current window width
48  var windowHeight = $(window).height()*0.8; //retrieve current window height
49  var htmlLines;
50  var formId = "ajaxloaded_tablelinesform_" + fromelement + "_" + fromelementid;
51  $.get(page, function (data) {
52  htmlLines = $(data).find('#tablelines') ;
53  });
54 
55 
56  var $dialog = $('<form id="' + formId + '" action="<?php print $objectUrl; ?>" method="post" ></form>')
57  .load( page + " #tablelines", function() {
58 
59  $("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute
60 
61  $("#" + formId + " .linecheckbox,#" + formId + " .linecheckboxtoggle").prop("checked", true); // checked by default
62 
63  // reload checkbox toggle function
64  $("#" + formId + " .linecheckboxtoggle").click(function(){
65  var checkBoxes = $("#" + formId + " .linecheckbox");
66  checkBoxes.prop("checked", this.checked);
67  });
68 
69 
70  })
71  .html(htmlLines)
72  .dialog({
73  autoOpen: false,
74  modal: true,
75  height: windowHeight,
76  width: windowWidth,
77  title: "<?php echo $langs->transnoentities('LinesToImport'); ?>",
78  buttons: {
79  "<?php echo $langs->trans('Import'); ?>": function() {
80  $( this ).dialog( "close" );
81  $("#" + formId).append('<input type="hidden" name="action" value="import_lines_from_object" />');
82  $("#" + formId).append('<input type="hidden" name="fromelement" value="' + fromelement + '" />');
83  $("#" + formId).append('<input type="hidden" name="fromelementid" value="' + fromelementid + '" />');
84  $("#" + formId).submit();
85  },
86  "<?php echo $langs->trans("Cancel"); ?>": function() {
87  $( this ).dialog( "close" );
88  }
89  }
90  });
91 
92  $dialog.dialog('open');
93  }
94  else
95  {
96  $.jnotify("<?php echo $langs->trans('ErrorNoUrl'); ?>", "error", true);
97  }
98 
99  });
100 
101 
102 
103 
104 });
105 
106 </script>
107 <style type="text/css">
108 .objectlinked_importbtn{
109  cursor:pointer;
110 }
111 </style>
112 <!-- END TEMPLATE IMPORT OBJECT LINKED LINES -->
print
Draft customers invoices.
Definition: index.php:89
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105