@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | // Protection to avoid direct call of template |
| 19 | 19 | if (empty($conf) || ! is_object($conf)) |
| 20 | 20 | { |
| 21 | - print "Error, template page can't be called as URL"; |
|
| 22 | - exit; |
|
| 21 | + print "Error, template page can't be called as URL"; |
|
| 22 | + exit; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -121,22 +121,22 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | <?php |
| 123 | 123 | for ($i=1; $i<=4; $i++) { |
| 124 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 125 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 126 | - echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
| 127 | - echo '<td>'.$this->control->tpl['profid'.$i]; |
|
| 128 | - if ($this->control->tpl['profid'.$i]) { |
|
| 129 | - if ($this->control->tpl['checkprofid'.$i] > 0) echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
| 130 | - else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
| 131 | - } |
|
| 132 | - echo '</td>'; |
|
| 133 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 134 | - } else { |
|
| 135 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 136 | - echo '<td> </td>'; |
|
| 137 | - echo '<td> </td>'; |
|
| 138 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 139 | - } |
|
| 124 | + if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 125 | + if ($i==1 || $i==3) echo '<tr>'; |
|
| 126 | + echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
| 127 | + echo '<td>'.$this->control->tpl['profid'.$i]; |
|
| 128 | + if ($this->control->tpl['profid'.$i]) { |
|
| 129 | + if ($this->control->tpl['checkprofid'.$i] > 0) echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
| 130 | + else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
| 131 | + } |
|
| 132 | + echo '</td>'; |
|
| 133 | + if ($i==2 || $i==4) echo '</tr>'; |
|
| 134 | + } else { |
|
| 135 | + if ($i==1 || $i==3) echo '<tr>'; |
|
| 136 | + echo '<td> </td>'; |
|
| 137 | + echo '<td> </td>'; |
|
| 138 | + if ($i==2 || $i==4) echo '</tr>'; |
|
| 139 | + } |
|
| 140 | 140 | } |
| 141 | 141 | ?> |
| 142 | 142 | |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | <td><?php echo $langs->trans('Capital'); ?></td> |
| 154 | 154 | <td colspan="3"> |
| 155 | 155 | <?php |
| 156 | - if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
| 157 | - else echo ' '; |
|
| 158 | - ?> |
|
| 156 | + if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
| 157 | + else echo ' '; |
|
| 158 | + ?> |
|
| 159 | 159 | </td> |
| 160 | 160 | </tr> |
| 161 | 161 | |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | // Protection to avoid direct call of template |
| 20 | 20 | if (empty($conf) || ! is_object($conf)) |
| 21 | 21 | { |
| 22 | - print "Error, template page can't be called as URL"; |
|
| 23 | - exit; |
|
| 22 | + print "Error, template page can't be called as URL"; |
|
| 23 | + exit; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | <?php |
| 113 | 113 | if ($this->control->tpl['fournisseur']) { |
| 114 | - if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
| 114 | + if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
| 115 | 115 | <tr> |
| 116 | 116 | <td><?php echo $langs->trans('SupplierCategory'); ?></td> |
| 117 | 117 | <td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td> |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | <?php |
| 165 | 165 | for ($i=1; $i<=4; $i++) { |
| 166 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 167 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 168 | - echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
| 169 | - echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
| 170 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 171 | - } else { |
|
| 172 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 173 | - echo '<td> </td>'; |
|
| 174 | - echo '<td> </td>'; |
|
| 175 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 176 | - } |
|
| 166 | + if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 167 | + if ($i==1 || $i==3) echo '<tr>'; |
|
| 168 | + echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
| 169 | + echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
| 170 | + if ($i==2 || $i==4) echo '</tr>'; |
|
| 171 | + } else { |
|
| 172 | + if ($i==1 || $i==3) echo '<tr>'; |
|
| 173 | + echo '<td> </td>'; |
|
| 174 | + echo '<td> </td>'; |
|
| 175 | + if ($i==2 || $i==4) echo '</tr>'; |
|
| 176 | + } |
|
| 177 | 177 | } |
| 178 | 178 | ?> |
| 179 | 179 | |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | class ActionsCardCompany extends ActionsCardCommon |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * Constructor |
|
| 34 | - * |
|
| 32 | + /** |
|
| 33 | + * Constructor |
|
| 34 | + * |
|
| 35 | 35 | * @param DoliDB $db Handler acces base de donnees |
| 36 | 36 | * @param string $dirmodule Name of directory of module |
| 37 | 37 | * @param string $targetmodule Name of directory of module where canvas is stored |
| 38 | 38 | * @param string $canvas Name of canvas |
| 39 | 39 | * @param string $card Name of tab (sub-canvas) |
| 40 | - */ |
|
| 41 | - function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
| 42 | - { |
|
| 40 | + */ |
|
| 41 | + function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
| 42 | + { |
|
| 43 | 43 | $this->db = $db; |
| 44 | 44 | $this->dirmodule = $dirmodule; |
| 45 | 45 | $this->targetmodule = $targetmodule; |
| 46 | 46 | $this->canvas = $canvas; |
| 47 | 47 | $this->card = $card; |
| 48 | - } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Return the title of card |
@@ -68,155 +68,155 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
| 71 | - /** |
|
| 72 | - * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
| 73 | - * |
|
| 74 | - * @param string $action Type of action |
|
| 75 | - * @param integer $id Id of object |
|
| 76 | - * @param string $ref Ref of object |
|
| 77 | - * @return void |
|
| 78 | - */ |
|
| 79 | - function assign_values(&$action, $id=0, $ref='') |
|
| 80 | - { |
|
| 71 | + /** |
|
| 72 | + * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
| 73 | + * |
|
| 74 | + * @param string $action Type of action |
|
| 75 | + * @param integer $id Id of object |
|
| 76 | + * @param string $ref Ref of object |
|
| 77 | + * @return void |
|
| 78 | + */ |
|
| 79 | + function assign_values(&$action, $id=0, $ref='') |
|
| 80 | + { |
|
| 81 | 81 | // phpcs:enable |
| 82 | - global $conf, $langs, $user, $mysoc; |
|
| 83 | - global $form, $formadmin, $formcompany; |
|
| 82 | + global $conf, $langs, $user, $mysoc; |
|
| 83 | + global $form, $formadmin, $formcompany; |
|
| 84 | 84 | |
| 85 | - $ret = $this->getObject($id,$ref); |
|
| 85 | + $ret = $this->getObject($id,$ref); |
|
| 86 | 86 | |
| 87 | - parent::assign_values($action); |
|
| 87 | + parent::assign_values($action); |
|
| 88 | 88 | |
| 89 | 89 | $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); |
| 90 | 90 | |
| 91 | 91 | $this->tpl['profid1'] = $this->object->idprof1; |
| 92 | - $this->tpl['profid2'] = $this->object->idprof2; |
|
| 93 | - $this->tpl['profid3'] = $this->object->idprof3; |
|
| 94 | - $this->tpl['profid4'] = $this->object->idprof4; |
|
| 95 | - |
|
| 96 | - if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
| 97 | - { |
|
| 98 | - $js = "\n"; |
|
| 99 | - $js.= '<script language="JavaScript" type="text/javascript">'; |
|
| 100 | - $js.= "function CheckVAT(a) {\n"; |
|
| 101 | - $js.= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n"; |
|
| 102 | - $js.= "}\n"; |
|
| 103 | - $js.= '</script>'; |
|
| 104 | - $js.= "\n"; |
|
| 105 | - $this->tpl['js_checkVatPopup'] = $js; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - if ($action == 'create' || $action == 'edit') |
|
| 109 | - { |
|
| 110 | - for ($i=1; $i<=4; $i++) |
|
| 111 | - { |
|
| 112 | - $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
| 113 | - $this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->country_code); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - // Type |
|
| 117 | - $this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id); |
|
| 118 | - |
|
| 119 | - // Juridical Status |
|
| 120 | - $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code); |
|
| 121 | - |
|
| 122 | - // Workforce |
|
| 123 | - $this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id); |
|
| 124 | - |
|
| 125 | - // VAT intra |
|
| 126 | - $s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 127 | - if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
| 128 | - { |
|
| 129 | - $s.=' '; |
|
| 130 | - |
|
| 131 | - if ($conf->use_javascript_ajax) |
|
| 132 | - { |
|
| 133 | - $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
| 134 | - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
| 135 | - } |
|
| 136 | - else |
|
| 137 | - { |
|
| 138 | - $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - else |
|
| 142 | - { |
|
| 143 | - $this->tpl['tva_intra'] = $s; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - else |
|
| 147 | - { |
|
| 148 | - // Confirm delete third party |
|
| 149 | - if ($action == 'delete') |
|
| 150 | - { |
|
| 151 | - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete"); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - for ($i=1; $i<=4; $i++) |
|
| 155 | - { |
|
| 156 | - $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
| 157 | - $this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object); |
|
| 158 | - $this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - // TVA intra |
|
| 162 | - if ($this->object->tva_intra) |
|
| 163 | - { |
|
| 164 | - $s=$this->object->tva_intra; |
|
| 165 | - $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 166 | - if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
| 167 | - { |
|
| 168 | - $s.=' '; |
|
| 169 | - |
|
| 170 | - if ($conf->use_javascript_ajax) |
|
| 171 | - { |
|
| 172 | - $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
| 173 | - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
| 174 | - } |
|
| 175 | - else |
|
| 176 | - { |
|
| 177 | - $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
| 178 | - } |
|
| 179 | - } |
|
| 180 | - else |
|
| 181 | - { |
|
| 182 | - $this->tpl['tva_intra'] = $s; |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - else |
|
| 186 | - { |
|
| 187 | - $this->tpl['tva_intra'] = ' '; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - // Parent company |
|
| 191 | - if ($this->object->parent) |
|
| 192 | - { |
|
| 193 | - $socm = new Societe($this->db); |
|
| 194 | - $socm->fetch($this->object->parent); |
|
| 195 | - $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
|
| 196 | - $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
|
| 197 | - } |
|
| 198 | - else |
|
| 199 | - { |
|
| 200 | - $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Check permissions of a user to show a page and an object. Check read permission |
|
| 207 | - * If $_REQUEST['action'] defined, we also check write permission. |
|
| 208 | - * |
|
| 209 | - * @param User $user User to check |
|
| 210 | - * @param string $features Features to check (in most cases, it's module name) |
|
| 211 | - * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
| 212 | - * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
| 213 | - * @param string $feature2 Feature to check (second level of permission) |
|
| 214 | - * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
| 215 | - * @param string $dbt_select Field name for select if not rowid. (optional) |
|
| 216 | - * @return int 1 |
|
| 217 | - */ |
|
| 218 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
| 219 | - { |
|
| 220 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
| 221 | - } |
|
| 92 | + $this->tpl['profid2'] = $this->object->idprof2; |
|
| 93 | + $this->tpl['profid3'] = $this->object->idprof3; |
|
| 94 | + $this->tpl['profid4'] = $this->object->idprof4; |
|
| 95 | + |
|
| 96 | + if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
| 97 | + { |
|
| 98 | + $js = "\n"; |
|
| 99 | + $js.= '<script language="JavaScript" type="text/javascript">'; |
|
| 100 | + $js.= "function CheckVAT(a) {\n"; |
|
| 101 | + $js.= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n"; |
|
| 102 | + $js.= "}\n"; |
|
| 103 | + $js.= '</script>'; |
|
| 104 | + $js.= "\n"; |
|
| 105 | + $this->tpl['js_checkVatPopup'] = $js; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + if ($action == 'create' || $action == 'edit') |
|
| 109 | + { |
|
| 110 | + for ($i=1; $i<=4; $i++) |
|
| 111 | + { |
|
| 112 | + $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
| 113 | + $this->tpl['showprofid'.$i] = $formcompany->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i],$this->object->country_code); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + // Type |
|
| 117 | + $this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id); |
|
| 118 | + |
|
| 119 | + // Juridical Status |
|
| 120 | + $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code); |
|
| 121 | + |
|
| 122 | + // Workforce |
|
| 123 | + $this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id); |
|
| 124 | + |
|
| 125 | + // VAT intra |
|
| 126 | + $s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 127 | + if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
| 128 | + { |
|
| 129 | + $s.=' '; |
|
| 130 | + |
|
| 131 | + if ($conf->use_javascript_ajax) |
|
| 132 | + { |
|
| 133 | + $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
| 134 | + $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
| 135 | + } |
|
| 136 | + else |
|
| 137 | + { |
|
| 138 | + $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + else |
|
| 142 | + { |
|
| 143 | + $this->tpl['tva_intra'] = $s; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + else |
|
| 147 | + { |
|
| 148 | + // Confirm delete third party |
|
| 149 | + if ($action == 'delete') |
|
| 150 | + { |
|
| 151 | + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete"); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + for ($i=1; $i<=4; $i++) |
|
| 155 | + { |
|
| 156 | + $this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->country_code); |
|
| 157 | + $this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object); |
|
| 158 | + $this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + // TVA intra |
|
| 162 | + if ($this->object->tva_intra) |
|
| 163 | + { |
|
| 164 | + $s=$this->object->tva_intra; |
|
| 165 | + $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 166 | + if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
|
| 167 | + { |
|
| 168 | + $s.=' '; |
|
| 169 | + |
|
| 170 | + if ($conf->use_javascript_ajax) |
|
| 171 | + { |
|
| 172 | + $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
|
| 173 | + $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
|
| 174 | + } |
|
| 175 | + else |
|
| 176 | + { |
|
| 177 | + $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | + else |
|
| 181 | + { |
|
| 182 | + $this->tpl['tva_intra'] = $s; |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + else |
|
| 186 | + { |
|
| 187 | + $this->tpl['tva_intra'] = ' '; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + // Parent company |
|
| 191 | + if ($this->object->parent) |
|
| 192 | + { |
|
| 193 | + $socm = new Societe($this->db); |
|
| 194 | + $socm->fetch($this->object->parent); |
|
| 195 | + $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
|
| 196 | + $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
|
| 197 | + } |
|
| 198 | + else |
|
| 199 | + { |
|
| 200 | + $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Check permissions of a user to show a page and an object. Check read permission |
|
| 207 | + * If $_REQUEST['action'] defined, we also check write permission. |
|
| 208 | + * |
|
| 209 | + * @param User $user User to check |
|
| 210 | + * @param string $features Features to check (in most cases, it's module name) |
|
| 211 | + * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
| 212 | + * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
| 213 | + * @param string $feature2 Feature to check (second level of permission) |
|
| 214 | + * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
| 215 | + * @param string $dbt_select Field name for select if not rowid. (optional) |
|
| 216 | + * @return int 1 |
|
| 217 | + */ |
|
| 218 | + function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
| 219 | + { |
|
| 220 | + return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
| 221 | + } |
|
| 222 | 222 | } |
@@ -37,47 +37,47 @@ discard block |
||
| 37 | 37 | var $canvas; |
| 38 | 38 | var $card; |
| 39 | 39 | |
| 40 | - //! Template container |
|
| 41 | - var $tpl = array(); |
|
| 42 | - //! Object container |
|
| 43 | - var $object; |
|
| 40 | + //! Template container |
|
| 41 | + var $tpl = array(); |
|
| 42 | + //! Object container |
|
| 43 | + var $object; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string Error code (or message) |
|
| 47 | - */ |
|
| 48 | - public $error=''; |
|
| 45 | + /** |
|
| 46 | + * @var string Error code (or message) |
|
| 47 | + */ |
|
| 48 | + public $error=''; |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var string[] Error codes (or messages) |
|
| 53 | - */ |
|
| 54 | - public $errors = array(); |
|
| 51 | + /** |
|
| 52 | + * @var string[] Error codes (or messages) |
|
| 53 | + */ |
|
| 54 | + public $errors = array(); |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * Get object from id or ref and save it into this->object |
| 59 | - * |
|
| 59 | + * |
|
| 60 | 60 | * @param int $id Object id |
| 61 | 61 | * @param ref $ref Object ref |
| 62 | 62 | * @return object Object loaded |
| 63 | 63 | */ |
| 64 | 64 | protected function getObject($id,$ref='') |
| 65 | 65 | { |
| 66 | - //$ret = $this->getInstanceDao(); |
|
| 66 | + //$ret = $this->getInstanceDao(); |
|
| 67 | 67 | |
| 68 | - $object = new Societe($this->db); |
|
| 69 | - if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
| 70 | - $this->object = $object; |
|
| 68 | + $object = new Societe($this->db); |
|
| 69 | + if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
| 70 | + $this->object = $object; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
| 74 | - /** |
|
| 75 | - * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
| 76 | - * |
|
| 77 | - * @param string $action Type of action |
|
| 78 | - * @param integer $id Id of object |
|
| 79 | - * @param string $ref Ref of object |
|
| 80 | - * @return void |
|
| 74 | + /** |
|
| 75 | + * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
| 76 | + * |
|
| 77 | + * @param string $action Type of action |
|
| 78 | + * @param integer $id Id of object |
|
| 79 | + * @param string $ref Ref of object |
|
| 80 | + * @return void |
|
| 81 | 81 | */ |
| 82 | 82 | function assign_values(&$action, $id=0, $ref='') |
| 83 | 83 | { |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if ($action == 'create') |
| 105 | 105 | { |
| 106 | - if ($conf->use_javascript_ajax) |
|
| 107 | - { |
|
| 108 | - $this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript"> |
|
| 106 | + if ($conf->use_javascript_ajax) |
|
| 107 | + { |
|
| 108 | + $this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript"> |
|
| 109 | 109 | $(document).ready(function () { |
| 110 | 110 | $("#radiocompany").click(function() { |
| 111 | 111 | document.formsoc.action.value="create"; |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | }); |
| 122 | 122 | }); |
| 123 | 123 | </script>'."\n"; |
| 124 | - } |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if ($action == 'create' || $action == 'edit') |
| 128 | 128 | { |
| 129 | - if ($conf->use_javascript_ajax) |
|
| 130 | - { |
|
| 131 | - $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> |
|
| 129 | + if ($conf->use_javascript_ajax) |
|
| 130 | + { |
|
| 131 | + $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> |
|
| 132 | 132 | $(document).ready(function () { |
| 133 | 133 | $("#selectcountry_id").change(function() { |
| 134 | 134 | document.formsoc.action.value="'.$action.'"; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | }); |
| 138 | 138 | }) |
| 139 | 139 | </script>'."\n"; |
| 140 | - } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | 142 | // Load object modCodeClient |
| 143 | 143 | $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); |
@@ -173,35 +173,35 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | if (! empty($conf->fournisseur->enabled)) |
| 175 | 175 | { |
| 176 | - $this->tpl['supplier_enabled'] = 1; |
|
| 177 | - |
|
| 178 | - // Load object modCodeFournisseur |
|
| 179 | - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; |
|
| 180 | - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
|
| 181 | - { |
|
| 182 | - $module = substr($module, 0, dol_strlen($module)-4); |
|
| 183 | - } |
|
| 176 | + $this->tpl['supplier_enabled'] = 1; |
|
| 177 | + |
|
| 178 | + // Load object modCodeFournisseur |
|
| 179 | + $module=$conf->global->SOCIETE_CODECLIENT_ADDON; |
|
| 180 | + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
|
| 181 | + { |
|
| 182 | + $module = substr($module, 0, dol_strlen($module)-4); |
|
| 183 | + } |
|
| 184 | 184 | $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); |
| 185 | 185 | foreach ($dirsociete as $dirroot) |
| 186 | 186 | { |
| 187 | 187 | $res=dol_include_once($dirroot.$module.'.php'); |
| 188 | 188 | if ($res) break; |
| 189 | 189 | } |
| 190 | - $modCodeFournisseur = new $module; |
|
| 191 | - $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; |
|
| 192 | - // We verified if the tag prefix is used |
|
| 193 | - if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
| 194 | - |
|
| 195 | - // Supplier |
|
| 196 | - $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
|
| 197 | - $this->tpl['suppliercode'] = $this->object->code_fournisseur; |
|
| 198 | - if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
| 199 | - $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
|
| 200 | - $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
|
| 201 | - $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
|
| 202 | - |
|
| 203 | - $this->object->LoadSupplierCateg(); |
|
| 204 | - $this->tpl['suppliercategory'] = $this->object->SupplierCategories; |
|
| 190 | + $modCodeFournisseur = new $module; |
|
| 191 | + $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; |
|
| 192 | + // We verified if the tag prefix is used |
|
| 193 | + if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
| 194 | + |
|
| 195 | + // Supplier |
|
| 196 | + $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
|
| 197 | + $this->tpl['suppliercode'] = $this->object->code_fournisseur; |
|
| 198 | + if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
| 199 | + $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
|
| 200 | + $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
|
| 201 | + $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
|
| 202 | + |
|
| 203 | + $this->object->LoadSupplierCateg(); |
|
| 204 | + $this->tpl['suppliercategory'] = $this->object->SupplierCategories; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Zip |
@@ -306,23 +306,23 @@ discard block |
||
| 306 | 306 | $nbofsalesrepresentative=count($listsalesrepresentatives); |
| 307 | 307 | if ($nbofsalesrepresentative > 3) // We print only number |
| 308 | 308 | { |
| 309 | - $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
|
| 310 | - $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
|
| 311 | - $this->tpl['sales_representatives'].= '</a>'; |
|
| 309 | + $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
|
| 310 | + $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
|
| 311 | + $this->tpl['sales_representatives'].= '</a>'; |
|
| 312 | 312 | } |
| 313 | 313 | else if ($nbofsalesrepresentative > 0) |
| 314 | 314 | { |
| 315 | - $userstatic=new User($this->db); |
|
| 316 | - $i=0; |
|
| 317 | - foreach($listsalesrepresentatives as $val) |
|
| 318 | - { |
|
| 319 | - $userstatic->id=$val['id']; |
|
| 320 | - $userstatic->lastname=$val['name']; |
|
| 321 | - $userstatic->firstname=$val['firstname']; |
|
| 322 | - $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
|
| 323 | - $i++; |
|
| 324 | - if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
| 325 | - } |
|
| 315 | + $userstatic=new User($this->db); |
|
| 316 | + $i=0; |
|
| 317 | + foreach($listsalesrepresentatives as $val) |
|
| 318 | + { |
|
| 319 | + $userstatic->id=$val['id']; |
|
| 320 | + $userstatic->lastname=$val['name']; |
|
| 321 | + $userstatic->firstname=$val['firstname']; |
|
| 322 | + $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
|
| 323 | + $i++; |
|
| 324 | + if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
| 325 | + } |
|
| 326 | 326 | } |
| 327 | 327 | else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
| 328 | 328 | |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | // Protection to avoid direct call of template |
| 20 | 20 | if (empty($conf) || ! is_object($conf)) |
| 21 | 21 | { |
| 22 | - print "Error, template page can't be called as URL"; |
|
| 23 | - exit; |
|
| 22 | + print "Error, template page can't be called as URL"; |
|
| 23 | + exit; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | ?> |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | // Protection to avoid direct call of template |
| 19 | 19 | if (empty($conf) || ! is_object($conf)) |
| 20 | 20 | { |
| 21 | - print "Error, template page can't be called as URL"; |
|
| 22 | - exit; |
|
| 21 | + print "Error, template page can't be called as URL"; |
|
| 22 | + exit; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | // Protection to avoid direct call of template |
| 20 | 20 | if (empty($conf) || ! is_object($conf)) |
| 21 | 21 | { |
| 22 | - print "Error, template page can't be called as URL"; |
|
| 23 | - exit; |
|
| 22 | + print "Error, template page can't be called as URL"; |
|
| 23 | + exit; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | ?> |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | <?php |
| 110 | 110 | if ($this->control->tpl['fournisseur']) { |
| 111 | - if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
| 111 | + if (count($this->control->tpl['suppliercategory']) > 0) { ?> |
|
| 112 | 112 | <tr> |
| 113 | 113 | <td><?php echo $langs->trans('SupplierCategory'); ?></td> |
| 114 | 114 | <td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td> |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | class ActionsCardIndividual extends ActionsCardCommon |
| 30 | 30 | { |
| 31 | 31 | /** |
| 32 | - * Constructor |
|
| 33 | - * |
|
| 32 | + * Constructor |
|
| 33 | + * |
|
| 34 | 34 | * @param DoliDB $db Handler acces base de donnees |
| 35 | 35 | * @param string $dirmodule Name of directory of module |
| 36 | 36 | * @param string $targetmodule Name of directory of module where canvas is stored |
| 37 | 37 | * @param string $canvas Name of canvas |
| 38 | 38 | * @param string $card Name of tab (sub-canvas) |
| 39 | 39 | */ |
| 40 | - function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
| 41 | - { |
|
| 42 | - $this->db = $db; |
|
| 43 | - $this->dirmodule = $dirmodule; |
|
| 44 | - $this->targetmodule = $targetmodule; |
|
| 40 | + function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
|
| 41 | + { |
|
| 42 | + $this->db = $db; |
|
| 43 | + $this->dirmodule = $dirmodule; |
|
| 44 | + $this->targetmodule = $targetmodule; |
|
| 45 | 45 | $this->canvas = $canvas; |
| 46 | 46 | $this->card = $card; |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -67,73 +67,73 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Execute actions |
|
| 70 | + /** |
|
| 71 | + * Execute actions |
|
| 72 | 72 | * @deprecated Use the doActions of hooks instead of this. |
| 73 | - * |
|
| 74 | - * @param string $action Action |
|
| 75 | - * @param int $id Id of object (may be empty for creation) |
|
| 76 | - * @return int <0 if KO, >0 if OK |
|
| 77 | - */ |
|
| 78 | - function doActions(&$action, $id) |
|
| 79 | - { |
|
| 80 | - $ret = $this->getObject($id); |
|
| 73 | + * |
|
| 74 | + * @param string $action Action |
|
| 75 | + * @param int $id Id of object (may be empty for creation) |
|
| 76 | + * @return int <0 if KO, >0 if OK |
|
| 77 | + */ |
|
| 78 | + function doActions(&$action, $id) |
|
| 79 | + { |
|
| 80 | + $ret = $this->getObject($id); |
|
| 81 | 81 | |
| 82 | - $return = parent::doActions($action); |
|
| 82 | + $return = parent::doActions($action); |
|
| 83 | 83 | |
| 84 | - return $return; |
|
| 85 | - } |
|
| 84 | + return $return; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
| 88 | - /** |
|
| 89 | - * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
| 90 | - * |
|
| 91 | - * @param string $action Type of action |
|
| 92 | - * @param integer $id Id of object |
|
| 93 | - * @param string $ref Ref of object |
|
| 94 | - * @return void |
|
| 95 | - */ |
|
| 96 | - function assign_values(&$action, $id=0, $ref='') |
|
| 97 | - { |
|
| 88 | + /** |
|
| 89 | + * Assign custom values for canvas (for example into this->tpl to be used by templates) |
|
| 90 | + * |
|
| 91 | + * @param string $action Type of action |
|
| 92 | + * @param integer $id Id of object |
|
| 93 | + * @param string $ref Ref of object |
|
| 94 | + * @return void |
|
| 95 | + */ |
|
| 96 | + function assign_values(&$action, $id=0, $ref='') |
|
| 97 | + { |
|
| 98 | 98 | // phpcs:enable |
| 99 | - global $conf, $langs; |
|
| 100 | - global $form, $formcompany; |
|
| 99 | + global $conf, $langs; |
|
| 100 | + global $form, $formcompany; |
|
| 101 | 101 | |
| 102 | - $ret = $this->getObject($id,$ref); |
|
| 102 | + $ret = $this->getObject($id,$ref); |
|
| 103 | 103 | |
| 104 | - parent::assign_values($action); |
|
| 104 | + parent::assign_values($action); |
|
| 105 | 105 | |
| 106 | 106 | $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); |
| 107 | 107 | |
| 108 | - if ($action == 'create' || $action == 'edit') |
|
| 109 | - { |
|
| 110 | - $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); |
|
| 111 | - } |
|
| 112 | - else |
|
| 113 | - { |
|
| 114 | - // Confirm delete third party |
|
| 115 | - if ($action == 'delete' || $conf->use_javascript_ajax) |
|
| 116 | - { |
|
| 117 | - $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete"); |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Check permissions of a user to show a page and an object. Check read permission |
|
| 124 | - * If $_REQUEST['action'] defined, we also check write permission. |
|
| 125 | - * |
|
| 126 | - * @param User $user User to check |
|
| 127 | - * @param string $features Features to check (in most cases, it's module name) |
|
| 128 | - * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
| 129 | - * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
| 130 | - * @param string $feature2 Feature to check (second level of permission) |
|
| 131 | - * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
| 132 | - * @param string $dbt_select Field name for select if not rowid. (optional) |
|
| 133 | - * @return int 1 |
|
| 134 | - */ |
|
| 135 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
| 136 | - { |
|
| 137 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
| 138 | - } |
|
| 108 | + if ($action == 'create' || $action == 'edit') |
|
| 109 | + { |
|
| 110 | + $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); |
|
| 111 | + } |
|
| 112 | + else |
|
| 113 | + { |
|
| 114 | + // Confirm delete third party |
|
| 115 | + if ($action == 'delete' || $conf->use_javascript_ajax) |
|
| 116 | + { |
|
| 117 | + $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete"); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Check permissions of a user to show a page and an object. Check read permission |
|
| 124 | + * If $_REQUEST['action'] defined, we also check write permission. |
|
| 125 | + * |
|
| 126 | + * @param User $user User to check |
|
| 127 | + * @param string $features Features to check (in most cases, it's module name) |
|
| 128 | + * @param int $objectid Object ID if we want to check permission on a particular record (optional) |
|
| 129 | + * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optional) |
|
| 130 | + * @param string $feature2 Feature to check (second level of permission) |
|
| 131 | + * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optional) |
|
| 132 | + * @param string $dbt_select Field name for select if not rowid. (optional) |
|
| 133 | + * @return int 1 |
|
| 134 | + */ |
|
| 135 | + function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
| 136 | + { |
|
| 137 | + return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
| 138 | + } |
|
| 139 | 139 | } |
@@ -72,36 +72,36 @@ discard block |
||
| 72 | 72 | $search=array(); |
| 73 | 73 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 74 | 74 | { |
| 75 | - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
| 75 | + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // List of fields to search into when doing a "search in all" |
| 79 | 79 | $fieldstosearchall = array(); |
| 80 | 80 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 81 | 81 | { |
| 82 | - if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
| 82 | + if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Definition of fields for list |
| 86 | 86 | $arrayfields=array(); |
| 87 | 87 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 88 | 88 | { |
| 89 | - // If $val['visible']==0, then we never show the field |
|
| 90 | - if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
| 89 | + // If $val['visible']==0, then we never show the field |
|
| 90 | + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // Extra fields |
| 94 | 94 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
| 95 | 95 | { |
| 96 | - foreach($extrafields->attribute_label as $key => $val) |
|
| 97 | - { |
|
| 98 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
| 99 | - } |
|
| 96 | + foreach($extrafields->attribute_label as $key => $val) |
|
| 97 | + { |
|
| 98 | + if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
| 99 | + } |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if ($id > 0) |
| 103 | 103 | { |
| 104 | - $result = $object->fetch($id); |
|
| 104 | + $result = $object->fetch($id); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -128,17 +128,17 @@ discard block |
||
| 128 | 128 | // Purge search criteria |
| 129 | 129 | if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
| 130 | 130 | { |
| 131 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
| 132 | - { |
|
| 133 | - $search[$key]=''; |
|
| 134 | - } |
|
| 135 | - $toselect=''; |
|
| 136 | - $search_array_options=array(); |
|
| 131 | + foreach($objectwebsiteaccount->fields as $key => $val) |
|
| 132 | + { |
|
| 133 | + $search[$key]=''; |
|
| 134 | + } |
|
| 135 | + $toselect=''; |
|
| 136 | + $search_array_options=array(); |
|
| 137 | 137 | } |
| 138 | 138 | if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') |
| 139 | - || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) |
|
| 139 | + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) |
|
| 140 | 140 | { |
| 141 | - $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
| 141 | + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // Mass actions |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
| 172 | 172 | foreach($search as $key => $val) |
| 173 | 173 | { |
| 174 | - $param.= '&search_'.$key.'='.urlencode($search[$key]); |
|
| 174 | + $param.= '&search_'.$key.'='.urlencode($search[$key]); |
|
| 175 | 175 | } |
| 176 | 176 | if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
| 177 | 177 | // Add $param from extra fields |
@@ -194,25 +194,25 @@ discard block |
||
| 194 | 194 | // Prefix |
| 195 | 195 | if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
| 196 | 196 | { |
| 197 | - print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
|
| 197 | + print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>'; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | if ($object->client) { |
| 201 | - print '<tr><td class="titlefield">'; |
|
| 202 | - print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
|
| 203 | - print $object->code_client; |
|
| 204 | - if ($object->check_codeclient() != 0) |
|
| 205 | - print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
| 206 | - print '</td></tr>'; |
|
| 201 | + print '<tr><td class="titlefield">'; |
|
| 202 | + print $langs->trans('CustomerCode') . '</td><td colspan="3">'; |
|
| 203 | + print $object->code_client; |
|
| 204 | + if ($object->check_codeclient() != 0) |
|
| 205 | + print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>'; |
|
| 206 | + print '</td></tr>'; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if ($object->fournisseur) { |
| 210 | - print '<tr><td class="titlefield">'; |
|
| 211 | - print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
|
| 212 | - print $object->code_fournisseur; |
|
| 213 | - if ($object->check_codefournisseur() != 0) |
|
| 214 | - print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
| 215 | - print '</td></tr>'; |
|
| 210 | + print '<tr><td class="titlefield">'; |
|
| 211 | + print $langs->trans('SupplierCode') . '</td><td colspan="3">'; |
|
| 212 | + print $object->code_fournisseur; |
|
| 213 | + if ($object->check_codefournisseur() != 0) |
|
| 214 | + print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>'; |
|
| 215 | + print '</td></tr>'; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | print '</table>'; |
@@ -223,15 +223,15 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | $newcardbutton = ''; |
| 225 | 225 | if (! empty($conf->website->enabled)) { |
| 226 | - if (! empty($user->rights->societe->lire)) { |
|
| 227 | - $newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>'; |
|
| 228 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
| 229 | - $newcardbutton.= '</a>'; |
|
| 230 | - } else { |
|
| 231 | - $newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction"); |
|
| 232 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
| 233 | - $newcardbutton.= '</a>'; |
|
| 234 | - } |
|
| 226 | + if (! empty($user->rights->societe->lire)) { |
|
| 227 | + $newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>'; |
|
| 228 | + $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
| 229 | + $newcardbutton.= '</a>'; |
|
| 230 | + } else { |
|
| 231 | + $newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction"); |
|
| 232 | + $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
| 233 | + $newcardbutton.= '</a>'; |
|
| 234 | + } |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | print '<br>'; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $sql = 'SELECT '; |
| 244 | 244 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 245 | 245 | { |
| 246 | - $sql.='t.'.$key.', '; |
|
| 246 | + $sql.='t.'.$key.', '; |
|
| 247 | 247 | } |
| 248 | 248 | // Add fields from extrafields |
| 249 | 249 | foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | $sql.=" AND fk_soc = ".$object->id; |
| 260 | 260 | foreach($search as $key => $val) |
| 261 | 261 | { |
| 262 | - $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
|
| 263 | - if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
| 262 | + $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0); |
|
| 263 | + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); |
|
| 264 | 264 | } |
| 265 | 265 | if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); |
| 266 | 266 | // Add where from extra fields |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | $nbtotalofrecords = ''; |
| 291 | 291 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
| 292 | 292 | { |
| 293 | - $result = $db->query($sql); |
|
| 294 | - $nbtotalofrecords = $db->num_rows($result); |
|
| 295 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 296 | - { |
|
| 297 | - $page = 0; |
|
| 298 | - $offset = 0; |
|
| 299 | - } |
|
| 293 | + $result = $db->query($sql); |
|
| 294 | + $nbtotalofrecords = $db->num_rows($result); |
|
| 295 | + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
| 296 | + { |
|
| 297 | + $page = 0; |
|
| 298 | + $offset = 0; |
|
| 299 | + } |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $sql.= $db->plimit($limit+1, $offset); |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | $resql=$db->query($sql); |
| 305 | 305 | if (! $resql) |
| 306 | 306 | { |
| 307 | - dol_print_error($db); |
|
| 308 | - exit; |
|
| 307 | + dol_print_error($db); |
|
| 308 | + exit; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $num = $db->num_rows($resql); |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | if ($sall) |
| 344 | 344 | { |
| 345 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
| 346 | - print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
|
| 345 | + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
| 346 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>'; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /*$moreforfilter = ''; |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | if (! empty($moreforfilter)) |
| 360 | 360 | { |
| 361 | - print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
| 362 | - print $moreforfilter; |
|
| 363 | - print '</div>'; |
|
| 361 | + print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
| 362 | + print $moreforfilter; |
|
| 363 | + print '</div>'; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | print '<tr class="liste_titre">'; |
| 377 | 377 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 378 | 378 | { |
| 379 | - $align=''; |
|
| 380 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 381 | - if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
| 382 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 383 | - if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
| 379 | + $align=''; |
|
| 380 | + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 381 | + if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; |
|
| 382 | + if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 383 | + if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; |
|
| 384 | 384 | } |
| 385 | 385 | // Extra fields |
| 386 | 386 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | print '<tr class="liste_titre">'; |
| 402 | 402 | foreach($objectwebsiteaccount->fields as $key => $val) |
| 403 | 403 | { |
| 404 | - $align=''; |
|
| 405 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 406 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
| 407 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 408 | - if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
| 404 | + $align=''; |
|
| 405 | + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 406 | + if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
| 407 | + if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 408 | + if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; |
|
| 409 | 409 | } |
| 410 | 410 | // Extra fields |
| 411 | 411 | // Extra fields |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | $needToFetchEachLine=0; |
| 423 | 423 | foreach ($extrafields->attribute_computed as $key => $val) |
| 424 | 424 | { |
| 425 | - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
| 425 | + if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | |
@@ -432,90 +432,90 @@ discard block |
||
| 432 | 432 | $totalarray=array(); |
| 433 | 433 | while ($i < min($num, $limit)) |
| 434 | 434 | { |
| 435 | - $obj = $db->fetch_object($resql); |
|
| 436 | - if (empty($obj)) break; // Should not happen |
|
| 437 | - |
|
| 438 | - // Store properties in $object |
|
| 439 | - $objectwebsiteaccount->id = $obj->rowid; |
|
| 440 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
| 441 | - { |
|
| 442 | - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - // Show here line of result |
|
| 446 | - print '<tr class="oddeven">'; |
|
| 447 | - foreach($objectwebsiteaccount->fields as $key => $val) |
|
| 448 | - { |
|
| 449 | - $align=''; |
|
| 450 | - if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 451 | - if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
| 452 | - if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 453 | - if (! empty($arrayfields['t.'.$key]['checked'])) |
|
| 454 | - { |
|
| 455 | - print '<td'; |
|
| 456 | - if ($align) print ' class="'.$align.'"'; |
|
| 457 | - print '>'; |
|
| 458 | - if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
| 459 | - else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
| 460 | - print '</td>'; |
|
| 461 | - if (! $i) $totalarray['nbfield']++; |
|
| 462 | - if (! empty($val['isameasure'])) |
|
| 463 | - { |
|
| 464 | - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
| 465 | - $totalarray['val']['t.'.$key] += $obj->$key; |
|
| 466 | - } |
|
| 467 | - } |
|
| 468 | - } |
|
| 469 | - // Extra fields |
|
| 470 | - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
| 471 | - // Fields from hook |
|
| 472 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
| 473 | - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
| 474 | - print $hookmanager->resPrint; |
|
| 475 | - // Action column |
|
| 476 | - print '<td class="nowrap" align="center">'; |
|
| 477 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
| 478 | - { |
|
| 479 | - $selected=0; |
|
| 480 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
| 481 | - print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
| 482 | - } |
|
| 483 | - print '</td>'; |
|
| 484 | - if (! $i) $totalarray['nbfield']++; |
|
| 485 | - |
|
| 486 | - print '</tr>'; |
|
| 487 | - |
|
| 488 | - $i++; |
|
| 435 | + $obj = $db->fetch_object($resql); |
|
| 436 | + if (empty($obj)) break; // Should not happen |
|
| 437 | + |
|
| 438 | + // Store properties in $object |
|
| 439 | + $objectwebsiteaccount->id = $obj->rowid; |
|
| 440 | + foreach($objectwebsiteaccount->fields as $key => $val) |
|
| 441 | + { |
|
| 442 | + if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + // Show here line of result |
|
| 446 | + print '<tr class="oddeven">'; |
|
| 447 | + foreach($objectwebsiteaccount->fields as $key => $val) |
|
| 448 | + { |
|
| 449 | + $align=''; |
|
| 450 | + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; |
|
| 451 | + if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; |
|
| 452 | + if ($key == 'status') $align.=($align?' ':'').'center'; |
|
| 453 | + if (! empty($arrayfields['t.'.$key]['checked'])) |
|
| 454 | + { |
|
| 455 | + print '<td'; |
|
| 456 | + if ($align) print ' class="'.$align.'"'; |
|
| 457 | + print '>'; |
|
| 458 | + if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); |
|
| 459 | + else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); |
|
| 460 | + print '</td>'; |
|
| 461 | + if (! $i) $totalarray['nbfield']++; |
|
| 462 | + if (! empty($val['isameasure'])) |
|
| 463 | + { |
|
| 464 | + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; |
|
| 465 | + $totalarray['val']['t.'.$key] += $obj->$key; |
|
| 466 | + } |
|
| 467 | + } |
|
| 468 | + } |
|
| 469 | + // Extra fields |
|
| 470 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
|
| 471 | + // Fields from hook |
|
| 472 | + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
| 473 | + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook |
|
| 474 | + print $hookmanager->resPrint; |
|
| 475 | + // Action column |
|
| 476 | + print '<td class="nowrap" align="center">'; |
|
| 477 | + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
| 478 | + { |
|
| 479 | + $selected=0; |
|
| 480 | + if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
| 481 | + print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
| 482 | + } |
|
| 483 | + print '</td>'; |
|
| 484 | + if (! $i) $totalarray['nbfield']++; |
|
| 485 | + |
|
| 486 | + print '</tr>'; |
|
| 487 | + |
|
| 488 | + $i++; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // Show total line |
| 492 | 492 | if (isset($totalarray['pos'])) |
| 493 | 493 | { |
| 494 | - print '<tr class="liste_total">'; |
|
| 495 | - $i=0; |
|
| 496 | - while ($i < $totalarray['nbfield']) |
|
| 497 | - { |
|
| 498 | - $i++; |
|
| 499 | - if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
| 500 | - else |
|
| 501 | - { |
|
| 502 | - if ($i == 1) |
|
| 503 | - { |
|
| 504 | - if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
| 505 | - else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
| 506 | - } |
|
| 507 | - else print '<td></td>'; |
|
| 508 | - } |
|
| 509 | - } |
|
| 510 | - print '</tr>'; |
|
| 494 | + print '<tr class="liste_total">'; |
|
| 495 | + $i=0; |
|
| 496 | + while ($i < $totalarray['nbfield']) |
|
| 497 | + { |
|
| 498 | + $i++; |
|
| 499 | + if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; |
|
| 500 | + else |
|
| 501 | + { |
|
| 502 | + if ($i == 1) |
|
| 503 | + { |
|
| 504 | + if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>'; |
|
| 505 | + else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
|
| 506 | + } |
|
| 507 | + else print '<td></td>'; |
|
| 508 | + } |
|
| 509 | + } |
|
| 510 | + print '</tr>'; |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | // If no record found |
| 514 | 514 | if ($num == 0) |
| 515 | 515 | { |
| 516 | - $colspan=1; |
|
| 517 | - foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
| 518 | - print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
|
| 516 | + $colspan=1; |
|
| 517 | + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } |
|
| 518 | + print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | |
@@ -532,21 +532,21 @@ discard block |
||
| 532 | 532 | |
| 533 | 533 | if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) |
| 534 | 534 | { |
| 535 | - $hidegeneratedfilelistifempty=1; |
|
| 536 | - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
| 535 | + $hidegeneratedfilelistifempty=1; |
|
| 536 | + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; |
|
| 537 | 537 | |
| 538 | - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 539 | - $formfile = new FormFile($db); |
|
| 538 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 539 | + $formfile = new FormFile($db); |
|
| 540 | 540 | |
| 541 | - // Show list of available documents |
|
| 542 | - $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
| 543 | - $urlsource.=str_replace('&','&',$param); |
|
| 541 | + // Show list of available documents |
|
| 542 | + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; |
|
| 543 | + $urlsource.=str_replace('&','&',$param); |
|
| 544 | 544 | |
| 545 | - $filedir=$diroutputmassaction; |
|
| 546 | - $genallowed=$user->rights->mymodule->read; |
|
| 547 | - $delallowed=$user->rights->mymodule->create; |
|
| 545 | + $filedir=$diroutputmassaction; |
|
| 546 | + $genallowed=$user->rights->mymodule->read; |
|
| 547 | + $delallowed=$user->rights->mymodule->create; |
|
| 548 | 548 | |
| 549 | - print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); |
|
| 549 | + print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // End of page |