@@ -35,33 +35,33 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function facture_prepare_head($object) |
37 | 37 | { |
38 | - global $db, $langs, $conf; |
|
39 | - |
|
40 | - $h = 0; |
|
41 | - $head = array(); |
|
42 | - |
|
43 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; |
|
44 | - $head[$h][1] = $langs->trans('Card'); |
|
45 | - $head[$h][2] = 'compta'; |
|
46 | - $h++; |
|
47 | - |
|
48 | - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
|
49 | - { |
|
50 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
51 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
|
52 | - $head[$h][1] = $langs->trans('ContactsAddresses'); |
|
53 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | - $head[$h][2] = 'contact'; |
|
55 | - $h++; |
|
56 | - } |
|
57 | - |
|
58 | - //if ($fac->mode_reglement_code == 'PRE') |
|
59 | - if (! empty($conf->prelevement->enabled)) |
|
60 | - { |
|
61 | - $nbStandingOrders=0; |
|
62 | - $sql = "SELECT COUNT(pfd.rowid) as nb"; |
|
63 | - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
|
64 | - $sql .= " WHERE pfd.fk_facture = ".$object->id; |
|
38 | + global $db, $langs, $conf; |
|
39 | + |
|
40 | + $h = 0; |
|
41 | + $head = array(); |
|
42 | + |
|
43 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; |
|
44 | + $head[$h][1] = $langs->trans('Card'); |
|
45 | + $head[$h][2] = 'compta'; |
|
46 | + $h++; |
|
47 | + |
|
48 | + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
|
49 | + { |
|
50 | + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
51 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
|
52 | + $head[$h][1] = $langs->trans('ContactsAddresses'); |
|
53 | + if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | + $head[$h][2] = 'contact'; |
|
55 | + $h++; |
|
56 | + } |
|
57 | + |
|
58 | + //if ($fac->mode_reglement_code == 'PRE') |
|
59 | + if (! empty($conf->prelevement->enabled)) |
|
60 | + { |
|
61 | + $nbStandingOrders=0; |
|
62 | + $sql = "SELECT COUNT(pfd.rowid) as nb"; |
|
63 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
|
64 | + $sql .= " WHERE pfd.fk_facture = ".$object->id; |
|
65 | 65 | $resql=$db->query($sql); |
66 | 66 | if ($resql) |
67 | 67 | { |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | if ($obj) $nbStandingOrders = $obj->nb; |
70 | 70 | } |
71 | 71 | else dol_print_error($db); |
72 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
|
73 | - $head[$h][1] = $langs->trans('StandingOrders'); |
|
74 | - if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
75 | - $head[$h][2] = 'standingorders'; |
|
76 | - $h++; |
|
77 | - } |
|
72 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
|
73 | + $head[$h][1] = $langs->trans('StandingOrders'); |
|
74 | + if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
75 | + $head[$h][2] = 'standingorders'; |
|
76 | + $h++; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | // Show more tabs from modules |
80 | 80 | // Entries must be declared in modules descriptor with line |
@@ -84,35 +84,35 @@ discard block |
||
84 | 84 | |
85 | 85 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 86 | { |
87 | - $nbNote = 0; |
|
87 | + $nbNote = 0; |
|
88 | 88 | if(!empty($object->note_private)) $nbNote++; |
89 | - if(!empty($object->note_public)) $nbNote++; |
|
90 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
|
91 | - $head[$h][1] = $langs->trans('Notes'); |
|
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | - $head[$h][2] = 'note'; |
|
94 | - $h++; |
|
89 | + if(!empty($object->note_public)) $nbNote++; |
|
90 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
|
91 | + $head[$h][1] = $langs->trans('Notes'); |
|
92 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | + $head[$h][2] = 'note'; |
|
94 | + $h++; |
|
95 | 95 | } |
96 | 96 | |
97 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
97 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
99 | + $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | 101 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
|
103 | - $head[$h][1] = $langs->trans('Documents'); |
|
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | - $head[$h][2] = 'documents'; |
|
106 | - $h++; |
|
102 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
|
103 | + $head[$h][1] = $langs->trans('Documents'); |
|
104 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | + $head[$h][2] = 'documents'; |
|
106 | + $h++; |
|
107 | 107 | |
108 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id; |
|
109 | - $head[$h][1] = $langs->trans('Info'); |
|
110 | - $head[$h][2] = 'info'; |
|
111 | - $h++; |
|
108 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id; |
|
109 | + $head[$h][1] = $langs->trans('Info'); |
|
110 | + $head[$h][2] = 'info'; |
|
111 | + $h++; |
|
112 | 112 | |
113 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove'); |
|
113 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove'); |
|
114 | 114 | |
115 | - return $head; |
|
115 | + return $head; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -122,50 +122,50 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function invoice_admin_prepare_head() |
124 | 124 | { |
125 | - global $langs, $conf, $user; |
|
126 | - |
|
127 | - $h = 0; |
|
128 | - $head = array(); |
|
129 | - |
|
130 | - $head[$h][0] = DOL_URL_ROOT.'/admin/facture.php'; |
|
131 | - $head[$h][1] = $langs->trans("Miscellaneous"); |
|
132 | - $head[$h][2] = 'general'; |
|
133 | - $h++; |
|
134 | - |
|
135 | - $head[$h][0] = DOL_URL_ROOT.'/admin/payment.php'; |
|
136 | - $head[$h][1] = $langs->trans("Payments"); |
|
137 | - $head[$h][2] = 'payment'; |
|
138 | - $h++; |
|
139 | - |
|
140 | - // Show more tabs from modules |
|
141 | - // Entries must be declared in modules descriptor with line |
|
142 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
143 | - // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
144 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); |
|
145 | - |
|
146 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; |
|
147 | - $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); |
|
148 | - $head[$h][2] = 'attributes'; |
|
149 | - $h++; |
|
150 | - |
|
151 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; |
|
152 | - $head[$h][1] = $langs->trans("ExtraFieldsLines"); |
|
153 | - $head[$h][2] = 'attributeslines'; |
|
154 | - $h++; |
|
155 | - |
|
156 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php'; |
|
157 | - $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec"); |
|
158 | - $head[$h][2] = 'attributesrec'; |
|
159 | - $h++; |
|
160 | - |
|
161 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php'; |
|
162 | - $head[$h][1] = $langs->trans("ExtraFieldsLinesRec"); |
|
163 | - $head[$h][2] = 'attributeslinesrec'; |
|
164 | - $h++; |
|
165 | - |
|
166 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); |
|
167 | - |
|
168 | - return $head; |
|
125 | + global $langs, $conf, $user; |
|
126 | + |
|
127 | + $h = 0; |
|
128 | + $head = array(); |
|
129 | + |
|
130 | + $head[$h][0] = DOL_URL_ROOT.'/admin/facture.php'; |
|
131 | + $head[$h][1] = $langs->trans("Miscellaneous"); |
|
132 | + $head[$h][2] = 'general'; |
|
133 | + $h++; |
|
134 | + |
|
135 | + $head[$h][0] = DOL_URL_ROOT.'/admin/payment.php'; |
|
136 | + $head[$h][1] = $langs->trans("Payments"); |
|
137 | + $head[$h][2] = 'payment'; |
|
138 | + $h++; |
|
139 | + |
|
140 | + // Show more tabs from modules |
|
141 | + // Entries must be declared in modules descriptor with line |
|
142 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
143 | + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
144 | + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); |
|
145 | + |
|
146 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; |
|
147 | + $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); |
|
148 | + $head[$h][2] = 'attributes'; |
|
149 | + $h++; |
|
150 | + |
|
151 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; |
|
152 | + $head[$h][1] = $langs->trans("ExtraFieldsLines"); |
|
153 | + $head[$h][2] = 'attributeslines'; |
|
154 | + $h++; |
|
155 | + |
|
156 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php'; |
|
157 | + $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec"); |
|
158 | + $head[$h][2] = 'attributesrec'; |
|
159 | + $h++; |
|
160 | + |
|
161 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php'; |
|
162 | + $head[$h][1] = $langs->trans("ExtraFieldsLinesRec"); |
|
163 | + $head[$h][2] = 'attributeslinesrec'; |
|
164 | + $h++; |
|
165 | + |
|
166 | + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); |
|
167 | + |
|
168 | + return $head; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function invoice_rec_prepare_head($object) |
179 | 179 | { |
180 | - global $db, $langs, $conf; |
|
180 | + global $db, $langs, $conf; |
|
181 | 181 | |
182 | - $h = 0; |
|
183 | - $head = array(); |
|
182 | + $h = 0; |
|
183 | + $head = array(); |
|
184 | 184 | |
185 | - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id; |
|
186 | - $head[$h][1] = $langs->trans("CardBill"); |
|
187 | - $head[$h][2] = 'card'; |
|
188 | - $h++; |
|
185 | + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id; |
|
186 | + $head[$h][1] = $langs->trans("CardBill"); |
|
187 | + $head[$h][2] = 'card'; |
|
188 | + $h++; |
|
189 | 189 | |
190 | 190 | // Show more tabs from modules |
191 | 191 | // Entries must be declared in modules descriptor with line |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // $this->tabs = array('entity:-tabname); to remove a tab |
194 | 194 | complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec'); |
195 | 195 | |
196 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); |
|
196 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); |
|
197 | 197 | |
198 | - return $head; |
|
198 | + return $head; |
|
199 | 199 | } |
@@ -47,31 +47,31 @@ discard block |
||
47 | 47 | |
48 | 48 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
49 | 49 | { |
50 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
50 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
51 | 51 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
52 | 52 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
53 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
53 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
54 | 54 | $head[$h][2] = 'contact'; |
55 | 55 | $h++; |
56 | 56 | } |
57 | 57 | |
58 | 58 | //if ($fac->mode_reglement_code == 'PRE') |
59 | - if (! empty($conf->prelevement->enabled)) |
|
59 | + if (!empty($conf->prelevement->enabled)) |
|
60 | 60 | { |
61 | - $nbStandingOrders=0; |
|
61 | + $nbStandingOrders = 0; |
|
62 | 62 | $sql = "SELECT COUNT(pfd.rowid) as nb"; |
63 | 63 | $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; |
64 | 64 | $sql .= " WHERE pfd.fk_facture = ".$object->id; |
65 | - $resql=$db->query($sql); |
|
65 | + $resql = $db->query($sql); |
|
66 | 66 | if ($resql) |
67 | 67 | { |
68 | - $obj=$db->fetch_object($resql); |
|
68 | + $obj = $db->fetch_object($resql); |
|
69 | 69 | if ($obj) $nbStandingOrders = $obj->nb; |
70 | 70 | } |
71 | 71 | else dol_print_error($db); |
72 | 72 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
73 | 73 | $head[$h][1] = $langs->trans('StandingOrders'); |
74 | - if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
74 | + if ($nbStandingOrders > 0) $head[$h][1] .= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
75 | 75 | $head[$h][2] = 'standingorders'; |
76 | 76 | $h++; |
77 | 77 | } |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | // Entries must be declared in modules descriptor with line |
81 | 81 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
82 | 82 | // $this->tabs = array('entity:-tabname); to remove a tab |
83 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice'); |
|
83 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice'); |
|
84 | 84 | |
85 | 85 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 86 | { |
87 | 87 | $nbNote = 0; |
88 | - if(!empty($object->note_private)) $nbNote++; |
|
89 | - if(!empty($object->note_public)) $nbNote++; |
|
88 | + if (!empty($object->note_private)) $nbNote++; |
|
89 | + if (!empty($object->note_public)) $nbNote++; |
|
90 | 90 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
91 | 91 | $head[$h][1] = $langs->trans('Notes'); |
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
92 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
93 | 93 | $head[$h][2] = 'note'; |
94 | 94 | $h++; |
95 | 95 | } |
96 | 96 | |
97 | 97 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
99 | + $upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
105 | 105 | $head[$h][2] = 'documents'; |
106 | 106 | $h++; |
107 | 107 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $head[$h][2] = 'info'; |
111 | 111 | $h++; |
112 | 112 | |
113 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove'); |
|
113 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'remove'); |
|
114 | 114 | |
115 | 115 | return $head; |
116 | 116 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | // Entries must be declared in modules descriptor with line |
142 | 142 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
143 | 143 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
144 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); |
|
144 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin'); |
|
145 | 145 | |
146 | 146 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; |
147 | 147 | $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $head[$h][2] = 'attributeslinesrec'; |
164 | 164 | $h++; |
165 | 165 | |
166 | - complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); |
|
166 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'invoice_admin', 'remove'); |
|
167 | 167 | |
168 | 168 | return $head; |
169 | 169 | } |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | // Entries must be declared in modules descriptor with line |
192 | 192 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
193 | 193 | // $this->tabs = array('entity:-tabname); to remove a tab |
194 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec'); |
|
194 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice-rec'); |
|
195 | 195 | |
196 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); |
|
196 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice-rec', 'remove'); |
|
197 | 197 | |
198 | 198 | return $head; |
199 | 199 | } |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
51 | 51 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id; |
52 | 52 | $head[$h][1] = $langs->trans('ContactsAddresses'); |
53 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
53 | + if ($nbContact > 0) { |
|
54 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
55 | + } |
|
54 | 56 | $head[$h][2] = 'contact'; |
55 | 57 | $h++; |
56 | 58 | } |
@@ -66,12 +68,17 @@ discard block |
||
66 | 68 | if ($resql) |
67 | 69 | { |
68 | 70 | $obj=$db->fetch_object($resql); |
69 | - if ($obj) $nbStandingOrders = $obj->nb; |
|
71 | + if ($obj) { |
|
72 | + $nbStandingOrders = $obj->nb; |
|
73 | + } |
|
74 | + } else { |
|
75 | + dol_print_error($db); |
|
70 | 76 | } |
71 | - else dol_print_error($db); |
|
72 | 77 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id; |
73 | 78 | $head[$h][1] = $langs->trans('StandingOrders'); |
74 | - if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
79 | + if ($nbStandingOrders > 0) { |
|
80 | + $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>'; |
|
81 | + } |
|
75 | 82 | $head[$h][2] = 'standingorders'; |
76 | 83 | $h++; |
77 | 84 | } |
@@ -85,11 +92,17 @@ discard block |
||
85 | 92 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
86 | 93 | { |
87 | 94 | $nbNote = 0; |
88 | - if(!empty($object->note_private)) $nbNote++; |
|
89 | - if(!empty($object->note_public)) $nbNote++; |
|
95 | + if(!empty($object->note_private)) { |
|
96 | + $nbNote++; |
|
97 | + } |
|
98 | + if(!empty($object->note_public)) { |
|
99 | + $nbNote++; |
|
100 | + } |
|
90 | 101 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; |
91 | 102 | $head[$h][1] = $langs->trans('Notes'); |
92 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
103 | + if ($nbNote > 0) { |
|
104 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
105 | + } |
|
93 | 106 | $head[$h][2] = 'note'; |
94 | 107 | $h++; |
95 | 108 | } |
@@ -101,7 +114,9 @@ discard block |
||
101 | 114 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | 115 | $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; |
103 | 116 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
117 | + if (($nbFiles+$nbLinks) > 0) { |
|
118 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
119 | + } |
|
105 | 120 | $head[$h][2] = 'documents'; |
106 | 121 | $h++; |
107 | 122 |
@@ -30,30 +30,30 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function establishment_prepare_head($object) |
32 | 32 | { |
33 | - global $langs, $conf; |
|
33 | + global $langs, $conf; |
|
34 | 34 | |
35 | - $h = 0; |
|
36 | - $head = array(); |
|
35 | + $h = 0; |
|
36 | + $head = array(); |
|
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id; |
|
39 | - $head[$h][1] = $langs->trans("Card"); |
|
40 | - $head[$h][2] = 'card'; |
|
41 | - $h++; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id; |
|
39 | + $head[$h][1] = $langs->trans("Card"); |
|
40 | + $head[$h][2] = 'card'; |
|
41 | + $h++; |
|
42 | 42 | |
43 | - // Show more tabs from modules |
|
44 | - // Entries must be declared in modules descriptor with line |
|
43 | + // Show more tabs from modules |
|
44 | + // Entries must be declared in modules descriptor with line |
|
45 | 45 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
46 | 46 | // $this->tabs = array('entity:-tabname); to remove a tab |
47 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment'); |
|
47 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment'); |
|
48 | 48 | |
49 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id; |
|
50 | - $head[$h][1] = $langs->trans("Info"); |
|
51 | - $head[$h][2] = 'info'; |
|
52 | - $h++; |
|
49 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id; |
|
50 | + $head[$h][1] = $langs->trans("Info"); |
|
51 | + $head[$h][2] = 'info'; |
|
52 | + $h++; |
|
53 | 53 | |
54 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove'); |
|
54 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove'); |
|
55 | 55 | |
56 | - return $head; |
|
56 | + return $head; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $h = 0; |
69 | 69 | $head = array(); |
70 | 70 | |
71 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php'; |
|
71 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php'; |
|
72 | 72 | $head[$h][1] = $langs->trans("Parameters"); |
73 | 73 | $head[$h][2] = 'parameters'; |
74 | 74 | $h++; |
75 | 75 | |
76 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php'; |
|
76 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php'; |
|
77 | 77 | $head[$h][1] = $langs->trans("Establishments"); |
78 | 78 | $head[$h][2] = 'establishments'; |
79 | 79 | $h++; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $h = 0; |
36 | 36 | $head = array(); |
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id=' . $object->id; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$object->id; |
|
39 | 39 | $head[$h][1] = $langs->trans("Card"); |
40 | 40 | $head[$h][2] = 'card'; |
41 | 41 | $h++; |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | // Entries must be declared in modules descriptor with line |
45 | 45 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
46 | 46 | // $this->tabs = array('entity:-tabname); to remove a tab |
47 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment'); |
|
47 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment'); |
|
48 | 48 | |
49 | - $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id=' . $object->id; |
|
49 | + $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id='.$object->id; |
|
50 | 50 | $head[$h][1] = $langs->trans("Info"); |
51 | 51 | $head[$h][2] = 'info'; |
52 | 52 | $h++; |
53 | 53 | |
54 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'establishment','remove'); |
|
54 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment', 'remove'); |
|
55 | 55 | |
56 | 56 | return $head; |
57 | 57 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | // Entries must be declared in modules descriptor with line |
83 | 83 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
84 | 84 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
85 | - complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin'); |
|
85 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin'); |
|
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,'',$head,$h,'hrm_admin','remove'); |
|
87 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin', 'remove'); |
|
88 | 88 | |
89 | 89 | return $head; |
90 | 90 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | function payment_prepare_head(Paiement $object) |
29 | 29 | { |
30 | 30 | |
31 | - global $langs, $conf; |
|
31 | + global $langs, $conf; |
|
32 | 32 | |
33 | - $h = 0; |
|
34 | - $head = array(); |
|
33 | + $h = 0; |
|
34 | + $head = array(); |
|
35 | 35 | |
36 | - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; |
|
37 | - $head[$h][1] = $langs->trans("Card"); |
|
38 | - $head[$h][2] = 'payment'; |
|
39 | - $h++; |
|
36 | + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; |
|
37 | + $head[$h][1] = $langs->trans("Card"); |
|
38 | + $head[$h][2] = 'payment'; |
|
39 | + $h++; |
|
40 | 40 | |
41 | 41 | // Show more tabs from modules |
42 | 42 | // Entries must be declared in modules descriptor with line |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | 45 | complete_head_from_modules($conf,$langs,$object,$head,$h,'payment'); |
46 | 46 | |
47 | - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
|
48 | - $head[$h][1] = $langs->trans("Info"); |
|
49 | - $head[$h][2] = 'info'; |
|
50 | - $h++; |
|
47 | + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
|
48 | + $head[$h][1] = $langs->trans("Info"); |
|
49 | + $head[$h][2] = 'info'; |
|
50 | + $h++; |
|
51 | 51 | |
52 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
52 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
53 | 53 | |
54 | - return $head; |
|
54 | + return $head; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | */ |
64 | 64 | function payment_supplier_prepare_head(Paiement $object) |
65 | 65 | { |
66 | - global $langs, $conf; |
|
66 | + global $langs, $conf; |
|
67 | 67 | |
68 | - $h = 0; |
|
69 | - $head = array(); |
|
68 | + $h = 0; |
|
69 | + $head = array(); |
|
70 | 70 | |
71 | - $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id; |
|
72 | - $head[$h][1] = $langs->trans("Card"); |
|
73 | - $head[$h][2] = 'payment'; |
|
74 | - $h++; |
|
71 | + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id; |
|
72 | + $head[$h][1] = $langs->trans("Card"); |
|
73 | + $head[$h][2] = 'payment'; |
|
74 | + $h++; |
|
75 | 75 | |
76 | 76 | // Show more tabs from modules |
77 | 77 | // Entries must be declared in modules descriptor with line |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | // $this->tabs = array('entity:-tabname); to remove a tab |
80 | 80 | complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); |
81 | 81 | |
82 | - $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
|
83 | - $head[$h][1] = $langs->trans('Info'); |
|
84 | - $head[$h][2] = 'info'; |
|
85 | - $h++; |
|
82 | + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
|
83 | + $head[$h][1] = $langs->trans('Info'); |
|
84 | + $head[$h][2] = 'info'; |
|
85 | + $h++; |
|
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
87 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
88 | 88 | |
89 | - return $head; |
|
89 | + return $head; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | */ |
98 | 98 | function getValidOnlinePaymentMethods($paymentmethod='') |
99 | 99 | { |
100 | - global $conf; |
|
101 | - |
|
102 | - $validpaymentmethod=array(); |
|
103 | - |
|
104 | - if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
105 | - { |
|
106 | - $validpaymentmethod['paypal']='valid'; |
|
107 | - } |
|
108 | - if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
109 | - { |
|
110 | - $validpaymentmethod['paybox']='valid'; |
|
111 | - } |
|
112 | - if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
113 | - { |
|
114 | - $validpaymentmethod['stripe']='valid'; |
|
115 | - } |
|
116 | - return $validpaymentmethod; |
|
100 | + global $conf; |
|
101 | + |
|
102 | + $validpaymentmethod=array(); |
|
103 | + |
|
104 | + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
105 | + { |
|
106 | + $validpaymentmethod['paypal']='valid'; |
|
107 | + } |
|
108 | + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
109 | + { |
|
110 | + $validpaymentmethod['paybox']='valid'; |
|
111 | + } |
|
112 | + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
113 | + { |
|
114 | + $validpaymentmethod['stripe']='valid'; |
|
115 | + } |
|
116 | + return $validpaymentmethod; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function showOnlinePaymentUrl($type,$ref) |
127 | 127 | { |
128 | - global $conf, $langs; |
|
128 | + global $conf, $langs; |
|
129 | 129 | |
130 | - // Load translation files required by the page |
|
130 | + // Load translation files required by the page |
|
131 | 131 | $langs->loadLangs(array('payment', 'paybox')); |
132 | 132 | |
133 | - $servicename='Online'; |
|
133 | + $servicename='Online'; |
|
134 | 134 | |
135 | - $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | - $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | - $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | - $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | - return $out; |
|
135 | + $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | + $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | + $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | + $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | + return $out; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -151,115 +151,115 @@ discard block |
||
151 | 151 | */ |
152 | 152 | function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag') |
153 | 153 | { |
154 | - global $conf; |
|
155 | - |
|
156 | - $ref=str_replace(' ','',$ref); |
|
157 | - $out=''; |
|
158 | - |
|
159 | - if ($type == 'free') |
|
160 | - { |
|
161 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | - { |
|
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | - } |
|
167 | - } |
|
168 | - elseif ($type == 'order') |
|
169 | - { |
|
170 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | - $out.=($mode?'</font>':''); |
|
174 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | - { |
|
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | - else |
|
178 | - { |
|
179 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | - $out.=($mode?'</font>':''); |
|
183 | - } |
|
184 | - } |
|
185 | - } |
|
186 | - elseif ($type == 'invoice') |
|
187 | - { |
|
188 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
191 | - $out.=($mode?'</font>':''); |
|
192 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | - { |
|
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | - else |
|
196 | - { |
|
197 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | - $out.=($mode?'</font>':''); |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
204 | - elseif ($type == 'contractline') |
|
205 | - { |
|
206 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
209 | - $out.=($mode?'</font>':''); |
|
210 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | - { |
|
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | - else |
|
214 | - { |
|
215 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | - $out.=($mode?'</font>':''); |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
222 | - elseif ($type == 'member' || $type == 'membersubscription') |
|
223 | - { |
|
224 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
227 | - $out.=($mode?'</font>':''); |
|
228 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | - { |
|
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | - else |
|
232 | - { |
|
233 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | - $out.=($mode?'</font>':''); |
|
237 | - } |
|
238 | - } |
|
239 | - } |
|
240 | - if ($type == 'donation') |
|
241 | - { |
|
242 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
245 | - $out.=($mode?'</font>':''); |
|
246 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | - { |
|
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | - else |
|
250 | - { |
|
251 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | - $out.=($mode?'</font>':''); |
|
255 | - } |
|
256 | - } |
|
257 | - } |
|
258 | - |
|
259 | - // For multicompany |
|
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | - |
|
262 | - return $out; |
|
154 | + global $conf; |
|
155 | + |
|
156 | + $ref=str_replace(' ','',$ref); |
|
157 | + $out=''; |
|
158 | + |
|
159 | + if ($type == 'free') |
|
160 | + { |
|
161 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | + { |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | + else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | + } |
|
167 | + } |
|
168 | + elseif ($type == 'order') |
|
169 | + { |
|
170 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | + if ($mode == 1) $out.='order_ref'; |
|
172 | + if ($mode == 0) $out.=urlencode($ref); |
|
173 | + $out.=($mode?'</font>':''); |
|
174 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | + { |
|
176 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | + else |
|
178 | + { |
|
179 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | + $out.=($mode?'</font>':''); |
|
183 | + } |
|
184 | + } |
|
185 | + } |
|
186 | + elseif ($type == 'invoice') |
|
187 | + { |
|
188 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | + if ($mode == 1) $out.='invoice_ref'; |
|
190 | + if ($mode == 0) $out.=urlencode($ref); |
|
191 | + $out.=($mode?'</font>':''); |
|
192 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | + { |
|
194 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | + else |
|
196 | + { |
|
197 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | + $out.=($mode?'</font>':''); |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | + elseif ($type == 'contractline') |
|
205 | + { |
|
206 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | + if ($mode == 1) $out.='contractline_ref'; |
|
208 | + if ($mode == 0) $out.=urlencode($ref); |
|
209 | + $out.=($mode?'</font>':''); |
|
210 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | + { |
|
212 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | + else |
|
214 | + { |
|
215 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | + $out.=($mode?'</font>':''); |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | + elseif ($type == 'member' || $type == 'membersubscription') |
|
223 | + { |
|
224 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | + if ($mode == 1) $out.='member_ref'; |
|
226 | + if ($mode == 0) $out.=urlencode($ref); |
|
227 | + $out.=($mode?'</font>':''); |
|
228 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | + { |
|
230 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | + else |
|
232 | + { |
|
233 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | + $out.=($mode?'</font>':''); |
|
237 | + } |
|
238 | + } |
|
239 | + } |
|
240 | + if ($type == 'donation') |
|
241 | + { |
|
242 | + $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | + if ($mode == 1) $out.='donation_ref'; |
|
244 | + if ($mode == 0) $out.=urlencode($ref); |
|
245 | + $out.=($mode?'</font>':''); |
|
246 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | + { |
|
248 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | + else |
|
250 | + { |
|
251 | + $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | + if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | + if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | + $out.=($mode?'</font>':''); |
|
255 | + } |
|
256 | + } |
|
257 | + } |
|
258 | + |
|
259 | + // For multicompany |
|
260 | + if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | + |
|
262 | + return $out; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -331,20 +331,20 @@ discard block |
||
331 | 331 | print '<div class="center">'."\n"; |
332 | 332 | if ($addformmessage) |
333 | 333 | { |
334 | - print '<!-- object = '.$object->element.' -->'; |
|
335 | - print '<br>'; |
|
336 | - |
|
337 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | - |
|
341 | - // Add other message if VAT exists |
|
342 | - if ($object->total_vat != 0 || $object->total_tva != 0) |
|
343 | - { |
|
344 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | - } |
|
334 | + print '<!-- object = '.$object->element.' -->'; |
|
335 | + print '<br>'; |
|
336 | + |
|
337 | + $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | + if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | + elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | + |
|
341 | + // Add other message if VAT exists |
|
342 | + if ($object->total_vat != 0 || $object->total_tva != 0) |
|
343 | + { |
|
344 | + $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | + if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | + elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | print '<font style="font-size: 10px;"><br><hr>'."\n"; |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | // Entries must be declared in modules descriptor with line |
43 | 43 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment'); |
|
45 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment'); |
|
46 | 46 | |
47 | 47 | $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; |
48 | 48 | $head[$h][1] = $langs->trans("Info"); |
49 | 49 | $head[$h][2] = 'info'; |
50 | 50 | $h++; |
51 | 51 | |
52 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment', 'remove'); |
|
52 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove'); |
|
53 | 53 | |
54 | 54 | return $head; |
55 | 55 | } |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | // Entries must be declared in modules descriptor with line |
78 | 78 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
79 | 79 | // $this->tabs = array('entity:-tabname); to remove a tab |
80 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); |
|
80 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier'); |
|
81 | 81 | |
82 | 82 | $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; |
83 | 83 | $head[$h][1] = $langs->trans('Info'); |
84 | 84 | $head[$h][2] = 'info'; |
85 | 85 | $h++; |
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier', 'remove'); |
|
87 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier', 'remove'); |
|
88 | 88 | |
89 | 89 | return $head; |
90 | 90 | } |
@@ -95,23 +95,23 @@ discard block |
||
95 | 95 | * @param string $paymentmethod Filter on this payment method (''=none, 'paypal', ...) |
96 | 96 | * @return array Array of valid payment method |
97 | 97 | */ |
98 | -function getValidOnlinePaymentMethods($paymentmethod='') |
|
98 | +function getValidOnlinePaymentMethods($paymentmethod = '') |
|
99 | 99 | { |
100 | 100 | global $conf; |
101 | 101 | |
102 | - $validpaymentmethod=array(); |
|
102 | + $validpaymentmethod = array(); |
|
103 | 103 | |
104 | - if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) |
|
104 | + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) |
|
105 | 105 | { |
106 | - $validpaymentmethod['paypal']='valid'; |
|
106 | + $validpaymentmethod['paypal'] = 'valid'; |
|
107 | 107 | } |
108 | - if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) |
|
108 | + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) |
|
109 | 109 | { |
110 | - $validpaymentmethod['paybox']='valid'; |
|
110 | + $validpaymentmethod['paybox'] = 'valid'; |
|
111 | 111 | } |
112 | - if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) |
|
112 | + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) |
|
113 | 113 | { |
114 | - $validpaymentmethod['stripe']='valid'; |
|
114 | + $validpaymentmethod['stripe'] = 'valid'; |
|
115 | 115 | } |
116 | 116 | return $validpaymentmethod; |
117 | 117 | } |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | * @param string $ref Ref of object |
124 | 124 | * @return string Url string |
125 | 125 | */ |
126 | -function showOnlinePaymentUrl($type,$ref) |
|
126 | +function showOnlinePaymentUrl($type, $ref) |
|
127 | 127 | { |
128 | 128 | global $conf, $langs; |
129 | 129 | |
130 | 130 | // Load translation files required by the page |
131 | 131 | $langs->loadLangs(array('payment', 'paybox')); |
132 | 132 | |
133 | - $servicename='Online'; |
|
133 | + $servicename = 'Online'; |
|
134 | 134 | |
135 | - $out = img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'<br>'; |
|
136 | - $url = getOnlinePaymentUrl(0,$type,$ref); |
|
137 | - $out.= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | - $out.= ajax_autoselect("onlinepaymenturl", 0); |
|
135 | + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>'; |
|
136 | + $url = getOnlinePaymentUrl(0, $type, $ref); |
|
137 | + $out .= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">'; |
|
138 | + $out .= ajax_autoselect("onlinepaymenturl", 0); |
|
139 | 139 | return $out; |
140 | 140 | } |
141 | 141 | |
@@ -149,115 +149,115 @@ discard block |
||
149 | 149 | * @param string $freetag Free tag |
150 | 150 | * @return string Url string |
151 | 151 | */ |
152 | -function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag') |
|
152 | +function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_free_tag') |
|
153 | 153 | { |
154 | 154 | global $conf; |
155 | 155 | |
156 | - $ref=str_replace(' ','',$ref); |
|
157 | - $out=''; |
|
156 | + $ref = str_replace(' ', '', $ref); |
|
157 | + $out = ''; |
|
158 | 158 | |
159 | 159 | if ($type == 'free') |
160 | 160 | { |
161 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
|
162 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
161 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : ''); |
|
162 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
163 | 163 | { |
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | + else $out .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | elseif ($type == 'order') |
169 | 169 | { |
170 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
|
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | - $out.=($mode?'</font>':''); |
|
174 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
170 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : ''); |
|
171 | + if ($mode == 1) $out .= 'order_ref'; |
|
172 | + if ($mode == 0) $out .= urlencode($ref); |
|
173 | + $out .= ($mode ? '</font>' : ''); |
|
174 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
175 | 175 | { |
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
176 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | 177 | else |
178 | 178 | { |
179 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
182 | - $out.=($mode?'</font>':''); |
|
179 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
180 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
182 | + $out .= ($mode ? '</font>' : ''); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | elseif ($type == 'invoice') |
187 | 187 | { |
188 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
|
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
191 | - $out.=($mode?'</font>':''); |
|
192 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
188 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : ''); |
|
189 | + if ($mode == 1) $out .= 'invoice_ref'; |
|
190 | + if ($mode == 0) $out .= urlencode($ref); |
|
191 | + $out .= ($mode ? '</font>' : ''); |
|
192 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
193 | 193 | { |
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
194 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | 195 | else |
196 | 196 | { |
197 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
200 | - $out.=($mode?'</font>':''); |
|
197 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
198 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
200 | + $out .= ($mode ? '</font>' : ''); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
204 | 204 | elseif ($type == 'contractline') |
205 | 205 | { |
206 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
|
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
209 | - $out.=($mode?'</font>':''); |
|
210 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
206 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : ''); |
|
207 | + if ($mode == 1) $out .= 'contractline_ref'; |
|
208 | + if ($mode == 0) $out .= urlencode($ref); |
|
209 | + $out .= ($mode ? '</font>' : ''); |
|
210 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
211 | 211 | { |
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
212 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | 213 | else |
214 | 214 | { |
215 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | - $out.=($mode?'</font>':''); |
|
215 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
216 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
218 | + $out .= ($mode ? '</font>' : ''); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | } |
222 | 222 | elseif ($type == 'member' || $type == 'membersubscription') |
223 | 223 | { |
224 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
|
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
227 | - $out.=($mode?'</font>':''); |
|
228 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
224 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : ''); |
|
225 | + if ($mode == 1) $out .= 'member_ref'; |
|
226 | + if ($mode == 0) $out .= urlencode($ref); |
|
227 | + $out .= ($mode ? '</font>' : ''); |
|
228 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
229 | 229 | { |
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
230 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | 231 | else |
232 | 232 | { |
233 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
236 | - $out.=($mode?'</font>':''); |
|
233 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
234 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
236 | + $out .= ($mode ? '</font>' : ''); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
240 | 240 | if ($type == 'donation') |
241 | 241 | { |
242 | - $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
|
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
245 | - $out.=($mode?'</font>':''); |
|
246 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
242 | + $out = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : ''); |
|
243 | + if ($mode == 1) $out .= 'donation_ref'; |
|
244 | + if ($mode == 0) $out .= urlencode($ref); |
|
245 | + $out .= ($mode ? '</font>' : ''); |
|
246 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
247 | 247 | { |
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
248 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | 249 | else |
250 | 250 | { |
251 | - $out.='&securekey='.($mode?'<font color="#666666">':''); |
|
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
254 | - $out.=($mode?'</font>':''); |
|
251 | + $out .= '&securekey='.($mode ? '<font color="#666666">' : ''); |
|
252 | + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); |
|
254 | + $out .= ($mode ? '</font>' : ''); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | 259 | // For multicompany |
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
260 | + if (!empty($out) && !empty($conf->multicompany->enabled)) $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
261 | 261 | |
262 | 262 | return $out; |
263 | 263 | } |
@@ -274,56 +274,56 @@ discard block |
||
274 | 274 | * @param Object $object Object related to payment |
275 | 275 | * @return void |
276 | 276 | */ |
277 | -function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null) |
|
277 | +function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null) |
|
278 | 278 | { |
279 | 279 | global $conf; |
280 | 280 | |
281 | 281 | // Juridical status |
282 | - $line1=""; |
|
282 | + $line1 = ""; |
|
283 | 283 | if ($fromcompany->forme_juridique_code) |
284 | 284 | { |
285 | - $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); |
|
285 | + $line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code); |
|
286 | 286 | } |
287 | 287 | // Capital |
288 | 288 | if ($fromcompany->capital) |
289 | 289 | { |
290 | - $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); |
|
290 | + $line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency); |
|
291 | 291 | } |
292 | 292 | // Prof Id 1 |
293 | - if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) |
|
293 | + if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) |
|
294 | 294 | { |
295 | - $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code); |
|
296 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
297 | - $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1; |
|
295 | + $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); |
|
296 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
297 | + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1; |
|
298 | 298 | } |
299 | 299 | // Prof Id 2 |
300 | 300 | if ($fromcompany->idprof2) |
301 | 301 | { |
302 | - $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code); |
|
303 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
304 | - $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2; |
|
302 | + $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); |
|
303 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
304 | + $line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | // Second line of company infos |
308 | - $line2=""; |
|
308 | + $line2 = ""; |
|
309 | 309 | // Prof Id 3 |
310 | 310 | if ($fromcompany->idprof3) |
311 | 311 | { |
312 | - $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code); |
|
313 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
314 | - $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3; |
|
312 | + $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); |
|
313 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
314 | + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3; |
|
315 | 315 | } |
316 | 316 | // Prof Id 4 |
317 | 317 | if ($fromcompany->idprof4) |
318 | 318 | { |
319 | - $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code); |
|
320 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
321 | - $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4; |
|
319 | + $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); |
|
320 | + if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1]; |
|
321 | + $line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4; |
|
322 | 322 | } |
323 | 323 | // IntraCommunautary VAT |
324 | 324 | if ($fromcompany->tva_intra != '') |
325 | 325 | { |
326 | - $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; |
|
326 | + $line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | print '<br>'; |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | print '<!-- object = '.$object->element.' -->'; |
335 | 335 | print '<br>'; |
336 | 336 | |
337 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
337 | + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
|
338 | + if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | + elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
340 | 340 | |
341 | 341 | // Add other message if VAT exists |
342 | 342 | if ($object->total_vat != 0 || $object->total_tva != 0) |
343 | 343 | { |
344 | - $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
344 | + $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
|
345 | + if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | + elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 |
@@ -161,78 +161,113 @@ discard block |
||
161 | 161 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); |
162 | 162 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
163 | 163 | { |
164 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
165 | - else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
164 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
165 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
166 | + } else { |
|
167 | + $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
168 | + } |
|
166 | 169 | } |
167 | - } |
|
168 | - elseif ($type == 'order') |
|
170 | + } elseif ($type == 'order') |
|
169 | 171 | { |
170 | 172 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); |
171 | - if ($mode == 1) $out.='order_ref'; |
|
172 | - if ($mode == 0) $out.=urlencode($ref); |
|
173 | + if ($mode == 1) { |
|
174 | + $out.='order_ref'; |
|
175 | + } |
|
176 | + if ($mode == 0) { |
|
177 | + $out.=urlencode($ref); |
|
178 | + } |
|
173 | 179 | $out.=($mode?'</font>':''); |
174 | 180 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
175 | 181 | { |
176 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
177 | - else |
|
182 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
183 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
184 | + } else |
|
178 | 185 | { |
179 | 186 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
180 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
181 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
187 | + if ($mode == 1) { |
|
188 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; |
|
189 | + } |
|
190 | + if ($mode == 0) { |
|
191 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
192 | + } |
|
182 | 193 | $out.=($mode?'</font>':''); |
183 | 194 | } |
184 | 195 | } |
185 | - } |
|
186 | - elseif ($type == 'invoice') |
|
196 | + } elseif ($type == 'invoice') |
|
187 | 197 | { |
188 | 198 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); |
189 | - if ($mode == 1) $out.='invoice_ref'; |
|
190 | - if ($mode == 0) $out.=urlencode($ref); |
|
199 | + if ($mode == 1) { |
|
200 | + $out.='invoice_ref'; |
|
201 | + } |
|
202 | + if ($mode == 0) { |
|
203 | + $out.=urlencode($ref); |
|
204 | + } |
|
191 | 205 | $out.=($mode?'</font>':''); |
192 | 206 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
193 | 207 | { |
194 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
195 | - else |
|
208 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
209 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
210 | + } else |
|
196 | 211 | { |
197 | 212 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
198 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
199 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
213 | + if ($mode == 1) { |
|
214 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; |
|
215 | + } |
|
216 | + if ($mode == 0) { |
|
217 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
218 | + } |
|
200 | 219 | $out.=($mode?'</font>':''); |
201 | 220 | } |
202 | 221 | } |
203 | - } |
|
204 | - elseif ($type == 'contractline') |
|
222 | + } elseif ($type == 'contractline') |
|
205 | 223 | { |
206 | 224 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); |
207 | - if ($mode == 1) $out.='contractline_ref'; |
|
208 | - if ($mode == 0) $out.=urlencode($ref); |
|
225 | + if ($mode == 1) { |
|
226 | + $out.='contractline_ref'; |
|
227 | + } |
|
228 | + if ($mode == 0) { |
|
229 | + $out.=urlencode($ref); |
|
230 | + } |
|
209 | 231 | $out.=($mode?'</font>':''); |
210 | 232 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
211 | 233 | { |
212 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
213 | - else |
|
234 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
235 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
236 | + } else |
|
214 | 237 | { |
215 | 238 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
216 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
217 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
239 | + if ($mode == 1) { |
|
240 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; |
|
241 | + } |
|
242 | + if ($mode == 0) { |
|
243 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
244 | + } |
|
218 | 245 | $out.=($mode?'</font>':''); |
219 | 246 | } |
220 | 247 | } |
221 | - } |
|
222 | - elseif ($type == 'member' || $type == 'membersubscription') |
|
248 | + } elseif ($type == 'member' || $type == 'membersubscription') |
|
223 | 249 | { |
224 | 250 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); |
225 | - if ($mode == 1) $out.='member_ref'; |
|
226 | - if ($mode == 0) $out.=urlencode($ref); |
|
251 | + if ($mode == 1) { |
|
252 | + $out.='member_ref'; |
|
253 | + } |
|
254 | + if ($mode == 0) { |
|
255 | + $out.=urlencode($ref); |
|
256 | + } |
|
227 | 257 | $out.=($mode?'</font>':''); |
228 | 258 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
229 | 259 | { |
230 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
231 | - else |
|
260 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
261 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
262 | + } else |
|
232 | 263 | { |
233 | 264 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
234 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
235 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
265 | + if ($mode == 1) { |
|
266 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; |
|
267 | + } |
|
268 | + if ($mode == 0) { |
|
269 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
270 | + } |
|
236 | 271 | $out.=($mode?'</font>':''); |
237 | 272 | } |
238 | 273 | } |
@@ -240,24 +275,36 @@ discard block |
||
240 | 275 | if ($type == 'donation') |
241 | 276 | { |
242 | 277 | $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=donation&ref='.($mode?'<font color="#666666">':''); |
243 | - if ($mode == 1) $out.='donation_ref'; |
|
244 | - if ($mode == 0) $out.=urlencode($ref); |
|
278 | + if ($mode == 1) { |
|
279 | + $out.='donation_ref'; |
|
280 | + } |
|
281 | + if ($mode == 0) { |
|
282 | + $out.=urlencode($ref); |
|
283 | + } |
|
245 | 284 | $out.=($mode?'</font>':''); |
246 | 285 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
247 | 286 | { |
248 | - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
249 | - else |
|
287 | + if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
|
288 | + $out.='&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; |
|
289 | + } else |
|
250 | 290 | { |
251 | 291 | $out.='&securekey='.($mode?'<font color="#666666">':''); |
252 | - if ($mode == 1) $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
253 | - if ($mode == 0) $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
292 | + if ($mode == 1) { |
|
293 | + $out.="hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; |
|
294 | + } |
|
295 | + if ($mode == 0) { |
|
296 | + $out.= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $type . $ref, 2); |
|
297 | + } |
|
254 | 298 | $out.=($mode?'</font>':''); |
255 | 299 | } |
256 | 300 | } |
257 | 301 | } |
258 | 302 | |
259 | 303 | // For multicompany |
260 | - if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities |
|
304 | + if (! empty($out) && ! empty($conf->multicompany->enabled)) { |
|
305 | + $out.="&entity=".$conf->entity; |
|
306 | + } |
|
307 | + // Check the entity because we may have the same reference in several entities |
|
261 | 308 | |
262 | 309 | return $out; |
263 | 310 | } |
@@ -293,14 +340,18 @@ discard block |
||
293 | 340 | if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || ! $fromcompany->idprof2)) |
294 | 341 | { |
295 | 342 | $field=$langs->transcountrynoentities("ProfId1",$fromcompany->country_code); |
296 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
343 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
344 | + $field=$reg[1]; |
|
345 | + } |
|
297 | 346 | $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1; |
298 | 347 | } |
299 | 348 | // Prof Id 2 |
300 | 349 | if ($fromcompany->idprof2) |
301 | 350 | { |
302 | 351 | $field=$langs->transcountrynoentities("ProfId2",$fromcompany->country_code); |
303 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
352 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
353 | + $field=$reg[1]; |
|
354 | + } |
|
304 | 355 | $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2; |
305 | 356 | } |
306 | 357 | |
@@ -310,14 +361,18 @@ discard block |
||
310 | 361 | if ($fromcompany->idprof3) |
311 | 362 | { |
312 | 363 | $field=$langs->transcountrynoentities("ProfId3",$fromcompany->country_code); |
313 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
364 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
365 | + $field=$reg[1]; |
|
366 | + } |
|
314 | 367 | $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3; |
315 | 368 | } |
316 | 369 | // Prof Id 4 |
317 | 370 | if ($fromcompany->idprof4) |
318 | 371 | { |
319 | 372 | $field=$langs->transcountrynoentities("ProfId4",$fromcompany->country_code); |
320 | - if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; |
|
373 | + if (preg_match('/\((.*)\)/i',$field,$reg)) { |
|
374 | + $field=$reg[1]; |
|
375 | + } |
|
321 | 376 | $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4; |
322 | 377 | } |
323 | 378 | // IntraCommunautary VAT |
@@ -335,23 +390,32 @@ discard block |
||
335 | 390 | print '<br>'; |
336 | 391 | |
337 | 392 | $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; |
338 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
339 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
393 | + if (! empty($conf->global->$parammessageform)) { |
|
394 | + print $langs->transnoentities($conf->global->$parammessageform); |
|
395 | + } elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) { |
|
396 | + print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); |
|
397 | + } |
|
340 | 398 | |
341 | 399 | // Add other message if VAT exists |
342 | 400 | if ($object->total_vat != 0 || $object->total_tva != 0) |
343 | 401 | { |
344 | 402 | $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; |
345 | - if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); |
|
346 | - elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
403 | + if (! empty($conf->global->$parammessageform)) { |
|
404 | + print $langs->transnoentities($conf->global->$parammessageform); |
|
405 | + } elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) { |
|
406 | + print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); |
|
407 | + } |
|
347 | 408 | } |
348 | 409 | } |
349 | 410 | |
350 | 411 | print '<font style="font-size: 10px;"><br><hr>'."\n"; |
351 | 412 | print $fromcompany->name.'<br>'; |
352 | 413 | print $line1; |
353 | - if (strlen($line1.$line2) > 50) print '<br>'; |
|
354 | - else print ' - '; |
|
414 | + if (strlen($line1.$line2) > 50) { |
|
415 | + print '<br>'; |
|
416 | + } else { |
|
417 | + print ' - '; |
|
418 | + } |
|
355 | 419 | print $line2; |
356 | 420 | print '</font></div>'."\n"; |
357 | 421 | } |
@@ -28,41 +28,41 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function asset_admin_prepare_head() |
30 | 30 | { |
31 | - global $langs, $conf; |
|
31 | + global $langs, $conf; |
|
32 | 32 | |
33 | - $langs->load("assets"); |
|
33 | + $langs->load("assets"); |
|
34 | 34 | |
35 | - $h = 0; |
|
36 | - $head = array(); |
|
35 | + $h = 0; |
|
36 | + $head = array(); |
|
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
39 | - $head[$h][1] = $langs->trans("Settings"); |
|
40 | - $head[$h][2] = 'settings'; |
|
41 | - $h++; |
|
38 | + $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
39 | + $head[$h][1] = $langs->trans("Settings"); |
|
40 | + $head[$h][2] = 'settings'; |
|
41 | + $h++; |
|
42 | 42 | |
43 | - // Show more tabs from modules |
|
44 | - // Entries must be declared in modules descriptor with line |
|
45 | - //$this->tabs = array( |
|
46 | - // 'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
47 | - //); // to add new tab |
|
48 | - //$this->tabs = array( |
|
49 | - // 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
50 | - //); // to remove a tab |
|
51 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
|
43 | + // Show more tabs from modules |
|
44 | + // Entries must be declared in modules descriptor with line |
|
45 | + //$this->tabs = array( |
|
46 | + // 'entity:+tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
47 | + //); // to add new tab |
|
48 | + //$this->tabs = array( |
|
49 | + // 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__' |
|
50 | + //); // to remove a tab |
|
51 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
|
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
54 | - $head[$h][1] = $langs->trans("ExtraFields"); |
|
55 | - $head[$h][2] = 'attributes'; |
|
56 | - $h++; |
|
53 | + $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
54 | + $head[$h][1] = $langs->trans("ExtraFields"); |
|
55 | + $head[$h][2] = 'attributes'; |
|
56 | + $h++; |
|
57 | 57 | |
58 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
59 | - $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
|
60 | - $head[$h][2] = 'attributes_type'; |
|
61 | - $h++; |
|
58 | + $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
59 | + $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
|
60 | + $head[$h][2] = 'attributes_type'; |
|
61 | + $h++; |
|
62 | 62 | |
63 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove'); |
|
63 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove'); |
|
64 | 64 | |
65 | - return $head; |
|
65 | + return $head; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -72,56 +72,56 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function asset_prepare_head() |
74 | 74 | { |
75 | - global $langs, $conf; |
|
76 | - |
|
77 | - $langs->load("assets"); |
|
78 | - |
|
79 | - $h = 0; |
|
80 | - $head = array(); |
|
81 | - |
|
82 | - $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
83 | - $head[$h][1] = $langs->trans("Card"); |
|
84 | - $head[$h][2] = 'card'; |
|
85 | - $h++; |
|
86 | - |
|
87 | - // Show more tabs from modules |
|
88 | - // Entries must be declared in modules descriptor with line |
|
89 | - //$this->tabs = array( |
|
90 | - // 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
91 | - //); // to add new tab |
|
92 | - //$this->tabs = array( |
|
93 | - // 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
94 | - //); // to remove a tab |
|
95 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets'); |
|
96 | - |
|
97 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
98 | - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
99 | - $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
102 | - $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
|
103 | - $head[$h][1] = $langs->trans('Documents'); |
|
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | - $head[$h][2] = 'documents'; |
|
106 | - $h++; |
|
107 | - |
|
108 | - $nbNote = 0; |
|
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
111 | - $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
|
112 | - $head[$h][1] = $langs->trans("Notes"); |
|
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | - $head[$h][2] = 'note'; |
|
115 | - $h++; |
|
116 | - |
|
117 | - $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
118 | - $head[$h][1] = $langs->trans("Info"); |
|
119 | - $head[$h][2] = 'info'; |
|
120 | - $h++; |
|
121 | - |
|
122 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'asset', 'remove'); |
|
123 | - |
|
124 | - return $head; |
|
75 | + global $langs, $conf; |
|
76 | + |
|
77 | + $langs->load("assets"); |
|
78 | + |
|
79 | + $h = 0; |
|
80 | + $head = array(); |
|
81 | + |
|
82 | + $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
83 | + $head[$h][1] = $langs->trans("Card"); |
|
84 | + $head[$h][2] = 'card'; |
|
85 | + $h++; |
|
86 | + |
|
87 | + // Show more tabs from modules |
|
88 | + // Entries must be declared in modules descriptor with line |
|
89 | + //$this->tabs = array( |
|
90 | + // 'entity:+tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
91 | + //); // to add new tab |
|
92 | + //$this->tabs = array( |
|
93 | + // 'entity:-tabname:Title:@assets:/assets/mypage.php?id=__ID__' |
|
94 | + //); // to remove a tab |
|
95 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets'); |
|
96 | + |
|
97 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
98 | + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
99 | + $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks=Link::count($db, $object->element, $object->id); |
|
102 | + $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
|
103 | + $head[$h][1] = $langs->trans('Documents'); |
|
104 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
105 | + $head[$h][2] = 'documents'; |
|
106 | + $h++; |
|
107 | + |
|
108 | + $nbNote = 0; |
|
109 | + if(!empty($object->note_private)) $nbNote++; |
|
110 | + if(!empty($object->note_public)) $nbNote++; |
|
111 | + $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
|
112 | + $head[$h][1] = $langs->trans("Notes"); |
|
113 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | + $head[$h][2] = 'note'; |
|
115 | + $h++; |
|
116 | + |
|
117 | + $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
118 | + $head[$h][1] = $langs->trans("Info"); |
|
119 | + $head[$h][2] = 'info'; |
|
120 | + $h++; |
|
121 | + |
|
122 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'asset', 'remove'); |
|
123 | + |
|
124 | + return $head; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -132,23 +132,23 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function asset_type_prepare_head(AssetType $object) |
134 | 134 | { |
135 | - global $langs, $conf, $user; |
|
135 | + global $langs, $conf, $user; |
|
136 | 136 | |
137 | - $h=0; |
|
138 | - $head = array(); |
|
137 | + $h=0; |
|
138 | + $head = array(); |
|
139 | 139 | |
140 | - $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
|
141 | - $head[$h][1] = $langs->trans("Card"); |
|
142 | - $head[$h][2] = 'card'; |
|
143 | - $h++; |
|
140 | + $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
|
141 | + $head[$h][1] = $langs->trans("Card"); |
|
142 | + $head[$h][2] = 'card'; |
|
143 | + $h++; |
|
144 | 144 | |
145 | - // Show more tabs from modules |
|
146 | - // Entries must be declared in modules descriptor with line |
|
147 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
148 | - // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
149 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
145 | + // Show more tabs from modules |
|
146 | + // Entries must be declared in modules descriptor with line |
|
147 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
148 | + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
|
149 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
151 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
152 | 152 | |
153 | - return $head; |
|
153 | + return $head; |
|
154 | 154 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $h = 0; |
36 | 36 | $head = array(); |
37 | 37 | |
38 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/setup.php'; |
|
38 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/setup.php'; |
|
39 | 39 | $head[$h][1] = $langs->trans("Settings"); |
40 | 40 | $head[$h][2] = 'settings'; |
41 | 41 | $h++; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | //); // to remove a tab |
51 | 51 | complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); |
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; |
|
53 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_extrafields.php'; |
|
54 | 54 | $head[$h][1] = $langs->trans("ExtraFields"); |
55 | 55 | $head[$h][2] = 'attributes'; |
56 | 56 | $h++; |
57 | 57 | |
58 | - $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_type_extrafields.php'; |
|
58 | + $head[$h][0] = DOL_URL_ROOT.'/asset/admin/assets_type_extrafields.php'; |
|
59 | 59 | $head[$h][1] = $langs->trans("ExtraFieldsAssetsType"); |
60 | 60 | $head[$h][2] = 'attributes_type'; |
61 | 61 | $h++; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $h = 0; |
80 | 80 | $head = array(); |
81 | 81 | |
82 | - $head[$h][0] = DOL_URL_ROOT . '/asset/card.php'; |
|
82 | + $head[$h][0] = DOL_URL_ROOT.'/asset/card.php'; |
|
83 | 83 | $head[$h][1] = $langs->trans("Card"); |
84 | 84 | $head[$h][2] = 'card'; |
85 | 85 | $h++; |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | |
97 | 97 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
98 | 98 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
99 | - $upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename,2,0,1,$object,'assets'). '/'. dol_sanitizeFileName($object->ref); |
|
100 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
101 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
99 | + $upload_dir = $conf->assets->dir_output.'/'.get_exdir($filename, 2, 0, 1, $object, 'assets').'/'.dol_sanitizeFileName($object->ref); |
|
100 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
101 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
105 | 105 | $head[$h][2] = 'documents'; |
106 | 106 | $h++; |
107 | 107 | |
108 | 108 | $nbNote = 0; |
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
109 | + if (!empty($object->note_private)) $nbNote++; |
|
110 | + if (!empty($object->note_public)) $nbNote++; |
|
111 | 111 | $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
112 | 112 | $head[$h][1] = $langs->trans("Notes"); |
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
113 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | 114 | $head[$h][2] = 'note'; |
115 | 115 | $h++; |
116 | 116 | |
117 | - $head[$h][0] = DOL_URL_ROOT . '/asset/info.php?id=' . $object->id; |
|
117 | + $head[$h][0] = DOL_URL_ROOT.'/asset/info.php?id='.$object->id; |
|
118 | 118 | $head[$h][1] = $langs->trans("Info"); |
119 | 119 | $head[$h][2] = 'info'; |
120 | 120 | $h++; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | global $langs, $conf, $user; |
136 | 136 | |
137 | - $h=0; |
|
137 | + $h = 0; |
|
138 | 138 | $head = array(); |
139 | 139 | |
140 | 140 | $head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | // Entries must be declared in modules descriptor with line |
147 | 147 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
148 | 148 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
149 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype'); |
|
149 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype'); |
|
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove'); |
|
151 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'assettype', 'remove'); |
|
152 | 152 | |
153 | 153 | return $head; |
154 | 154 | } |
@@ -101,16 +101,24 @@ |
||
101 | 101 | $nbLinks=Link::count($db, $object->element, $object->id); |
102 | 102 | $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
103 | 103 | $head[$h][1] = $langs->trans('Documents'); |
104 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
104 | + if (($nbFiles+$nbLinks) > 0) { |
|
105 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
106 | + } |
|
105 | 107 | $head[$h][2] = 'documents'; |
106 | 108 | $h++; |
107 | 109 | |
108 | 110 | $nbNote = 0; |
109 | - if(!empty($object->note_private)) $nbNote++; |
|
110 | - if(!empty($object->note_public)) $nbNote++; |
|
111 | + if(!empty($object->note_private)) { |
|
112 | + $nbNote++; |
|
113 | + } |
|
114 | + if(!empty($object->note_public)) { |
|
115 | + $nbNote++; |
|
116 | + } |
|
111 | 117 | $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
112 | 118 | $head[$h][1] = $langs->trans("Notes"); |
113 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
119 | + if ($nbNote > 0) { |
|
120 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
121 | + } |
|
114 | 122 | $head[$h][2] = 'note'; |
115 | 123 | $h++; |
116 | 124 |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $tab = 0; |
37 | 37 | $head = array(); |
38 | 38 | |
39 | - $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id; |
|
40 | - $head[$tab][1] = $langs->trans('Card'); |
|
41 | - $head[$tab][2] = 'card'; |
|
42 | - $tab++; |
|
39 | + $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id; |
|
40 | + $head[$tab][1] = $langs->trans('Card'); |
|
41 | + $head[$tab][2] = 'card'; |
|
42 | + $tab++; |
|
43 | 43 | |
44 | 44 | // Show more tabs from modules |
45 | 45 | // Entries must be declared in modules descriptor with line |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | // $this->tabs = array('entity:-tabname); to remove a tab |
48 | 48 | complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat'); |
49 | 49 | |
50 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
50 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
51 | 51 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
52 | - $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
52 | + $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
54 | 54 | $nbLinks=Link::count($db, $object->element, $object->id); |
55 | - $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
|
56 | - $head[$tab][1] = $langs->trans("Documents"); |
|
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
58 | - $head[$tab][2] = 'documents'; |
|
59 | - $tab++; |
|
55 | + $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
|
56 | + $head[$tab][1] = $langs->trans("Documents"); |
|
57 | + if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
58 | + $head[$tab][2] = 'documents'; |
|
59 | + $tab++; |
|
60 | 60 | |
61 | 61 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id; |
62 | 62 | $head[$tab][1] = $langs->trans("Info"); |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | // Entries must be declared in modules descriptor with line |
46 | 46 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
47 | 47 | // $this->tabs = array('entity:-tabname); to remove a tab |
48 | - complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat'); |
|
48 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat'); |
|
49 | 49 | |
50 | 50 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
51 | 51 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
52 | - $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
53 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
54 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
52 | + $upload_dir = $conf->tax->dir_output."/".dol_sanitizeFileName($object->ref); |
|
53 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
54 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
55 | 55 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
56 | 56 | $head[$tab][1] = $langs->trans("Documents"); |
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
57 | + if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
58 | 58 | $head[$tab][2] = 'documents'; |
59 | 59 | $tab++; |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $head[$tab][2] = 'info'; |
64 | 64 | $tab++; |
65 | 65 | |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$tab,'vat','remove'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'vat', 'remove'); |
|
67 | 67 | |
68 | 68 | return $head; |
69 | 69 | } |
@@ -54,7 +54,9 @@ |
||
54 | 54 | $nbLinks=Link::count($db, $object->element, $object->id); |
55 | 55 | $head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id; |
56 | 56 | $head[$tab][1] = $langs->trans("Documents"); |
57 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
57 | + if (($nbFiles+$nbLinks) > 0) { |
|
58 | + $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
59 | + } |
|
58 | 60 | $head[$tab][2] = 'documents'; |
59 | 61 | $tab++; |
60 | 62 |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function donation_admin_prepare_head() |
30 | 30 | { |
31 | - global $langs, $conf; |
|
31 | + global $langs, $conf; |
|
32 | 32 | |
33 | - $h = 0; |
|
34 | - $head = array(); |
|
33 | + $h = 0; |
|
34 | + $head = array(); |
|
35 | 35 | |
36 | - $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php'; |
|
37 | - $head[$h][1] = $langs->trans("Miscellaneous"); |
|
38 | - $head[$h][2] = 'general'; |
|
39 | - $h ++; |
|
36 | + $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php'; |
|
37 | + $head[$h][1] = $langs->trans("Miscellaneous"); |
|
38 | + $head[$h][2] = 'general'; |
|
39 | + $h ++; |
|
40 | 40 | |
41 | - // Show more tabs from modules |
|
42 | - // Entries must be declared in modules descriptor with line |
|
43 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
44 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
45 | - complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin'); |
|
41 | + // Show more tabs from modules |
|
42 | + // Entries must be declared in modules descriptor with line |
|
43 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
44 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
45 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin'); |
|
46 | 46 | |
47 | - $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php'; |
|
48 | - $head[$h][1] = $langs->trans("ExtraFields"); |
|
47 | + $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php'; |
|
48 | + $head[$h][1] = $langs->trans("ExtraFields"); |
|
49 | 49 | $head[$h][2] = 'attributes'; |
50 | - $h++; |
|
50 | + $h++; |
|
51 | 51 | |
52 | - complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin', 'remove'); |
|
52 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin', 'remove'); |
|
53 | 53 | |
54 | - return $head; |
|
54 | + return $head; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -62,48 +62,48 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function donation_prepare_head($object) |
64 | 64 | { |
65 | - global $db, $langs, $conf; |
|
65 | + global $db, $langs, $conf; |
|
66 | 66 | |
67 | - $h = 0; |
|
68 | - $head = array(); |
|
67 | + $h = 0; |
|
68 | + $head = array(); |
|
69 | 69 | |
70 | - $head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id; |
|
71 | - $head[$h][1] = $langs->trans("Card"); |
|
72 | - $head[$h][2] = 'card'; |
|
73 | - $h ++; |
|
70 | + $head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id; |
|
71 | + $head[$h][1] = $langs->trans("Card"); |
|
72 | + $head[$h][2] = 'card'; |
|
73 | + $h ++; |
|
74 | 74 | |
75 | - // Show more tabs from modules |
|
76 | - // Entries must be declared in modules descriptor with line |
|
77 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
78 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
79 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation'); |
|
75 | + // Show more tabs from modules |
|
76 | + // Entries must be declared in modules descriptor with line |
|
77 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
78 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
79 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation'); |
|
80 | 80 | |
81 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
81 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
82 | 82 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
83 | - $upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); |
|
84 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
83 | + $upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); |
|
84 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
85 | 85 | $nbLinks=Link::count($db, $object->element, $object->id); |
86 | - $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; |
|
87 | - $head[$h][1] = $langs->trans('Documents'); |
|
88 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
89 | - $head[$h][2] = 'documents'; |
|
90 | - $h++; |
|
86 | + $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; |
|
87 | + $head[$h][1] = $langs->trans('Documents'); |
|
88 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
89 | + $head[$h][2] = 'documents'; |
|
90 | + $h++; |
|
91 | 91 | |
92 | - $nbNote = 0; |
|
93 | - if(!empty($object->note_private)) $nbNote++; |
|
94 | - if(!empty($object->note_public)) $nbNote++; |
|
95 | - $head[$h][0] = DOL_URL_ROOT.'/don/note.php?id='.$object->id; |
|
96 | - $head[$h][1] = $langs->trans("Notes"); |
|
97 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
98 | - $head[$h][2] = 'note'; |
|
99 | - $h++; |
|
92 | + $nbNote = 0; |
|
93 | + if(!empty($object->note_private)) $nbNote++; |
|
94 | + if(!empty($object->note_public)) $nbNote++; |
|
95 | + $head[$h][0] = DOL_URL_ROOT.'/don/note.php?id='.$object->id; |
|
96 | + $head[$h][1] = $langs->trans("Notes"); |
|
97 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
98 | + $head[$h][2] = 'note'; |
|
99 | + $h++; |
|
100 | 100 | |
101 | - $head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id; |
|
102 | - $head[$h][1] = $langs->trans("Info"); |
|
103 | - $head[$h][2] = 'info'; |
|
104 | - $h++; |
|
101 | + $head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id; |
|
102 | + $head[$h][1] = $langs->trans("Info"); |
|
103 | + $head[$h][2] = 'info'; |
|
104 | + $h++; |
|
105 | 105 | |
106 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation', 'remove'); |
|
106 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation', 'remove'); |
|
107 | 107 | |
108 | - return $head; |
|
108 | + return $head; |
|
109 | 109 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $h = 0; |
34 | 34 | $head = array(); |
35 | 35 | |
36 | - $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php'; |
|
36 | + $head[$h][0] = DOL_URL_ROOT.'/don/admin/donation.php'; |
|
37 | 37 | $head[$h][1] = $langs->trans("Miscellaneous"); |
38 | 38 | $head[$h][2] = 'general'; |
39 | - $h ++; |
|
39 | + $h++; |
|
40 | 40 | |
41 | 41 | // Show more tabs from modules |
42 | 42 | // Entries must be declared in modules descriptor with line |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // $this->tabs = array('entity:-tabname); to remove a tab |
45 | 45 | complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin'); |
46 | 46 | |
47 | - $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php'; |
|
47 | + $head[$h][0] = DOL_URL_ROOT.'/don/admin/donation_extrafields.php'; |
|
48 | 48 | $head[$h][1] = $langs->trans("ExtraFields"); |
49 | 49 | $head[$h][2] = 'attributes'; |
50 | 50 | $h++; |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $h = 0; |
68 | 68 | $head = array(); |
69 | 69 | |
70 | - $head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id; |
|
70 | + $head[$h][0] = DOL_URL_ROOT.'/don/card.php?id='.$object->id; |
|
71 | 71 | $head[$h][1] = $langs->trans("Card"); |
72 | 72 | $head[$h][2] = 'card'; |
73 | - $h ++; |
|
73 | + $h++; |
|
74 | 74 | |
75 | 75 | // Show more tabs from modules |
76 | 76 | // Entries must be declared in modules descriptor with line |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | |
81 | 81 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
82 | 82 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
83 | - $upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); |
|
84 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
85 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
83 | + $upload_dir = $conf->don->dir_output.'/'.get_exdir($filename, 2, 0, 1, $object, 'donation').'/'.dol_sanitizeFileName($object->ref); |
|
84 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
85 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
86 | 86 | $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; |
87 | 87 | $head[$h][1] = $langs->trans('Documents'); |
88 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
88 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
89 | 89 | $head[$h][2] = 'documents'; |
90 | 90 | $h++; |
91 | 91 | |
92 | 92 | $nbNote = 0; |
93 | - if(!empty($object->note_private)) $nbNote++; |
|
94 | - if(!empty($object->note_public)) $nbNote++; |
|
93 | + if (!empty($object->note_private)) $nbNote++; |
|
94 | + if (!empty($object->note_public)) $nbNote++; |
|
95 | 95 | $head[$h][0] = DOL_URL_ROOT.'/don/note.php?id='.$object->id; |
96 | 96 | $head[$h][1] = $langs->trans("Notes"); |
97 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
97 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
98 | 98 | $head[$h][2] = 'note'; |
99 | 99 | $h++; |
100 | 100 | |
101 | - $head[$h][0] = DOL_URL_ROOT . '/don/info.php?id=' . $object->id; |
|
101 | + $head[$h][0] = DOL_URL_ROOT.'/don/info.php?id='.$object->id; |
|
102 | 102 | $head[$h][1] = $langs->trans("Info"); |
103 | 103 | $head[$h][2] = 'info'; |
104 | 104 | $h++; |
@@ -85,16 +85,24 @@ |
||
85 | 85 | $nbLinks=Link::count($db, $object->element, $object->id); |
86 | 86 | $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; |
87 | 87 | $head[$h][1] = $langs->trans('Documents'); |
88 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
88 | + if (($nbFiles+$nbLinks) > 0) { |
|
89 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
90 | + } |
|
89 | 91 | $head[$h][2] = 'documents'; |
90 | 92 | $h++; |
91 | 93 | |
92 | 94 | $nbNote = 0; |
93 | - if(!empty($object->note_private)) $nbNote++; |
|
94 | - if(!empty($object->note_public)) $nbNote++; |
|
95 | + if(!empty($object->note_private)) { |
|
96 | + $nbNote++; |
|
97 | + } |
|
98 | + if(!empty($object->note_public)) { |
|
99 | + $nbNote++; |
|
100 | + } |
|
95 | 101 | $head[$h][0] = DOL_URL_ROOT.'/don/note.php?id='.$object->id; |
96 | 102 | $head[$h][1] = $langs->trans("Notes"); |
97 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
103 | + if ($nbNote > 0) { |
|
104 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
105 | + } |
|
98 | 106 | $head[$h][2] = 'note'; |
99 | 107 | $h++; |
100 | 108 |
@@ -29,33 +29,33 @@ |
||
29 | 29 | */ |
30 | 30 | function trip_prepare_head(Deplacement $object) |
31 | 31 | { |
32 | - global $langs, $conf; |
|
32 | + global $langs, $conf; |
|
33 | 33 | |
34 | - $h = 0; |
|
35 | - $head = array(); |
|
34 | + $h = 0; |
|
35 | + $head = array(); |
|
36 | 36 | |
37 | - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/card.php?id=' . $object->id; |
|
38 | - $head[$h][1] = $langs->trans("Card"); |
|
39 | - $head[$h][2] = 'card'; |
|
40 | - $h++; |
|
37 | + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/card.php?id=' . $object->id; |
|
38 | + $head[$h][1] = $langs->trans("Card"); |
|
39 | + $head[$h][2] = 'card'; |
|
40 | + $h++; |
|
41 | 41 | |
42 | - // Show more tabs from modules |
|
43 | - // Entries must be declared in modules descriptor with line |
|
42 | + // Show more tabs from modules |
|
43 | + // Entries must be declared in modules descriptor with line |
|
44 | 44 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
45 | 45 | // $this->tabs = array('entity:-tabname); to remove a tab |
46 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'trip'); |
|
46 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'trip'); |
|
47 | 47 | |
48 | - $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/document.php?id='.$object->id; |
|
49 | - $head[$h][1] = $langs->trans("Documents"); |
|
50 | - $head[$h][2] = 'documents'; |
|
51 | - $h++; |
|
48 | + $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/document.php?id='.$object->id; |
|
49 | + $head[$h][1] = $langs->trans("Documents"); |
|
50 | + $head[$h][2] = 'documents'; |
|
51 | + $h++; |
|
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; |
|
54 | - $head[$h][1] = $langs->trans("Info"); |
|
55 | - $head[$h][2] = 'info'; |
|
56 | - $h++; |
|
53 | + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; |
|
54 | + $head[$h][1] = $langs->trans("Info"); |
|
55 | + $head[$h][2] = 'info'; |
|
56 | + $h++; |
|
57 | 57 | |
58 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove'); |
|
58 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove'); |
|
59 | 59 | |
60 | - return $head; |
|
60 | + return $head; |
|
61 | 61 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $h = 0; |
35 | 35 | $head = array(); |
36 | 36 | |
37 | - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/card.php?id=' . $object->id; |
|
37 | + $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$object->id; |
|
38 | 38 | $head[$h][1] = $langs->trans("Card"); |
39 | 39 | $head[$h][2] = 'card'; |
40 | 40 | $h++; |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | // Entries must be declared in modules descriptor with line |
44 | 44 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
45 | 45 | // $this->tabs = array('entity:-tabname); to remove a tab |
46 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'trip'); |
|
46 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip'); |
|
47 | 47 | |
48 | 48 | $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/document.php?id='.$object->id; |
49 | 49 | $head[$h][1] = $langs->trans("Documents"); |
50 | 50 | $head[$h][2] = 'documents'; |
51 | 51 | $h++; |
52 | 52 | |
53 | - $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; |
|
53 | + $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/info.php?id='.$object->id; |
|
54 | 54 | $head[$h][1] = $langs->trans("Info"); |
55 | 55 | $head[$h][2] = 'info'; |
56 | 56 | $h++; |
57 | 57 | |
58 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove'); |
|
58 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip', 'remove'); |
|
59 | 59 | |
60 | 60 | return $head; |
61 | 61 | } |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function categories_prepare_head($object,$type) |
33 | 33 | { |
34 | - global $langs, $conf, $user; |
|
34 | + global $langs, $conf, $user; |
|
35 | 35 | |
36 | - // Load translation files required by the page |
|
36 | + // Load translation files required by the page |
|
37 | 37 | $langs->loadLangs(array('categories', 'products')); |
38 | 38 | |
39 | - $h = 0; |
|
40 | - $head = array(); |
|
39 | + $h = 0; |
|
40 | + $head = array(); |
|
41 | 41 | |
42 | - $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type; |
|
43 | - $head[$h][1] = $langs->trans("Card"); |
|
44 | - $head[$h][2] = 'card'; |
|
45 | - $h++; |
|
42 | + $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type; |
|
43 | + $head[$h][1] = $langs->trans("Card"); |
|
44 | + $head[$h][2] = 'card'; |
|
45 | + $h++; |
|
46 | 46 | |
47 | - $head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type; |
|
48 | - $head[$h][1] = $langs->trans("Photos"); |
|
49 | - $head[$h][2] = 'photos'; |
|
50 | - $h++; |
|
47 | + $head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type; |
|
48 | + $head[$h][1] = $langs->trans("Photos"); |
|
49 | + $head[$h][2] = 'photos'; |
|
50 | + $h++; |
|
51 | 51 | |
52 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
53 | - { |
|
54 | - $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type; |
|
55 | - $head[$h][1] = $langs->trans("Translation"); |
|
56 | - $head[$h][2] = 'translation'; |
|
57 | - $h++; |
|
58 | - } |
|
52 | + if (! empty($conf->global->MAIN_MULTILANGS)) |
|
53 | + { |
|
54 | + $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type; |
|
55 | + $head[$h][1] = $langs->trans("Translation"); |
|
56 | + $head[$h][2] = 'translation'; |
|
57 | + $h++; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | // Show more tabs from modules |
61 | 61 | // Entries must be declared in modules descriptor with line |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove'); |
67 | 67 | |
68 | - return $head; |
|
68 | + return $head; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -76,32 +76,32 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function categoriesadmin_prepare_head() |
78 | 78 | { |
79 | - global $langs, $conf, $user; |
|
79 | + global $langs, $conf, $user; |
|
80 | 80 | |
81 | - $langs->load("categories"); |
|
81 | + $langs->load("categories"); |
|
82 | 82 | |
83 | - $h = 0; |
|
84 | - $head = array(); |
|
83 | + $h = 0; |
|
84 | + $head = array(); |
|
85 | 85 | |
86 | - $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php'; |
|
87 | - $head[$h][1] = $langs->trans("Setup"); |
|
88 | - $head[$h][2] = 'setup'; |
|
89 | - $h++; |
|
86 | + $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie.php'; |
|
87 | + $head[$h][1] = $langs->trans("Setup"); |
|
88 | + $head[$h][2] = 'setup'; |
|
89 | + $h++; |
|
90 | 90 | |
91 | - $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php'; |
|
92 | - $head[$h][1] = $langs->trans("ExtraFieldsCategories"); |
|
93 | - $head[$h][2] = 'attributes_categories'; |
|
94 | - $h++; |
|
91 | + $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php'; |
|
92 | + $head[$h][1] = $langs->trans("ExtraFieldsCategories"); |
|
93 | + $head[$h][2] = 'attributes_categories'; |
|
94 | + $h++; |
|
95 | 95 | |
96 | - // Show more tabs from modules |
|
97 | - // Entries must be declared in modules descriptor with line |
|
98 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
99 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
100 | - complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin'); |
|
96 | + // Show more tabs from modules |
|
97 | + // Entries must be declared in modules descriptor with line |
|
98 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
99 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
100 | + complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin'); |
|
101 | 101 | |
102 | - complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove'); |
|
102 | + complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove'); |
|
103 | 103 | |
104 | - return $head; |
|
104 | + return $head; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string $type Type of category |
30 | 30 | * @return array Array of tabs to show |
31 | 31 | */ |
32 | -function categories_prepare_head($object,$type) |
|
32 | +function categories_prepare_head($object, $type) |
|
33 | 33 | { |
34 | 34 | global $langs, $conf, $user; |
35 | 35 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $head[$h][2] = 'photos'; |
50 | 50 | $h++; |
51 | 51 | |
52 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
52 | + if (!empty($conf->global->MAIN_MULTILANGS)) |
|
53 | 53 | { |
54 | 54 | $head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&type='.$type; |
55 | 55 | $head[$h][1] = $langs->trans("Translation"); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | // Entries must be declared in modules descriptor with line |
62 | 62 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
63 | 63 | // $this->tabs = array('entity:-tabname); to remove a tab |
64 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type); |
|
64 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type); |
|
65 | 65 | |
66 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove'); |
|
66 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'categories_'.$type, 'remove'); |
|
67 | 67 | |
68 | 68 | return $head; |
69 | 69 | } |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | // Entries must be declared in modules descriptor with line |
98 | 98 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
99 | 99 | // $this->tabs = array('entity:-tabname); to remove a tab |
100 | - complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin'); |
|
100 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin'); |
|
101 | 101 | |
102 | - complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove'); |
|
102 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'categoriesadmin', 'remove'); |
|
103 | 103 | |
104 | 104 | return $head; |
105 | 105 | } |
@@ -35,122 +35,122 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function project_prepare_head($object) |
37 | 37 | { |
38 | - global $db, $langs, $conf, $user; |
|
39 | - |
|
40 | - $h = 0; |
|
41 | - $head = array(); |
|
42 | - |
|
43 | - $head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$object->id; |
|
44 | - $head[$h][1] = $langs->trans("Project"); |
|
45 | - $head[$h][2] = 'project'; |
|
46 | - $h++; |
|
47 | - |
|
48 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
49 | - $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; |
|
50 | - $head[$h][1] = $langs->trans("ProjectContact"); |
|
51 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
52 | - $head[$h][2] = 'contact'; |
|
53 | - $h++; |
|
54 | - |
|
55 | - if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
56 | - { |
|
57 | - // Then tab for sub level of projet, i mean tasks |
|
58 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; |
|
59 | - $head[$h][1] = $langs->trans("Tasks"); |
|
60 | - |
|
61 | - require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
|
62 | - $taskstatic=new Task($db); |
|
63 | - $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
|
64 | - if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>'; |
|
65 | - $head[$h][2] = 'tasks'; |
|
66 | - $h++; |
|
67 | - |
|
68 | - $nbTimeSpent=0; |
|
69 | - $sql = "SELECT t.rowid"; |
|
70 | - //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
|
71 | - //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
|
72 | - $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; |
|
73 | - $sql .= " WHERE t.fk_task = pt.rowid"; |
|
74 | - $sql .= " AND pt.fk_projet =".$object->id; |
|
75 | - $resql = $db->query($sql); |
|
76 | - if ($resql) |
|
77 | - { |
|
78 | - $obj = $db->fetch_object($resql); |
|
79 | - if ($obj) $nbTimeSpent=1; |
|
80 | - } |
|
81 | - else dol_print_error($db); |
|
82 | - |
|
83 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; |
|
84 | - $head[$h][1] = $langs->trans("TimeSpent"); |
|
85 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
86 | - $head[$h][2] = 'timespent'; |
|
87 | - $h++; |
|
88 | - } |
|
89 | - |
|
90 | - if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) |
|
91 | - || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) |
|
92 | - || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) |
|
93 | - { |
|
94 | - $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; |
|
95 | - $head[$h][1] = $langs->trans("ProjectOverview"); |
|
96 | - $head[$h][2] = 'element'; |
|
97 | - $h++; |
|
98 | - } |
|
99 | - |
|
100 | - // Show more tabs from modules |
|
101 | - // Entries must be declared in modules descriptor with line |
|
102 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
103 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
104 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'project'); |
|
105 | - |
|
106 | - |
|
107 | - if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
|
108 | - { |
|
109 | - $nbNote = 0; |
|
110 | - if(!empty($object->note_private)) $nbNote++; |
|
111 | - if(!empty($object->note_public)) $nbNote++; |
|
112 | - $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; |
|
113 | - $head[$h][1] = $langs->trans('Notes'); |
|
114 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
115 | - $head[$h][2] = 'notes'; |
|
116 | - $h++; |
|
117 | - } |
|
118 | - |
|
119 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
120 | - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
121 | - $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
122 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
123 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
124 | - $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; |
|
125 | - $head[$h][1] = $langs->trans('Documents'); |
|
126 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
127 | - $head[$h][2] = 'document'; |
|
128 | - $h++; |
|
129 | - |
|
130 | - // Manage discussion |
|
131 | - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) |
|
132 | - { |
|
133 | - $nbComments = $object->getNbComments(); |
|
134 | - $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; |
|
135 | - $head[$h][1] = $langs->trans("CommentLink"); |
|
136 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
137 | - $head[$h][2] = 'project_comment'; |
|
138 | - $h++; |
|
139 | - } |
|
140 | - |
|
141 | - $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; |
|
142 | - $head[$h][1].= $langs->trans("Events"); |
|
143 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
144 | - { |
|
145 | - $head[$h][1].= '/'; |
|
146 | - $head[$h][1].= $langs->trans("Agenda"); |
|
147 | - } |
|
148 | - $head[$h][2] = 'agenda'; |
|
149 | - $h++; |
|
150 | - |
|
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove'); |
|
152 | - |
|
153 | - return $head; |
|
38 | + global $db, $langs, $conf, $user; |
|
39 | + |
|
40 | + $h = 0; |
|
41 | + $head = array(); |
|
42 | + |
|
43 | + $head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$object->id; |
|
44 | + $head[$h][1] = $langs->trans("Project"); |
|
45 | + $head[$h][2] = 'project'; |
|
46 | + $h++; |
|
47 | + |
|
48 | + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
49 | + $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; |
|
50 | + $head[$h][1] = $langs->trans("ProjectContact"); |
|
51 | + if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
52 | + $head[$h][2] = 'contact'; |
|
53 | + $h++; |
|
54 | + |
|
55 | + if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
56 | + { |
|
57 | + // Then tab for sub level of projet, i mean tasks |
|
58 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; |
|
59 | + $head[$h][1] = $langs->trans("Tasks"); |
|
60 | + |
|
61 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
|
62 | + $taskstatic=new Task($db); |
|
63 | + $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
|
64 | + if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>'; |
|
65 | + $head[$h][2] = 'tasks'; |
|
66 | + $h++; |
|
67 | + |
|
68 | + $nbTimeSpent=0; |
|
69 | + $sql = "SELECT t.rowid"; |
|
70 | + //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
|
71 | + //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
|
72 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; |
|
73 | + $sql .= " WHERE t.fk_task = pt.rowid"; |
|
74 | + $sql .= " AND pt.fk_projet =".$object->id; |
|
75 | + $resql = $db->query($sql); |
|
76 | + if ($resql) |
|
77 | + { |
|
78 | + $obj = $db->fetch_object($resql); |
|
79 | + if ($obj) $nbTimeSpent=1; |
|
80 | + } |
|
81 | + else dol_print_error($db); |
|
82 | + |
|
83 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; |
|
84 | + $head[$h][1] = $langs->trans("TimeSpent"); |
|
85 | + if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
86 | + $head[$h][2] = 'timespent'; |
|
87 | + $h++; |
|
88 | + } |
|
89 | + |
|
90 | + if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) |
|
91 | + || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) |
|
92 | + || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) |
|
93 | + { |
|
94 | + $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; |
|
95 | + $head[$h][1] = $langs->trans("ProjectOverview"); |
|
96 | + $head[$h][2] = 'element'; |
|
97 | + $h++; |
|
98 | + } |
|
99 | + |
|
100 | + // Show more tabs from modules |
|
101 | + // Entries must be declared in modules descriptor with line |
|
102 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
103 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
104 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'project'); |
|
105 | + |
|
106 | + |
|
107 | + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
|
108 | + { |
|
109 | + $nbNote = 0; |
|
110 | + if(!empty($object->note_private)) $nbNote++; |
|
111 | + if(!empty($object->note_public)) $nbNote++; |
|
112 | + $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; |
|
113 | + $head[$h][1] = $langs->trans('Notes'); |
|
114 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
115 | + $head[$h][2] = 'notes'; |
|
116 | + $h++; |
|
117 | + } |
|
118 | + |
|
119 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
120 | + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
121 | + $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
122 | + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
123 | + $nbLinks=Link::count($db, $object->element, $object->id); |
|
124 | + $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; |
|
125 | + $head[$h][1] = $langs->trans('Documents'); |
|
126 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
127 | + $head[$h][2] = 'document'; |
|
128 | + $h++; |
|
129 | + |
|
130 | + // Manage discussion |
|
131 | + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) |
|
132 | + { |
|
133 | + $nbComments = $object->getNbComments(); |
|
134 | + $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; |
|
135 | + $head[$h][1] = $langs->trans("CommentLink"); |
|
136 | + if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
137 | + $head[$h][2] = 'project_comment'; |
|
138 | + $h++; |
|
139 | + } |
|
140 | + |
|
141 | + $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; |
|
142 | + $head[$h][1].= $langs->trans("Events"); |
|
143 | + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
144 | + { |
|
145 | + $head[$h][1].= '/'; |
|
146 | + $head[$h][1].= $langs->trans("Agenda"); |
|
147 | + } |
|
148 | + $head[$h][2] = 'agenda'; |
|
149 | + $h++; |
|
150 | + |
|
151 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove'); |
|
152 | + |
|
153 | + return $head; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,86 +162,86 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function task_prepare_head($object) |
164 | 164 | { |
165 | - global $db, $langs, $conf, $user; |
|
166 | - $h = 0; |
|
167 | - $head = array(); |
|
168 | - |
|
169 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
170 | - $head[$h][1] = $langs->trans("Card"); |
|
171 | - $head[$h][2] = 'task_task'; |
|
172 | - $h++; |
|
173 | - |
|
174 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
175 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
176 | - $head[$h][1] = $langs->trans("TaskRessourceLinks"); |
|
177 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
178 | - $head[$h][2] = 'task_contact'; |
|
179 | - $h++; |
|
180 | - |
|
181 | - // Is there timespent ? |
|
182 | - $nbTimeSpent=0; |
|
183 | - $sql = "SELECT t.rowid"; |
|
184 | - //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
|
185 | - //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
|
186 | - $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; |
|
187 | - $sql .= " WHERE t.fk_task =".$object->id; |
|
188 | - $resql = $db->query($sql); |
|
189 | - if ($resql) |
|
190 | - { |
|
191 | - $obj = $db->fetch_object($resql); |
|
192 | - if ($obj) $nbTimeSpent=1; |
|
193 | - } |
|
194 | - else dol_print_error($db); |
|
195 | - |
|
196 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
197 | - $head[$h][1] = $langs->trans("TimeSpent"); |
|
198 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
199 | - $head[$h][2] = 'task_time'; |
|
200 | - $h++; |
|
201 | - |
|
202 | - // Show more tabs from modules |
|
203 | - // Entries must be declared in modules descriptor with line |
|
204 | - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
205 | - // $this->tabs = array('entity:-tabname); to remove a tab |
|
206 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); |
|
207 | - |
|
208 | - if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
|
209 | - { |
|
210 | - $nbNote = 0; |
|
211 | - if(!empty($object->note_private)) $nbNote++; |
|
212 | - if(!empty($object->note_public)) $nbNote++; |
|
213 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
214 | - $head[$h][1] = $langs->trans('Notes'); |
|
215 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
216 | - $head[$h][2] = 'task_notes'; |
|
217 | - $h++; |
|
218 | - } |
|
219 | - |
|
220 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
221 | - $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); |
|
222 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
223 | - include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
224 | - $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
225 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
226 | - $head[$h][1] = $langs->trans('Documents'); |
|
227 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
228 | - $head[$h][2] = 'task_document'; |
|
229 | - $h++; |
|
230 | - |
|
231 | - // Manage discussion |
|
232 | - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) |
|
233 | - { |
|
234 | - $nbComments = $object->getNbComments(); |
|
235 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
236 | - $head[$h][1] = $langs->trans("CommentLink"); |
|
237 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
238 | - $head[$h][2] = 'task_comment'; |
|
239 | - $h++; |
|
240 | - } |
|
241 | - |
|
242 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove'); |
|
243 | - |
|
244 | - return $head; |
|
165 | + global $db, $langs, $conf, $user; |
|
166 | + $h = 0; |
|
167 | + $head = array(); |
|
168 | + |
|
169 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
170 | + $head[$h][1] = $langs->trans("Card"); |
|
171 | + $head[$h][2] = 'task_task'; |
|
172 | + $h++; |
|
173 | + |
|
174 | + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
175 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
176 | + $head[$h][1] = $langs->trans("TaskRessourceLinks"); |
|
177 | + if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
178 | + $head[$h][2] = 'task_contact'; |
|
179 | + $h++; |
|
180 | + |
|
181 | + // Is there timespent ? |
|
182 | + $nbTimeSpent=0; |
|
183 | + $sql = "SELECT t.rowid"; |
|
184 | + //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
|
185 | + //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
|
186 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; |
|
187 | + $sql .= " WHERE t.fk_task =".$object->id; |
|
188 | + $resql = $db->query($sql); |
|
189 | + if ($resql) |
|
190 | + { |
|
191 | + $obj = $db->fetch_object($resql); |
|
192 | + if ($obj) $nbTimeSpent=1; |
|
193 | + } |
|
194 | + else dol_print_error($db); |
|
195 | + |
|
196 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
197 | + $head[$h][1] = $langs->trans("TimeSpent"); |
|
198 | + if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
199 | + $head[$h][2] = 'task_time'; |
|
200 | + $h++; |
|
201 | + |
|
202 | + // Show more tabs from modules |
|
203 | + // Entries must be declared in modules descriptor with line |
|
204 | + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
|
205 | + // $this->tabs = array('entity:-tabname); to remove a tab |
|
206 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); |
|
207 | + |
|
208 | + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
|
209 | + { |
|
210 | + $nbNote = 0; |
|
211 | + if(!empty($object->note_private)) $nbNote++; |
|
212 | + if(!empty($object->note_public)) $nbNote++; |
|
213 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
214 | + $head[$h][1] = $langs->trans('Notes'); |
|
215 | + if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
216 | + $head[$h][2] = 'task_notes'; |
|
217 | + $h++; |
|
218 | + } |
|
219 | + |
|
220 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
221 | + $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); |
|
222 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
223 | + include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
224 | + $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
225 | + $nbLinks=Link::count($db, $object->element, $object->id); |
|
226 | + $head[$h][1] = $langs->trans('Documents'); |
|
227 | + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
228 | + $head[$h][2] = 'task_document'; |
|
229 | + $h++; |
|
230 | + |
|
231 | + // Manage discussion |
|
232 | + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) |
|
233 | + { |
|
234 | + $nbComments = $object->getNbComments(); |
|
235 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
236 | + $head[$h][1] = $langs->trans("CommentLink"); |
|
237 | + if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
238 | + $head[$h][2] = 'task_comment'; |
|
239 | + $h++; |
|
240 | + } |
|
241 | + |
|
242 | + complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove'); |
|
243 | + |
|
244 | + return $head; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -253,33 +253,33 @@ discard block |
||
253 | 253 | */ |
254 | 254 | function project_timesheet_prepare_head($mode, $fuser=null) |
255 | 255 | { |
256 | - global $langs, $conf, $user; |
|
257 | - $h = 0; |
|
258 | - $head = array(); |
|
259 | - |
|
260 | - $h = 0; |
|
261 | - |
|
262 | - $param=''; |
|
263 | - $param.=($mode?'&mode='.$mode:''); |
|
264 | - if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id; |
|
265 | - |
|
266 | - if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) |
|
267 | - { |
|
268 | - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:''); |
|
269 | - $head[$h][1] = $langs->trans("InputPerWeek"); |
|
270 | - $head[$h][2] = 'inputperweek'; |
|
271 | - $h++; |
|
272 | - } |
|
273 | - |
|
274 | - if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) |
|
275 | - { |
|
276 | - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:''); |
|
277 | - $head[$h][1] = $langs->trans("InputPerDay"); |
|
278 | - $head[$h][2] = 'inputperday'; |
|
279 | - $h++; |
|
280 | - } |
|
281 | - |
|
282 | - /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) |
|
256 | + global $langs, $conf, $user; |
|
257 | + $h = 0; |
|
258 | + $head = array(); |
|
259 | + |
|
260 | + $h = 0; |
|
261 | + |
|
262 | + $param=''; |
|
263 | + $param.=($mode?'&mode='.$mode:''); |
|
264 | + if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id; |
|
265 | + |
|
266 | + if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) |
|
267 | + { |
|
268 | + $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:''); |
|
269 | + $head[$h][1] = $langs->trans("InputPerWeek"); |
|
270 | + $head[$h][2] = 'inputperweek'; |
|
271 | + $h++; |
|
272 | + } |
|
273 | + |
|
274 | + if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) |
|
275 | + { |
|
276 | + $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:''); |
|
277 | + $head[$h][1] = $langs->trans("InputPerDay"); |
|
278 | + $head[$h][2] = 'inputperday'; |
|
279 | + $h++; |
|
280 | + } |
|
281 | + |
|
282 | + /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) |
|
283 | 283 | { |
284 | 284 | $head[$h][0] = DOL_URL_ROOT."/projet/activity/perline.php".($param?'?'.$param:''); |
285 | 285 | $head[$h][1] = $langs->trans("InputDetail"); |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | $h++; |
288 | 288 | }*/ |
289 | 289 | |
290 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet'); |
|
290 | + complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet'); |
|
291 | 291 | |
292 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet','remove'); |
|
292 | + complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet','remove'); |
|
293 | 293 | |
294 | - return $head; |
|
294 | + return $head; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -302,32 +302,32 @@ discard block |
||
302 | 302 | */ |
303 | 303 | function project_admin_prepare_head() |
304 | 304 | { |
305 | - global $langs, $conf, $user; |
|
306 | - $h = 0; |
|
307 | - $head = array(); |
|
305 | + global $langs, $conf, $user; |
|
306 | + $h = 0; |
|
307 | + $head = array(); |
|
308 | 308 | |
309 | - $h = 0; |
|
309 | + $h = 0; |
|
310 | 310 | |
311 | - $head[$h][0] = DOL_URL_ROOT."/projet/admin/project.php"; |
|
312 | - $head[$h][1] = $langs->trans("Projects"); |
|
313 | - $head[$h][2] = 'project'; |
|
314 | - $h++; |
|
311 | + $head[$h][0] = DOL_URL_ROOT."/projet/admin/project.php"; |
|
312 | + $head[$h][1] = $langs->trans("Projects"); |
|
313 | + $head[$h][2] = 'project'; |
|
314 | + $h++; |
|
315 | 315 | |
316 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin'); |
|
316 | + complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin'); |
|
317 | 317 | |
318 | - $head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php"; |
|
319 | - $head[$h][1] = $langs->trans("ExtraFieldsProject"); |
|
320 | - $head[$h][2] = 'attributes'; |
|
321 | - $h++; |
|
318 | + $head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php"; |
|
319 | + $head[$h][1] = $langs->trans("ExtraFieldsProject"); |
|
320 | + $head[$h][2] = 'attributes'; |
|
321 | + $h++; |
|
322 | 322 | |
323 | - $head[$h][0] = DOL_URL_ROOT.'/projet/admin/project_task_extrafields.php'; |
|
324 | - $head[$h][1] = $langs->trans("ExtraFieldsProjectTask"); |
|
325 | - $head[$h][2] = 'attributes_task'; |
|
326 | - $h++; |
|
323 | + $head[$h][0] = DOL_URL_ROOT.'/projet/admin/project_task_extrafields.php'; |
|
324 | + $head[$h][1] = $langs->trans("ExtraFieldsProjectTask"); |
|
325 | + $head[$h][2] = 'attributes_task'; |
|
326 | + $h++; |
|
327 | 327 | |
328 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin','remove'); |
|
328 | + complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin','remove'); |
|
329 | 329 | |
330 | - return $head; |
|
330 | + return $head; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -349,284 +349,284 @@ discard block |
||
349 | 349 | */ |
350 | 350 | function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0, $filterprogresscalc='') |
351 | 351 | { |
352 | - global $user, $bc, $langs, $conf, $db; |
|
353 | - global $projectstatic, $taskstatic; |
|
354 | - |
|
355 | - $lastprojectid=0; |
|
356 | - |
|
357 | - $projectsArrayId=explode(',',$projectsListId); |
|
358 | - if ($filterprogresscalc!=='') { |
|
359 | - foreach ($lines as $key=>$line) { |
|
360 | - if (!empty($line->planned_workload) && !empty($line->duration)) { |
|
361 | - $filterprogresscalc = str_replace(' = ', ' == ', $filterprogresscalc); |
|
362 | - if (!eval($filterprogresscalc)) { |
|
363 | - unset($lines[$key]); |
|
364 | - } |
|
365 | - } |
|
366 | - } |
|
367 | - $lines=array_values($lines); |
|
368 | - } |
|
369 | - |
|
370 | - $numlines=count($lines); |
|
371 | - |
|
372 | - // We declare counter as global because we want to edit them into recursive call |
|
373 | - global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; |
|
374 | - if ($level == 0) |
|
375 | - { |
|
376 | - $total_projectlinesa_spent=0; |
|
377 | - $total_projectlinesa_planned=0; |
|
378 | - $total_projectlinesa_spent_if_planned=0; |
|
379 | - } |
|
380 | - |
|
381 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
382 | - { |
|
383 | - if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
384 | - |
|
385 | - // Process line |
|
386 | - // print "i:".$i."-".$lines[$i]->fk_project.'<br>'; |
|
387 | - |
|
388 | - if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
389 | - { |
|
390 | - // Show task line. |
|
391 | - $showline=1; |
|
392 | - $showlineingray=0; |
|
393 | - |
|
394 | - // If there is filters to use |
|
395 | - if (is_array($taskrole)) |
|
396 | - { |
|
397 | - // If task not legitimate to show, search if a legitimate task exists later in tree |
|
398 | - if (! isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) |
|
399 | - { |
|
400 | - // So search if task has a subtask legitimate to show |
|
401 | - $foundtaskforuserdeeper=0; |
|
402 | - searchTaskInChild($foundtaskforuserdeeper,$lines[$i]->id,$lines,$taskrole); |
|
403 | - //print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.'<br>'; |
|
404 | - if ($foundtaskforuserdeeper > 0) |
|
405 | - { |
|
406 | - $showlineingray=1; // We will show line but in gray |
|
407 | - } |
|
408 | - else |
|
409 | - { |
|
410 | - $showline=0; // No reason to show line |
|
411 | - } |
|
412 | - } |
|
413 | - } |
|
414 | - else |
|
415 | - { |
|
416 | - // Caller did not ask to filter on tasks of a specific user (this probably means he want also tasks of all users, into public project |
|
417 | - // or into all other projects if user has permission to). |
|
418 | - if (empty($user->rights->projet->all->lire)) |
|
419 | - { |
|
420 | - // User is not allowed on this project and project is not public, so we hide line |
|
421 | - if (! in_array($lines[$i]->fk_project, $projectsArrayId)) |
|
422 | - { |
|
423 | - // Note that having a user assigned to a task into a project user has no permission on, should not be possible |
|
424 | - // because assignement on task can be done only on contact of project. |
|
425 | - // If assignement was done and after, was removed from contact of project, then we can hide the line. |
|
426 | - $showline=0; |
|
427 | - } |
|
428 | - } |
|
429 | - } |
|
430 | - |
|
431 | - if ($showline) |
|
432 | - { |
|
433 | - // Break on a new project |
|
434 | - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
435 | - { |
|
436 | - $var = !$var; |
|
437 | - $lastprojectid=$lines[$i]->fk_project; |
|
438 | - } |
|
439 | - |
|
440 | - print '<tr '.$bc[$var].' id="row-'.$lines[$i]->id.'">'."\n"; |
|
441 | - |
|
442 | - if ($showproject) |
|
443 | - { |
|
444 | - // Project ref |
|
445 | - print "<td>"; |
|
446 | - //if ($showlineingray) print '<i>'; |
|
447 | - $projectstatic->id=$lines[$i]->fk_project; |
|
448 | - $projectstatic->ref=$lines[$i]->projectref; |
|
449 | - $projectstatic->public=$lines[$i]->public; |
|
450 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
451 | - if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | - else print $projectstatic->getNomUrl(1,'nolink'); |
|
453 | - //if ($showlineingray) print '</i>'; |
|
454 | - print "</td>"; |
|
455 | - |
|
456 | - // Project status |
|
457 | - print '<td>'; |
|
458 | - $projectstatic->statut=$lines[$i]->projectstatus; |
|
459 | - print $projectstatic->getLibStatut(2); |
|
460 | - print "</td>"; |
|
461 | - } |
|
462 | - |
|
463 | - // Ref of task |
|
464 | - print '<td>'; |
|
465 | - if ($showlineingray) |
|
466 | - { |
|
467 | - print '<i>'.img_object('','projecttask').' '.$lines[$i]->ref.'</i>'; |
|
468 | - } |
|
469 | - else |
|
470 | - { |
|
471 | - $taskstatic->id=$lines[$i]->id; |
|
472 | - $taskstatic->ref=$lines[$i]->ref; |
|
473 | - $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); |
|
474 | - print $taskstatic->getNomUrl(1,'withproject'); |
|
475 | - } |
|
476 | - print '</td>'; |
|
477 | - |
|
478 | - // Title of task |
|
479 | - print "<td>"; |
|
480 | - if ($showlineingray) print '<i>'; |
|
481 | - //else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">'; |
|
482 | - for ($k = 0 ; $k < $level ; $k++) |
|
483 | - { |
|
484 | - print " "; |
|
485 | - } |
|
486 | - print $lines[$i]->label; |
|
487 | - if ($showlineingray) print '</i>'; |
|
488 | - //else print '</a>'; |
|
489 | - print "</td>\n"; |
|
490 | - |
|
491 | - // Date start |
|
492 | - print '<td align="center">'; |
|
493 | - print dol_print_date($lines[$i]->date_start,'dayhour'); |
|
494 | - print '</td>'; |
|
495 | - |
|
496 | - // Date end |
|
497 | - print '<td align="center">'; |
|
498 | - $taskstatic->projectstatus = $lines[$i]->projectstatus; |
|
499 | - $taskstatic->progress = $lines[$i]->progress; |
|
500 | - $taskstatic->fk_statut = $lines[$i]->status; |
|
501 | - $taskstatic->datee = $lines[$i]->date_end; |
|
502 | - print dol_print_date($lines[$i]->date_end,'dayhour'); |
|
503 | - if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); |
|
504 | - print '</td>'; |
|
505 | - |
|
506 | - $plannedworkloadoutputformat='allhourmin'; |
|
507 | - $timespentoutputformat='allhourmin'; |
|
508 | - if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | - if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
510 | - |
|
511 | - // Planned Workload (in working hours) |
|
512 | - print '<td align="right">'; |
|
513 | - $fullhour=convertSecondToTime($lines[$i]->planned_workload,$plannedworkloadoutputformat); |
|
514 | - $workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
515 | - if ($lines[$i]->planned_workload != '') |
|
516 | - { |
|
517 | - print $fullhour; |
|
518 | - // TODO Add delay taking account of working hours per day and working day per week |
|
519 | - //if ($workingdelay != $fullhour) print '<br>('.$workingdelay.')'; |
|
520 | - } |
|
521 | - //else print '--:--'; |
|
522 | - print '</td>'; |
|
523 | - |
|
524 | - // Time spent |
|
525 | - print '<td align="right">'; |
|
526 | - if ($showlineingray) print '<i>'; |
|
527 | - else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; |
|
528 | - if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,$timespentoutputformat); |
|
529 | - else print '--:--'; |
|
530 | - if ($showlineingray) print '</i>'; |
|
531 | - else print '</a>'; |
|
532 | - print '</td>'; |
|
533 | - |
|
534 | - // Progress calculated (Note: ->duration is time spent) |
|
535 | - print '<td align="right">'; |
|
536 | - if ($lines[$i]->planned_workload || $lines[$i]->duration) |
|
537 | - { |
|
538 | - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; |
|
539 | - else print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>'; |
|
540 | - } |
|
541 | - print '</td>'; |
|
542 | - |
|
543 | - // Progress declared |
|
544 | - print '<td align="right">'; |
|
545 | - if ($lines[$i]->progress != '') |
|
546 | - { |
|
547 | - print $lines[$i]->progress.' %'; |
|
548 | - } |
|
549 | - print '</td>'; |
|
550 | - |
|
551 | - // Contacts of task |
|
552 | - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
553 | - { |
|
554 | - print '<td>'; |
|
555 | - foreach(array('internal','external') as $source) |
|
556 | - { |
|
557 | - $tab = $lines[$i]->liste_contact(-1,$source); |
|
558 | - $num=count($tab); |
|
559 | - if (!empty($num)){ |
|
560 | - foreach ($tab as $contacttask){ |
|
561 | - //var_dump($contacttask); |
|
562 | - if ($source == 'internal') $c = new User($db); |
|
563 | - else $c = new Contact($db); |
|
564 | - $c->fetch($contacttask['id']); |
|
565 | - print $c->getNomUrl(1) . ' (' . $contacttask['libelle'] . ')' . '<br>'; |
|
566 | - } |
|
567 | - } |
|
568 | - } |
|
569 | - print '</td>'; |
|
570 | - } |
|
571 | - |
|
572 | - // Tick to drag and drop |
|
573 | - if ($addordertick) |
|
574 | - { |
|
575 | - print '<td align="center" class="tdlineupdown hideonsmartphone"> </td>'; |
|
576 | - } |
|
577 | - |
|
578 | - print "</tr>\n"; |
|
579 | - |
|
580 | - if (! $showlineingray) $inc++; |
|
581 | - |
|
582 | - if ($level >= 0) // Call sublevels |
|
583 | - { |
|
584 | - $level++; |
|
585 | - if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); |
|
586 | - $level--; |
|
587 | - } |
|
588 | - |
|
589 | - $total_projectlinesa_spent += $lines[$i]->duration; |
|
590 | - $total_projectlinesa_planned += $lines[$i]->planned_workload; |
|
591 | - if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; |
|
592 | - } |
|
593 | - } |
|
594 | - else |
|
595 | - { |
|
596 | - //$level--; |
|
597 | - } |
|
598 | - } |
|
599 | - |
|
600 | - if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level <= 0) |
|
601 | - { |
|
602 | - print '<tr class="liste_total nodrag nodrop">'; |
|
603 | - print '<td class="liste_total">'.$langs->trans("Total").'</td>'; |
|
604 | - if ($showproject) print '<td></td><td></td>'; |
|
605 | - print '<td></td>'; |
|
606 | - print '<td></td>'; |
|
607 | - print '<td></td>'; |
|
608 | - print '<td align="right" class="nowrap liste_total">'; |
|
609 | - print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); |
|
610 | - print '</td>'; |
|
611 | - print '<td align="right" class="nowrap liste_total">'; |
|
612 | - if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">'; |
|
613 | - print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); |
|
614 | - if ($projectidfortotallink > 0) print '</a>'; |
|
615 | - print '</td>'; |
|
616 | - print '<td align="right" class="nowrap liste_total">'; |
|
617 | - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; |
|
618 | - print '</td>'; |
|
619 | - print '<td></td>'; |
|
620 | - // Contacts of task |
|
621 | - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
622 | - { |
|
623 | - print '<td></td>'; |
|
624 | - } |
|
625 | - if ($addordertick) print '<td class="hideonsmartphone"></td>'; |
|
626 | - print '</tr>'; |
|
627 | - } |
|
628 | - |
|
629 | - return $inc; |
|
352 | + global $user, $bc, $langs, $conf, $db; |
|
353 | + global $projectstatic, $taskstatic; |
|
354 | + |
|
355 | + $lastprojectid=0; |
|
356 | + |
|
357 | + $projectsArrayId=explode(',',$projectsListId); |
|
358 | + if ($filterprogresscalc!=='') { |
|
359 | + foreach ($lines as $key=>$line) { |
|
360 | + if (!empty($line->planned_workload) && !empty($line->duration)) { |
|
361 | + $filterprogresscalc = str_replace(' = ', ' == ', $filterprogresscalc); |
|
362 | + if (!eval($filterprogresscalc)) { |
|
363 | + unset($lines[$key]); |
|
364 | + } |
|
365 | + } |
|
366 | + } |
|
367 | + $lines=array_values($lines); |
|
368 | + } |
|
369 | + |
|
370 | + $numlines=count($lines); |
|
371 | + |
|
372 | + // We declare counter as global because we want to edit them into recursive call |
|
373 | + global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; |
|
374 | + if ($level == 0) |
|
375 | + { |
|
376 | + $total_projectlinesa_spent=0; |
|
377 | + $total_projectlinesa_planned=0; |
|
378 | + $total_projectlinesa_spent_if_planned=0; |
|
379 | + } |
|
380 | + |
|
381 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
382 | + { |
|
383 | + if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
384 | + |
|
385 | + // Process line |
|
386 | + // print "i:".$i."-".$lines[$i]->fk_project.'<br>'; |
|
387 | + |
|
388 | + if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
389 | + { |
|
390 | + // Show task line. |
|
391 | + $showline=1; |
|
392 | + $showlineingray=0; |
|
393 | + |
|
394 | + // If there is filters to use |
|
395 | + if (is_array($taskrole)) |
|
396 | + { |
|
397 | + // If task not legitimate to show, search if a legitimate task exists later in tree |
|
398 | + if (! isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) |
|
399 | + { |
|
400 | + // So search if task has a subtask legitimate to show |
|
401 | + $foundtaskforuserdeeper=0; |
|
402 | + searchTaskInChild($foundtaskforuserdeeper,$lines[$i]->id,$lines,$taskrole); |
|
403 | + //print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.'<br>'; |
|
404 | + if ($foundtaskforuserdeeper > 0) |
|
405 | + { |
|
406 | + $showlineingray=1; // We will show line but in gray |
|
407 | + } |
|
408 | + else |
|
409 | + { |
|
410 | + $showline=0; // No reason to show line |
|
411 | + } |
|
412 | + } |
|
413 | + } |
|
414 | + else |
|
415 | + { |
|
416 | + // Caller did not ask to filter on tasks of a specific user (this probably means he want also tasks of all users, into public project |
|
417 | + // or into all other projects if user has permission to). |
|
418 | + if (empty($user->rights->projet->all->lire)) |
|
419 | + { |
|
420 | + // User is not allowed on this project and project is not public, so we hide line |
|
421 | + if (! in_array($lines[$i]->fk_project, $projectsArrayId)) |
|
422 | + { |
|
423 | + // Note that having a user assigned to a task into a project user has no permission on, should not be possible |
|
424 | + // because assignement on task can be done only on contact of project. |
|
425 | + // If assignement was done and after, was removed from contact of project, then we can hide the line. |
|
426 | + $showline=0; |
|
427 | + } |
|
428 | + } |
|
429 | + } |
|
430 | + |
|
431 | + if ($showline) |
|
432 | + { |
|
433 | + // Break on a new project |
|
434 | + if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
435 | + { |
|
436 | + $var = !$var; |
|
437 | + $lastprojectid=$lines[$i]->fk_project; |
|
438 | + } |
|
439 | + |
|
440 | + print '<tr '.$bc[$var].' id="row-'.$lines[$i]->id.'">'."\n"; |
|
441 | + |
|
442 | + if ($showproject) |
|
443 | + { |
|
444 | + // Project ref |
|
445 | + print "<td>"; |
|
446 | + //if ($showlineingray) print '<i>'; |
|
447 | + $projectstatic->id=$lines[$i]->fk_project; |
|
448 | + $projectstatic->ref=$lines[$i]->projectref; |
|
449 | + $projectstatic->public=$lines[$i]->public; |
|
450 | + $projectstatic->title=$lines[$i]->projectlabel; |
|
451 | + if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | + else print $projectstatic->getNomUrl(1,'nolink'); |
|
453 | + //if ($showlineingray) print '</i>'; |
|
454 | + print "</td>"; |
|
455 | + |
|
456 | + // Project status |
|
457 | + print '<td>'; |
|
458 | + $projectstatic->statut=$lines[$i]->projectstatus; |
|
459 | + print $projectstatic->getLibStatut(2); |
|
460 | + print "</td>"; |
|
461 | + } |
|
462 | + |
|
463 | + // Ref of task |
|
464 | + print '<td>'; |
|
465 | + if ($showlineingray) |
|
466 | + { |
|
467 | + print '<i>'.img_object('','projecttask').' '.$lines[$i]->ref.'</i>'; |
|
468 | + } |
|
469 | + else |
|
470 | + { |
|
471 | + $taskstatic->id=$lines[$i]->id; |
|
472 | + $taskstatic->ref=$lines[$i]->ref; |
|
473 | + $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); |
|
474 | + print $taskstatic->getNomUrl(1,'withproject'); |
|
475 | + } |
|
476 | + print '</td>'; |
|
477 | + |
|
478 | + // Title of task |
|
479 | + print "<td>"; |
|
480 | + if ($showlineingray) print '<i>'; |
|
481 | + //else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">'; |
|
482 | + for ($k = 0 ; $k < $level ; $k++) |
|
483 | + { |
|
484 | + print " "; |
|
485 | + } |
|
486 | + print $lines[$i]->label; |
|
487 | + if ($showlineingray) print '</i>'; |
|
488 | + //else print '</a>'; |
|
489 | + print "</td>\n"; |
|
490 | + |
|
491 | + // Date start |
|
492 | + print '<td align="center">'; |
|
493 | + print dol_print_date($lines[$i]->date_start,'dayhour'); |
|
494 | + print '</td>'; |
|
495 | + |
|
496 | + // Date end |
|
497 | + print '<td align="center">'; |
|
498 | + $taskstatic->projectstatus = $lines[$i]->projectstatus; |
|
499 | + $taskstatic->progress = $lines[$i]->progress; |
|
500 | + $taskstatic->fk_statut = $lines[$i]->status; |
|
501 | + $taskstatic->datee = $lines[$i]->date_end; |
|
502 | + print dol_print_date($lines[$i]->date_end,'dayhour'); |
|
503 | + if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); |
|
504 | + print '</td>'; |
|
505 | + |
|
506 | + $plannedworkloadoutputformat='allhourmin'; |
|
507 | + $timespentoutputformat='allhourmin'; |
|
508 | + if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | + if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
510 | + |
|
511 | + // Planned Workload (in working hours) |
|
512 | + print '<td align="right">'; |
|
513 | + $fullhour=convertSecondToTime($lines[$i]->planned_workload,$plannedworkloadoutputformat); |
|
514 | + $workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
515 | + if ($lines[$i]->planned_workload != '') |
|
516 | + { |
|
517 | + print $fullhour; |
|
518 | + // TODO Add delay taking account of working hours per day and working day per week |
|
519 | + //if ($workingdelay != $fullhour) print '<br>('.$workingdelay.')'; |
|
520 | + } |
|
521 | + //else print '--:--'; |
|
522 | + print '</td>'; |
|
523 | + |
|
524 | + // Time spent |
|
525 | + print '<td align="right">'; |
|
526 | + if ($showlineingray) print '<i>'; |
|
527 | + else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; |
|
528 | + if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,$timespentoutputformat); |
|
529 | + else print '--:--'; |
|
530 | + if ($showlineingray) print '</i>'; |
|
531 | + else print '</a>'; |
|
532 | + print '</td>'; |
|
533 | + |
|
534 | + // Progress calculated (Note: ->duration is time spent) |
|
535 | + print '<td align="right">'; |
|
536 | + if ($lines[$i]->planned_workload || $lines[$i]->duration) |
|
537 | + { |
|
538 | + if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; |
|
539 | + else print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>'; |
|
540 | + } |
|
541 | + print '</td>'; |
|
542 | + |
|
543 | + // Progress declared |
|
544 | + print '<td align="right">'; |
|
545 | + if ($lines[$i]->progress != '') |
|
546 | + { |
|
547 | + print $lines[$i]->progress.' %'; |
|
548 | + } |
|
549 | + print '</td>'; |
|
550 | + |
|
551 | + // Contacts of task |
|
552 | + if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
553 | + { |
|
554 | + print '<td>'; |
|
555 | + foreach(array('internal','external') as $source) |
|
556 | + { |
|
557 | + $tab = $lines[$i]->liste_contact(-1,$source); |
|
558 | + $num=count($tab); |
|
559 | + if (!empty($num)){ |
|
560 | + foreach ($tab as $contacttask){ |
|
561 | + //var_dump($contacttask); |
|
562 | + if ($source == 'internal') $c = new User($db); |
|
563 | + else $c = new Contact($db); |
|
564 | + $c->fetch($contacttask['id']); |
|
565 | + print $c->getNomUrl(1) . ' (' . $contacttask['libelle'] . ')' . '<br>'; |
|
566 | + } |
|
567 | + } |
|
568 | + } |
|
569 | + print '</td>'; |
|
570 | + } |
|
571 | + |
|
572 | + // Tick to drag and drop |
|
573 | + if ($addordertick) |
|
574 | + { |
|
575 | + print '<td align="center" class="tdlineupdown hideonsmartphone"> </td>'; |
|
576 | + } |
|
577 | + |
|
578 | + print "</tr>\n"; |
|
579 | + |
|
580 | + if (! $showlineingray) $inc++; |
|
581 | + |
|
582 | + if ($level >= 0) // Call sublevels |
|
583 | + { |
|
584 | + $level++; |
|
585 | + if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); |
|
586 | + $level--; |
|
587 | + } |
|
588 | + |
|
589 | + $total_projectlinesa_spent += $lines[$i]->duration; |
|
590 | + $total_projectlinesa_planned += $lines[$i]->planned_workload; |
|
591 | + if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; |
|
592 | + } |
|
593 | + } |
|
594 | + else |
|
595 | + { |
|
596 | + //$level--; |
|
597 | + } |
|
598 | + } |
|
599 | + |
|
600 | + if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level <= 0) |
|
601 | + { |
|
602 | + print '<tr class="liste_total nodrag nodrop">'; |
|
603 | + print '<td class="liste_total">'.$langs->trans("Total").'</td>'; |
|
604 | + if ($showproject) print '<td></td><td></td>'; |
|
605 | + print '<td></td>'; |
|
606 | + print '<td></td>'; |
|
607 | + print '<td></td>'; |
|
608 | + print '<td align="right" class="nowrap liste_total">'; |
|
609 | + print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); |
|
610 | + print '</td>'; |
|
611 | + print '<td align="right" class="nowrap liste_total">'; |
|
612 | + if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">'; |
|
613 | + print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); |
|
614 | + if ($projectidfortotallink > 0) print '</a>'; |
|
615 | + print '</td>'; |
|
616 | + print '<td align="right" class="nowrap liste_total">'; |
|
617 | + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; |
|
618 | + print '</td>'; |
|
619 | + print '<td></td>'; |
|
620 | + // Contacts of task |
|
621 | + if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
622 | + { |
|
623 | + print '<td></td>'; |
|
624 | + } |
|
625 | + if ($addordertick) print '<td class="hideonsmartphone"></td>'; |
|
626 | + print '</tr>'; |
|
627 | + } |
|
628 | + |
|
629 | + return $inc; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | |
@@ -649,191 +649,191 @@ discard block |
||
649 | 649 | */ |
650 | 650 | function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0) |
651 | 651 | { |
652 | - global $conf, $db, $user, $bc, $langs; |
|
653 | - global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
|
654 | - |
|
655 | - $lastprojectid=0; |
|
656 | - $totalforeachline=array(); |
|
657 | - $workloadforid=array(); |
|
658 | - $lineswithoutlevel0=array(); |
|
659 | - |
|
660 | - $numlines=count($lines); |
|
661 | - |
|
662 | - // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
|
663 | - if ($parent == 0) // Always and only if at first level |
|
664 | - { |
|
665 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
666 | - { |
|
667 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
668 | - } |
|
669 | - } |
|
670 | - |
|
671 | - if (empty($oldprojectforbreak)) |
|
672 | - { |
|
673 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
674 | - } |
|
675 | - |
|
676 | - //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
|
677 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
678 | - { |
|
679 | - if ($parent == 0) $level = 0; |
|
680 | - |
|
681 | - //if ($lines[$i]->fk_task_parent == $parent) |
|
682 | - //{ |
|
683 | - // If we want all or we have a role on task, we show it |
|
684 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
685 | - { |
|
686 | - //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
|
687 | - |
|
688 | - // Break on a new project |
|
689 | - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
690 | - { |
|
691 | - $lastprojectid=$lines[$i]->fk_project; |
|
692 | - if ($preselectedday) |
|
693 | - { |
|
694 | - $projectstatic->id = $lines[$i]->fk_project; |
|
695 | - } |
|
696 | - } |
|
697 | - |
|
698 | - if (empty($workloadforid[$projectstatic->id])) |
|
699 | - { |
|
700 | - if ($preselectedday) |
|
701 | - { |
|
702 | - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
703 | - $workloadforid[$projectstatic->id]=1; |
|
704 | - } |
|
705 | - } |
|
706 | - |
|
707 | - $projectstatic->id=$lines[$i]->fk_project; |
|
708 | - $projectstatic->ref=$lines[$i]->project_ref; |
|
709 | - $projectstatic->title=$lines[$i]->project_label; |
|
710 | - $projectstatic->public=$lines[$i]->public; |
|
711 | - |
|
712 | - $taskstatic->id=$lines[$i]->task_id; |
|
713 | - $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); |
|
714 | - $taskstatic->label=$lines[$i]->task_label; |
|
715 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
716 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
717 | - |
|
718 | - $thirdpartystatic->id=$lines[$i]->socid; |
|
719 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
720 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
721 | - |
|
722 | - if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
|
723 | - { |
|
724 | - print '<tr class="oddeven trforbreak">'."\n"; |
|
725 | - print '<td colspan="11">'; |
|
726 | - print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
727 | - if ($projectstatic->title) |
|
728 | - { |
|
729 | - print ' - '; |
|
730 | - print $projectstatic->title; |
|
731 | - } |
|
732 | - print '</td>'; |
|
733 | - print '</tr>'; |
|
734 | - } |
|
735 | - |
|
736 | - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
737 | - |
|
738 | - print '<tr class="oddeven">'."\n"; |
|
739 | - |
|
740 | - // User |
|
741 | - /* |
|
652 | + global $conf, $db, $user, $bc, $langs; |
|
653 | + global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
|
654 | + |
|
655 | + $lastprojectid=0; |
|
656 | + $totalforeachline=array(); |
|
657 | + $workloadforid=array(); |
|
658 | + $lineswithoutlevel0=array(); |
|
659 | + |
|
660 | + $numlines=count($lines); |
|
661 | + |
|
662 | + // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
|
663 | + if ($parent == 0) // Always and only if at first level |
|
664 | + { |
|
665 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
666 | + { |
|
667 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
668 | + } |
|
669 | + } |
|
670 | + |
|
671 | + if (empty($oldprojectforbreak)) |
|
672 | + { |
|
673 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
674 | + } |
|
675 | + |
|
676 | + //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
|
677 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
678 | + { |
|
679 | + if ($parent == 0) $level = 0; |
|
680 | + |
|
681 | + //if ($lines[$i]->fk_task_parent == $parent) |
|
682 | + //{ |
|
683 | + // If we want all or we have a role on task, we show it |
|
684 | + if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
685 | + { |
|
686 | + //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
|
687 | + |
|
688 | + // Break on a new project |
|
689 | + if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
690 | + { |
|
691 | + $lastprojectid=$lines[$i]->fk_project; |
|
692 | + if ($preselectedday) |
|
693 | + { |
|
694 | + $projectstatic->id = $lines[$i]->fk_project; |
|
695 | + } |
|
696 | + } |
|
697 | + |
|
698 | + if (empty($workloadforid[$projectstatic->id])) |
|
699 | + { |
|
700 | + if ($preselectedday) |
|
701 | + { |
|
702 | + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
703 | + $workloadforid[$projectstatic->id]=1; |
|
704 | + } |
|
705 | + } |
|
706 | + |
|
707 | + $projectstatic->id=$lines[$i]->fk_project; |
|
708 | + $projectstatic->ref=$lines[$i]->project_ref; |
|
709 | + $projectstatic->title=$lines[$i]->project_label; |
|
710 | + $projectstatic->public=$lines[$i]->public; |
|
711 | + |
|
712 | + $taskstatic->id=$lines[$i]->task_id; |
|
713 | + $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); |
|
714 | + $taskstatic->label=$lines[$i]->task_label; |
|
715 | + $taskstatic->date_start=$lines[$i]->date_start; |
|
716 | + $taskstatic->date_end=$lines[$i]->date_end; |
|
717 | + |
|
718 | + $thirdpartystatic->id=$lines[$i]->socid; |
|
719 | + $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
720 | + $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
721 | + |
|
722 | + if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
|
723 | + { |
|
724 | + print '<tr class="oddeven trforbreak">'."\n"; |
|
725 | + print '<td colspan="11">'; |
|
726 | + print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
727 | + if ($projectstatic->title) |
|
728 | + { |
|
729 | + print ' - '; |
|
730 | + print $projectstatic->title; |
|
731 | + } |
|
732 | + print '</td>'; |
|
733 | + print '</tr>'; |
|
734 | + } |
|
735 | + |
|
736 | + if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
737 | + |
|
738 | + print '<tr class="oddeven">'."\n"; |
|
739 | + |
|
740 | + // User |
|
741 | + /* |
|
742 | 742 | print '<td class="nowrap">'; |
743 | 743 | print $fuser->getNomUrl(1, 'withproject', 'time'); |
744 | 744 | print '</td>'; |
745 | 745 | */ |
746 | 746 | |
747 | - // Project |
|
748 | - print "<td>"; |
|
749 | - if ($oldprojectforbreak == -1) |
|
750 | - { |
|
751 | - print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
752 | - print '<br>'.$projectstatic->title; |
|
753 | - } |
|
754 | - print "</td>"; |
|
755 | - |
|
756 | - // Thirdparty |
|
757 | - print '<td class="tdoverflowmax100">'; |
|
758 | - if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); |
|
759 | - print '</td>'; |
|
760 | - |
|
761 | - // Ref |
|
762 | - print '<td>'; |
|
763 | - print '<!-- Task id = '.$lines[$i]->id.' -->'; |
|
764 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
765 | - print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
|
766 | - // Label task |
|
767 | - print '<br>'; |
|
768 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
769 | - print $taskstatic->label; |
|
770 | - //print "<br>"; |
|
771 | - //for ($k = 0 ; $k < $level ; $k++) print " "; |
|
772 | - //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); |
|
773 | - print "</td>\n"; |
|
774 | - |
|
775 | - // Date |
|
776 | - print '<td align="center">'; |
|
777 | - print dol_print_date($lines[$i]->timespent_datehour,'day'); |
|
778 | - print '</td>'; |
|
779 | - |
|
780 | - $disabledproject=1;$disabledtask=1; |
|
781 | - //print "x".$lines[$i]->fk_project; |
|
782 | - //var_dump($lines[$i]); |
|
783 | - //var_dump($projectsrole[$lines[$i]->fk_project]); |
|
784 | - // If at least one role for project |
|
785 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
786 | - { |
|
787 | - $disabledproject=0; |
|
788 | - $disabledtask=0; |
|
789 | - } |
|
790 | - // If $restricteditformytask is on and I have no role on task, i disable edit |
|
791 | - if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
|
792 | - { |
|
793 | - $disabledtask=1; |
|
794 | - } |
|
795 | - |
|
796 | - // Hour |
|
797 | - print '<td class="nowrap" align="center">'; |
|
798 | - print dol_print_date($lines[$i]->timespent_datehour,'hour'); |
|
799 | - print '</td>'; |
|
800 | - |
|
801 | - $cssonholiday=''; |
|
802 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
803 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
804 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
805 | - |
|
806 | - // Duration |
|
807 | - print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">'; |
|
808 | - |
|
809 | - $dayWorkLoad = $lines[$i]->timespent_duration; |
|
810 | - $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; |
|
811 | - |
|
812 | - $alreadyspent=''; |
|
813 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
814 | - |
|
815 | - print convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
816 | - |
|
817 | - $modeinput='hours'; |
|
818 | - |
|
819 | - print '<script type="text/javascript">'; |
|
820 | - print "jQuery(document).ready(function () {\n"; |
|
821 | - print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });"; |
|
822 | - print "})\n"; |
|
823 | - print '</script>'; |
|
824 | - |
|
825 | - print '</td>'; |
|
826 | - |
|
827 | - // Note |
|
828 | - print '<td align="center">'; |
|
829 | - print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
830 | - print $lines[$i]->timespent_note; |
|
831 | - print '</textarea>'; |
|
832 | - print '</td>'; |
|
833 | - |
|
834 | - // Warning |
|
835 | - print '<td align="right">'; |
|
836 | - /*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
747 | + // Project |
|
748 | + print "<td>"; |
|
749 | + if ($oldprojectforbreak == -1) |
|
750 | + { |
|
751 | + print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
752 | + print '<br>'.$projectstatic->title; |
|
753 | + } |
|
754 | + print "</td>"; |
|
755 | + |
|
756 | + // Thirdparty |
|
757 | + print '<td class="tdoverflowmax100">'; |
|
758 | + if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); |
|
759 | + print '</td>'; |
|
760 | + |
|
761 | + // Ref |
|
762 | + print '<td>'; |
|
763 | + print '<!-- Task id = '.$lines[$i]->id.' -->'; |
|
764 | + for ($k = 0 ; $k < $level ; $k++) print " "; |
|
765 | + print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
|
766 | + // Label task |
|
767 | + print '<br>'; |
|
768 | + for ($k = 0 ; $k < $level ; $k++) print " "; |
|
769 | + print $taskstatic->label; |
|
770 | + //print "<br>"; |
|
771 | + //for ($k = 0 ; $k < $level ; $k++) print " "; |
|
772 | + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); |
|
773 | + print "</td>\n"; |
|
774 | + |
|
775 | + // Date |
|
776 | + print '<td align="center">'; |
|
777 | + print dol_print_date($lines[$i]->timespent_datehour,'day'); |
|
778 | + print '</td>'; |
|
779 | + |
|
780 | + $disabledproject=1;$disabledtask=1; |
|
781 | + //print "x".$lines[$i]->fk_project; |
|
782 | + //var_dump($lines[$i]); |
|
783 | + //var_dump($projectsrole[$lines[$i]->fk_project]); |
|
784 | + // If at least one role for project |
|
785 | + if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
786 | + { |
|
787 | + $disabledproject=0; |
|
788 | + $disabledtask=0; |
|
789 | + } |
|
790 | + // If $restricteditformytask is on and I have no role on task, i disable edit |
|
791 | + if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
|
792 | + { |
|
793 | + $disabledtask=1; |
|
794 | + } |
|
795 | + |
|
796 | + // Hour |
|
797 | + print '<td class="nowrap" align="center">'; |
|
798 | + print dol_print_date($lines[$i]->timespent_datehour,'hour'); |
|
799 | + print '</td>'; |
|
800 | + |
|
801 | + $cssonholiday=''; |
|
802 | + if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
803 | + elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
804 | + elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
805 | + |
|
806 | + // Duration |
|
807 | + print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">'; |
|
808 | + |
|
809 | + $dayWorkLoad = $lines[$i]->timespent_duration; |
|
810 | + $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; |
|
811 | + |
|
812 | + $alreadyspent=''; |
|
813 | + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
814 | + |
|
815 | + print convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
816 | + |
|
817 | + $modeinput='hours'; |
|
818 | + |
|
819 | + print '<script type="text/javascript">'; |
|
820 | + print "jQuery(document).ready(function () {\n"; |
|
821 | + print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });"; |
|
822 | + print "})\n"; |
|
823 | + print '</script>'; |
|
824 | + |
|
825 | + print '</td>'; |
|
826 | + |
|
827 | + // Note |
|
828 | + print '<td align="center">'; |
|
829 | + print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
830 | + print $lines[$i]->timespent_note; |
|
831 | + print '</textarea>'; |
|
832 | + print '</td>'; |
|
833 | + |
|
834 | + // Warning |
|
835 | + print '<td align="right">'; |
|
836 | + /*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
837 | 837 | else if ($disabledtask) |
838 | 838 | { |
839 | 839 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
@@ -841,18 +841,18 @@ discard block |
||
841 | 841 | |
842 | 842 | print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
843 | 843 | }*/ |
844 | - print '</td>'; |
|
845 | - |
|
846 | - print "</tr>\n"; |
|
847 | - } |
|
848 | - //} |
|
849 | - //else |
|
850 | - //{ |
|
851 | - //$level--; |
|
852 | - //} |
|
853 | - } |
|
854 | - |
|
855 | - return $totalforeachline; |
|
844 | + print '</td>'; |
|
845 | + |
|
846 | + print "</tr>\n"; |
|
847 | + } |
|
848 | + //} |
|
849 | + //else |
|
850 | + //{ |
|
851 | + //$level--; |
|
852 | + //} |
|
853 | + } |
|
854 | + |
|
855 | + return $totalforeachline; |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -875,273 +875,273 @@ discard block |
||
875 | 875 | */ |
876 | 876 | function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0) |
877 | 877 | { |
878 | - global $conf, $db, $user, $bc, $langs; |
|
879 | - global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
|
880 | - |
|
881 | - $lastprojectid=0; |
|
882 | - $totalforeachday=array(); |
|
883 | - $workloadforid=array(); |
|
884 | - $lineswithoutlevel0=array(); |
|
885 | - |
|
886 | - $numlines=count($lines); |
|
887 | - |
|
888 | - // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
|
889 | - if ($parent == 0) // Always and only if at first level |
|
890 | - { |
|
891 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
892 | - { |
|
893 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
894 | - } |
|
895 | - } |
|
896 | - |
|
897 | - if (empty($oldprojectforbreak)) |
|
898 | - { |
|
899 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
900 | - } |
|
901 | - |
|
902 | - //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
|
903 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
904 | - { |
|
905 | - if ($parent == 0) $level = 0; |
|
906 | - |
|
907 | - if ($lines[$i]->fk_task_parent == $parent) |
|
908 | - { |
|
909 | - // If we want all or we have a role on task, we show it |
|
910 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
911 | - { |
|
912 | - //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
|
913 | - |
|
914 | - if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases |
|
915 | - { |
|
916 | - continue; |
|
917 | - } |
|
918 | - |
|
919 | - // Break on a new project |
|
920 | - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
921 | - { |
|
922 | - $lastprojectid=$lines[$i]->fk_project; |
|
923 | - if ($preselectedday) |
|
924 | - { |
|
925 | - $projectstatic->id = $lines[$i]->fk_project; |
|
926 | - } |
|
927 | - } |
|
928 | - |
|
929 | - if (empty($workloadforid[$projectstatic->id])) |
|
930 | - { |
|
931 | - if ($preselectedday) |
|
932 | - { |
|
933 | - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
934 | - $workloadforid[$projectstatic->id]=1; |
|
935 | - } |
|
936 | - } |
|
937 | - |
|
938 | - $projectstatic->id=$lines[$i]->fk_project; |
|
939 | - $projectstatic->ref=$lines[$i]->projectref; |
|
940 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
941 | - $projectstatic->public=$lines[$i]->public; |
|
942 | - |
|
943 | - $taskstatic->id=$lines[$i]->id; |
|
944 | - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
945 | - $taskstatic->label=$lines[$i]->label; |
|
946 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
947 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
948 | - |
|
949 | - $thirdpartystatic->id=$lines[$i]->socid; |
|
950 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
951 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
952 | - |
|
953 | - if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
|
954 | - { |
|
955 | - print '<tr class="oddeven trforbreak">'."\n"; |
|
956 | - print '<td colspan="9">'; |
|
957 | - print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
958 | - if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
|
959 | - if ($projectstatic->title) |
|
960 | - { |
|
961 | - print ' - '; |
|
962 | - print $projectstatic->title; |
|
963 | - } |
|
964 | - print '</td>'; |
|
965 | - print '</tr>'; |
|
966 | - } |
|
967 | - |
|
968 | - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
969 | - |
|
970 | - print '<tr class="oddeven">'."\n"; |
|
971 | - |
|
972 | - // User |
|
973 | - /* |
|
878 | + global $conf, $db, $user, $bc, $langs; |
|
879 | + global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
|
880 | + |
|
881 | + $lastprojectid=0; |
|
882 | + $totalforeachday=array(); |
|
883 | + $workloadforid=array(); |
|
884 | + $lineswithoutlevel0=array(); |
|
885 | + |
|
886 | + $numlines=count($lines); |
|
887 | + |
|
888 | + // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
|
889 | + if ($parent == 0) // Always and only if at first level |
|
890 | + { |
|
891 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
892 | + { |
|
893 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
894 | + } |
|
895 | + } |
|
896 | + |
|
897 | + if (empty($oldprojectforbreak)) |
|
898 | + { |
|
899 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
900 | + } |
|
901 | + |
|
902 | + //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
|
903 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
904 | + { |
|
905 | + if ($parent == 0) $level = 0; |
|
906 | + |
|
907 | + if ($lines[$i]->fk_task_parent == $parent) |
|
908 | + { |
|
909 | + // If we want all or we have a role on task, we show it |
|
910 | + if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
911 | + { |
|
912 | + //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
|
913 | + |
|
914 | + if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases |
|
915 | + { |
|
916 | + continue; |
|
917 | + } |
|
918 | + |
|
919 | + // Break on a new project |
|
920 | + if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
921 | + { |
|
922 | + $lastprojectid=$lines[$i]->fk_project; |
|
923 | + if ($preselectedday) |
|
924 | + { |
|
925 | + $projectstatic->id = $lines[$i]->fk_project; |
|
926 | + } |
|
927 | + } |
|
928 | + |
|
929 | + if (empty($workloadforid[$projectstatic->id])) |
|
930 | + { |
|
931 | + if ($preselectedday) |
|
932 | + { |
|
933 | + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
934 | + $workloadforid[$projectstatic->id]=1; |
|
935 | + } |
|
936 | + } |
|
937 | + |
|
938 | + $projectstatic->id=$lines[$i]->fk_project; |
|
939 | + $projectstatic->ref=$lines[$i]->projectref; |
|
940 | + $projectstatic->title=$lines[$i]->projectlabel; |
|
941 | + $projectstatic->public=$lines[$i]->public; |
|
942 | + |
|
943 | + $taskstatic->id=$lines[$i]->id; |
|
944 | + $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
945 | + $taskstatic->label=$lines[$i]->label; |
|
946 | + $taskstatic->date_start=$lines[$i]->date_start; |
|
947 | + $taskstatic->date_end=$lines[$i]->date_end; |
|
948 | + |
|
949 | + $thirdpartystatic->id=$lines[$i]->socid; |
|
950 | + $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
951 | + $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
952 | + |
|
953 | + if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
|
954 | + { |
|
955 | + print '<tr class="oddeven trforbreak">'."\n"; |
|
956 | + print '<td colspan="9">'; |
|
957 | + print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
958 | + if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
|
959 | + if ($projectstatic->title) |
|
960 | + { |
|
961 | + print ' - '; |
|
962 | + print $projectstatic->title; |
|
963 | + } |
|
964 | + print '</td>'; |
|
965 | + print '</tr>'; |
|
966 | + } |
|
967 | + |
|
968 | + if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
969 | + |
|
970 | + print '<tr class="oddeven">'."\n"; |
|
971 | + |
|
972 | + // User |
|
973 | + /* |
|
974 | 974 | print '<td class="nowrap">'; |
975 | 975 | print $fuser->getNomUrl(1, 'withproject', 'time'); |
976 | 976 | print '</td>'; |
977 | 977 | */ |
978 | 978 | |
979 | - // Project |
|
980 | - /*print "<td>"; |
|
979 | + // Project |
|
980 | + /*print "<td>"; |
|
981 | 981 | if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
982 | 982 | print "</td>";*/ |
983 | 983 | |
984 | - // Thirdparty |
|
985 | - /*print '<td class="tdoverflowmax100">'; |
|
984 | + // Thirdparty |
|
985 | + /*print '<td class="tdoverflowmax100">'; |
|
986 | 986 | if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); |
987 | 987 | print '</td>';*/ |
988 | 988 | |
989 | - // Ref |
|
990 | - print '<td>'; |
|
991 | - print '<!-- Task id = '.$lines[$i]->id.' -->'; |
|
992 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
993 | - print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
|
994 | - // Label task |
|
995 | - print '<br>'; |
|
996 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
997 | - print $taskstatic->label; |
|
998 | - //print "<br>"; |
|
999 | - //for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1000 | - //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); |
|
1001 | - print "</td>\n"; |
|
1002 | - |
|
1003 | - // Planned Workload |
|
1004 | - print '<td align="right" class="leftborder plannedworkload">'; |
|
1005 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1006 | - else print '--:--'; |
|
1007 | - print '</td>'; |
|
1008 | - |
|
1009 | - // Progress declared % |
|
1010 | - print '<td align="right">'; |
|
1011 | - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1012 | - print '</td>'; |
|
1013 | - |
|
1014 | - // Time spent by everybody |
|
1015 | - print '<td align="right">'; |
|
1016 | - // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user |
|
1017 | - if ($lines[$i]->duration) |
|
1018 | - { |
|
1019 | - print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
|
1020 | - print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1021 | - print '</a>'; |
|
1022 | - } |
|
1023 | - else print '--:--'; |
|
1024 | - print "</td>\n"; |
|
1025 | - |
|
1026 | - // Time spent by user |
|
1027 | - print '<td align="right">'; |
|
1028 | - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1029 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1030 | - else print '--:--'; |
|
1031 | - print "</td>\n"; |
|
1032 | - |
|
1033 | - $disabledproject=1;$disabledtask=1; |
|
1034 | - //print "x".$lines[$i]->fk_project; |
|
1035 | - //var_dump($lines[$i]); |
|
1036 | - //var_dump($projectsrole[$lines[$i]->fk_project]); |
|
1037 | - // If at least one role for project |
|
1038 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1039 | - { |
|
1040 | - $disabledproject=0; |
|
1041 | - $disabledtask=0; |
|
1042 | - } |
|
1043 | - // If $restricteditformytask is on and I have no role on task, i disable edit |
|
1044 | - if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
|
1045 | - { |
|
1046 | - $disabledtask=1; |
|
1047 | - } |
|
1048 | - |
|
1049 | - // Form to add new time |
|
1050 | - print '<td class="nowrap leftborder" align="center">'; |
|
1051 | - $tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask); |
|
1052 | - print $tableCell; |
|
1053 | - print '</td>'; |
|
1054 | - |
|
1055 | - $cssonholiday=''; |
|
1056 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1057 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1058 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1059 | - |
|
1060 | - global $daytoparse; |
|
1061 | - $tmparray = dol_getdate($daytoparse,true); // detail of current day |
|
1062 | - $idw = $tmparray['wday']; |
|
1063 | - |
|
1064 | - global $numstartworkingday, $numendworkingday; |
|
1065 | - $cssweekend=''; |
|
1066 | - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1067 | - { |
|
1068 | - $cssweekend='weekend'; |
|
1069 | - } |
|
1070 | - |
|
1071 | - // Duration |
|
1072 | - print '<td class="center duration'.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1073 | - $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; |
|
1074 | - $totalforeachday[$preselectedday]+=$dayWorkLoad; |
|
1075 | - |
|
1076 | - $alreadyspent=''; |
|
1077 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1078 | - |
|
1079 | - $idw = 0; |
|
1080 | - |
|
1081 | - $tableCell=''; |
|
1082 | - $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1083 | - $tableCell.='<span class="hideonsmartphone"> + </span>'; |
|
1084 | - //$tableCell.=' '; |
|
1085 | - $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); |
|
1086 | - //$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">'; |
|
1087 | - print $tableCell; |
|
1088 | - |
|
1089 | - $modeinput='hours'; |
|
1090 | - |
|
1091 | - print '<script type="text/javascript">'; |
|
1092 | - print "jQuery(document).ready(function () {\n"; |
|
1093 | - print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });"; |
|
1094 | - print "})\n"; |
|
1095 | - print '</script>'; |
|
1096 | - |
|
1097 | - print '</td>'; |
|
1098 | - |
|
1099 | - // Note |
|
1100 | - print '<td align="center">'; |
|
1101 | - print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
1102 | - print '</textarea>'; |
|
1103 | - print '</td>'; |
|
1104 | - |
|
1105 | - // Warning |
|
1106 | - print '<td align="right">'; |
|
1107 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1108 | - else if ($disabledtask) |
|
1109 | - { |
|
1110 | - $titleassigntask = $langs->trans("AssignTaskToMe"); |
|
1111 | - if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1112 | - |
|
1113 | - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1114 | - } |
|
1115 | - print '</td>'; |
|
1116 | - |
|
1117 | - print "</tr>\n"; |
|
1118 | - } |
|
1119 | - |
|
1120 | - $inc++; |
|
1121 | - $level++; |
|
1122 | - if ($lines[$i]->id > 0) |
|
1123 | - { |
|
1124 | - //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level); |
|
1125 | - //var_dump($totalforeachday); |
|
1126 | - $ret = projectLinesPerDay($inc, $lines[$i]->id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak); |
|
1127 | - //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
|
1128 | - //var_dump($ret); |
|
1129 | - foreach($ret as $key => $val) |
|
1130 | - { |
|
1131 | - $totalforeachday[$key]+=$val; |
|
1132 | - } |
|
1133 | - //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
|
1134 | - //var_dump($totalforeachday); |
|
1135 | - } |
|
1136 | - $level--; |
|
1137 | - } |
|
1138 | - else |
|
1139 | - { |
|
1140 | - //$level--; |
|
1141 | - } |
|
1142 | - } |
|
1143 | - |
|
1144 | - return $totalforeachday; |
|
989 | + // Ref |
|
990 | + print '<td>'; |
|
991 | + print '<!-- Task id = '.$lines[$i]->id.' -->'; |
|
992 | + for ($k = 0 ; $k < $level ; $k++) print " "; |
|
993 | + print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
|
994 | + // Label task |
|
995 | + print '<br>'; |
|
996 | + for ($k = 0 ; $k < $level ; $k++) print " "; |
|
997 | + print $taskstatic->label; |
|
998 | + //print "<br>"; |
|
999 | + //for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1000 | + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); |
|
1001 | + print "</td>\n"; |
|
1002 | + |
|
1003 | + // Planned Workload |
|
1004 | + print '<td align="right" class="leftborder plannedworkload">'; |
|
1005 | + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1006 | + else print '--:--'; |
|
1007 | + print '</td>'; |
|
1008 | + |
|
1009 | + // Progress declared % |
|
1010 | + print '<td align="right">'; |
|
1011 | + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1012 | + print '</td>'; |
|
1013 | + |
|
1014 | + // Time spent by everybody |
|
1015 | + print '<td align="right">'; |
|
1016 | + // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user |
|
1017 | + if ($lines[$i]->duration) |
|
1018 | + { |
|
1019 | + print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
|
1020 | + print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1021 | + print '</a>'; |
|
1022 | + } |
|
1023 | + else print '--:--'; |
|
1024 | + print "</td>\n"; |
|
1025 | + |
|
1026 | + // Time spent by user |
|
1027 | + print '<td align="right">'; |
|
1028 | + $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1029 | + if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1030 | + else print '--:--'; |
|
1031 | + print "</td>\n"; |
|
1032 | + |
|
1033 | + $disabledproject=1;$disabledtask=1; |
|
1034 | + //print "x".$lines[$i]->fk_project; |
|
1035 | + //var_dump($lines[$i]); |
|
1036 | + //var_dump($projectsrole[$lines[$i]->fk_project]); |
|
1037 | + // If at least one role for project |
|
1038 | + if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1039 | + { |
|
1040 | + $disabledproject=0; |
|
1041 | + $disabledtask=0; |
|
1042 | + } |
|
1043 | + // If $restricteditformytask is on and I have no role on task, i disable edit |
|
1044 | + if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
|
1045 | + { |
|
1046 | + $disabledtask=1; |
|
1047 | + } |
|
1048 | + |
|
1049 | + // Form to add new time |
|
1050 | + print '<td class="nowrap leftborder" align="center">'; |
|
1051 | + $tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask); |
|
1052 | + print $tableCell; |
|
1053 | + print '</td>'; |
|
1054 | + |
|
1055 | + $cssonholiday=''; |
|
1056 | + if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1057 | + elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1058 | + elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1059 | + |
|
1060 | + global $daytoparse; |
|
1061 | + $tmparray = dol_getdate($daytoparse,true); // detail of current day |
|
1062 | + $idw = $tmparray['wday']; |
|
1063 | + |
|
1064 | + global $numstartworkingday, $numendworkingday; |
|
1065 | + $cssweekend=''; |
|
1066 | + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1067 | + { |
|
1068 | + $cssweekend='weekend'; |
|
1069 | + } |
|
1070 | + |
|
1071 | + // Duration |
|
1072 | + print '<td class="center duration'.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1073 | + $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; |
|
1074 | + $totalforeachday[$preselectedday]+=$dayWorkLoad; |
|
1075 | + |
|
1076 | + $alreadyspent=''; |
|
1077 | + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1078 | + |
|
1079 | + $idw = 0; |
|
1080 | + |
|
1081 | + $tableCell=''; |
|
1082 | + $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1083 | + $tableCell.='<span class="hideonsmartphone"> + </span>'; |
|
1084 | + //$tableCell.=' '; |
|
1085 | + $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); |
|
1086 | + //$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">'; |
|
1087 | + print $tableCell; |
|
1088 | + |
|
1089 | + $modeinput='hours'; |
|
1090 | + |
|
1091 | + print '<script type="text/javascript">'; |
|
1092 | + print "jQuery(document).ready(function () {\n"; |
|
1093 | + print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });"; |
|
1094 | + print "})\n"; |
|
1095 | + print '</script>'; |
|
1096 | + |
|
1097 | + print '</td>'; |
|
1098 | + |
|
1099 | + // Note |
|
1100 | + print '<td align="center">'; |
|
1101 | + print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
1102 | + print '</textarea>'; |
|
1103 | + print '</td>'; |
|
1104 | + |
|
1105 | + // Warning |
|
1106 | + print '<td align="right">'; |
|
1107 | + if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1108 | + else if ($disabledtask) |
|
1109 | + { |
|
1110 | + $titleassigntask = $langs->trans("AssignTaskToMe"); |
|
1111 | + if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1112 | + |
|
1113 | + print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1114 | + } |
|
1115 | + print '</td>'; |
|
1116 | + |
|
1117 | + print "</tr>\n"; |
|
1118 | + } |
|
1119 | + |
|
1120 | + $inc++; |
|
1121 | + $level++; |
|
1122 | + if ($lines[$i]->id > 0) |
|
1123 | + { |
|
1124 | + //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level); |
|
1125 | + //var_dump($totalforeachday); |
|
1126 | + $ret = projectLinesPerDay($inc, $lines[$i]->id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak); |
|
1127 | + //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
|
1128 | + //var_dump($ret); |
|
1129 | + foreach($ret as $key => $val) |
|
1130 | + { |
|
1131 | + $totalforeachday[$key]+=$val; |
|
1132 | + } |
|
1133 | + //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
|
1134 | + //var_dump($totalforeachday); |
|
1135 | + } |
|
1136 | + $level--; |
|
1137 | + } |
|
1138 | + else |
|
1139 | + { |
|
1140 | + //$level--; |
|
1141 | + } |
|
1142 | + } |
|
1143 | + |
|
1144 | + return $totalforeachday; |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | |
@@ -1164,263 +1164,263 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0) |
1166 | 1166 | { |
1167 | - global $conf, $db, $user, $bc, $langs; |
|
1168 | - global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
|
1169 | - |
|
1170 | - $numlines=count($lines); |
|
1171 | - |
|
1172 | - $lastprojectid=0; |
|
1173 | - $workloadforid=array(); |
|
1174 | - $totalforeachday=array(); |
|
1175 | - $lineswithoutlevel0=array(); |
|
1176 | - |
|
1177 | - // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
|
1178 | - if ($parent == 0) // Always and only if at first level |
|
1179 | - { |
|
1180 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1181 | - { |
|
1182 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
1183 | - } |
|
1184 | - } |
|
1185 | - |
|
1186 | - //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
|
1187 | - |
|
1188 | - if (empty($oldprojectforbreak)) |
|
1189 | - { |
|
1190 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break |
|
1191 | - } |
|
1192 | - |
|
1193 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1194 | - { |
|
1195 | - if ($parent == 0) $level = 0; |
|
1196 | - |
|
1197 | - if ($lines[$i]->fk_task_parent == $parent) |
|
1198 | - { |
|
1199 | - // If we want all or we have a role on task, we show it |
|
1200 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
1201 | - { |
|
1202 | - //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
|
1203 | - |
|
1204 | - if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases |
|
1205 | - { |
|
1206 | - continue; |
|
1207 | - } |
|
1208 | - |
|
1209 | - // Break on a new project |
|
1210 | - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
1211 | - { |
|
1212 | - $lastprojectid=$lines[$i]->fk_project; |
|
1213 | - $projectstatic->id = $lines[$i]->fk_project; |
|
1214 | - } |
|
1215 | - |
|
1216 | - //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); |
|
1217 | - //var_dump($projectstatic->weekWorkLoadPerTask); |
|
1218 | - if (empty($workloadforid[$projectstatic->id])) |
|
1219 | - { |
|
1220 | - $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
1221 | - $workloadforid[$projectstatic->id]=1; |
|
1222 | - } |
|
1223 | - //var_dump($projectstatic->weekWorkLoadPerTask); |
|
1224 | - //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); |
|
1225 | - |
|
1226 | - $projectstatic->id=$lines[$i]->fk_project; |
|
1227 | - $projectstatic->ref=$lines[$i]->projectref; |
|
1228 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
1229 | - $projectstatic->public=$lines[$i]->public; |
|
1230 | - $projectstatic->thirdparty_name=$lines[$i]->thirdparty_name; |
|
1231 | - |
|
1232 | - $taskstatic->id=$lines[$i]->id; |
|
1233 | - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
1234 | - $taskstatic->label=$lines[$i]->label; |
|
1235 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
1236 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
1237 | - |
|
1238 | - $thirdpartystatic->id=$lines[$i]->thirdparty_id; |
|
1239 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
1240 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
1241 | - |
|
1242 | - if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
|
1243 | - { |
|
1244 | - print '<tr class="oddeven trforbreak">'."\n"; |
|
1245 | - print '<td colspan="13">'; |
|
1246 | - print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
1247 | - if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
|
1248 | - if ($projectstatic->title) |
|
1249 | - { |
|
1250 | - print ' - '; |
|
1251 | - print $projectstatic->title; |
|
1252 | - } |
|
1253 | - print '</td>'; |
|
1254 | - print '</tr>'; |
|
1255 | - } |
|
1256 | - |
|
1257 | - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
1258 | - |
|
1259 | - print '<tr class="oddeven">'."\n"; |
|
1260 | - |
|
1261 | - // User |
|
1262 | - /* |
|
1167 | + global $conf, $db, $user, $bc, $langs; |
|
1168 | + global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
|
1169 | + |
|
1170 | + $numlines=count($lines); |
|
1171 | + |
|
1172 | + $lastprojectid=0; |
|
1173 | + $workloadforid=array(); |
|
1174 | + $totalforeachday=array(); |
|
1175 | + $lineswithoutlevel0=array(); |
|
1176 | + |
|
1177 | + // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
|
1178 | + if ($parent == 0) // Always and only if at first level |
|
1179 | + { |
|
1180 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
1181 | + { |
|
1182 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
1183 | + } |
|
1184 | + } |
|
1185 | + |
|
1186 | + //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
|
1187 | + |
|
1188 | + if (empty($oldprojectforbreak)) |
|
1189 | + { |
|
1190 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break |
|
1191 | + } |
|
1192 | + |
|
1193 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
1194 | + { |
|
1195 | + if ($parent == 0) $level = 0; |
|
1196 | + |
|
1197 | + if ($lines[$i]->fk_task_parent == $parent) |
|
1198 | + { |
|
1199 | + // If we want all or we have a role on task, we show it |
|
1200 | + if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
1201 | + { |
|
1202 | + //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
|
1203 | + |
|
1204 | + if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases |
|
1205 | + { |
|
1206 | + continue; |
|
1207 | + } |
|
1208 | + |
|
1209 | + // Break on a new project |
|
1210 | + if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
|
1211 | + { |
|
1212 | + $lastprojectid=$lines[$i]->fk_project; |
|
1213 | + $projectstatic->id = $lines[$i]->fk_project; |
|
1214 | + } |
|
1215 | + |
|
1216 | + //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); |
|
1217 | + //var_dump($projectstatic->weekWorkLoadPerTask); |
|
1218 | + if (empty($workloadforid[$projectstatic->id])) |
|
1219 | + { |
|
1220 | + $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
1221 | + $workloadforid[$projectstatic->id]=1; |
|
1222 | + } |
|
1223 | + //var_dump($projectstatic->weekWorkLoadPerTask); |
|
1224 | + //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); |
|
1225 | + |
|
1226 | + $projectstatic->id=$lines[$i]->fk_project; |
|
1227 | + $projectstatic->ref=$lines[$i]->projectref; |
|
1228 | + $projectstatic->title=$lines[$i]->projectlabel; |
|
1229 | + $projectstatic->public=$lines[$i]->public; |
|
1230 | + $projectstatic->thirdparty_name=$lines[$i]->thirdparty_name; |
|
1231 | + |
|
1232 | + $taskstatic->id=$lines[$i]->id; |
|
1233 | + $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
1234 | + $taskstatic->label=$lines[$i]->label; |
|
1235 | + $taskstatic->date_start=$lines[$i]->date_start; |
|
1236 | + $taskstatic->date_end=$lines[$i]->date_end; |
|
1237 | + |
|
1238 | + $thirdpartystatic->id=$lines[$i]->thirdparty_id; |
|
1239 | + $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
1240 | + $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
1241 | + |
|
1242 | + if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
|
1243 | + { |
|
1244 | + print '<tr class="oddeven trforbreak">'."\n"; |
|
1245 | + print '<td colspan="13">'; |
|
1246 | + print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
1247 | + if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
|
1248 | + if ($projectstatic->title) |
|
1249 | + { |
|
1250 | + print ' - '; |
|
1251 | + print $projectstatic->title; |
|
1252 | + } |
|
1253 | + print '</td>'; |
|
1254 | + print '</tr>'; |
|
1255 | + } |
|
1256 | + |
|
1257 | + if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
1258 | + |
|
1259 | + print '<tr class="oddeven">'."\n"; |
|
1260 | + |
|
1261 | + // User |
|
1262 | + /* |
|
1263 | 1263 | print '<td class="nowrap">'; |
1264 | 1264 | print $fuser->getNomUrl(1, 'withproject', 'time'); |
1265 | 1265 | print '</td>'; |
1266 | 1266 | */ |
1267 | 1267 | |
1268 | - // Project |
|
1269 | - /*print '<td class="nowrap">'; |
|
1268 | + // Project |
|
1269 | + /*print '<td class="nowrap">'; |
|
1270 | 1270 | if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
1271 | 1271 | print "</td>";*/ |
1272 | 1272 | |
1273 | - // Thirdparty |
|
1274 | - /*print '<td class="tdoverflowmax100">'; |
|
1273 | + // Thirdparty |
|
1274 | + /*print '<td class="tdoverflowmax100">'; |
|
1275 | 1275 | if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project'); |
1276 | 1276 | print '</td>';*/ |
1277 | 1277 | |
1278 | - // Ref |
|
1279 | - print '<td class="nowrap">'; |
|
1280 | - print '<!-- Task id = '.$lines[$i]->id.' -->'; |
|
1281 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1282 | - print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
|
1283 | - // Label task |
|
1284 | - print '<br>'; |
|
1285 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1286 | - //print $taskstatic->getNomUrl(0, 'withproject', 'time'); |
|
1287 | - print $taskstatic->label; |
|
1288 | - //print "<br>"; |
|
1289 | - //for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1290 | - //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); |
|
1291 | - print "</td>\n"; |
|
1292 | - |
|
1293 | - // Planned Workload |
|
1294 | - print '<td align="right" class="leftborder plannedworkload">'; |
|
1295 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1296 | - else print '--:--'; |
|
1297 | - print '</td>'; |
|
1298 | - |
|
1299 | - // Progress declared % |
|
1300 | - print '<td align="right">'; |
|
1301 | - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1302 | - print '</td>'; |
|
1303 | - |
|
1304 | - // Time spent by everybody |
|
1305 | - print '<td align="right">'; |
|
1306 | - // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user |
|
1307 | - if ($lines[$i]->duration) |
|
1308 | - { |
|
1309 | - print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
|
1310 | - print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1311 | - print '</a>'; |
|
1312 | - } |
|
1313 | - else print '--:--'; |
|
1314 | - print "</td>\n"; |
|
1315 | - |
|
1316 | - // Time spent by user |
|
1317 | - print '<td align="right">'; |
|
1318 | - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1319 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1320 | - else print '--:--'; |
|
1321 | - print "</td>\n"; |
|
1322 | - |
|
1323 | - $disabledproject=1;$disabledtask=1; |
|
1324 | - //print "x".$lines[$i]->fk_project; |
|
1325 | - //var_dump($lines[$i]); |
|
1326 | - //var_dump($projectsrole[$lines[$i]->fk_project]); |
|
1327 | - // If at least one role for project |
|
1328 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1329 | - { |
|
1330 | - $disabledproject=0; |
|
1331 | - $disabledtask=0; |
|
1332 | - } |
|
1333 | - // If $restricteditformytask is on and I have no role on task, i disable edit |
|
1334 | - if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
|
1335 | - { |
|
1336 | - $disabledtask=1; |
|
1337 | - } |
|
1338 | - |
|
1339 | - //var_dump($projectstatic->weekWorkLoadPerTask); |
|
1340 | - |
|
1341 | - // Fields to show current time |
|
1342 | - $tableCell=''; $modeinput='hours'; |
|
1343 | - for ($idw = 0; $idw < 7; $idw++) |
|
1344 | - { |
|
1345 | - $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
|
1346 | - |
|
1347 | - $cssonholiday=''; |
|
1348 | - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1349 | - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1350 | - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1351 | - |
|
1352 | - $tmparray=dol_getdate($tmpday); |
|
1353 | - $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; |
|
1354 | - $totalforeachday[$tmpday]+=$dayWorkLoad; |
|
1355 | - |
|
1356 | - $alreadyspent=''; |
|
1357 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1358 | - $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); |
|
1359 | - |
|
1360 | - global $numstartworkingday, $numendworkingday; |
|
1361 | - $cssweekend=''; |
|
1362 | - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1363 | - { |
|
1364 | - $cssweekend='weekend'; |
|
1365 | - } |
|
1366 | - |
|
1367 | - $tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1368 | - $placeholder=''; |
|
1369 | - if ($alreadyspent) |
|
1370 | - { |
|
1371 | - $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1372 | - //$placeholder=' placeholder="00:00"'; |
|
1373 | - //$tableCell.='+'; |
|
1374 | - } |
|
1375 | - $tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; |
|
1376 | - $tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"'; |
|
1377 | - $tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"'; |
|
1378 | - $tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />'; |
|
1379 | - $tableCell.='</td>'; |
|
1380 | - print $tableCell; |
|
1381 | - } |
|
1382 | - |
|
1383 | - // Warning |
|
1384 | - print '<td align="right">'; |
|
1385 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1386 | - else if ($disabledtask) |
|
1387 | - { |
|
1388 | - $titleassigntask = $langs->trans("AssignTaskToMe"); |
|
1389 | - if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1390 | - |
|
1391 | - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1392 | - } |
|
1393 | - print '</td>'; |
|
1394 | - |
|
1395 | - print "</tr>\n"; |
|
1396 | - } |
|
1397 | - |
|
1398 | - // Call to show task with a lower level (task under the current task) |
|
1399 | - $inc++; |
|
1400 | - $level++; |
|
1401 | - if ($lines[$i]->id > 0) |
|
1402 | - { |
|
1403 | - //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level); |
|
1404 | - //var_dump($totalforeachday); |
|
1405 | - $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak); |
|
1406 | - //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
|
1407 | - //var_dump($ret); |
|
1408 | - foreach($ret as $key => $val) |
|
1409 | - { |
|
1410 | - $totalforeachday[$key]+=$val; |
|
1411 | - } |
|
1412 | - //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
|
1413 | - //var_dump($totalforeachday); |
|
1414 | - } |
|
1415 | - $level--; |
|
1416 | - } |
|
1417 | - else |
|
1418 | - { |
|
1419 | - //$level--; |
|
1420 | - } |
|
1421 | - } |
|
1422 | - |
|
1423 | - return $totalforeachday; |
|
1278 | + // Ref |
|
1279 | + print '<td class="nowrap">'; |
|
1280 | + print '<!-- Task id = '.$lines[$i]->id.' -->'; |
|
1281 | + for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1282 | + print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
|
1283 | + // Label task |
|
1284 | + print '<br>'; |
|
1285 | + for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1286 | + //print $taskstatic->getNomUrl(0, 'withproject', 'time'); |
|
1287 | + print $taskstatic->label; |
|
1288 | + //print "<br>"; |
|
1289 | + //for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1290 | + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); |
|
1291 | + print "</td>\n"; |
|
1292 | + |
|
1293 | + // Planned Workload |
|
1294 | + print '<td align="right" class="leftborder plannedworkload">'; |
|
1295 | + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1296 | + else print '--:--'; |
|
1297 | + print '</td>'; |
|
1298 | + |
|
1299 | + // Progress declared % |
|
1300 | + print '<td align="right">'; |
|
1301 | + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1302 | + print '</td>'; |
|
1303 | + |
|
1304 | + // Time spent by everybody |
|
1305 | + print '<td align="right">'; |
|
1306 | + // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user |
|
1307 | + if ($lines[$i]->duration) |
|
1308 | + { |
|
1309 | + print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
|
1310 | + print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1311 | + print '</a>'; |
|
1312 | + } |
|
1313 | + else print '--:--'; |
|
1314 | + print "</td>\n"; |
|
1315 | + |
|
1316 | + // Time spent by user |
|
1317 | + print '<td align="right">'; |
|
1318 | + $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1319 | + if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1320 | + else print '--:--'; |
|
1321 | + print "</td>\n"; |
|
1322 | + |
|
1323 | + $disabledproject=1;$disabledtask=1; |
|
1324 | + //print "x".$lines[$i]->fk_project; |
|
1325 | + //var_dump($lines[$i]); |
|
1326 | + //var_dump($projectsrole[$lines[$i]->fk_project]); |
|
1327 | + // If at least one role for project |
|
1328 | + if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1329 | + { |
|
1330 | + $disabledproject=0; |
|
1331 | + $disabledtask=0; |
|
1332 | + } |
|
1333 | + // If $restricteditformytask is on and I have no role on task, i disable edit |
|
1334 | + if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
|
1335 | + { |
|
1336 | + $disabledtask=1; |
|
1337 | + } |
|
1338 | + |
|
1339 | + //var_dump($projectstatic->weekWorkLoadPerTask); |
|
1340 | + |
|
1341 | + // Fields to show current time |
|
1342 | + $tableCell=''; $modeinput='hours'; |
|
1343 | + for ($idw = 0; $idw < 7; $idw++) |
|
1344 | + { |
|
1345 | + $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
|
1346 | + |
|
1347 | + $cssonholiday=''; |
|
1348 | + if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1349 | + elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1350 | + elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1351 | + |
|
1352 | + $tmparray=dol_getdate($tmpday); |
|
1353 | + $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; |
|
1354 | + $totalforeachday[$tmpday]+=$dayWorkLoad; |
|
1355 | + |
|
1356 | + $alreadyspent=''; |
|
1357 | + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1358 | + $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); |
|
1359 | + |
|
1360 | + global $numstartworkingday, $numendworkingday; |
|
1361 | + $cssweekend=''; |
|
1362 | + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1363 | + { |
|
1364 | + $cssweekend='weekend'; |
|
1365 | + } |
|
1366 | + |
|
1367 | + $tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1368 | + $placeholder=''; |
|
1369 | + if ($alreadyspent) |
|
1370 | + { |
|
1371 | + $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1372 | + //$placeholder=' placeholder="00:00"'; |
|
1373 | + //$tableCell.='+'; |
|
1374 | + } |
|
1375 | + $tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; |
|
1376 | + $tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"'; |
|
1377 | + $tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"'; |
|
1378 | + $tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />'; |
|
1379 | + $tableCell.='</td>'; |
|
1380 | + print $tableCell; |
|
1381 | + } |
|
1382 | + |
|
1383 | + // Warning |
|
1384 | + print '<td align="right">'; |
|
1385 | + if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1386 | + else if ($disabledtask) |
|
1387 | + { |
|
1388 | + $titleassigntask = $langs->trans("AssignTaskToMe"); |
|
1389 | + if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1390 | + |
|
1391 | + print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1392 | + } |
|
1393 | + print '</td>'; |
|
1394 | + |
|
1395 | + print "</tr>\n"; |
|
1396 | + } |
|
1397 | + |
|
1398 | + // Call to show task with a lower level (task under the current task) |
|
1399 | + $inc++; |
|
1400 | + $level++; |
|
1401 | + if ($lines[$i]->id > 0) |
|
1402 | + { |
|
1403 | + //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level); |
|
1404 | + //var_dump($totalforeachday); |
|
1405 | + $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak); |
|
1406 | + //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
|
1407 | + //var_dump($ret); |
|
1408 | + foreach($ret as $key => $val) |
|
1409 | + { |
|
1410 | + $totalforeachday[$key]+=$val; |
|
1411 | + } |
|
1412 | + //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
|
1413 | + //var_dump($totalforeachday); |
|
1414 | + } |
|
1415 | + $level--; |
|
1416 | + } |
|
1417 | + else |
|
1418 | + { |
|
1419 | + //$level--; |
|
1420 | + } |
|
1421 | + } |
|
1422 | + |
|
1423 | + return $totalforeachday; |
|
1424 | 1424 | } |
1425 | 1425 | |
1426 | 1426 | |
@@ -1435,29 +1435,29 @@ discard block |
||
1435 | 1435 | */ |
1436 | 1436 | function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) |
1437 | 1437 | { |
1438 | - //print 'Search in line with parent id = '.$parent.'<br>'; |
|
1439 | - $numlines=count($lines); |
|
1440 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1441 | - { |
|
1442 | - // Process line $lines[$i] |
|
1443 | - if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent) |
|
1444 | - { |
|
1445 | - // If task is legitimate to show, no more need to search deeper |
|
1446 | - if (isset($taskrole[$lines[$i]->id])) |
|
1447 | - { |
|
1448 | - //print 'Found a legitimate task id='.$lines[$i]->id.'<br>'; |
|
1449 | - $inc++; |
|
1450 | - return $inc; |
|
1451 | - } |
|
1452 | - |
|
1453 | - searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole); |
|
1454 | - //print 'Found inc='.$inc.'<br>'; |
|
1455 | - |
|
1456 | - if ($inc > 0) return $inc; |
|
1457 | - } |
|
1458 | - } |
|
1459 | - |
|
1460 | - return $inc; |
|
1438 | + //print 'Search in line with parent id = '.$parent.'<br>'; |
|
1439 | + $numlines=count($lines); |
|
1440 | + for ($i = 0 ; $i < $numlines ; $i++) |
|
1441 | + { |
|
1442 | + // Process line $lines[$i] |
|
1443 | + if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent) |
|
1444 | + { |
|
1445 | + // If task is legitimate to show, no more need to search deeper |
|
1446 | + if (isset($taskrole[$lines[$i]->id])) |
|
1447 | + { |
|
1448 | + //print 'Found a legitimate task id='.$lines[$i]->id.'<br>'; |
|
1449 | + $inc++; |
|
1450 | + return $inc; |
|
1451 | + } |
|
1452 | + |
|
1453 | + searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole); |
|
1454 | + //print 'Found inc='.$inc.'<br>'; |
|
1455 | + |
|
1456 | + if ($inc > 0) return $inc; |
|
1457 | + } |
|
1458 | + } |
|
1459 | + |
|
1460 | + return $inc; |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | /** |
@@ -1475,235 +1475,235 @@ discard block |
||
1475 | 1475 | */ |
1476 | 1476 | function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=0, $statut=-1, $listofoppstatus=array(),$hiddenfields=array()) |
1477 | 1477 | { |
1478 | - global $langs,$conf,$user,$bc; |
|
1479 | - |
|
1480 | - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
1481 | - |
|
1482 | - $projectstatic=new Project($db); |
|
1483 | - $thirdpartystatic=new Societe($db); |
|
1484 | - |
|
1485 | - $sortfield=''; |
|
1486 | - $sortorder=''; |
|
1487 | - $project_year_filter=0; |
|
1488 | - |
|
1489 | - $title=$langs->trans("Projects"); |
|
1490 | - if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1491 | - |
|
1492 | - $arrayidtypeofcontact=array(); |
|
1493 | - |
|
1494 | - print '<div class="div-table-responsive-no-min">'; |
|
1495 | - print '<table class="noborder" width="100%">'; |
|
1496 | - |
|
1497 | - $sql= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1498 | - if ($mytasks) |
|
1499 | - { |
|
1500 | - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
1501 | - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
1502 | - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
1503 | - } |
|
1504 | - else |
|
1505 | - { |
|
1506 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1507 | - } |
|
1508 | - $sql.= " WHERE p.entity IN (".getEntity('project').")"; |
|
1509 | - $sql.= " AND p.rowid IN (".$projectsListId.")"; |
|
1510 | - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1511 | - if ($mytasks) |
|
1512 | - { |
|
1513 | - $sql.= " AND p.rowid = t.fk_projet"; |
|
1514 | - $sql.= " AND ec.element_id = t.rowid"; |
|
1515 | - $sql.= " AND ec.fk_socpeople = ".$user->id; |
|
1516 | - $sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact |
|
1517 | - $sql.= " AND ctc.element = 'project_task'"; |
|
1518 | - } |
|
1519 | - if ($statut >= 0) |
|
1520 | - { |
|
1521 | - $sql.= " AND p.fk_statut = ".$statut; |
|
1522 | - } |
|
1523 | - if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) |
|
1524 | - { |
|
1525 | - $project_year_filter = GETPOST("project_year_filter"); |
|
1526 | - //Check if empty or invalid year. Wildcard ignores the sql check |
|
1527 | - if ($project_year_filter != "*") |
|
1528 | - { |
|
1529 | - if (empty($project_year_filter) || !ctype_digit($project_year_filter)) |
|
1530 | - { |
|
1531 | - $project_year_filter = date("Y"); |
|
1532 | - } |
|
1533 | - $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; |
|
1534 | - $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; |
|
1535 | - } |
|
1536 | - } |
|
1537 | - |
|
1538 | - // Get id of project we must show tasks |
|
1539 | - $arrayidofprojects=array(); |
|
1540 | - $sql1 = "SELECT p.rowid as projectid"; |
|
1541 | - $sql1.= $sql; |
|
1542 | - $resql = $db->query($sql1); |
|
1543 | - if ($resql) |
|
1544 | - { |
|
1545 | - $i=0; |
|
1546 | - $num = $db->num_rows($resql); |
|
1547 | - while ($i < $num) |
|
1548 | - { |
|
1549 | - $objp = $db->fetch_object($resql); |
|
1550 | - $arrayidofprojects[$objp->projectid]=$objp->projectid; |
|
1551 | - $i++; |
|
1552 | - } |
|
1553 | - } |
|
1554 | - else dol_print_error($db); |
|
1555 | - if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1; |
|
1556 | - |
|
1557 | - // Get list of project with calculation on tasks |
|
1558 | - $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; |
|
1559 | - $sql2.= " p.dateo, p.datee,"; |
|
1560 | - $sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; |
|
1561 | - $sql2.= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1562 | - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; |
|
1563 | - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1564 | - $sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")"; |
|
1565 | - $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; |
|
1566 | - $sql2.= " ORDER BY p.title, p.ref"; |
|
1567 | - |
|
1568 | - $resql = $db->query($sql2); |
|
1569 | - if ($resql) |
|
1570 | - { |
|
1571 | - $total_task = 0; |
|
1572 | - $total_opp_amount = 0; |
|
1573 | - $ponderated_opp_amount = 0; |
|
1574 | - |
|
1575 | - $num = $db->num_rows($resql); |
|
1576 | - $i = 0; |
|
1577 | - |
|
1578 | - print '<tr class="liste_titre">'; |
|
1579 | - print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1580 | - print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1581 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1582 | - { |
|
1583 | - print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder); |
|
1584 | - print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder); |
|
1585 | - } |
|
1586 | - if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
1587 | - { |
|
1588 | - print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder); |
|
1589 | - if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); |
|
1590 | - if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); |
|
1591 | - } |
|
1592 | - print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); |
|
1593 | - print "</tr>\n"; |
|
1594 | - |
|
1595 | - $total_plannedworkload=0; |
|
1596 | - $total_declaredprogressworkload=0; |
|
1597 | - while ($i < $num) |
|
1598 | - { |
|
1599 | - $objp = $db->fetch_object($resql); |
|
1600 | - |
|
1601 | - $projectstatic->id = $objp->projectid; |
|
1602 | - $projectstatic->user_author_id = $objp->fk_user_creat; |
|
1603 | - $projectstatic->public = $objp->public; |
|
1604 | - |
|
1605 | - // Check is user has read permission on project |
|
1606 | - $userAccess = $projectstatic->restrictedProjectArea($user); |
|
1607 | - if ($userAccess >= 0) |
|
1608 | - { |
|
1609 | - $projectstatic->ref=$objp->ref; |
|
1610 | - $projectstatic->statut = $objp->status; |
|
1611 | - $projectstatic->title = $objp->title; |
|
1612 | - $projectstatic->datee = $db->jdate($objp->datee); |
|
1613 | - $projectstatic->dateo = $db->jdate($objp->dateo); |
|
1614 | - |
|
1615 | - |
|
1616 | - print '<tr class="oddeven">'; |
|
1617 | - print '<td>'; |
|
1618 | - print $projectstatic->getNomUrl(1); |
|
1619 | - if (! in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title,24); |
|
1620 | - print '</td>'; |
|
1621 | - print '<td>'; |
|
1622 | - if ($objp->fk_soc > 0) |
|
1623 | - { |
|
1624 | - $thirdpartystatic->id=$objp->fk_soc; |
|
1625 | - $thirdpartystatic->ref=$objp->socname; |
|
1626 | - $thirdpartystatic->name=$objp->socname; |
|
1627 | - print $thirdpartystatic->getNomUrl(1); |
|
1628 | - } |
|
1629 | - print '</td>'; |
|
1630 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1631 | - { |
|
1632 | - print '<td align="right">'; |
|
1633 | - if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); |
|
1634 | - print '</td>'; |
|
1635 | - print '<td align="right">'; |
|
1636 | - $code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); |
|
1637 | - if ($code) print $langs->trans("OppStatus".$code); |
|
1638 | - print '</td>'; |
|
1639 | - } |
|
1640 | - if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
1641 | - { |
|
1642 | - print '<td align="right">'.$objp->nb.'</td>'; |
|
1643 | - |
|
1644 | - $plannedworkload=$objp->planned_workload; |
|
1645 | - $total_plannedworkload+=$plannedworkload; |
|
1646 | - if (! in_array('plannedworkload', $hiddenfields)) |
|
1647 | - { |
|
1648 | - print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>'; |
|
1649 | - } |
|
1650 | - if (! in_array('declaredprogress', $hiddenfields)) |
|
1651 | - { |
|
1652 | - $declaredprogressworkload=$objp->declared_progess_workload; |
|
1653 | - $total_declaredprogressworkload+=$declaredprogressworkload; |
|
1654 | - print '<td align="right">'; |
|
1655 | - //print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>"; |
|
1656 | - print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':''); |
|
1657 | - print '</td>'; |
|
1658 | - } |
|
1659 | - } |
|
1660 | - |
|
1661 | - print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>'; |
|
1662 | - print "</tr>\n"; |
|
1663 | - |
|
1664 | - $total_task = $total_task + $objp->nb; |
|
1665 | - $total_opp_amount = $total_opp_amount + $objp->opp_amount; |
|
1666 | - $ponderated_opp_amount = $ponderated_opp_amount + price2num($listofoppstatus[$objp->opp_status] * $objp->opp_amount / 100); |
|
1667 | - } |
|
1668 | - |
|
1669 | - $i++; |
|
1670 | - } |
|
1671 | - |
|
1672 | - print '<tr class="liste_total">'; |
|
1673 | - print '<td colspan="2">'.$langs->trans("Total")."</td>"; |
|
1674 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1675 | - { |
|
1676 | - print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; |
|
1677 | - print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; |
|
1678 | - } |
|
1679 | - if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
1680 | - { |
|
1681 | - print '<td class="liste_total" align="right">'.$total_task.'</td>'; |
|
1682 | - if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; |
|
1683 | - if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>'; |
|
1684 | - } |
|
1685 | - print '<td class="liste_total"></td>'; |
|
1686 | - print '</tr>'; |
|
1687 | - |
|
1688 | - $db->free($resql); |
|
1689 | - } |
|
1690 | - else |
|
1691 | - { |
|
1692 | - dol_print_error($db); |
|
1693 | - } |
|
1694 | - |
|
1695 | - print "</table>"; |
|
1696 | - print '</div>'; |
|
1697 | - |
|
1698 | - if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) |
|
1699 | - { |
|
1700 | - //Add the year filter input |
|
1701 | - print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; |
|
1702 | - print '<table width="100%">'; |
|
1703 | - print '<tr>'; |
|
1704 | - print '<td>'.$langs->trans("Year").'</td>'; |
|
1705 | - print '<td style="text-align:right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.'"/>'; |
|
1706 | - print "</tr>\n"; |
|
1707 | - print '</table></form>'; |
|
1708 | - } |
|
1478 | + global $langs,$conf,$user,$bc; |
|
1479 | + |
|
1480 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
1481 | + |
|
1482 | + $projectstatic=new Project($db); |
|
1483 | + $thirdpartystatic=new Societe($db); |
|
1484 | + |
|
1485 | + $sortfield=''; |
|
1486 | + $sortorder=''; |
|
1487 | + $project_year_filter=0; |
|
1488 | + |
|
1489 | + $title=$langs->trans("Projects"); |
|
1490 | + if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1491 | + |
|
1492 | + $arrayidtypeofcontact=array(); |
|
1493 | + |
|
1494 | + print '<div class="div-table-responsive-no-min">'; |
|
1495 | + print '<table class="noborder" width="100%">'; |
|
1496 | + |
|
1497 | + $sql= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1498 | + if ($mytasks) |
|
1499 | + { |
|
1500 | + $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
1501 | + $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
1502 | + $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
1503 | + } |
|
1504 | + else |
|
1505 | + { |
|
1506 | + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1507 | + } |
|
1508 | + $sql.= " WHERE p.entity IN (".getEntity('project').")"; |
|
1509 | + $sql.= " AND p.rowid IN (".$projectsListId.")"; |
|
1510 | + if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1511 | + if ($mytasks) |
|
1512 | + { |
|
1513 | + $sql.= " AND p.rowid = t.fk_projet"; |
|
1514 | + $sql.= " AND ec.element_id = t.rowid"; |
|
1515 | + $sql.= " AND ec.fk_socpeople = ".$user->id; |
|
1516 | + $sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact |
|
1517 | + $sql.= " AND ctc.element = 'project_task'"; |
|
1518 | + } |
|
1519 | + if ($statut >= 0) |
|
1520 | + { |
|
1521 | + $sql.= " AND p.fk_statut = ".$statut; |
|
1522 | + } |
|
1523 | + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) |
|
1524 | + { |
|
1525 | + $project_year_filter = GETPOST("project_year_filter"); |
|
1526 | + //Check if empty or invalid year. Wildcard ignores the sql check |
|
1527 | + if ($project_year_filter != "*") |
|
1528 | + { |
|
1529 | + if (empty($project_year_filter) || !ctype_digit($project_year_filter)) |
|
1530 | + { |
|
1531 | + $project_year_filter = date("Y"); |
|
1532 | + } |
|
1533 | + $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; |
|
1534 | + $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; |
|
1535 | + } |
|
1536 | + } |
|
1537 | + |
|
1538 | + // Get id of project we must show tasks |
|
1539 | + $arrayidofprojects=array(); |
|
1540 | + $sql1 = "SELECT p.rowid as projectid"; |
|
1541 | + $sql1.= $sql; |
|
1542 | + $resql = $db->query($sql1); |
|
1543 | + if ($resql) |
|
1544 | + { |
|
1545 | + $i=0; |
|
1546 | + $num = $db->num_rows($resql); |
|
1547 | + while ($i < $num) |
|
1548 | + { |
|
1549 | + $objp = $db->fetch_object($resql); |
|
1550 | + $arrayidofprojects[$objp->projectid]=$objp->projectid; |
|
1551 | + $i++; |
|
1552 | + } |
|
1553 | + } |
|
1554 | + else dol_print_error($db); |
|
1555 | + if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1; |
|
1556 | + |
|
1557 | + // Get list of project with calculation on tasks |
|
1558 | + $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; |
|
1559 | + $sql2.= " p.dateo, p.datee,"; |
|
1560 | + $sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; |
|
1561 | + $sql2.= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1562 | + $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; |
|
1563 | + $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1564 | + $sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")"; |
|
1565 | + $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; |
|
1566 | + $sql2.= " ORDER BY p.title, p.ref"; |
|
1567 | + |
|
1568 | + $resql = $db->query($sql2); |
|
1569 | + if ($resql) |
|
1570 | + { |
|
1571 | + $total_task = 0; |
|
1572 | + $total_opp_amount = 0; |
|
1573 | + $ponderated_opp_amount = 0; |
|
1574 | + |
|
1575 | + $num = $db->num_rows($resql); |
|
1576 | + $i = 0; |
|
1577 | + |
|
1578 | + print '<tr class="liste_titre">'; |
|
1579 | + print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1580 | + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1581 | + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1582 | + { |
|
1583 | + print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder); |
|
1584 | + print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder); |
|
1585 | + } |
|
1586 | + if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
1587 | + { |
|
1588 | + print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder); |
|
1589 | + if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); |
|
1590 | + if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); |
|
1591 | + } |
|
1592 | + print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); |
|
1593 | + print "</tr>\n"; |
|
1594 | + |
|
1595 | + $total_plannedworkload=0; |
|
1596 | + $total_declaredprogressworkload=0; |
|
1597 | + while ($i < $num) |
|
1598 | + { |
|
1599 | + $objp = $db->fetch_object($resql); |
|
1600 | + |
|
1601 | + $projectstatic->id = $objp->projectid; |
|
1602 | + $projectstatic->user_author_id = $objp->fk_user_creat; |
|
1603 | + $projectstatic->public = $objp->public; |
|
1604 | + |
|
1605 | + // Check is user has read permission on project |
|
1606 | + $userAccess = $projectstatic->restrictedProjectArea($user); |
|
1607 | + if ($userAccess >= 0) |
|
1608 | + { |
|
1609 | + $projectstatic->ref=$objp->ref; |
|
1610 | + $projectstatic->statut = $objp->status; |
|
1611 | + $projectstatic->title = $objp->title; |
|
1612 | + $projectstatic->datee = $db->jdate($objp->datee); |
|
1613 | + $projectstatic->dateo = $db->jdate($objp->dateo); |
|
1614 | + |
|
1615 | + |
|
1616 | + print '<tr class="oddeven">'; |
|
1617 | + print '<td>'; |
|
1618 | + print $projectstatic->getNomUrl(1); |
|
1619 | + if (! in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title,24); |
|
1620 | + print '</td>'; |
|
1621 | + print '<td>'; |
|
1622 | + if ($objp->fk_soc > 0) |
|
1623 | + { |
|
1624 | + $thirdpartystatic->id=$objp->fk_soc; |
|
1625 | + $thirdpartystatic->ref=$objp->socname; |
|
1626 | + $thirdpartystatic->name=$objp->socname; |
|
1627 | + print $thirdpartystatic->getNomUrl(1); |
|
1628 | + } |
|
1629 | + print '</td>'; |
|
1630 | + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1631 | + { |
|
1632 | + print '<td align="right">'; |
|
1633 | + if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); |
|
1634 | + print '</td>'; |
|
1635 | + print '<td align="right">'; |
|
1636 | + $code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); |
|
1637 | + if ($code) print $langs->trans("OppStatus".$code); |
|
1638 | + print '</td>'; |
|
1639 | + } |
|
1640 | + if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
1641 | + { |
|
1642 | + print '<td align="right">'.$objp->nb.'</td>'; |
|
1643 | + |
|
1644 | + $plannedworkload=$objp->planned_workload; |
|
1645 | + $total_plannedworkload+=$plannedworkload; |
|
1646 | + if (! in_array('plannedworkload', $hiddenfields)) |
|
1647 | + { |
|
1648 | + print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>'; |
|
1649 | + } |
|
1650 | + if (! in_array('declaredprogress', $hiddenfields)) |
|
1651 | + { |
|
1652 | + $declaredprogressworkload=$objp->declared_progess_workload; |
|
1653 | + $total_declaredprogressworkload+=$declaredprogressworkload; |
|
1654 | + print '<td align="right">'; |
|
1655 | + //print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>"; |
|
1656 | + print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':''); |
|
1657 | + print '</td>'; |
|
1658 | + } |
|
1659 | + } |
|
1660 | + |
|
1661 | + print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>'; |
|
1662 | + print "</tr>\n"; |
|
1663 | + |
|
1664 | + $total_task = $total_task + $objp->nb; |
|
1665 | + $total_opp_amount = $total_opp_amount + $objp->opp_amount; |
|
1666 | + $ponderated_opp_amount = $ponderated_opp_amount + price2num($listofoppstatus[$objp->opp_status] * $objp->opp_amount / 100); |
|
1667 | + } |
|
1668 | + |
|
1669 | + $i++; |
|
1670 | + } |
|
1671 | + |
|
1672 | + print '<tr class="liste_total">'; |
|
1673 | + print '<td colspan="2">'.$langs->trans("Total")."</td>"; |
|
1674 | + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1675 | + { |
|
1676 | + print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; |
|
1677 | + print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; |
|
1678 | + } |
|
1679 | + if (empty($conf->global->PROJECT_HIDE_TASKS)) |
|
1680 | + { |
|
1681 | + print '<td class="liste_total" align="right">'.$total_task.'</td>'; |
|
1682 | + if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; |
|
1683 | + if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>'; |
|
1684 | + } |
|
1685 | + print '<td class="liste_total"></td>'; |
|
1686 | + print '</tr>'; |
|
1687 | + |
|
1688 | + $db->free($resql); |
|
1689 | + } |
|
1690 | + else |
|
1691 | + { |
|
1692 | + dol_print_error($db); |
|
1693 | + } |
|
1694 | + |
|
1695 | + print "</table>"; |
|
1696 | + print '</div>'; |
|
1697 | + |
|
1698 | + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) |
|
1699 | + { |
|
1700 | + //Add the year filter input |
|
1701 | + print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; |
|
1702 | + print '<table width="100%">'; |
|
1703 | + print '<tr>'; |
|
1704 | + print '<td>'.$langs->trans("Year").'</td>'; |
|
1705 | + print '<td style="text-align:right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.'"/>'; |
|
1706 | + print "</tr>\n"; |
|
1707 | + print '</table></form>'; |
|
1708 | + } |
|
1709 | 1709 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $head[$h][2] = 'project'; |
46 | 46 | $h++; |
47 | 47 | |
48 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
48 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
49 | 49 | $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; |
50 | 50 | $head[$h][1] = $langs->trans("ProjectContact"); |
51 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
51 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
52 | 52 | $head[$h][2] = 'contact'; |
53 | 53 | $h++; |
54 | 54 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | $head[$h][1] = $langs->trans("Tasks"); |
60 | 60 | |
61 | 61 | require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
62 | - $taskstatic=new Task($db); |
|
63 | - $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
|
64 | - if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>'; |
|
62 | + $taskstatic = new Task($db); |
|
63 | + $nbTasks = count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
|
64 | + if ($nbTasks > 0) $head[$h][1] .= ' <span class="badge">'.($nbTasks).'</span>'; |
|
65 | 65 | $head[$h][2] = 'tasks'; |
66 | 66 | $h++; |
67 | 67 | |
68 | - $nbTimeSpent=0; |
|
68 | + $nbTimeSpent = 0; |
|
69 | 69 | $sql = "SELECT t.rowid"; |
70 | 70 | //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
71 | 71 | //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
@@ -76,20 +76,20 @@ discard block |
||
76 | 76 | if ($resql) |
77 | 77 | { |
78 | 78 | $obj = $db->fetch_object($resql); |
79 | - if ($obj) $nbTimeSpent=1; |
|
79 | + if ($obj) $nbTimeSpent = 1; |
|
80 | 80 | } |
81 | 81 | else dol_print_error($db); |
82 | 82 | |
83 | 83 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; |
84 | 84 | $head[$h][1] = $langs->trans("TimeSpent"); |
85 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
85 | + if ($nbTimeSpent > 0) $head[$h][1] .= ' <span class="badge">...</span>'; |
|
86 | 86 | $head[$h][2] = 'timespent'; |
87 | 87 | $h++; |
88 | 88 | } |
89 | 89 | |
90 | - if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) |
|
91 | - || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) |
|
92 | - || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) |
|
90 | + if (!empty($conf->fournisseur->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) |
|
91 | + || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) |
|
92 | + || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) |
|
93 | 93 | { |
94 | 94 | $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; |
95 | 95 | $head[$h][1] = $langs->trans("ProjectOverview"); |
@@ -101,29 +101,29 @@ discard block |
||
101 | 101 | // Entries must be declared in modules descriptor with line |
102 | 102 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
103 | 103 | // $this->tabs = array('entity:-tabname); to remove a tab |
104 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'project'); |
|
104 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'project'); |
|
105 | 105 | |
106 | 106 | |
107 | 107 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
108 | 108 | { |
109 | 109 | $nbNote = 0; |
110 | - if(!empty($object->note_private)) $nbNote++; |
|
111 | - if(!empty($object->note_public)) $nbNote++; |
|
110 | + if (!empty($object->note_private)) $nbNote++; |
|
111 | + if (!empty($object->note_public)) $nbNote++; |
|
112 | 112 | $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; |
113 | 113 | $head[$h][1] = $langs->trans('Notes'); |
114 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
114 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
115 | 115 | $head[$h][2] = 'notes'; |
116 | 116 | $h++; |
117 | 117 | } |
118 | 118 | |
119 | 119 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
120 | 120 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
121 | - $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
122 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
123 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
121 | + $upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($object->ref); |
|
122 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
123 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
124 | 124 | $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; |
125 | 125 | $head[$h][1] = $langs->trans('Documents'); |
126 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
126 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
127 | 127 | $head[$h][2] = 'document'; |
128 | 128 | $h++; |
129 | 129 | |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | $nbComments = $object->getNbComments(); |
134 | 134 | $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; |
135 | 135 | $head[$h][1] = $langs->trans("CommentLink"); |
136 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
136 | + if ($nbComments > 0) $head[$h][1] .= ' <span class="badge">'.$nbComments.'</span>'; |
|
137 | 137 | $head[$h][2] = 'project_comment'; |
138 | 138 | $h++; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; |
142 | - $head[$h][1].= $langs->trans("Events"); |
|
143 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
142 | + $head[$h][1] .= $langs->trans("Events"); |
|
143 | + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
|
144 | 144 | { |
145 | - $head[$h][1].= '/'; |
|
146 | - $head[$h][1].= $langs->trans("Agenda"); |
|
145 | + $head[$h][1] .= '/'; |
|
146 | + $head[$h][1] .= $langs->trans("Agenda"); |
|
147 | 147 | } |
148 | 148 | $head[$h][2] = 'agenda'; |
149 | 149 | $h++; |
150 | 150 | |
151 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove'); |
|
151 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'project', 'remove'); |
|
152 | 152 | |
153 | 153 | return $head; |
154 | 154 | } |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | $h = 0; |
167 | 167 | $head = array(); |
168 | 168 | |
169 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
169 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
170 | 170 | $head[$h][1] = $langs->trans("Card"); |
171 | 171 | $head[$h][2] = 'task_task'; |
172 | 172 | $h++; |
173 | 173 | |
174 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
175 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
174 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
175 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
176 | 176 | $head[$h][1] = $langs->trans("TaskRessourceLinks"); |
177 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
177 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
178 | 178 | $head[$h][2] = 'task_contact'; |
179 | 179 | $h++; |
180 | 180 | |
181 | 181 | // Is there timespent ? |
182 | - $nbTimeSpent=0; |
|
182 | + $nbTimeSpent = 0; |
|
183 | 183 | $sql = "SELECT t.rowid"; |
184 | 184 | //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; |
185 | 185 | //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | if ($resql) |
190 | 190 | { |
191 | 191 | $obj = $db->fetch_object($resql); |
192 | - if ($obj) $nbTimeSpent=1; |
|
192 | + if ($obj) $nbTimeSpent = 1; |
|
193 | 193 | } |
194 | 194 | else dol_print_error($db); |
195 | 195 | |
196 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
196 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
197 | 197 | $head[$h][1] = $langs->trans("TimeSpent"); |
198 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
198 | + if ($nbTimeSpent > 0) $head[$h][1] .= ' <span class="badge">...</span>'; |
|
199 | 199 | $head[$h][2] = 'task_time'; |
200 | 200 | $h++; |
201 | 201 | |
@@ -203,28 +203,28 @@ discard block |
||
203 | 203 | // Entries must be declared in modules descriptor with line |
204 | 204 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
205 | 205 | // $this->tabs = array('entity:-tabname); to remove a tab |
206 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); |
|
206 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'task'); |
|
207 | 207 | |
208 | 208 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
209 | 209 | { |
210 | 210 | $nbNote = 0; |
211 | - if(!empty($object->note_private)) $nbNote++; |
|
212 | - if(!empty($object->note_public)) $nbNote++; |
|
213 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
211 | + if (!empty($object->note_private)) $nbNote++; |
|
212 | + if (!empty($object->note_public)) $nbNote++; |
|
213 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
214 | 214 | $head[$h][1] = $langs->trans('Notes'); |
215 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
215 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
216 | 216 | $head[$h][2] = 'task_notes'; |
217 | 217 | $h++; |
218 | 218 | } |
219 | 219 | |
220 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
221 | - $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); |
|
220 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
221 | + $filesdir = $conf->projet->dir_output."/".dol_sanitizeFileName($object->project->ref).'/'.dol_sanitizeFileName($object->ref); |
|
222 | 222 | include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
223 | 223 | include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
224 | - $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
225 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
224 | + $nbFiles = count(dol_dir_list($filesdir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
225 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
226 | 226 | $head[$h][1] = $langs->trans('Documents'); |
227 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
227 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
228 | 228 | $head[$h][2] = 'task_document'; |
229 | 229 | $h++; |
230 | 230 | |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) |
233 | 233 | { |
234 | 234 | $nbComments = $object->getNbComments(); |
235 | - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
|
235 | + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); |
|
236 | 236 | $head[$h][1] = $langs->trans("CommentLink"); |
237 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
237 | + if ($nbComments > 0) $head[$h][1] .= ' <span class="badge">'.$nbComments.'</span>'; |
|
238 | 238 | $head[$h][2] = 'task_comment'; |
239 | 239 | $h++; |
240 | 240 | } |
241 | 241 | |
242 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove'); |
|
242 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'task', 'remove'); |
|
243 | 243 | |
244 | 244 | return $head; |
245 | 245 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string $fuser Filter on user |
252 | 252 | * @return array Array of tabs to show |
253 | 253 | */ |
254 | -function project_timesheet_prepare_head($mode, $fuser=null) |
|
254 | +function project_timesheet_prepare_head($mode, $fuser = null) |
|
255 | 255 | { |
256 | 256 | global $langs, $conf, $user; |
257 | 257 | $h = 0; |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | $h = 0; |
261 | 261 | |
262 | - $param=''; |
|
263 | - $param.=($mode?'&mode='.$mode:''); |
|
264 | - if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id; |
|
262 | + $param = ''; |
|
263 | + $param .= ($mode ? '&mode='.$mode : ''); |
|
264 | + if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param .= '&search_usertoprocessid='.$fuser->id; |
|
265 | 265 | |
266 | 266 | if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) |
267 | 267 | { |
268 | - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param?'?'.$param:''); |
|
268 | + $head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($param ? '?'.$param : ''); |
|
269 | 269 | $head[$h][1] = $langs->trans("InputPerWeek"); |
270 | 270 | $head[$h][2] = 'inputperweek'; |
271 | 271 | $h++; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) |
275 | 275 | { |
276 | - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param?'?'.$param:''); |
|
276 | + $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($param ? '?'.$param : ''); |
|
277 | 277 | $head[$h][1] = $langs->trans("InputPerDay"); |
278 | 278 | $head[$h][2] = 'inputperday'; |
279 | 279 | $h++; |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $h++; |
288 | 288 | }*/ |
289 | 289 | |
290 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet'); |
|
290 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet'); |
|
291 | 291 | |
292 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet','remove'); |
|
292 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet', 'remove'); |
|
293 | 293 | |
294 | 294 | return $head; |
295 | 295 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $head[$h][2] = 'project'; |
314 | 314 | $h++; |
315 | 315 | |
316 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin'); |
|
316 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_admin'); |
|
317 | 317 | |
318 | 318 | $head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php"; |
319 | 319 | $head[$h][1] = $langs->trans("ExtraFieldsProject"); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $head[$h][2] = 'attributes_task'; |
326 | 326 | $h++; |
327 | 327 | |
328 | - complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin','remove'); |
|
328 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'project_admin', 'remove'); |
|
329 | 329 | |
330 | 330 | return $head; |
331 | 331 | } |
@@ -347,15 +347,15 @@ discard block |
||
347 | 347 | * @param string $filterprogresscalc filter text |
348 | 348 | * @return void |
349 | 349 | */ |
350 | -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0, $filterprogresscalc='') |
|
350 | +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '') |
|
351 | 351 | { |
352 | 352 | global $user, $bc, $langs, $conf, $db; |
353 | 353 | global $projectstatic, $taskstatic; |
354 | 354 | |
355 | - $lastprojectid=0; |
|
355 | + $lastprojectid = 0; |
|
356 | 356 | |
357 | - $projectsArrayId=explode(',',$projectsListId); |
|
358 | - if ($filterprogresscalc!=='') { |
|
357 | + $projectsArrayId = explode(',', $projectsListId); |
|
358 | + if ($filterprogresscalc !== '') { |
|
359 | 359 | foreach ($lines as $key=>$line) { |
360 | 360 | if (!empty($line->planned_workload) && !empty($line->duration)) { |
361 | 361 | $filterprogresscalc = str_replace(' = ', ' == ', $filterprogresscalc); |
@@ -364,23 +364,23 @@ discard block |
||
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
367 | - $lines=array_values($lines); |
|
367 | + $lines = array_values($lines); |
|
368 | 368 | } |
369 | 369 | |
370 | - $numlines=count($lines); |
|
370 | + $numlines = count($lines); |
|
371 | 371 | |
372 | 372 | // We declare counter as global because we want to edit them into recursive call |
373 | - global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; |
|
373 | + global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned; |
|
374 | 374 | if ($level == 0) |
375 | 375 | { |
376 | - $total_projectlinesa_spent=0; |
|
377 | - $total_projectlinesa_planned=0; |
|
378 | - $total_projectlinesa_spent_if_planned=0; |
|
376 | + $total_projectlinesa_spent = 0; |
|
377 | + $total_projectlinesa_planned = 0; |
|
378 | + $total_projectlinesa_spent_if_planned = 0; |
|
379 | 379 | } |
380 | 380 | |
381 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
381 | + for ($i = 0; $i < $numlines; $i++) |
|
382 | 382 | { |
383 | - if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
383 | + if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
384 | 384 | |
385 | 385 | // Process line |
386 | 386 | // print "i:".$i."-".$lines[$i]->fk_project.'<br>'; |
@@ -388,26 +388,26 @@ discard block |
||
388 | 388 | if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines |
389 | 389 | { |
390 | 390 | // Show task line. |
391 | - $showline=1; |
|
392 | - $showlineingray=0; |
|
391 | + $showline = 1; |
|
392 | + $showlineingray = 0; |
|
393 | 393 | |
394 | 394 | // If there is filters to use |
395 | 395 | if (is_array($taskrole)) |
396 | 396 | { |
397 | 397 | // If task not legitimate to show, search if a legitimate task exists later in tree |
398 | - if (! isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) |
|
398 | + if (!isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) |
|
399 | 399 | { |
400 | 400 | // So search if task has a subtask legitimate to show |
401 | - $foundtaskforuserdeeper=0; |
|
402 | - searchTaskInChild($foundtaskforuserdeeper,$lines[$i]->id,$lines,$taskrole); |
|
401 | + $foundtaskforuserdeeper = 0; |
|
402 | + searchTaskInChild($foundtaskforuserdeeper, $lines[$i]->id, $lines, $taskrole); |
|
403 | 403 | //print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.'<br>'; |
404 | 404 | if ($foundtaskforuserdeeper > 0) |
405 | 405 | { |
406 | - $showlineingray=1; // We will show line but in gray |
|
406 | + $showlineingray = 1; // We will show line but in gray |
|
407 | 407 | } |
408 | 408 | else |
409 | 409 | { |
410 | - $showline=0; // No reason to show line |
|
410 | + $showline = 0; // No reason to show line |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | } |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | if (empty($user->rights->projet->all->lire)) |
419 | 419 | { |
420 | 420 | // User is not allowed on this project and project is not public, so we hide line |
421 | - if (! in_array($lines[$i]->fk_project, $projectsArrayId)) |
|
421 | + if (!in_array($lines[$i]->fk_project, $projectsArrayId)) |
|
422 | 422 | { |
423 | 423 | // Note that having a user assigned to a task into a project user has no permission on, should not be possible |
424 | 424 | // because assignement on task can be done only on contact of project. |
425 | 425 | // If assignement was done and after, was removed from contact of project, then we can hide the line. |
426 | - $showline=0; |
|
426 | + $showline = 0; |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
435 | 435 | { |
436 | 436 | $var = !$var; |
437 | - $lastprojectid=$lines[$i]->fk_project; |
|
437 | + $lastprojectid = $lines[$i]->fk_project; |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | print '<tr '.$bc[$var].' id="row-'.$lines[$i]->id.'">'."\n"; |
@@ -444,18 +444,18 @@ discard block |
||
444 | 444 | // Project ref |
445 | 445 | print "<td>"; |
446 | 446 | //if ($showlineingray) print '<i>'; |
447 | - $projectstatic->id=$lines[$i]->fk_project; |
|
448 | - $projectstatic->ref=$lines[$i]->projectref; |
|
449 | - $projectstatic->public=$lines[$i]->public; |
|
450 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
451 | - if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | - else print $projectstatic->getNomUrl(1,'nolink'); |
|
447 | + $projectstatic->id = $lines[$i]->fk_project; |
|
448 | + $projectstatic->ref = $lines[$i]->projectref; |
|
449 | + $projectstatic->public = $lines[$i]->public; |
|
450 | + $projectstatic->title = $lines[$i]->projectlabel; |
|
451 | + if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | + else print $projectstatic->getNomUrl(1, 'nolink'); |
|
453 | 453 | //if ($showlineingray) print '</i>'; |
454 | 454 | print "</td>"; |
455 | 455 | |
456 | 456 | // Project status |
457 | 457 | print '<td>'; |
458 | - $projectstatic->statut=$lines[$i]->projectstatus; |
|
458 | + $projectstatic->statut = $lines[$i]->projectstatus; |
|
459 | 459 | print $projectstatic->getLibStatut(2); |
460 | 460 | print "</td>"; |
461 | 461 | } |
@@ -464,14 +464,14 @@ discard block |
||
464 | 464 | print '<td>'; |
465 | 465 | if ($showlineingray) |
466 | 466 | { |
467 | - print '<i>'.img_object('','projecttask').' '.$lines[$i]->ref.'</i>'; |
|
467 | + print '<i>'.img_object('', 'projecttask').' '.$lines[$i]->ref.'</i>'; |
|
468 | 468 | } |
469 | 469 | else |
470 | 470 | { |
471 | - $taskstatic->id=$lines[$i]->id; |
|
472 | - $taskstatic->ref=$lines[$i]->ref; |
|
473 | - $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); |
|
474 | - print $taskstatic->getNomUrl(1,'withproject'); |
|
471 | + $taskstatic->id = $lines[$i]->id; |
|
472 | + $taskstatic->ref = $lines[$i]->ref; |
|
473 | + $taskstatic->label = ($taskrole[$lines[$i]->id] ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : ''); |
|
474 | + print $taskstatic->getNomUrl(1, 'withproject'); |
|
475 | 475 | } |
476 | 476 | print '</td>'; |
477 | 477 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | print "<td>"; |
480 | 480 | if ($showlineingray) print '<i>'; |
481 | 481 | //else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">'; |
482 | - for ($k = 0 ; $k < $level ; $k++) |
|
482 | + for ($k = 0; $k < $level; $k++) |
|
483 | 483 | { |
484 | 484 | print " "; |
485 | 485 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | // Date start |
492 | 492 | print '<td align="center">'; |
493 | - print dol_print_date($lines[$i]->date_start,'dayhour'); |
|
493 | + print dol_print_date($lines[$i]->date_start, 'dayhour'); |
|
494 | 494 | print '</td>'; |
495 | 495 | |
496 | 496 | // Date end |
@@ -499,19 +499,19 @@ discard block |
||
499 | 499 | $taskstatic->progress = $lines[$i]->progress; |
500 | 500 | $taskstatic->fk_statut = $lines[$i]->status; |
501 | 501 | $taskstatic->datee = $lines[$i]->date_end; |
502 | - print dol_print_date($lines[$i]->date_end,'dayhour'); |
|
502 | + print dol_print_date($lines[$i]->date_end, 'dayhour'); |
|
503 | 503 | if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); |
504 | 504 | print '</td>'; |
505 | 505 | |
506 | - $plannedworkloadoutputformat='allhourmin'; |
|
507 | - $timespentoutputformat='allhourmin'; |
|
508 | - if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | - if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
506 | + $plannedworkloadoutputformat = 'allhourmin'; |
|
507 | + $timespentoutputformat = 'allhourmin'; |
|
508 | + if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | + if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
510 | 510 | |
511 | 511 | // Planned Workload (in working hours) |
512 | 512 | print '<td align="right">'; |
513 | - $fullhour=convertSecondToTime($lines[$i]->planned_workload,$plannedworkloadoutputformat); |
|
514 | - $workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
513 | + $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat); |
|
514 | + $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
515 | 515 | if ($lines[$i]->planned_workload != '') |
516 | 516 | { |
517 | 517 | print $fullhour; |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | // Time spent |
525 | 525 | print '<td align="right">'; |
526 | 526 | if ($showlineingray) print '<i>'; |
527 | - else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; |
|
528 | - if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,$timespentoutputformat); |
|
527 | + else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ? '' : '&withproject=1').'">'; |
|
528 | + if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); |
|
529 | 529 | else print '--:--'; |
530 | 530 | if ($showlineingray) print '</i>'; |
531 | 531 | else print '</a>'; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | print '<td align="right">'; |
536 | 536 | if ($lines[$i]->planned_workload || $lines[$i]->duration) |
537 | 537 | { |
538 | - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; |
|
538 | + if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).' %'; |
|
539 | 539 | else print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>'; |
540 | 540 | } |
541 | 541 | print '</td>'; |
@@ -549,20 +549,20 @@ discard block |
||
549 | 549 | print '</td>'; |
550 | 550 | |
551 | 551 | // Contacts of task |
552 | - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
552 | + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
553 | 553 | { |
554 | 554 | print '<td>'; |
555 | - foreach(array('internal','external') as $source) |
|
555 | + foreach (array('internal', 'external') as $source) |
|
556 | 556 | { |
557 | - $tab = $lines[$i]->liste_contact(-1,$source); |
|
558 | - $num=count($tab); |
|
559 | - if (!empty($num)){ |
|
560 | - foreach ($tab as $contacttask){ |
|
557 | + $tab = $lines[$i]->liste_contact(-1, $source); |
|
558 | + $num = count($tab); |
|
559 | + if (!empty($num)) { |
|
560 | + foreach ($tab as $contacttask) { |
|
561 | 561 | //var_dump($contacttask); |
562 | 562 | if ($source == 'internal') $c = new User($db); |
563 | 563 | else $c = new Contact($db); |
564 | 564 | $c->fetch($contacttask['id']); |
565 | - print $c->getNomUrl(1) . ' (' . $contacttask['libelle'] . ')' . '<br>'; |
|
565 | + print $c->getNomUrl(1).' ('.$contacttask['libelle'].')'.'<br>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | print "</tr>\n"; |
579 | 579 | |
580 | - if (! $showlineingray) $inc++; |
|
580 | + if (!$showlineingray) $inc++; |
|
581 | 581 | |
582 | 582 | if ($level >= 0) // Call sublevels |
583 | 583 | { |
@@ -609,16 +609,16 @@ discard block |
||
609 | 609 | print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); |
610 | 610 | print '</td>'; |
611 | 611 | print '<td align="right" class="nowrap liste_total">'; |
612 | - if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">'; |
|
612 | + if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ? '' : '&withproject=1').'">'; |
|
613 | 613 | print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); |
614 | 614 | if ($projectidfortotallink > 0) print '</a>'; |
615 | 615 | print '</td>'; |
616 | 616 | print '<td align="right" class="nowrap liste_total">'; |
617 | - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; |
|
617 | + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %'; |
|
618 | 618 | print '</td>'; |
619 | 619 | print '<td></td>'; |
620 | 620 | // Contacts of task |
621 | - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
621 | + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) |
|
622 | 622 | { |
623 | 623 | print '<td></td>'; |
624 | 624 | } |
@@ -647,48 +647,48 @@ discard block |
||
647 | 647 | * @param int $oldprojectforbreak Old project id of last project break |
648 | 648 | * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks |
649 | 649 | */ |
650 | -function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0) |
|
650 | +function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0) |
|
651 | 651 | { |
652 | 652 | global $conf, $db, $user, $bc, $langs; |
653 | 653 | global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
654 | 654 | |
655 | - $lastprojectid=0; |
|
656 | - $totalforeachline=array(); |
|
657 | - $workloadforid=array(); |
|
658 | - $lineswithoutlevel0=array(); |
|
655 | + $lastprojectid = 0; |
|
656 | + $totalforeachline = array(); |
|
657 | + $workloadforid = array(); |
|
658 | + $lineswithoutlevel0 = array(); |
|
659 | 659 | |
660 | - $numlines=count($lines); |
|
660 | + $numlines = count($lines); |
|
661 | 661 | |
662 | 662 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
663 | 663 | if ($parent == 0) // Always and only if at first level |
664 | 664 | { |
665 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
665 | + for ($i = 0; $i < $numlines; $i++) |
|
666 | 666 | { |
667 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
667 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; |
|
668 | 668 | } |
669 | 669 | } |
670 | 670 | |
671 | 671 | if (empty($oldprojectforbreak)) |
672 | 672 | { |
673 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
673 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
677 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
677 | + for ($i = 0; $i < $numlines; $i++) |
|
678 | 678 | { |
679 | 679 | if ($parent == 0) $level = 0; |
680 | 680 | |
681 | 681 | //if ($lines[$i]->fk_task_parent == $parent) |
682 | 682 | //{ |
683 | 683 | // If we want all or we have a role on task, we show it |
684 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
684 | + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) |
|
685 | 685 | { |
686 | 686 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
687 | 687 | |
688 | 688 | // Break on a new project |
689 | 689 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
690 | 690 | { |
691 | - $lastprojectid=$lines[$i]->fk_project; |
|
691 | + $lastprojectid = $lines[$i]->fk_project; |
|
692 | 692 | if ($preselectedday) |
693 | 693 | { |
694 | 694 | $projectstatic->id = $lines[$i]->fk_project; |
@@ -699,31 +699,31 @@ discard block |
||
699 | 699 | { |
700 | 700 | if ($preselectedday) |
701 | 701 | { |
702 | - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
703 | - $workloadforid[$projectstatic->id]=1; |
|
702 | + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
703 | + $workloadforid[$projectstatic->id] = 1; |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | |
707 | - $projectstatic->id=$lines[$i]->fk_project; |
|
708 | - $projectstatic->ref=$lines[$i]->project_ref; |
|
709 | - $projectstatic->title=$lines[$i]->project_label; |
|
710 | - $projectstatic->public=$lines[$i]->public; |
|
707 | + $projectstatic->id = $lines[$i]->fk_project; |
|
708 | + $projectstatic->ref = $lines[$i]->project_ref; |
|
709 | + $projectstatic->title = $lines[$i]->project_label; |
|
710 | + $projectstatic->public = $lines[$i]->public; |
|
711 | 711 | |
712 | - $taskstatic->id=$lines[$i]->task_id; |
|
713 | - $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); |
|
714 | - $taskstatic->label=$lines[$i]->task_label; |
|
715 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
716 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
712 | + $taskstatic->id = $lines[$i]->task_id; |
|
713 | + $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id); |
|
714 | + $taskstatic->label = $lines[$i]->task_label; |
|
715 | + $taskstatic->date_start = $lines[$i]->date_start; |
|
716 | + $taskstatic->date_end = $lines[$i]->date_end; |
|
717 | 717 | |
718 | - $thirdpartystatic->id=$lines[$i]->socid; |
|
719 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
720 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
718 | + $thirdpartystatic->id = $lines[$i]->socid; |
|
719 | + $thirdpartystatic->name = $lines[$i]->thirdparty_name; |
|
720 | + $thirdpartystatic->email = $lines[$i]->thirdparty_email; |
|
721 | 721 | |
722 | 722 | if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
723 | 723 | { |
724 | 724 | print '<tr class="oddeven trforbreak">'."\n"; |
725 | 725 | print '<td colspan="11">'; |
726 | - print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
726 | + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
727 | 727 | if ($projectstatic->title) |
728 | 728 | { |
729 | 729 | print ' - '; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | print "<td>"; |
749 | 749 | if ($oldprojectforbreak == -1) |
750 | 750 | { |
751 | - print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
751 | + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); |
|
752 | 752 | print '<br>'.$projectstatic->title; |
753 | 753 | } |
754 | 754 | print "</td>"; |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | // Ref |
762 | 762 | print '<td>'; |
763 | 763 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
764 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
764 | + for ($k = 0; $k < $level; $k++) print " "; |
|
765 | 765 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
766 | 766 | // Label task |
767 | 767 | print '<br>'; |
768 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
768 | + for ($k = 0; $k < $level; $k++) print " "; |
|
769 | 769 | print $taskstatic->label; |
770 | 770 | //print "<br>"; |
771 | 771 | //for ($k = 0 ; $k < $level ; $k++) print " "; |
@@ -774,47 +774,47 @@ discard block |
||
774 | 774 | |
775 | 775 | // Date |
776 | 776 | print '<td align="center">'; |
777 | - print dol_print_date($lines[$i]->timespent_datehour,'day'); |
|
777 | + print dol_print_date($lines[$i]->timespent_datehour, 'day'); |
|
778 | 778 | print '</td>'; |
779 | 779 | |
780 | - $disabledproject=1;$disabledtask=1; |
|
780 | + $disabledproject = 1; $disabledtask = 1; |
|
781 | 781 | //print "x".$lines[$i]->fk_project; |
782 | 782 | //var_dump($lines[$i]); |
783 | 783 | //var_dump($projectsrole[$lines[$i]->fk_project]); |
784 | 784 | // If at least one role for project |
785 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
785 | + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
786 | 786 | { |
787 | - $disabledproject=0; |
|
788 | - $disabledtask=0; |
|
787 | + $disabledproject = 0; |
|
788 | + $disabledtask = 0; |
|
789 | 789 | } |
790 | 790 | // If $restricteditformytask is on and I have no role on task, i disable edit |
791 | 791 | if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
792 | 792 | { |
793 | - $disabledtask=1; |
|
793 | + $disabledtask = 1; |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | // Hour |
797 | 797 | print '<td class="nowrap" align="center">'; |
798 | - print dol_print_date($lines[$i]->timespent_datehour,'hour'); |
|
798 | + print dol_print_date($lines[$i]->timespent_datehour, 'hour'); |
|
799 | 799 | print '</td>'; |
800 | 800 | |
801 | - $cssonholiday=''; |
|
802 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
803 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
804 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
801 | + $cssonholiday = ''; |
|
802 | + if (!$isavailable[$preselectedday]['morning'] && !$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayallday '; |
|
803 | + elseif (!$isavailable[$preselectedday]['morning']) $cssonholiday .= 'onholidaymorning '; |
|
804 | + elseif (!$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayafternoon '; |
|
805 | 805 | |
806 | 806 | // Duration |
807 | - print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">'; |
|
807 | + print '<td align="center" class="duration'.($cssonholiday ? ' '.$cssonholiday : '').'">'; |
|
808 | 808 | |
809 | 809 | $dayWorkLoad = $lines[$i]->timespent_duration; |
810 | - $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; |
|
810 | + $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration; |
|
811 | 811 | |
812 | - $alreadyspent=''; |
|
813 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
812 | + $alreadyspent = ''; |
|
813 | + if ($dayWorkLoad > 0) $alreadyspent = convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); |
|
814 | 814 | |
815 | - print convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
815 | + print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); |
|
816 | 816 | |
817 | - $modeinput='hours'; |
|
817 | + $modeinput = 'hours'; |
|
818 | 818 | |
819 | 819 | print '<script type="text/javascript">'; |
820 | 820 | print "jQuery(document).ready(function () {\n"; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | |
827 | 827 | // Note |
828 | 828 | print '<td align="center">'; |
829 | - print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
829 | + print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask ? ' disabled="disabled"' : '').'>'; |
|
830 | 830 | print $lines[$i]->timespent_note; |
831 | 831 | print '</textarea>'; |
832 | 832 | print '</td>'; |
@@ -873,41 +873,41 @@ discard block |
||
873 | 873 | * @param int $oldprojectforbreak Old project id of last project break |
874 | 874 | * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks |
875 | 875 | */ |
876 | -function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0) |
|
876 | +function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0) |
|
877 | 877 | { |
878 | 878 | global $conf, $db, $user, $bc, $langs; |
879 | 879 | global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
880 | 880 | |
881 | - $lastprojectid=0; |
|
882 | - $totalforeachday=array(); |
|
883 | - $workloadforid=array(); |
|
884 | - $lineswithoutlevel0=array(); |
|
881 | + $lastprojectid = 0; |
|
882 | + $totalforeachday = array(); |
|
883 | + $workloadforid = array(); |
|
884 | + $lineswithoutlevel0 = array(); |
|
885 | 885 | |
886 | - $numlines=count($lines); |
|
886 | + $numlines = count($lines); |
|
887 | 887 | |
888 | 888 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
889 | 889 | if ($parent == 0) // Always and only if at first level |
890 | 890 | { |
891 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
891 | + for ($i = 0; $i < $numlines; $i++) |
|
892 | 892 | { |
893 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
893 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | |
897 | 897 | if (empty($oldprojectforbreak)) |
898 | 898 | { |
899 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break |
|
899 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
903 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
903 | + for ($i = 0; $i < $numlines; $i++) |
|
904 | 904 | { |
905 | 905 | if ($parent == 0) $level = 0; |
906 | 906 | |
907 | 907 | if ($lines[$i]->fk_task_parent == $parent) |
908 | 908 | { |
909 | 909 | // If we want all or we have a role on task, we show it |
910 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
910 | + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) |
|
911 | 911 | { |
912 | 912 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
913 | 913 | |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | // Break on a new project |
920 | 920 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
921 | 921 | { |
922 | - $lastprojectid=$lines[$i]->fk_project; |
|
922 | + $lastprojectid = $lines[$i]->fk_project; |
|
923 | 923 | if ($preselectedday) |
924 | 924 | { |
925 | 925 | $projectstatic->id = $lines[$i]->fk_project; |
@@ -930,31 +930,31 @@ discard block |
||
930 | 930 | { |
931 | 931 | if ($preselectedday) |
932 | 932 | { |
933 | - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
934 | - $workloadforid[$projectstatic->id]=1; |
|
933 | + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
934 | + $workloadforid[$projectstatic->id] = 1; |
|
935 | 935 | } |
936 | 936 | } |
937 | 937 | |
938 | - $projectstatic->id=$lines[$i]->fk_project; |
|
939 | - $projectstatic->ref=$lines[$i]->projectref; |
|
940 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
941 | - $projectstatic->public=$lines[$i]->public; |
|
938 | + $projectstatic->id = $lines[$i]->fk_project; |
|
939 | + $projectstatic->ref = $lines[$i]->projectref; |
|
940 | + $projectstatic->title = $lines[$i]->projectlabel; |
|
941 | + $projectstatic->public = $lines[$i]->public; |
|
942 | 942 | |
943 | - $taskstatic->id=$lines[$i]->id; |
|
944 | - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
945 | - $taskstatic->label=$lines[$i]->label; |
|
946 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
947 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
943 | + $taskstatic->id = $lines[$i]->id; |
|
944 | + $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id); |
|
945 | + $taskstatic->label = $lines[$i]->label; |
|
946 | + $taskstatic->date_start = $lines[$i]->date_start; |
|
947 | + $taskstatic->date_end = $lines[$i]->date_end; |
|
948 | 948 | |
949 | - $thirdpartystatic->id=$lines[$i]->socid; |
|
950 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
951 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
949 | + $thirdpartystatic->id = $lines[$i]->socid; |
|
950 | + $thirdpartystatic->name = $lines[$i]->thirdparty_name; |
|
951 | + $thirdpartystatic->email = $lines[$i]->thirdparty_email; |
|
952 | 952 | |
953 | 953 | if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
954 | 954 | { |
955 | 955 | print '<tr class="oddeven trforbreak">'."\n"; |
956 | 956 | print '<td colspan="9">'; |
957 | - print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
957 | + print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
958 | 958 | if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
959 | 959 | if ($projectstatic->title) |
960 | 960 | { |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | // Ref |
990 | 990 | print '<td>'; |
991 | 991 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
992 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
992 | + for ($k = 0; $k < $level; $k++) print " "; |
|
993 | 993 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
994 | 994 | // Label task |
995 | 995 | print '<br>'; |
996 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
996 | + for ($k = 0; $k < $level; $k++) print " "; |
|
997 | 997 | print $taskstatic->label; |
998 | 998 | //print "<br>"; |
999 | 999 | //for ($k = 0 ; $k < $level ; $k++) print " "; |
@@ -1002,13 +1002,13 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | // Planned Workload |
1004 | 1004 | print '<td align="right" class="leftborder plannedworkload">'; |
1005 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1005 | + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); |
|
1006 | 1006 | else print '--:--'; |
1007 | 1007 | print '</td>'; |
1008 | 1008 | |
1009 | 1009 | // Progress declared % |
1010 | 1010 | print '<td align="right">'; |
1011 | - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1011 | + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress'); |
|
1012 | 1012 | print '</td>'; |
1013 | 1013 | |
1014 | 1014 | // Time spent by everybody |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | if ($lines[$i]->duration) |
1018 | 1018 | { |
1019 | 1019 | print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
1020 | - print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1020 | + print convertSecondToTime($lines[$i]->duration, 'allhourmin'); |
|
1021 | 1021 | print '</a>'; |
1022 | 1022 | } |
1023 | 1023 | else print '--:--'; |
@@ -1025,25 +1025,25 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | // Time spent by user |
1027 | 1027 | print '<td align="right">'; |
1028 | - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1029 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1028 | + $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1029 | + if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin'); |
|
1030 | 1030 | else print '--:--'; |
1031 | 1031 | print "</td>\n"; |
1032 | 1032 | |
1033 | - $disabledproject=1;$disabledtask=1; |
|
1033 | + $disabledproject = 1; $disabledtask = 1; |
|
1034 | 1034 | //print "x".$lines[$i]->fk_project; |
1035 | 1035 | //var_dump($lines[$i]); |
1036 | 1036 | //var_dump($projectsrole[$lines[$i]->fk_project]); |
1037 | 1037 | // If at least one role for project |
1038 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1038 | + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1039 | 1039 | { |
1040 | - $disabledproject=0; |
|
1041 | - $disabledtask=0; |
|
1040 | + $disabledproject = 0; |
|
1041 | + $disabledtask = 0; |
|
1042 | 1042 | } |
1043 | 1043 | // If $restricteditformytask is on and I have no role on task, i disable edit |
1044 | 1044 | if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
1045 | 1045 | { |
1046 | - $disabledtask=1; |
|
1046 | + $disabledtask = 1; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | // Form to add new time |
@@ -1052,41 +1052,41 @@ discard block |
||
1052 | 1052 | print $tableCell; |
1053 | 1053 | print '</td>'; |
1054 | 1054 | |
1055 | - $cssonholiday=''; |
|
1056 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1057 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1058 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1055 | + $cssonholiday = ''; |
|
1056 | + if (!$isavailable[$preselectedday]['morning'] && !$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayallday '; |
|
1057 | + elseif (!$isavailable[$preselectedday]['morning']) $cssonholiday .= 'onholidaymorning '; |
|
1058 | + elseif (!$isavailable[$preselectedday]['afternoon']) $cssonholiday .= 'onholidayafternoon '; |
|
1059 | 1059 | |
1060 | 1060 | global $daytoparse; |
1061 | - $tmparray = dol_getdate($daytoparse,true); // detail of current day |
|
1061 | + $tmparray = dol_getdate($daytoparse, true); // detail of current day |
|
1062 | 1062 | $idw = $tmparray['wday']; |
1063 | 1063 | |
1064 | 1064 | global $numstartworkingday, $numendworkingday; |
1065 | - $cssweekend=''; |
|
1065 | + $cssweekend = ''; |
|
1066 | 1066 | if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
1067 | 1067 | { |
1068 | - $cssweekend='weekend'; |
|
1068 | + $cssweekend = 'weekend'; |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | // Duration |
1072 | - print '<td class="center duration'.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1072 | + print '<td class="center duration'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">'; |
|
1073 | 1073 | $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; |
1074 | - $totalforeachday[$preselectedday]+=$dayWorkLoad; |
|
1074 | + $totalforeachday[$preselectedday] += $dayWorkLoad; |
|
1075 | 1075 | |
1076 | - $alreadyspent=''; |
|
1077 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1076 | + $alreadyspent = ''; |
|
1077 | + if ($dayWorkLoad > 0) $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin'); |
|
1078 | 1078 | |
1079 | 1079 | $idw = 0; |
1080 | 1080 | |
1081 | - $tableCell=''; |
|
1082 | - $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1083 | - $tableCell.='<span class="hideonsmartphone"> + </span>'; |
|
1081 | + $tableCell = ''; |
|
1082 | + $tableCell .= '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1083 | + $tableCell .= '<span class="hideonsmartphone"> + </span>'; |
|
1084 | 1084 | //$tableCell.=' '; |
1085 | - $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); |
|
1085 | + $tableCell .= $form->select_duration($lines[$i]->id.'duration', '', $disabledtask, 'text', 0, 1); |
|
1086 | 1086 | //$tableCell.=' <input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">'; |
1087 | 1087 | print $tableCell; |
1088 | 1088 | |
1089 | - $modeinput='hours'; |
|
1089 | + $modeinput = 'hours'; |
|
1090 | 1090 | |
1091 | 1091 | print '<script type="text/javascript">'; |
1092 | 1092 | print "jQuery(document).ready(function () {\n"; |
@@ -1098,19 +1098,19 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | // Note |
1100 | 1100 | print '<td align="center">'; |
1101 | - print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask?' disabled="disabled"':'').'>'; |
|
1101 | + print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask ? ' disabled="disabled"' : '').'>'; |
|
1102 | 1102 | print '</textarea>'; |
1103 | 1103 | print '</td>'; |
1104 | 1104 | |
1105 | 1105 | // Warning |
1106 | 1106 | print '<td align="right">'; |
1107 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1107 | + if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); |
|
1108 | 1108 | else if ($disabledtask) |
1109 | 1109 | { |
1110 | 1110 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
1111 | 1111 | if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
1112 | 1112 | |
1113 | - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1113 | + print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1114 | 1114 | } |
1115 | 1115 | print '</td>'; |
1116 | 1116 | |
@@ -1126,9 +1126,9 @@ discard block |
||
1126 | 1126 | $ret = projectLinesPerDay($inc, $lines[$i]->id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak); |
1127 | 1127 | //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
1128 | 1128 | //var_dump($ret); |
1129 | - foreach($ret as $key => $val) |
|
1129 | + foreach ($ret as $key => $val) |
|
1130 | 1130 | { |
1131 | - $totalforeachday[$key]+=$val; |
|
1131 | + $totalforeachday[$key] += $val; |
|
1132 | 1132 | } |
1133 | 1133 | //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
1134 | 1134 | //var_dump($totalforeachday); |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | * @param int $oldprojectforbreak Old project id of last project break |
1163 | 1163 | * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks |
1164 | 1164 | */ |
1165 | -function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0) |
|
1165 | +function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0) |
|
1166 | 1166 | { |
1167 | 1167 | global $conf, $db, $user, $bc, $langs; |
1168 | 1168 | global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; |
1169 | 1169 | |
1170 | - $numlines=count($lines); |
|
1170 | + $numlines = count($lines); |
|
1171 | 1171 | |
1172 | - $lastprojectid=0; |
|
1173 | - $workloadforid=array(); |
|
1174 | - $totalforeachday=array(); |
|
1175 | - $lineswithoutlevel0=array(); |
|
1172 | + $lastprojectid = 0; |
|
1173 | + $workloadforid = array(); |
|
1174 | + $totalforeachday = array(); |
|
1175 | + $lineswithoutlevel0 = array(); |
|
1176 | 1176 | |
1177 | 1177 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
1178 | 1178 | if ($parent == 0) // Always and only if at first level |
1179 | 1179 | { |
1180 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1180 | + for ($i = 0; $i < $numlines; $i++) |
|
1181 | 1181 | { |
1182 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
1182 | + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1187,17 +1187,17 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | if (empty($oldprojectforbreak)) |
1189 | 1189 | { |
1190 | - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break |
|
1190 | + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1193 | + for ($i = 0; $i < $numlines; $i++) |
|
1194 | 1194 | { |
1195 | 1195 | if ($parent == 0) $level = 0; |
1196 | 1196 | |
1197 | 1197 | if ($lines[$i]->fk_task_parent == $parent) |
1198 | 1198 | { |
1199 | 1199 | // If we want all or we have a role on task, we show it |
1200 | - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) |
|
1200 | + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) |
|
1201 | 1201 | { |
1202 | 1202 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
1203 | 1203 | |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | // Break on a new project |
1210 | 1210 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
1211 | 1211 | { |
1212 | - $lastprojectid=$lines[$i]->fk_project; |
|
1212 | + $lastprojectid = $lines[$i]->fk_project; |
|
1213 | 1213 | $projectstatic->id = $lines[$i]->fk_project; |
1214 | 1214 | } |
1215 | 1215 | |
@@ -1217,33 +1217,33 @@ discard block |
||
1217 | 1217 | //var_dump($projectstatic->weekWorkLoadPerTask); |
1218 | 1218 | if (empty($workloadforid[$projectstatic->id])) |
1219 | 1219 | { |
1220 | - $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
1221 | - $workloadforid[$projectstatic->id]=1; |
|
1220 | + $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week |
|
1221 | + $workloadforid[$projectstatic->id] = 1; |
|
1222 | 1222 | } |
1223 | 1223 | //var_dump($projectstatic->weekWorkLoadPerTask); |
1224 | 1224 | //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); |
1225 | 1225 | |
1226 | - $projectstatic->id=$lines[$i]->fk_project; |
|
1227 | - $projectstatic->ref=$lines[$i]->projectref; |
|
1228 | - $projectstatic->title=$lines[$i]->projectlabel; |
|
1229 | - $projectstatic->public=$lines[$i]->public; |
|
1230 | - $projectstatic->thirdparty_name=$lines[$i]->thirdparty_name; |
|
1226 | + $projectstatic->id = $lines[$i]->fk_project; |
|
1227 | + $projectstatic->ref = $lines[$i]->projectref; |
|
1228 | + $projectstatic->title = $lines[$i]->projectlabel; |
|
1229 | + $projectstatic->public = $lines[$i]->public; |
|
1230 | + $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name; |
|
1231 | 1231 | |
1232 | - $taskstatic->id=$lines[$i]->id; |
|
1233 | - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); |
|
1234 | - $taskstatic->label=$lines[$i]->label; |
|
1235 | - $taskstatic->date_start=$lines[$i]->date_start; |
|
1236 | - $taskstatic->date_end=$lines[$i]->date_end; |
|
1232 | + $taskstatic->id = $lines[$i]->id; |
|
1233 | + $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id); |
|
1234 | + $taskstatic->label = $lines[$i]->label; |
|
1235 | + $taskstatic->date_start = $lines[$i]->date_start; |
|
1236 | + $taskstatic->date_end = $lines[$i]->date_end; |
|
1237 | 1237 | |
1238 | - $thirdpartystatic->id=$lines[$i]->thirdparty_id; |
|
1239 | - $thirdpartystatic->name=$lines[$i]->thirdparty_name; |
|
1240 | - $thirdpartystatic->email=$lines[$i]->thirdparty_email; |
|
1238 | + $thirdpartystatic->id = $lines[$i]->thirdparty_id; |
|
1239 | + $thirdpartystatic->name = $lines[$i]->thirdparty_name; |
|
1240 | + $thirdpartystatic->email = $lines[$i]->thirdparty_email; |
|
1241 | 1241 | |
1242 | 1242 | if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) |
1243 | 1243 | { |
1244 | 1244 | print '<tr class="oddeven trforbreak">'."\n"; |
1245 | 1245 | print '<td colspan="13">'; |
1246 | - print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
1246 | + print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
|
1247 | 1247 | if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
1248 | 1248 | if ($projectstatic->title) |
1249 | 1249 | { |
@@ -1278,11 +1278,11 @@ discard block |
||
1278 | 1278 | // Ref |
1279 | 1279 | print '<td class="nowrap">'; |
1280 | 1280 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
1281 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1281 | + for ($k = 0; $k < $level; $k++) print " "; |
|
1282 | 1282 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
1283 | 1283 | // Label task |
1284 | 1284 | print '<br>'; |
1285 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1285 | + for ($k = 0; $k < $level; $k++) print " "; |
|
1286 | 1286 | //print $taskstatic->getNomUrl(0, 'withproject', 'time'); |
1287 | 1287 | print $taskstatic->label; |
1288 | 1288 | //print "<br>"; |
@@ -1292,13 +1292,13 @@ discard block |
||
1292 | 1292 | |
1293 | 1293 | // Planned Workload |
1294 | 1294 | print '<td align="right" class="leftborder plannedworkload">'; |
1295 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1295 | + if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin'); |
|
1296 | 1296 | else print '--:--'; |
1297 | 1297 | print '</td>'; |
1298 | 1298 | |
1299 | 1299 | // Progress declared % |
1300 | 1300 | print '<td align="right">'; |
1301 | - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); |
|
1301 | + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress'); |
|
1302 | 1302 | print '</td>'; |
1303 | 1303 | |
1304 | 1304 | // Time spent by everybody |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | if ($lines[$i]->duration) |
1308 | 1308 | { |
1309 | 1309 | print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
1310 | - print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
|
1310 | + print convertSecondToTime($lines[$i]->duration, 'allhourmin'); |
|
1311 | 1311 | print '</a>'; |
1312 | 1312 | } |
1313 | 1313 | else print '--:--'; |
@@ -1315,80 +1315,80 @@ discard block |
||
1315 | 1315 | |
1316 | 1316 | // Time spent by user |
1317 | 1317 | print '<td align="right">'; |
1318 | - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1319 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1318 | + $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id); |
|
1319 | + if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin'); |
|
1320 | 1320 | else print '--:--'; |
1321 | 1321 | print "</td>\n"; |
1322 | 1322 | |
1323 | - $disabledproject=1;$disabledtask=1; |
|
1323 | + $disabledproject = 1; $disabledtask = 1; |
|
1324 | 1324 | //print "x".$lines[$i]->fk_project; |
1325 | 1325 | //var_dump($lines[$i]); |
1326 | 1326 | //var_dump($projectsrole[$lines[$i]->fk_project]); |
1327 | 1327 | // If at least one role for project |
1328 | - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1328 | + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) |
|
1329 | 1329 | { |
1330 | - $disabledproject=0; |
|
1331 | - $disabledtask=0; |
|
1330 | + $disabledproject = 0; |
|
1331 | + $disabledtask = 0; |
|
1332 | 1332 | } |
1333 | 1333 | // If $restricteditformytask is on and I have no role on task, i disable edit |
1334 | 1334 | if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) |
1335 | 1335 | { |
1336 | - $disabledtask=1; |
|
1336 | + $disabledtask = 1; |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | //var_dump($projectstatic->weekWorkLoadPerTask); |
1340 | 1340 | |
1341 | 1341 | // Fields to show current time |
1342 | - $tableCell=''; $modeinput='hours'; |
|
1342 | + $tableCell = ''; $modeinput = 'hours'; |
|
1343 | 1343 | for ($idw = 0; $idw < 7; $idw++) |
1344 | 1344 | { |
1345 | - $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
|
1345 | + $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
|
1346 | 1346 | |
1347 | - $cssonholiday=''; |
|
1348 | - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1349 | - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1350 | - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1347 | + $cssonholiday = ''; |
|
1348 | + if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayallday '; |
|
1349 | + elseif (!$isavailable[$tmpday]['morning']) $cssonholiday .= 'onholidaymorning '; |
|
1350 | + elseif (!$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayafternoon '; |
|
1351 | 1351 | |
1352 | - $tmparray=dol_getdate($tmpday); |
|
1352 | + $tmparray = dol_getdate($tmpday); |
|
1353 | 1353 | $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; |
1354 | - $totalforeachday[$tmpday]+=$dayWorkLoad; |
|
1354 | + $totalforeachday[$tmpday] += $dayWorkLoad; |
|
1355 | 1355 | |
1356 | - $alreadyspent=''; |
|
1357 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1358 | - $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); |
|
1356 | + $alreadyspent = ''; |
|
1357 | + if ($dayWorkLoad > 0) $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin'); |
|
1358 | + $alttitle = $langs->trans("AddHereTimeSpentForDay", $tmparray['day'], $tmparray['mon']); |
|
1359 | 1359 | |
1360 | 1360 | global $numstartworkingday, $numendworkingday; |
1361 | - $cssweekend=''; |
|
1361 | + $cssweekend = ''; |
|
1362 | 1362 | if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
1363 | 1363 | { |
1364 | - $cssweekend='weekend'; |
|
1364 | + $cssweekend = 'weekend'; |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | - $tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
|
1368 | - $placeholder=''; |
|
1367 | + $tableCell = '<td align="center" class="hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">'; |
|
1368 | + $placeholder = ''; |
|
1369 | 1369 | if ($alreadyspent) |
1370 | 1370 | { |
1371 | - $tableCell.='<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1371 | + $tableCell .= '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>'; |
|
1372 | 1372 | //$placeholder=' placeholder="00:00"'; |
1373 | 1373 | //$tableCell.='+'; |
1374 | 1374 | } |
1375 | - $tableCell.='<input type="text" alt="'.($disabledtask?'':$alttitle).'" title="'.($disabledtask?'':$alttitle).'" '.($disabledtask?'disabled':$placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; |
|
1376 | - $tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"'; |
|
1377 | - $tableCell.=' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"'; |
|
1378 | - $tableCell.=' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />'; |
|
1379 | - $tableCell.='</td>'; |
|
1375 | + $tableCell .= '<input type="text" alt="'.($disabledtask ? '' : $alttitle).'" title="'.($disabledtask ? '' : $alttitle).'" '.($disabledtask ? 'disabled' : $placeholder).' class="center smallpadd" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; |
|
1376 | + $tableCell .= ' onkeypress="return regexEvent(this,event,\'timeChar\')"'; |
|
1377 | + $tableCell .= ' onkeyup="updateTotal('.$idw.',\''.$modeinput.'\')"'; |
|
1378 | + $tableCell .= ' onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />'; |
|
1379 | + $tableCell .= '</td>'; |
|
1380 | 1380 | print $tableCell; |
1381 | 1381 | } |
1382 | 1382 | |
1383 | 1383 | // Warning |
1384 | 1384 | print '<td align="right">'; |
1385 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1385 | + if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); |
|
1386 | 1386 | else if ($disabledtask) |
1387 | 1387 | { |
1388 | 1388 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
1389 | 1389 | if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
1390 | 1390 | |
1391 | - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1391 | + print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
|
1392 | 1392 | } |
1393 | 1393 | print '</td>'; |
1394 | 1394 | |
@@ -1405,9 +1405,9 @@ discard block |
||
1405 | 1405 | $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak); |
1406 | 1406 | //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); |
1407 | 1407 | //var_dump($ret); |
1408 | - foreach($ret as $key => $val) |
|
1408 | + foreach ($ret as $key => $val) |
|
1409 | 1409 | { |
1410 | - $totalforeachday[$key]+=$val; |
|
1410 | + $totalforeachday[$key] += $val; |
|
1411 | 1411 | } |
1412 | 1412 | //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); |
1413 | 1413 | //var_dump($totalforeachday); |
@@ -1436,8 +1436,8 @@ discard block |
||
1436 | 1436 | function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) |
1437 | 1437 | { |
1438 | 1438 | //print 'Search in line with parent id = '.$parent.'<br>'; |
1439 | - $numlines=count($lines); |
|
1440 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1439 | + $numlines = count($lines); |
|
1440 | + for ($i = 0; $i < $numlines; $i++) |
|
1441 | 1441 | { |
1442 | 1442 | // Process line $lines[$i] |
1443 | 1443 | if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent) |
@@ -1473,52 +1473,52 @@ discard block |
||
1473 | 1473 | * @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', ) |
1474 | 1474 | * @return void |
1475 | 1475 | */ |
1476 | -function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=0, $statut=-1, $listofoppstatus=array(),$hiddenfields=array()) |
|
1476 | +function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array(), $hiddenfields = array()) |
|
1477 | 1477 | { |
1478 | - global $langs,$conf,$user,$bc; |
|
1478 | + global $langs, $conf, $user, $bc; |
|
1479 | 1479 | |
1480 | 1480 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
1481 | 1481 | |
1482 | - $projectstatic=new Project($db); |
|
1483 | - $thirdpartystatic=new Societe($db); |
|
1482 | + $projectstatic = new Project($db); |
|
1483 | + $thirdpartystatic = new Societe($db); |
|
1484 | 1484 | |
1485 | - $sortfield=''; |
|
1486 | - $sortorder=''; |
|
1487 | - $project_year_filter=0; |
|
1485 | + $sortfield = ''; |
|
1486 | + $sortorder = ''; |
|
1487 | + $project_year_filter = 0; |
|
1488 | 1488 | |
1489 | - $title=$langs->trans("Projects"); |
|
1490 | - if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1489 | + $title = $langs->trans("Projects"); |
|
1490 | + if (strcmp($statut, '') && $statut >= 0) $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1491 | 1491 | |
1492 | - $arrayidtypeofcontact=array(); |
|
1492 | + $arrayidtypeofcontact = array(); |
|
1493 | 1493 | |
1494 | 1494 | print '<div class="div-table-responsive-no-min">'; |
1495 | 1495 | print '<table class="noborder" width="100%">'; |
1496 | 1496 | |
1497 | - $sql= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1497 | + $sql = " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1498 | 1498 | if ($mytasks) |
1499 | 1499 | { |
1500 | - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
1501 | - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
1502 | - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
1500 | + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
1501 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
1502 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
1503 | 1503 | } |
1504 | 1504 | else |
1505 | 1505 | { |
1506 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1506 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1507 | 1507 | } |
1508 | - $sql.= " WHERE p.entity IN (".getEntity('project').")"; |
|
1509 | - $sql.= " AND p.rowid IN (".$projectsListId.")"; |
|
1510 | - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1508 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
1509 | + $sql .= " AND p.rowid IN (".$projectsListId.")"; |
|
1510 | + if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1511 | 1511 | if ($mytasks) |
1512 | 1512 | { |
1513 | - $sql.= " AND p.rowid = t.fk_projet"; |
|
1514 | - $sql.= " AND ec.element_id = t.rowid"; |
|
1515 | - $sql.= " AND ec.fk_socpeople = ".$user->id; |
|
1516 | - $sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact |
|
1517 | - $sql.= " AND ctc.element = 'project_task'"; |
|
1513 | + $sql .= " AND p.rowid = t.fk_projet"; |
|
1514 | + $sql .= " AND ec.element_id = t.rowid"; |
|
1515 | + $sql .= " AND ec.fk_socpeople = ".$user->id; |
|
1516 | + $sql .= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact |
|
1517 | + $sql .= " AND ctc.element = 'project_task'"; |
|
1518 | 1518 | } |
1519 | 1519 | if ($statut >= 0) |
1520 | 1520 | { |
1521 | - $sql.= " AND p.fk_statut = ".$statut; |
|
1521 | + $sql .= " AND p.fk_statut = ".$statut; |
|
1522 | 1522 | } |
1523 | 1523 | if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) |
1524 | 1524 | { |
@@ -1530,40 +1530,40 @@ discard block |
||
1530 | 1530 | { |
1531 | 1531 | $project_year_filter = date("Y"); |
1532 | 1532 | } |
1533 | - $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; |
|
1534 | - $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; |
|
1533 | + $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")"; |
|
1534 | + $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")"; |
|
1535 | 1535 | } |
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | // Get id of project we must show tasks |
1539 | - $arrayidofprojects=array(); |
|
1539 | + $arrayidofprojects = array(); |
|
1540 | 1540 | $sql1 = "SELECT p.rowid as projectid"; |
1541 | - $sql1.= $sql; |
|
1541 | + $sql1 .= $sql; |
|
1542 | 1542 | $resql = $db->query($sql1); |
1543 | 1543 | if ($resql) |
1544 | 1544 | { |
1545 | - $i=0; |
|
1545 | + $i = 0; |
|
1546 | 1546 | $num = $db->num_rows($resql); |
1547 | 1547 | while ($i < $num) |
1548 | 1548 | { |
1549 | 1549 | $objp = $db->fetch_object($resql); |
1550 | - $arrayidofprojects[$objp->projectid]=$objp->projectid; |
|
1550 | + $arrayidofprojects[$objp->projectid] = $objp->projectid; |
|
1551 | 1551 | $i++; |
1552 | 1552 | } |
1553 | 1553 | } |
1554 | 1554 | else dol_print_error($db); |
1555 | - if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1; |
|
1555 | + if (empty($arrayidofprojects)) $arrayidofprojects[0] = -1; |
|
1556 | 1556 | |
1557 | 1557 | // Get list of project with calculation on tasks |
1558 | 1558 | $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; |
1559 | - $sql2.= " p.dateo, p.datee,"; |
|
1560 | - $sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; |
|
1561 | - $sql2.= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1562 | - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; |
|
1563 | - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1564 | - $sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")"; |
|
1565 | - $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; |
|
1566 | - $sql2.= " ORDER BY p.title, p.ref"; |
|
1559 | + $sql2 .= " p.dateo, p.datee,"; |
|
1560 | + $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload"; |
|
1561 | + $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
1562 | + $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; |
|
1563 | + $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
|
1564 | + $sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")"; |
|
1565 | + $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; |
|
1566 | + $sql2 .= " ORDER BY p.title, p.ref"; |
|
1567 | 1567 | |
1568 | 1568 | $resql = $db->query($sql2); |
1569 | 1569 | if ($resql) |
@@ -1576,24 +1576,24 @@ discard block |
||
1576 | 1576 | $i = 0; |
1577 | 1577 | |
1578 | 1578 | print '<tr class="liste_titre">'; |
1579 | - print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1580 | - print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); |
|
1581 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1579 | + print_liste_field_titre($title.' <span class="badge">'.$num.'</span>', $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); |
|
1580 | + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); |
|
1581 | + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1582 | 1582 | { |
1583 | - print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder); |
|
1584 | - print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder); |
|
1583 | + print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1584 | + print_liste_field_titre("OpportunityStatus", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1585 | 1585 | } |
1586 | 1586 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
1587 | 1587 | { |
1588 | - print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder); |
|
1589 | - if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); |
|
1590 | - if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); |
|
1588 | + print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1589 | + if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1590 | + if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1591 | 1591 | } |
1592 | - print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); |
|
1592 | + print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder); |
|
1593 | 1593 | print "</tr>\n"; |
1594 | 1594 | |
1595 | - $total_plannedworkload=0; |
|
1596 | - $total_declaredprogressworkload=0; |
|
1595 | + $total_plannedworkload = 0; |
|
1596 | + $total_declaredprogressworkload = 0; |
|
1597 | 1597 | while ($i < $num) |
1598 | 1598 | { |
1599 | 1599 | $objp = $db->fetch_object($resql); |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | $userAccess = $projectstatic->restrictedProjectArea($user); |
1607 | 1607 | if ($userAccess >= 0) |
1608 | 1608 | { |
1609 | - $projectstatic->ref=$objp->ref; |
|
1609 | + $projectstatic->ref = $objp->ref; |
|
1610 | 1610 | $projectstatic->statut = $objp->status; |
1611 | 1611 | $projectstatic->title = $objp->title; |
1612 | 1612 | $projectstatic->datee = $db->jdate($objp->datee); |
@@ -1616,18 +1616,18 @@ discard block |
||
1616 | 1616 | print '<tr class="oddeven">'; |
1617 | 1617 | print '<td>'; |
1618 | 1618 | print $projectstatic->getNomUrl(1); |
1619 | - if (! in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title,24); |
|
1619 | + if (!in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title, 24); |
|
1620 | 1620 | print '</td>'; |
1621 | 1621 | print '<td>'; |
1622 | 1622 | if ($objp->fk_soc > 0) |
1623 | 1623 | { |
1624 | - $thirdpartystatic->id=$objp->fk_soc; |
|
1625 | - $thirdpartystatic->ref=$objp->socname; |
|
1626 | - $thirdpartystatic->name=$objp->socname; |
|
1624 | + $thirdpartystatic->id = $objp->fk_soc; |
|
1625 | + $thirdpartystatic->ref = $objp->socname; |
|
1626 | + $thirdpartystatic->name = $objp->socname; |
|
1627 | 1627 | print $thirdpartystatic->getNomUrl(1); |
1628 | 1628 | } |
1629 | 1629 | print '</td>'; |
1630 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1630 | + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1631 | 1631 | { |
1632 | 1632 | print '<td align="right">'; |
1633 | 1633 | if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); |
@@ -1641,19 +1641,19 @@ discard block |
||
1641 | 1641 | { |
1642 | 1642 | print '<td align="right">'.$objp->nb.'</td>'; |
1643 | 1643 | |
1644 | - $plannedworkload=$objp->planned_workload; |
|
1645 | - $total_plannedworkload+=$plannedworkload; |
|
1646 | - if (! in_array('plannedworkload', $hiddenfields)) |
|
1644 | + $plannedworkload = $objp->planned_workload; |
|
1645 | + $total_plannedworkload += $plannedworkload; |
|
1646 | + if (!in_array('plannedworkload', $hiddenfields)) |
|
1647 | 1647 | { |
1648 | - print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>'; |
|
1648 | + print '<td align="right">'.($plannedworkload ?convertSecondToTime($plannedworkload) : '').'</td>'; |
|
1649 | 1649 | } |
1650 | - if (! in_array('declaredprogress', $hiddenfields)) |
|
1650 | + if (!in_array('declaredprogress', $hiddenfields)) |
|
1651 | 1651 | { |
1652 | - $declaredprogressworkload=$objp->declared_progess_workload; |
|
1653 | - $total_declaredprogressworkload+=$declaredprogressworkload; |
|
1652 | + $declaredprogressworkload = $objp->declared_progess_workload; |
|
1653 | + $total_declaredprogressworkload += $declaredprogressworkload; |
|
1654 | 1654 | print '<td align="right">'; |
1655 | 1655 | //print $objp->planned_workload.'-'.$objp->declared_progess_workload."<br>"; |
1656 | - print ($plannedworkload?round(100*$declaredprogressworkload/$plannedworkload,0).'%':''); |
|
1656 | + print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); |
|
1657 | 1657 | print '</td>'; |
1658 | 1658 | } |
1659 | 1659 | } |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | |
1672 | 1672 | print '<tr class="liste_total">'; |
1673 | 1673 | print '<td colspan="2">'.$langs->trans("Total")."</td>"; |
1674 | - if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1674 | + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
|
1675 | 1675 | { |
1676 | 1676 | print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>'; |
1677 | 1677 | print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>'; |
@@ -1679,8 +1679,8 @@ discard block |
||
1679 | 1679 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
1680 | 1680 | { |
1681 | 1681 | print '<td class="liste_total" align="right">'.$total_task.'</td>'; |
1682 | - if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; |
|
1683 | - if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>'; |
|
1682 | + if (!in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').'</td>'; |
|
1683 | + if (!in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'</td>'; |
|
1684 | 1684 | } |
1685 | 1685 | print '<td class="liste_total"></td>'; |
1686 | 1686 | print '</tr>'; |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
49 | 49 | $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; |
50 | 50 | $head[$h][1] = $langs->trans("ProjectContact"); |
51 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
51 | + if ($nbContact > 0) { |
|
52 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
53 | + } |
|
52 | 54 | $head[$h][2] = 'contact'; |
53 | 55 | $h++; |
54 | 56 | |
@@ -61,7 +63,9 @@ discard block |
||
61 | 63 | require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
62 | 64 | $taskstatic=new Task($db); |
63 | 65 | $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); |
64 | - if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>'; |
|
66 | + if ($nbTasks > 0) { |
|
67 | + $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>'; |
|
68 | + } |
|
65 | 69 | $head[$h][2] = 'tasks'; |
66 | 70 | $h++; |
67 | 71 | |
@@ -76,13 +80,18 @@ discard block |
||
76 | 80 | if ($resql) |
77 | 81 | { |
78 | 82 | $obj = $db->fetch_object($resql); |
79 | - if ($obj) $nbTimeSpent=1; |
|
83 | + if ($obj) { |
|
84 | + $nbTimeSpent=1; |
|
85 | + } |
|
86 | + } else { |
|
87 | + dol_print_error($db); |
|
80 | 88 | } |
81 | - else dol_print_error($db); |
|
82 | 89 | |
83 | 90 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; |
84 | 91 | $head[$h][1] = $langs->trans("TimeSpent"); |
85 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
92 | + if ($nbTimeSpent > 0) { |
|
93 | + $head[$h][1].= ' <span class="badge">...</span>'; |
|
94 | + } |
|
86 | 95 | $head[$h][2] = 'timespent'; |
87 | 96 | $h++; |
88 | 97 | } |
@@ -107,11 +116,17 @@ discard block |
||
107 | 116 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
108 | 117 | { |
109 | 118 | $nbNote = 0; |
110 | - if(!empty($object->note_private)) $nbNote++; |
|
111 | - if(!empty($object->note_public)) $nbNote++; |
|
119 | + if(!empty($object->note_private)) { |
|
120 | + $nbNote++; |
|
121 | + } |
|
122 | + if(!empty($object->note_public)) { |
|
123 | + $nbNote++; |
|
124 | + } |
|
112 | 125 | $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; |
113 | 126 | $head[$h][1] = $langs->trans('Notes'); |
114 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
127 | + if ($nbNote > 0) { |
|
128 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
129 | + } |
|
115 | 130 | $head[$h][2] = 'notes'; |
116 | 131 | $h++; |
117 | 132 | } |
@@ -123,7 +138,9 @@ discard block |
||
123 | 138 | $nbLinks=Link::count($db, $object->element, $object->id); |
124 | 139 | $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; |
125 | 140 | $head[$h][1] = $langs->trans('Documents'); |
126 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
141 | + if (($nbFiles+$nbLinks) > 0) { |
|
142 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
143 | + } |
|
127 | 144 | $head[$h][2] = 'document'; |
128 | 145 | $h++; |
129 | 146 | |
@@ -133,7 +150,9 @@ discard block |
||
133 | 150 | $nbComments = $object->getNbComments(); |
134 | 151 | $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; |
135 | 152 | $head[$h][1] = $langs->trans("CommentLink"); |
136 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
153 | + if ($nbComments > 0) { |
|
154 | + $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
155 | + } |
|
137 | 156 | $head[$h][2] = 'project_comment'; |
138 | 157 | $h++; |
139 | 158 | } |
@@ -174,7 +193,9 @@ discard block |
||
174 | 193 | $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
175 | 194 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
176 | 195 | $head[$h][1] = $langs->trans("TaskRessourceLinks"); |
177 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
196 | + if ($nbContact > 0) { |
|
197 | + $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
198 | + } |
|
178 | 199 | $head[$h][2] = 'task_contact'; |
179 | 200 | $h++; |
180 | 201 | |
@@ -189,13 +210,18 @@ discard block |
||
189 | 210 | if ($resql) |
190 | 211 | { |
191 | 212 | $obj = $db->fetch_object($resql); |
192 | - if ($obj) $nbTimeSpent=1; |
|
213 | + if ($obj) { |
|
214 | + $nbTimeSpent=1; |
|
215 | + } |
|
216 | + } else { |
|
217 | + dol_print_error($db); |
|
193 | 218 | } |
194 | - else dol_print_error($db); |
|
195 | 219 | |
196 | 220 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
197 | 221 | $head[$h][1] = $langs->trans("TimeSpent"); |
198 | - if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>'; |
|
222 | + if ($nbTimeSpent > 0) { |
|
223 | + $head[$h][1].= ' <span class="badge">...</span>'; |
|
224 | + } |
|
199 | 225 | $head[$h][2] = 'task_time'; |
200 | 226 | $h++; |
201 | 227 | |
@@ -208,11 +234,17 @@ discard block |
||
208 | 234 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
209 | 235 | { |
210 | 236 | $nbNote = 0; |
211 | - if(!empty($object->note_private)) $nbNote++; |
|
212 | - if(!empty($object->note_public)) $nbNote++; |
|
237 | + if(!empty($object->note_private)) { |
|
238 | + $nbNote++; |
|
239 | + } |
|
240 | + if(!empty($object->note_public)) { |
|
241 | + $nbNote++; |
|
242 | + } |
|
213 | 243 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/note.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
214 | 244 | $head[$h][1] = $langs->trans('Notes'); |
215 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
245 | + if ($nbNote > 0) { |
|
246 | + $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
247 | + } |
|
216 | 248 | $head[$h][2] = 'task_notes'; |
217 | 249 | $h++; |
218 | 250 | } |
@@ -224,7 +256,9 @@ discard block |
||
224 | 256 | $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$')); |
225 | 257 | $nbLinks=Link::count($db, $object->element, $object->id); |
226 | 258 | $head[$h][1] = $langs->trans('Documents'); |
227 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
259 | + if (($nbFiles+$nbLinks) > 0) { |
|
260 | + $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
261 | + } |
|
228 | 262 | $head[$h][2] = 'task_document'; |
229 | 263 | $h++; |
230 | 264 | |
@@ -234,7 +268,9 @@ discard block |
||
234 | 268 | $nbComments = $object->getNbComments(); |
235 | 269 | $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); |
236 | 270 | $head[$h][1] = $langs->trans("CommentLink"); |
237 | - if ($nbComments > 0) $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
271 | + if ($nbComments > 0) { |
|
272 | + $head[$h][1].= ' <span class="badge">'.$nbComments.'</span>'; |
|
273 | + } |
|
238 | 274 | $head[$h][2] = 'task_comment'; |
239 | 275 | $h++; |
240 | 276 | } |
@@ -261,7 +297,9 @@ discard block |
||
261 | 297 | |
262 | 298 | $param=''; |
263 | 299 | $param.=($mode?'&mode='.$mode:''); |
264 | - if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param.='&search_usertoprocessid='.$fuser->id; |
|
300 | + if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) { |
|
301 | + $param.='&search_usertoprocessid='.$fuser->id; |
|
302 | + } |
|
265 | 303 | |
266 | 304 | if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) |
267 | 305 | { |
@@ -380,15 +418,20 @@ discard block |
||
380 | 418 | |
381 | 419 | for ($i = 0 ; $i < $numlines ; $i++) |
382 | 420 | { |
383 | - if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
421 | + if ($parent == 0 && $level >= 0) { |
|
422 | + $level = 0; |
|
423 | + } |
|
424 | + // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
384 | 425 | |
385 | 426 | // Process line |
386 | 427 | // print "i:".$i."-".$lines[$i]->fk_project.'<br>'; |
387 | 428 | |
388 | - if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
429 | + if ($lines[$i]->fk_parent == $parent || $level < 0) { |
|
430 | + // if $level = -1, we dont' use sublevel recursion, we show all lines |
|
389 | 431 | { |
390 | 432 | // Show task line. |
391 | 433 | $showline=1; |
434 | + } |
|
392 | 435 | $showlineingray=0; |
393 | 436 | |
394 | 437 | // If there is filters to use |
@@ -404,14 +447,12 @@ discard block |
||
404 | 447 | if ($foundtaskforuserdeeper > 0) |
405 | 448 | { |
406 | 449 | $showlineingray=1; // We will show line but in gray |
407 | - } |
|
408 | - else |
|
450 | + } else |
|
409 | 451 | { |
410 | 452 | $showline=0; // No reason to show line |
411 | 453 | } |
412 | 454 | } |
413 | - } |
|
414 | - else |
|
455 | + } else |
|
415 | 456 | { |
416 | 457 | // Caller did not ask to filter on tasks of a specific user (this probably means he want also tasks of all users, into public project |
417 | 458 | // or into all other projects if user has permission to). |
@@ -448,8 +489,11 @@ discard block |
||
448 | 489 | $projectstatic->ref=$lines[$i]->projectref; |
449 | 490 | $projectstatic->public=$lines[$i]->public; |
450 | 491 | $projectstatic->title=$lines[$i]->projectlabel; |
451 | - if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); |
|
452 | - else print $projectstatic->getNomUrl(1,'nolink'); |
|
492 | + if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) { |
|
493 | + print $projectstatic->getNomUrl(1); |
|
494 | + } else { |
|
495 | + print $projectstatic->getNomUrl(1,'nolink'); |
|
496 | + } |
|
453 | 497 | //if ($showlineingray) print '</i>'; |
454 | 498 | print "</td>"; |
455 | 499 | |
@@ -465,8 +509,7 @@ discard block |
||
465 | 509 | if ($showlineingray) |
466 | 510 | { |
467 | 511 | print '<i>'.img_object('','projecttask').' '.$lines[$i]->ref.'</i>'; |
468 | - } |
|
469 | - else |
|
512 | + } else |
|
470 | 513 | { |
471 | 514 | $taskstatic->id=$lines[$i]->id; |
472 | 515 | $taskstatic->ref=$lines[$i]->ref; |
@@ -477,14 +520,18 @@ discard block |
||
477 | 520 | |
478 | 521 | // Title of task |
479 | 522 | print "<td>"; |
480 | - if ($showlineingray) print '<i>'; |
|
523 | + if ($showlineingray) { |
|
524 | + print '<i>'; |
|
525 | + } |
|
481 | 526 | //else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">'; |
482 | 527 | for ($k = 0 ; $k < $level ; $k++) |
483 | 528 | { |
484 | 529 | print " "; |
485 | 530 | } |
486 | 531 | print $lines[$i]->label; |
487 | - if ($showlineingray) print '</i>'; |
|
532 | + if ($showlineingray) { |
|
533 | + print '</i>'; |
|
534 | + } |
|
488 | 535 | //else print '</a>'; |
489 | 536 | print "</td>\n"; |
490 | 537 | |
@@ -500,13 +547,19 @@ discard block |
||
500 | 547 | $taskstatic->fk_statut = $lines[$i]->status; |
501 | 548 | $taskstatic->datee = $lines[$i]->date_end; |
502 | 549 | print dol_print_date($lines[$i]->date_end,'dayhour'); |
503 | - if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); |
|
550 | + if ($taskstatic->hasDelay()) { |
|
551 | + print img_warning($langs->trans("Late")); |
|
552 | + } |
|
504 | 553 | print '</td>'; |
505 | 554 | |
506 | 555 | $plannedworkloadoutputformat='allhourmin'; |
507 | 556 | $timespentoutputformat='allhourmin'; |
508 | - if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
509 | - if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
557 | + if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) { |
|
558 | + $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
559 | + } |
|
560 | + if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) { |
|
561 | + $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
562 | + } |
|
510 | 563 | |
511 | 564 | // Planned Workload (in working hours) |
512 | 565 | print '<td align="right">'; |
@@ -523,20 +576,32 @@ discard block |
||
523 | 576 | |
524 | 577 | // Time spent |
525 | 578 | print '<td align="right">'; |
526 | - if ($showlineingray) print '<i>'; |
|
527 | - else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; |
|
528 | - if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,$timespentoutputformat); |
|
529 | - else print '--:--'; |
|
530 | - if ($showlineingray) print '</i>'; |
|
531 | - else print '</a>'; |
|
579 | + if ($showlineingray) { |
|
580 | + print '<i>'; |
|
581 | + } else { |
|
582 | + print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; |
|
583 | + } |
|
584 | + if ($lines[$i]->duration) { |
|
585 | + print convertSecondToTime($lines[$i]->duration,$timespentoutputformat); |
|
586 | + } else { |
|
587 | + print '--:--'; |
|
588 | + } |
|
589 | + if ($showlineingray) { |
|
590 | + print '</i>'; |
|
591 | + } else { |
|
592 | + print '</a>'; |
|
593 | + } |
|
532 | 594 | print '</td>'; |
533 | 595 | |
534 | 596 | // Progress calculated (Note: ->duration is time spent) |
535 | 597 | print '<td align="right">'; |
536 | 598 | if ($lines[$i]->planned_workload || $lines[$i]->duration) |
537 | 599 | { |
538 | - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; |
|
539 | - else print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>'; |
|
600 | + if ($lines[$i]->planned_workload) { |
|
601 | + print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %'; |
|
602 | + } else { |
|
603 | + print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>'; |
|
604 | + } |
|
540 | 605 | } |
541 | 606 | print '</td>'; |
542 | 607 | |
@@ -559,8 +624,11 @@ discard block |
||
559 | 624 | if (!empty($num)){ |
560 | 625 | foreach ($tab as $contacttask){ |
561 | 626 | //var_dump($contacttask); |
562 | - if ($source == 'internal') $c = new User($db); |
|
563 | - else $c = new Contact($db); |
|
627 | + if ($source == 'internal') { |
|
628 | + $c = new User($db); |
|
629 | + } else { |
|
630 | + $c = new Contact($db); |
|
631 | + } |
|
564 | 632 | $c->fetch($contacttask['id']); |
565 | 633 | print $c->getNomUrl(1) . ' (' . $contacttask['libelle'] . ')' . '<br>'; |
566 | 634 | } |
@@ -577,21 +645,28 @@ discard block |
||
577 | 645 | |
578 | 646 | print "</tr>\n"; |
579 | 647 | |
580 | - if (! $showlineingray) $inc++; |
|
648 | + if (! $showlineingray) { |
|
649 | + $inc++; |
|
650 | + } |
|
581 | 651 | |
582 | - if ($level >= 0) // Call sublevels |
|
652 | + if ($level >= 0) { |
|
653 | + // Call sublevels |
|
583 | 654 | { |
584 | 655 | $level++; |
585 | - if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); |
|
656 | + } |
|
657 | + if ($lines[$i]->id) { |
|
658 | + projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); |
|
659 | + } |
|
586 | 660 | $level--; |
587 | 661 | } |
588 | 662 | |
589 | 663 | $total_projectlinesa_spent += $lines[$i]->duration; |
590 | 664 | $total_projectlinesa_planned += $lines[$i]->planned_workload; |
591 | - if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; |
|
665 | + if ($lines[$i]->planned_workload) { |
|
666 | + $total_projectlinesa_spent_if_planned += $lines[$i]->duration; |
|
667 | + } |
|
592 | 668 | } |
593 | - } |
|
594 | - else |
|
669 | + } else |
|
595 | 670 | { |
596 | 671 | //$level--; |
597 | 672 | } |
@@ -601,7 +676,9 @@ discard block |
||
601 | 676 | { |
602 | 677 | print '<tr class="liste_total nodrag nodrop">'; |
603 | 678 | print '<td class="liste_total">'.$langs->trans("Total").'</td>'; |
604 | - if ($showproject) print '<td></td><td></td>'; |
|
679 | + if ($showproject) { |
|
680 | + print '<td></td><td></td>'; |
|
681 | + } |
|
605 | 682 | print '<td></td>'; |
606 | 683 | print '<td></td>'; |
607 | 684 | print '<td></td>'; |
@@ -609,12 +686,18 @@ discard block |
||
609 | 686 | print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); |
610 | 687 | print '</td>'; |
611 | 688 | print '<td align="right" class="nowrap liste_total">'; |
612 | - if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">'; |
|
689 | + if ($projectidfortotallink > 0) { |
|
690 | + print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject?'':'&withproject=1').'">'; |
|
691 | + } |
|
613 | 692 | print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); |
614 | - if ($projectidfortotallink > 0) print '</a>'; |
|
693 | + if ($projectidfortotallink > 0) { |
|
694 | + print '</a>'; |
|
695 | + } |
|
615 | 696 | print '</td>'; |
616 | 697 | print '<td align="right" class="nowrap liste_total">'; |
617 | - if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; |
|
698 | + if ($total_projectlinesa_planned) { |
|
699 | + print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %'; |
|
700 | + } |
|
618 | 701 | print '</td>'; |
619 | 702 | print '<td></td>'; |
620 | 703 | // Contacts of task |
@@ -622,7 +705,9 @@ discard block |
||
622 | 705 | { |
623 | 706 | print '<td></td>'; |
624 | 707 | } |
625 | - if ($addordertick) print '<td class="hideonsmartphone"></td>'; |
|
708 | + if ($addordertick) { |
|
709 | + print '<td class="hideonsmartphone"></td>'; |
|
710 | + } |
|
626 | 711 | print '</tr>'; |
627 | 712 | } |
628 | 713 | |
@@ -660,11 +745,16 @@ discard block |
||
660 | 745 | $numlines=count($lines); |
661 | 746 | |
662 | 747 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
663 | - if ($parent == 0) // Always and only if at first level |
|
748 | + if ($parent == 0) { |
|
749 | + // Always and only if at first level |
|
664 | 750 | { |
665 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
751 | + for ($i = 0 ; |
|
752 | + } |
|
753 | + $i < $numlines ; $i++) |
|
666 | 754 | { |
667 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
755 | + if ($lines[$i]->fk_task_parent) { |
|
756 | + $lineswithoutlevel0[]=$lines[$i]; |
|
757 | + } |
|
668 | 758 | } |
669 | 759 | } |
670 | 760 | |
@@ -676,7 +766,9 @@ discard block |
||
676 | 766 | //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
677 | 767 | for ($i = 0 ; $i < $numlines ; $i++) |
678 | 768 | { |
679 | - if ($parent == 0) $level = 0; |
|
769 | + if ($parent == 0) { |
|
770 | + $level = 0; |
|
771 | + } |
|
680 | 772 | |
681 | 773 | //if ($lines[$i]->fk_task_parent == $parent) |
682 | 774 | //{ |
@@ -733,7 +825,9 @@ discard block |
||
733 | 825 | print '</tr>'; |
734 | 826 | } |
735 | 827 | |
736 | - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
828 | + if ($oldprojectforbreak != -1) { |
|
829 | + $oldprojectforbreak = $projectstatic->id; |
|
830 | + } |
|
737 | 831 | |
738 | 832 | print '<tr class="oddeven">'."\n"; |
739 | 833 | |
@@ -755,17 +849,23 @@ discard block |
||
755 | 849 | |
756 | 850 | // Thirdparty |
757 | 851 | print '<td class="tdoverflowmax100">'; |
758 | - if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); |
|
852 | + if ($thirdpartystatic->id > 0) { |
|
853 | + print $thirdpartystatic->getNomUrl(1, 'project', 10); |
|
854 | + } |
|
759 | 855 | print '</td>'; |
760 | 856 | |
761 | 857 | // Ref |
762 | 858 | print '<td>'; |
763 | 859 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
764 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
860 | + for ($k = 0 ; $k < $level ; $k++) { |
|
861 | + print " "; |
|
862 | + } |
|
765 | 863 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
766 | 864 | // Label task |
767 | 865 | print '<br>'; |
768 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
866 | + for ($k = 0 ; $k < $level ; $k++) { |
|
867 | + print " "; |
|
868 | + } |
|
769 | 869 | print $taskstatic->label; |
770 | 870 | //print "<br>"; |
771 | 871 | //for ($k = 0 ; $k < $level ; $k++) print " "; |
@@ -799,9 +899,13 @@ discard block |
||
799 | 899 | print '</td>'; |
800 | 900 | |
801 | 901 | $cssonholiday=''; |
802 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
803 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
804 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
902 | + if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) { |
|
903 | + $cssonholiday.='onholidayallday '; |
|
904 | + } elseif (! $isavailable[$preselectedday]['morning']) { |
|
905 | + $cssonholiday.='onholidaymorning '; |
|
906 | + } elseif (! $isavailable[$preselectedday]['afternoon']) { |
|
907 | + $cssonholiday.='onholidayafternoon '; |
|
908 | + } |
|
805 | 909 | |
806 | 910 | // Duration |
807 | 911 | print '<td align="center" class="duration'.($cssonholiday?' '.$cssonholiday:'').'">'; |
@@ -810,7 +914,9 @@ discard block |
||
810 | 914 | $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; |
811 | 915 | |
812 | 916 | $alreadyspent=''; |
813 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
917 | + if ($dayWorkLoad > 0) { |
|
918 | + $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
|
919 | + } |
|
814 | 920 | |
815 | 921 | print convertSecondToTime($lines[$i]->timespent_duration,'allhourmin'); |
816 | 922 | |
@@ -886,11 +992,16 @@ discard block |
||
886 | 992 | $numlines=count($lines); |
887 | 993 | |
888 | 994 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
889 | - if ($parent == 0) // Always and only if at first level |
|
995 | + if ($parent == 0) { |
|
996 | + // Always and only if at first level |
|
890 | 997 | { |
891 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
998 | + for ($i = 0 ; |
|
999 | + } |
|
1000 | + $i < $numlines ; $i++) |
|
892 | 1001 | { |
893 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
1002 | + if ($lines[$i]->fk_task_parent) { |
|
1003 | + $lineswithoutlevel0[]=$lines[$i]; |
|
1004 | + } |
|
894 | 1005 | } |
895 | 1006 | } |
896 | 1007 | |
@@ -902,7 +1013,9 @@ discard block |
||
902 | 1013 | //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); |
903 | 1014 | for ($i = 0 ; $i < $numlines ; $i++) |
904 | 1015 | { |
905 | - if ($parent == 0) $level = 0; |
|
1016 | + if ($parent == 0) { |
|
1017 | + $level = 0; |
|
1018 | + } |
|
906 | 1019 | |
907 | 1020 | if ($lines[$i]->fk_task_parent == $parent) |
908 | 1021 | { |
@@ -911,10 +1024,12 @@ discard block |
||
911 | 1024 | { |
912 | 1025 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
913 | 1026 | |
914 | - if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases |
|
1027 | + if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) { |
|
1028 | + // we have no role on task and we request to hide such cases |
|
915 | 1029 | { |
916 | 1030 | continue; |
917 | 1031 | } |
1032 | + } |
|
918 | 1033 | |
919 | 1034 | // Break on a new project |
920 | 1035 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
@@ -955,7 +1070,9 @@ discard block |
||
955 | 1070 | print '<tr class="oddeven trforbreak">'."\n"; |
956 | 1071 | print '<td colspan="9">'; |
957 | 1072 | print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
958 | - if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
|
1073 | + if ($thirdpartystatic->id > 0) { |
|
1074 | + print ' - '.$thirdpartystatic->getNomUrl(1); |
|
1075 | + } |
|
959 | 1076 | if ($projectstatic->title) |
960 | 1077 | { |
961 | 1078 | print ' - '; |
@@ -965,7 +1082,9 @@ discard block |
||
965 | 1082 | print '</tr>'; |
966 | 1083 | } |
967 | 1084 | |
968 | - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
1085 | + if ($oldprojectforbreak != -1) { |
|
1086 | + $oldprojectforbreak = $projectstatic->id; |
|
1087 | + } |
|
969 | 1088 | |
970 | 1089 | print '<tr class="oddeven">'."\n"; |
971 | 1090 | |
@@ -989,11 +1108,15 @@ discard block |
||
989 | 1108 | // Ref |
990 | 1109 | print '<td>'; |
991 | 1110 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
992 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1111 | + for ($k = 0 ; $k < $level ; $k++) { |
|
1112 | + print " "; |
|
1113 | + } |
|
993 | 1114 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
994 | 1115 | // Label task |
995 | 1116 | print '<br>'; |
996 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1117 | + for ($k = 0 ; $k < $level ; $k++) { |
|
1118 | + print " "; |
|
1119 | + } |
|
997 | 1120 | print $taskstatic->label; |
998 | 1121 | //print "<br>"; |
999 | 1122 | //for ($k = 0 ; $k < $level ; $k++) print " "; |
@@ -1002,8 +1125,11 @@ discard block |
||
1002 | 1125 | |
1003 | 1126 | // Planned Workload |
1004 | 1127 | print '<td align="right" class="leftborder plannedworkload">'; |
1005 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1006 | - else print '--:--'; |
|
1128 | + if ($lines[$i]->planned_workload) { |
|
1129 | + print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1130 | + } else { |
|
1131 | + print '--:--'; |
|
1132 | + } |
|
1007 | 1133 | print '</td>'; |
1008 | 1134 | |
1009 | 1135 | // Progress declared % |
@@ -1019,15 +1145,19 @@ discard block |
||
1019 | 1145 | print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
1020 | 1146 | print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
1021 | 1147 | print '</a>'; |
1148 | + } else { |
|
1149 | + print '--:--'; |
|
1022 | 1150 | } |
1023 | - else print '--:--'; |
|
1024 | 1151 | print "</td>\n"; |
1025 | 1152 | |
1026 | 1153 | // Time spent by user |
1027 | 1154 | print '<td align="right">'; |
1028 | 1155 | $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
1029 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1030 | - else print '--:--'; |
|
1156 | + if ($tmptimespent['total_duration']) { |
|
1157 | + print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1158 | + } else { |
|
1159 | + print '--:--'; |
|
1160 | + } |
|
1031 | 1161 | print "</td>\n"; |
1032 | 1162 | |
1033 | 1163 | $disabledproject=1;$disabledtask=1; |
@@ -1053,9 +1183,13 @@ discard block |
||
1053 | 1183 | print '</td>'; |
1054 | 1184 | |
1055 | 1185 | $cssonholiday=''; |
1056 | - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1057 | - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1058 | - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1186 | + if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) { |
|
1187 | + $cssonholiday.='onholidayallday '; |
|
1188 | + } elseif (! $isavailable[$preselectedday]['morning']) { |
|
1189 | + $cssonholiday.='onholidaymorning '; |
|
1190 | + } elseif (! $isavailable[$preselectedday]['afternoon']) { |
|
1191 | + $cssonholiday.='onholidayafternoon '; |
|
1192 | + } |
|
1059 | 1193 | |
1060 | 1194 | global $daytoparse; |
1061 | 1195 | $tmparray = dol_getdate($daytoparse,true); // detail of current day |
@@ -1063,10 +1197,12 @@ discard block |
||
1063 | 1197 | |
1064 | 1198 | global $numstartworkingday, $numendworkingday; |
1065 | 1199 | $cssweekend=''; |
1066 | - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1200 | + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) { |
|
1201 | + // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1067 | 1202 | { |
1068 | 1203 | $cssweekend='weekend'; |
1069 | 1204 | } |
1205 | + } |
|
1070 | 1206 | |
1071 | 1207 | // Duration |
1072 | 1208 | print '<td class="center duration'.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
@@ -1074,7 +1210,9 @@ discard block |
||
1074 | 1210 | $totalforeachday[$preselectedday]+=$dayWorkLoad; |
1075 | 1211 | |
1076 | 1212 | $alreadyspent=''; |
1077 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1213 | + if ($dayWorkLoad > 0) { |
|
1214 | + $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1215 | + } |
|
1078 | 1216 | |
1079 | 1217 | $idw = 0; |
1080 | 1218 | |
@@ -1104,11 +1242,14 @@ discard block |
||
1104 | 1242 | |
1105 | 1243 | // Warning |
1106 | 1244 | print '<td align="right">'; |
1107 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1108 | - else if ($disabledtask) |
|
1245 | + if ((! $lines[$i]->public) && $disabledproject) { |
|
1246 | + print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1247 | + } else if ($disabledtask) |
|
1109 | 1248 | { |
1110 | 1249 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
1111 | - if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1250 | + if ($fuser->id != $user->id) { |
|
1251 | + $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1252 | + } |
|
1112 | 1253 | |
1113 | 1254 | print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
1114 | 1255 | } |
@@ -1134,8 +1275,7 @@ discard block |
||
1134 | 1275 | //var_dump($totalforeachday); |
1135 | 1276 | } |
1136 | 1277 | $level--; |
1137 | - } |
|
1138 | - else |
|
1278 | + } else |
|
1139 | 1279 | { |
1140 | 1280 | //$level--; |
1141 | 1281 | } |
@@ -1175,11 +1315,16 @@ discard block |
||
1175 | 1315 | $lineswithoutlevel0=array(); |
1176 | 1316 | |
1177 | 1317 | // Create a smaller array with sublevels only to be used later. This increase dramatically performances. |
1178 | - if ($parent == 0) // Always and only if at first level |
|
1318 | + if ($parent == 0) { |
|
1319 | + // Always and only if at first level |
|
1179 | 1320 | { |
1180 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
1321 | + for ($i = 0 ; |
|
1322 | + } |
|
1323 | + $i < $numlines ; $i++) |
|
1181 | 1324 | { |
1182 | - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; |
|
1325 | + if ($lines[$i]->fk_task_parent) { |
|
1326 | + $lineswithoutlevel0[]=$lines[$i]; |
|
1327 | + } |
|
1183 | 1328 | } |
1184 | 1329 | } |
1185 | 1330 | |
@@ -1192,7 +1337,9 @@ discard block |
||
1192 | 1337 | |
1193 | 1338 | for ($i = 0 ; $i < $numlines ; $i++) |
1194 | 1339 | { |
1195 | - if ($parent == 0) $level = 0; |
|
1340 | + if ($parent == 0) { |
|
1341 | + $level = 0; |
|
1342 | + } |
|
1196 | 1343 | |
1197 | 1344 | if ($lines[$i]->fk_task_parent == $parent) |
1198 | 1345 | { |
@@ -1201,10 +1348,12 @@ discard block |
||
1201 | 1348 | { |
1202 | 1349 | //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); |
1203 | 1350 | |
1204 | - if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases |
|
1351 | + if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) { |
|
1352 | + // we have no role on task and we request to hide such cases |
|
1205 | 1353 | { |
1206 | 1354 | continue; |
1207 | 1355 | } |
1356 | + } |
|
1208 | 1357 | |
1209 | 1358 | // Break on a new project |
1210 | 1359 | if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) |
@@ -1244,7 +1393,9 @@ discard block |
||
1244 | 1393 | print '<tr class="oddeven trforbreak">'."\n"; |
1245 | 1394 | print '<td colspan="13">'; |
1246 | 1395 | print $projectstatic->getNomUrl(1,'',0,'<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]); |
1247 | - if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); |
|
1396 | + if ($thirdpartystatic->id > 0) { |
|
1397 | + print ' - '.$thirdpartystatic->getNomUrl(1); |
|
1398 | + } |
|
1248 | 1399 | if ($projectstatic->title) |
1249 | 1400 | { |
1250 | 1401 | print ' - '; |
@@ -1254,7 +1405,9 @@ discard block |
||
1254 | 1405 | print '</tr>'; |
1255 | 1406 | } |
1256 | 1407 | |
1257 | - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; |
|
1408 | + if ($oldprojectforbreak != -1) { |
|
1409 | + $oldprojectforbreak = $projectstatic->id; |
|
1410 | + } |
|
1258 | 1411 | |
1259 | 1412 | print '<tr class="oddeven">'."\n"; |
1260 | 1413 | |
@@ -1278,11 +1431,15 @@ discard block |
||
1278 | 1431 | // Ref |
1279 | 1432 | print '<td class="nowrap">'; |
1280 | 1433 | print '<!-- Task id = '.$lines[$i]->id.' -->'; |
1281 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1434 | + for ($k = 0 ; $k < $level ; $k++) { |
|
1435 | + print " "; |
|
1436 | + } |
|
1282 | 1437 | print $taskstatic->getNomUrl(1, 'withproject', 'time'); |
1283 | 1438 | // Label task |
1284 | 1439 | print '<br>'; |
1285 | - for ($k = 0 ; $k < $level ; $k++) print " "; |
|
1440 | + for ($k = 0 ; $k < $level ; $k++) { |
|
1441 | + print " "; |
|
1442 | + } |
|
1286 | 1443 | //print $taskstatic->getNomUrl(0, 'withproject', 'time'); |
1287 | 1444 | print $taskstatic->label; |
1288 | 1445 | //print "<br>"; |
@@ -1292,8 +1449,11 @@ discard block |
||
1292 | 1449 | |
1293 | 1450 | // Planned Workload |
1294 | 1451 | print '<td align="right" class="leftborder plannedworkload">'; |
1295 | - if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1296 | - else print '--:--'; |
|
1452 | + if ($lines[$i]->planned_workload) { |
|
1453 | + print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); |
|
1454 | + } else { |
|
1455 | + print '--:--'; |
|
1456 | + } |
|
1297 | 1457 | print '</td>'; |
1298 | 1458 | |
1299 | 1459 | // Progress declared % |
@@ -1309,15 +1469,19 @@ discard block |
||
1309 | 1469 | print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; |
1310 | 1470 | print convertSecondToTime($lines[$i]->duration,'allhourmin'); |
1311 | 1471 | print '</a>'; |
1472 | + } else { |
|
1473 | + print '--:--'; |
|
1312 | 1474 | } |
1313 | - else print '--:--'; |
|
1314 | 1475 | print "</td>\n"; |
1315 | 1476 | |
1316 | 1477 | // Time spent by user |
1317 | 1478 | print '<td align="right">'; |
1318 | 1479 | $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); |
1319 | - if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1320 | - else print '--:--'; |
|
1480 | + if ($tmptimespent['total_duration']) { |
|
1481 | + print convertSecondToTime($tmptimespent['total_duration'],'allhourmin'); |
|
1482 | + } else { |
|
1483 | + print '--:--'; |
|
1484 | + } |
|
1321 | 1485 | print "</td>\n"; |
1322 | 1486 | |
1323 | 1487 | $disabledproject=1;$disabledtask=1; |
@@ -1345,24 +1509,32 @@ discard block |
||
1345 | 1509 | $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
1346 | 1510 | |
1347 | 1511 | $cssonholiday=''; |
1348 | - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; |
|
1349 | - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; |
|
1350 | - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; |
|
1512 | + if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) { |
|
1513 | + $cssonholiday.='onholidayallday '; |
|
1514 | + } elseif (! $isavailable[$tmpday]['morning']) { |
|
1515 | + $cssonholiday.='onholidaymorning '; |
|
1516 | + } elseif (! $isavailable[$tmpday]['afternoon']) { |
|
1517 | + $cssonholiday.='onholidayafternoon '; |
|
1518 | + } |
|
1351 | 1519 | |
1352 | 1520 | $tmparray=dol_getdate($tmpday); |
1353 | 1521 | $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; |
1354 | 1522 | $totalforeachday[$tmpday]+=$dayWorkLoad; |
1355 | 1523 | |
1356 | 1524 | $alreadyspent=''; |
1357 | - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1525 | + if ($dayWorkLoad > 0) { |
|
1526 | + $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); |
|
1527 | + } |
|
1358 | 1528 | $alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']); |
1359 | 1529 | |
1360 | 1530 | global $numstartworkingday, $numendworkingday; |
1361 | 1531 | $cssweekend=''; |
1362 | - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1532 | + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) { |
|
1533 | + // This is a day is not inside the setup of working days, so we use a week-end css. |
|
1363 | 1534 | { |
1364 | 1535 | $cssweekend='weekend'; |
1365 | 1536 | } |
1537 | + } |
|
1366 | 1538 | |
1367 | 1539 | $tableCell ='<td align="center" class="hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'">'; |
1368 | 1540 | $placeholder=''; |
@@ -1382,11 +1554,14 @@ discard block |
||
1382 | 1554 | |
1383 | 1555 | // Warning |
1384 | 1556 | print '<td align="right">'; |
1385 | - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1386 | - else if ($disabledtask) |
|
1557 | + if ((! $lines[$i]->public) && $disabledproject) { |
|
1558 | + print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); |
|
1559 | + } else if ($disabledtask) |
|
1387 | 1560 | { |
1388 | 1561 | $titleassigntask = $langs->trans("AssignTaskToMe"); |
1389 | - if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1562 | + if ($fuser->id != $user->id) { |
|
1563 | + $titleassigntask = $langs->trans("AssignTaskToUser", '...'); |
|
1564 | + } |
|
1390 | 1565 | |
1391 | 1566 | print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); |
1392 | 1567 | } |
@@ -1413,8 +1588,7 @@ discard block |
||
1413 | 1588 | //var_dump($totalforeachday); |
1414 | 1589 | } |
1415 | 1590 | $level--; |
1416 | - } |
|
1417 | - else |
|
1591 | + } else |
|
1418 | 1592 | { |
1419 | 1593 | //$level--; |
1420 | 1594 | } |
@@ -1453,7 +1627,9 @@ discard block |
||
1453 | 1627 | searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole); |
1454 | 1628 | //print 'Found inc='.$inc.'<br>'; |
1455 | 1629 | |
1456 | - if ($inc > 0) return $inc; |
|
1630 | + if ($inc > 0) { |
|
1631 | + return $inc; |
|
1632 | + } |
|
1457 | 1633 | } |
1458 | 1634 | } |
1459 | 1635 | |
@@ -1487,7 +1663,9 @@ discard block |
||
1487 | 1663 | $project_year_filter=0; |
1488 | 1664 | |
1489 | 1665 | $title=$langs->trans("Projects"); |
1490 | - if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1666 | + if (strcmp($statut, '') && $statut >= 0) { |
|
1667 | + $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); |
|
1668 | + } |
|
1491 | 1669 | |
1492 | 1670 | $arrayidtypeofcontact=array(); |
1493 | 1671 | |
@@ -1500,14 +1678,15 @@ discard block |
||
1500 | 1678 | $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; |
1501 | 1679 | $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
1502 | 1680 | $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
1503 | - } |
|
1504 | - else |
|
1681 | + } else |
|
1505 | 1682 | { |
1506 | 1683 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; |
1507 | 1684 | } |
1508 | 1685 | $sql.= " WHERE p.entity IN (".getEntity('project').")"; |
1509 | 1686 | $sql.= " AND p.rowid IN (".$projectsListId.")"; |
1510 | - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1687 | + if ($socid) { |
|
1688 | + $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
1689 | + } |
|
1511 | 1690 | if ($mytasks) |
1512 | 1691 | { |
1513 | 1692 | $sql.= " AND p.rowid = t.fk_projet"; |
@@ -1550,9 +1729,12 @@ discard block |
||
1550 | 1729 | $arrayidofprojects[$objp->projectid]=$objp->projectid; |
1551 | 1730 | $i++; |
1552 | 1731 | } |
1732 | + } else { |
|
1733 | + dol_print_error($db); |
|
1734 | + } |
|
1735 | + if (empty($arrayidofprojects)) { |
|
1736 | + $arrayidofprojects[0]=-1; |
|
1553 | 1737 | } |
1554 | - else dol_print_error($db); |
|
1555 | - if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1; |
|
1556 | 1738 | |
1557 | 1739 | // Get list of project with calculation on tasks |
1558 | 1740 | $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,"; |
@@ -1586,8 +1768,12 @@ discard block |
||
1586 | 1768 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
1587 | 1769 | { |
1588 | 1770 | print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder); |
1589 | - if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); |
|
1590 | - if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); |
|
1771 | + if (! in_array('plannedworkload', $hiddenfields)) { |
|
1772 | + print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); |
|
1773 | + } |
|
1774 | + if (! in_array('declaredprogress', $hiddenfields)) { |
|
1775 | + print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); |
|
1776 | + } |
|
1591 | 1777 | } |
1592 | 1778 | print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); |
1593 | 1779 | print "</tr>\n"; |
@@ -1616,7 +1802,9 @@ discard block |
||
1616 | 1802 | print '<tr class="oddeven">'; |
1617 | 1803 | print '<td>'; |
1618 | 1804 | print $projectstatic->getNomUrl(1); |
1619 | - if (! in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title,24); |
|
1805 | + if (! in_array('projectlabel', $hiddenfields)) { |
|
1806 | + print '<br>'.dol_trunc($objp->title,24); |
|
1807 | + } |
|
1620 | 1808 | print '</td>'; |
1621 | 1809 | print '<td>'; |
1622 | 1810 | if ($objp->fk_soc > 0) |
@@ -1630,11 +1818,15 @@ discard block |
||
1630 | 1818 | if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) |
1631 | 1819 | { |
1632 | 1820 | print '<td align="right">'; |
1633 | - if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); |
|
1821 | + if ($objp->opp_amount) { |
|
1822 | + print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); |
|
1823 | + } |
|
1634 | 1824 | print '</td>'; |
1635 | 1825 | print '<td align="right">'; |
1636 | 1826 | $code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); |
1637 | - if ($code) print $langs->trans("OppStatus".$code); |
|
1827 | + if ($code) { |
|
1828 | + print $langs->trans("OppStatus".$code); |
|
1829 | + } |
|
1638 | 1830 | print '</td>'; |
1639 | 1831 | } |
1640 | 1832 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
@@ -1679,15 +1871,18 @@ discard block |
||
1679 | 1871 | if (empty($conf->global->PROJECT_HIDE_TASKS)) |
1680 | 1872 | { |
1681 | 1873 | print '<td class="liste_total" align="right">'.$total_task.'</td>'; |
1682 | - if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; |
|
1683 | - if (! in_array('declaredprogress', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>'; |
|
1874 | + if (! in_array('plannedworkload', $hiddenfields)) { |
|
1875 | + print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>'; |
|
1876 | + } |
|
1877 | + if (! in_array('declaredprogress', $hiddenfields)) { |
|
1878 | + print '<td class="liste_total" align="right">'.($total_plannedworkload?round(100*$total_declaredprogressworkload/$total_plannedworkload,0).'%':'').'</td>'; |
|
1879 | + } |
|
1684 | 1880 | } |
1685 | 1881 | print '<td class="liste_total"></td>'; |
1686 | 1882 | print '</tr>'; |
1687 | 1883 | |
1688 | 1884 | $db->free($resql); |
1689 | - } |
|
1690 | - else |
|
1885 | + } else |
|
1691 | 1886 | { |
1692 | 1887 | dol_print_error($db); |
1693 | 1888 | } |