@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if (empty($socid)) |
| 102 | 102 | { |
| 103 | - dol_print_error($db); |
|
| 104 | - exit; |
|
| 103 | + dol_print_error($db); |
|
| 104 | + exit; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $head = societe_prepare_head($object); |
@@ -118,50 +118,50 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
| 120 | 120 | { |
| 121 | - print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
|
| 121 | + print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | //if ($conf->agenda->enabled && $user->rights->agenda->myactions->read) $elementTypeArray['action']=$langs->transnoentitiesnoconv('Events'); |
| 125 | 125 | |
| 126 | 126 | if ($object->client) |
| 127 | 127 | { |
| 128 | - print '<tr><td class="titlefield">'; |
|
| 129 | - print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
|
| 130 | - print $object->code_client; |
|
| 131 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 132 | - print '</td></tr>'; |
|
| 133 | - $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; |
|
| 134 | - $resql=$db->query($sql); |
|
| 135 | - if (!$resql) dol_print_error($db); |
|
| 136 | - |
|
| 137 | - $obj = $db->fetch_object($resql); |
|
| 138 | - $nbFactsClient = $obj->nb; |
|
| 139 | - $thirdTypeArray['customer']=$langs->trans("customer"); |
|
| 140 | - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 141 | - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 142 | - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 143 | - if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 128 | + print '<tr><td class="titlefield">'; |
|
| 129 | + print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
|
| 130 | + print $object->code_client; |
|
| 131 | + if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 132 | + print '</td></tr>'; |
|
| 133 | + $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; |
|
| 134 | + $resql=$db->query($sql); |
|
| 135 | + if (!$resql) dol_print_error($db); |
|
| 136 | + |
|
| 137 | + $obj = $db->fetch_object($resql); |
|
| 138 | + $nbFactsClient = $obj->nb; |
|
| 139 | + $thirdTypeArray['customer']=$langs->trans("customer"); |
|
| 140 | + if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 141 | + if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 142 | + if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 143 | + if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); |
| 147 | 147 | |
| 148 | 148 | if ($object->fournisseur) |
| 149 | 149 | { |
| 150 | - print '<tr><td class="titlefield">'; |
|
| 151 | - print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
|
| 152 | - print $object->code_fournisseur; |
|
| 153 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 154 | - print '</td></tr>'; |
|
| 155 | - $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; |
|
| 156 | - $resql=$db->query($sql); |
|
| 157 | - if (!$resql) dol_print_error($db); |
|
| 158 | - |
|
| 159 | - $obj = $db->fetch_object($resql); |
|
| 160 | - $nbCmdsFourn = $obj->nb; |
|
| 161 | - $thirdTypeArray['supplier']=$langs->trans("supplier"); |
|
| 162 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 163 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 164 | - if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 150 | + print '<tr><td class="titlefield">'; |
|
| 151 | + print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
|
| 152 | + print $object->code_fournisseur; |
|
| 153 | + if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 154 | + print '</td></tr>'; |
|
| 155 | + $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; |
|
| 156 | + $resql=$db->query($sql); |
|
| 157 | + if (!$resql) dol_print_error($db); |
|
| 158 | + |
|
| 159 | + $obj = $db->fetch_object($resql); |
|
| 160 | + $nbCmdsFourn = $obj->nb; |
|
| 161 | + $thirdTypeArray['supplier']=$langs->trans("supplier"); |
|
| 162 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 163 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 164 | + if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 165 | 165 | } |
| 166 | 166 | print '</table>'; |
| 167 | 167 | |
@@ -187,66 +187,66 @@ discard block |
||
| 187 | 187 | }*/ |
| 188 | 188 | if ($type_element == 'fichinter') |
| 189 | 189 | { // Customer : show products from invoices |
| 190 | - require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 191 | - $documentstatic=new Fichinter($db); |
|
| 192 | - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, '; |
|
| 193 | - $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. |
|
| 194 | - $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 195 | - $where.= " AND f.entity = ".$conf->entity; |
|
| 196 | - $dateprint = 'f.datec'; |
|
| 197 | - $doc_number='f.ref'; |
|
| 190 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 191 | + $documentstatic=new Fichinter($db); |
|
| 192 | + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, '; |
|
| 193 | + $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. |
|
| 194 | + $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 195 | + $where.= " AND f.entity = ".$conf->entity; |
|
| 196 | + $dateprint = 'f.datec'; |
|
| 197 | + $doc_number='f.ref'; |
|
| 198 | 198 | } |
| 199 | 199 | if ($type_element == 'invoice') |
| 200 | 200 | { // Customer : show products from invoices |
| 201 | - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 202 | - $documentstatic=new Facture($db); |
|
| 203 | - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; |
|
| 204 | - $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; |
|
| 205 | - $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 206 | - $where.= " AND d.fk_facture = f.rowid"; |
|
| 207 | - $where.= " AND f.entity = ".$conf->entity; |
|
| 208 | - $dateprint = 'f.datef'; |
|
| 209 | - $doc_number='f.ref'; |
|
| 210 | - $thirdTypeSelect='customer'; |
|
| 201 | + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 202 | + $documentstatic=new Facture($db); |
|
| 203 | + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; |
|
| 204 | + $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; |
|
| 205 | + $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 206 | + $where.= " AND d.fk_facture = f.rowid"; |
|
| 207 | + $where.= " AND f.entity = ".$conf->entity; |
|
| 208 | + $dateprint = 'f.datef'; |
|
| 209 | + $doc_number='f.ref'; |
|
| 210 | + $thirdTypeSelect='customer'; |
|
| 211 | 211 | } |
| 212 | 212 | if ($type_element == 'propal') |
| 213 | 213 | { |
| 214 | - require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 215 | - $documentstatic=new Propal($db); |
|
| 216 | - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, '; |
|
| 217 | - $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; |
|
| 218 | - $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 219 | - $where.= " AND d.fk_propal = c.rowid"; |
|
| 220 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 221 | - $datePrint = 'c.datep'; |
|
| 222 | - $doc_number='c.ref'; |
|
| 223 | - $thirdTypeSelect='customer'; |
|
| 214 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 215 | + $documentstatic=new Propal($db); |
|
| 216 | + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, '; |
|
| 217 | + $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; |
|
| 218 | + $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 219 | + $where.= " AND d.fk_propal = c.rowid"; |
|
| 220 | + $where.= " AND c.entity = ".$conf->entity; |
|
| 221 | + $datePrint = 'c.datep'; |
|
| 222 | + $doc_number='c.ref'; |
|
| 223 | + $thirdTypeSelect='customer'; |
|
| 224 | 224 | } |
| 225 | 225 | if ($type_element == 'order') |
| 226 | 226 | { |
| 227 | - require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
| 228 | - $documentstatic=new Commande($db); |
|
| 229 | - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, '; |
|
| 230 | - $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; |
|
| 231 | - $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 232 | - $where.= " AND d.fk_commande = c.rowid"; |
|
| 233 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 234 | - $dateprint = 'c.date_commande'; |
|
| 235 | - $doc_number='c.ref'; |
|
| 236 | - $thirdTypeSelect='customer'; |
|
| 227 | + require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
| 228 | + $documentstatic=new Commande($db); |
|
| 229 | + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, '; |
|
| 230 | + $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; |
|
| 231 | + $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 232 | + $where.= " AND d.fk_commande = c.rowid"; |
|
| 233 | + $where.= " AND c.entity = ".$conf->entity; |
|
| 234 | + $dateprint = 'c.date_commande'; |
|
| 235 | + $doc_number='c.ref'; |
|
| 236 | + $thirdTypeSelect='customer'; |
|
| 237 | 237 | } |
| 238 | 238 | if ($type_element == 'supplier_invoice') |
| 239 | 239 | { // Supplier : Show products from invoices. |
| 240 | - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 241 | - $documentstatic=new FactureFournisseur($db); |
|
| 242 | - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; |
|
| 243 | - $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; |
|
| 244 | - $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 245 | - $where.= " AND d.fk_facture_fourn = f.rowid"; |
|
| 246 | - $where.= " AND f.entity = ".$conf->entity; |
|
| 247 | - $dateprint = 'f.datef'; |
|
| 248 | - $doc_number='f.ref'; |
|
| 249 | - $thirdTypeSelect='supplier'; |
|
| 240 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 241 | + $documentstatic=new FactureFournisseur($db); |
|
| 242 | + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; |
|
| 243 | + $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; |
|
| 244 | + $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 245 | + $where.= " AND d.fk_facture_fourn = f.rowid"; |
|
| 246 | + $where.= " AND f.entity = ".$conf->entity; |
|
| 247 | + $dateprint = 'f.datef'; |
|
| 248 | + $doc_number='f.ref'; |
|
| 249 | + $thirdTypeSelect='supplier'; |
|
| 250 | 250 | } |
| 251 | 251 | if ($type_element == 'supplier_proposal') |
| 252 | 252 | { |
@@ -263,30 +263,30 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | if ($type_element == 'supplier_order') |
| 265 | 265 | { // Supplier : Show products from orders. |
| 266 | - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
| 267 | - $documentstatic=new CommandeFournisseur($db); |
|
| 268 | - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; |
|
| 269 | - $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; |
|
| 270 | - $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 271 | - $where.= " AND d.fk_commande = c.rowid"; |
|
| 272 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 273 | - $dateprint = 'c.date_valid'; |
|
| 274 | - $doc_number='c.ref'; |
|
| 275 | - $thirdTypeSelect='supplier'; |
|
| 266 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
| 267 | + $documentstatic=new CommandeFournisseur($db); |
|
| 268 | + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; |
|
| 269 | + $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; |
|
| 270 | + $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 271 | + $where.= " AND d.fk_commande = c.rowid"; |
|
| 272 | + $where.= " AND c.entity = ".$conf->entity; |
|
| 273 | + $dateprint = 'c.date_valid'; |
|
| 274 | + $doc_number='c.ref'; |
|
| 275 | + $thirdTypeSelect='supplier'; |
|
| 276 | 276 | } |
| 277 | 277 | if ($type_element == 'contract') |
| 278 | 278 | { // Order |
| 279 | - require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 280 | - $documentstatic=new Contrat($db); |
|
| 281 | - $documentstaticline=new ContratLigne($db); |
|
| 282 | - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; |
|
| 283 | - $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; |
|
| 284 | - $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 285 | - $where.= " AND d.fk_contrat = c.rowid"; |
|
| 286 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 287 | - $dateprint = 'c.date_valid'; |
|
| 288 | - $doc_number='c.ref'; |
|
| 289 | - $thirdTypeSelect='customer'; |
|
| 279 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 280 | + $documentstatic=new Contrat($db); |
|
| 281 | + $documentstaticline=new ContratLigne($db); |
|
| 282 | + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; |
|
| 283 | + $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; |
|
| 284 | + $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
|
| 285 | + $where.= " AND d.fk_contrat = c.rowid"; |
|
| 286 | + $where.= " AND c.entity = ".$conf->entity; |
|
| 287 | + $dateprint = 'c.date_valid'; |
|
| 288 | + $doc_number='c.ref'; |
|
| 289 | + $thirdTypeSelect='customer'; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | $parameters=array(); |
@@ -294,45 +294,45 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | if (!empty($sql_select)) |
| 296 | 296 | { |
| 297 | - $sql = $sql_select; |
|
| 298 | - $sql.= ' d.description as description,'; |
|
| 299 | - if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 300 | - if ($type_element == 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 301 | - if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 302 | - if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 303 | - $sql.= " s.rowid as socid "; |
|
| 304 | - if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 305 | - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; |
|
| 306 | - if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 307 | - $sql.= $where; |
|
| 308 | - if ($month > 0) { |
|
| 309 | - if ($year > 0) { |
|
| 310 | - $start = dol_mktime(0, 0, 0, $month, 1, $year); |
|
| 311 | - $end = dol_time_plus_duree($start,1,'m') - 1; |
|
| 312 | - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 313 | - } else { |
|
| 314 | - $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; |
|
| 315 | - } |
|
| 316 | - } else if ($year > 0) { |
|
| 317 | - $start = dol_mktime(0, 0, 0, 1, 1, $year); |
|
| 318 | - $end = dol_time_plus_duree($start,1,'y') - 1; |
|
| 319 | - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 320 | - } |
|
| 321 | - if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 322 | - if ($sprod_fulldescr) |
|
| 323 | - { |
|
| 324 | - $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 325 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 326 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 327 | - $sql.=")"; |
|
| 328 | - } |
|
| 329 | - $sql.= $db->order($sortfield,$sortorder); |
|
| 330 | - |
|
| 331 | - $resql=$db->query($sql); |
|
| 332 | - $totalnboflines = $db->num_rows($resql); |
|
| 333 | - |
|
| 334 | - $sql.= $db->plimit($limit + 1, $offset); |
|
| 335 | - //print $sql; |
|
| 297 | + $sql = $sql_select; |
|
| 298 | + $sql.= ' d.description as description,'; |
|
| 299 | + if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 300 | + if ($type_element == 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 301 | + if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 302 | + if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 303 | + $sql.= " s.rowid as socid "; |
|
| 304 | + if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 305 | + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; |
|
| 306 | + if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 307 | + $sql.= $where; |
|
| 308 | + if ($month > 0) { |
|
| 309 | + if ($year > 0) { |
|
| 310 | + $start = dol_mktime(0, 0, 0, $month, 1, $year); |
|
| 311 | + $end = dol_time_plus_duree($start,1,'m') - 1; |
|
| 312 | + $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 313 | + } else { |
|
| 314 | + $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; |
|
| 315 | + } |
|
| 316 | + } else if ($year > 0) { |
|
| 317 | + $start = dol_mktime(0, 0, 0, 1, 1, $year); |
|
| 318 | + $end = dol_time_plus_duree($start,1,'y') - 1; |
|
| 319 | + $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 320 | + } |
|
| 321 | + if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 322 | + if ($sprod_fulldescr) |
|
| 323 | + { |
|
| 324 | + $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 325 | + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 326 | + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 327 | + $sql.=")"; |
|
| 328 | + } |
|
| 329 | + $sql.= $db->order($sortfield,$sortorder); |
|
| 330 | + |
|
| 331 | + $resql=$db->query($sql); |
|
| 332 | + $totalnboflines = $db->num_rows($resql); |
|
| 333 | + |
|
| 334 | + $sql.= $db->plimit($limit + 1, $offset); |
|
| 335 | + //print $sql; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | $disabled=0; |
@@ -359,19 +359,19 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | if ($sql_select) |
| 361 | 361 | { |
| 362 | - $resql=$db->query($sql); |
|
| 363 | - if (!$resql) dol_print_error($db); |
|
| 362 | + $resql=$db->query($sql); |
|
| 363 | + if (!$resql) dol_print_error($db); |
|
| 364 | 364 | |
| 365 | - $num = $db->num_rows($resql); |
|
| 365 | + $num = $db->num_rows($resql); |
|
| 366 | 366 | |
| 367 | - $param="&socid=".$socid."&type_element=".$type_element; |
|
| 367 | + $param="&socid=".$socid."&type_element=".$type_element; |
|
| 368 | 368 | if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
| 369 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 370 | - if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 371 | - if ($sref) $param.= "&sref=".urlencode($sref); |
|
| 372 | - if ($month) $param.= "&month=".$month; |
|
| 373 | - if ($year) $param.= "&year=".$year; |
|
| 374 | - if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 369 | + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 370 | + if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 371 | + if ($sref) $param.= "&sref=".urlencode($sref); |
|
| 372 | + if ($month) $param.= "&month=".$month; |
|
| 373 | + if ($year) $param.= "&year=".$year; |
|
| 374 | + if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 375 | 375 | |
| 376 | 376 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); |
| 377 | 377 | |
@@ -414,167 +414,167 @@ discard block |
||
| 414 | 414 | print "</tr>\n"; |
| 415 | 415 | |
| 416 | 416 | |
| 417 | - $i = 0; |
|
| 418 | - while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) |
|
| 419 | - { |
|
| 420 | - $documentstatic->id=$objp->doc_id; |
|
| 421 | - $documentstatic->ref=$objp->doc_number; |
|
| 422 | - $documentstatic->type=$objp->doc_type; |
|
| 423 | - $documentstatic->fk_statut=$objp->status; |
|
| 424 | - $documentstatic->fk_status=$objp->status; |
|
| 425 | - $documentstatic->statut=$objp->status; |
|
| 426 | - $documentstatic->status=$objp->status; |
|
| 427 | - $documentstatic->paye=$objp->paid; |
|
| 428 | - |
|
| 429 | - if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; |
|
| 430 | - |
|
| 431 | - print '<tr class="oddeven">'; |
|
| 432 | - print '<td class="nobordernopadding nowrap" width="100">'; |
|
| 433 | - print $documentstatic->getNomUrl(1); |
|
| 434 | - print '</td>'; |
|
| 435 | - print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),'day').'</td>'; |
|
| 436 | - |
|
| 437 | - // Status |
|
| 438 | - print '<td align="center">'; |
|
| 439 | - if ($type_element == 'contract') |
|
| 440 | - { |
|
| 441 | - print $documentstaticline->getLibStatut(2); |
|
| 442 | - } |
|
| 443 | - else |
|
| 444 | - { |
|
| 445 | - print $documentstatic->getLibStatut(2); |
|
| 446 | - } |
|
| 447 | - print '</td>'; |
|
| 448 | - |
|
| 449 | - print '<td>'; |
|
| 450 | - |
|
| 451 | - // Define text, description and type |
|
| 452 | - $text=''; $description=''; $type=0; |
|
| 453 | - |
|
| 454 | - // Code to show product duplicated from commonobject->printObjectLine |
|
| 455 | - if ($objp->fk_product > 0) |
|
| 456 | - { |
|
| 457 | - $product_static = new Product($db); |
|
| 458 | - |
|
| 459 | - $product_static->type=$objp->fk_product_type; |
|
| 460 | - $product_static->id=$objp->fk_product; |
|
| 461 | - $product_static->ref=$objp->ref; |
|
| 462 | - $product_static->entity=$objp->pentity; |
|
| 463 | - $text=$product_static->getNomUrl(1); |
|
| 464 | - } |
|
| 465 | - |
|
| 466 | - // Product |
|
| 467 | - if ($objp->fk_product > 0) |
|
| 468 | - { |
|
| 469 | - // Define output language |
|
| 470 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
| 471 | - { |
|
| 472 | - $prod = new Product($db); |
|
| 473 | - $prod->fetch($objp->fk_product); |
|
| 474 | - |
|
| 475 | - $outputlangs = $langs; |
|
| 476 | - $newlang=''; |
|
| 477 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); |
|
| 478 | - if (empty($newlang)) $newlang=$object->default_lang; |
|
| 479 | - if (! empty($newlang)) |
|
| 480 | - { |
|
| 481 | - $outputlangs = new Translate("",$conf); |
|
| 482 | - $outputlangs->setDefaultLang($newlang); |
|
| 483 | - } |
|
| 484 | - |
|
| 485 | - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
| 486 | - } |
|
| 487 | - else |
|
| 488 | - { |
|
| 489 | - $label = $objp->product_label; |
|
| 490 | - } |
|
| 491 | - |
|
| 492 | - $text.= ' - '.(! empty($objp->label)?$objp->label:$label); |
|
| 493 | - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); |
|
| 494 | - } |
|
| 495 | - |
|
| 496 | - if (($objp->info_bits & 2) == 2) { ?> |
|
| 417 | + $i = 0; |
|
| 418 | + while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) |
|
| 419 | + { |
|
| 420 | + $documentstatic->id=$objp->doc_id; |
|
| 421 | + $documentstatic->ref=$objp->doc_number; |
|
| 422 | + $documentstatic->type=$objp->doc_type; |
|
| 423 | + $documentstatic->fk_statut=$objp->status; |
|
| 424 | + $documentstatic->fk_status=$objp->status; |
|
| 425 | + $documentstatic->statut=$objp->status; |
|
| 426 | + $documentstatic->status=$objp->status; |
|
| 427 | + $documentstatic->paye=$objp->paid; |
|
| 428 | + |
|
| 429 | + if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; |
|
| 430 | + |
|
| 431 | + print '<tr class="oddeven">'; |
|
| 432 | + print '<td class="nobordernopadding nowrap" width="100">'; |
|
| 433 | + print $documentstatic->getNomUrl(1); |
|
| 434 | + print '</td>'; |
|
| 435 | + print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),'day').'</td>'; |
|
| 436 | + |
|
| 437 | + // Status |
|
| 438 | + print '<td align="center">'; |
|
| 439 | + if ($type_element == 'contract') |
|
| 440 | + { |
|
| 441 | + print $documentstaticline->getLibStatut(2); |
|
| 442 | + } |
|
| 443 | + else |
|
| 444 | + { |
|
| 445 | + print $documentstatic->getLibStatut(2); |
|
| 446 | + } |
|
| 447 | + print '</td>'; |
|
| 448 | + |
|
| 449 | + print '<td>'; |
|
| 450 | + |
|
| 451 | + // Define text, description and type |
|
| 452 | + $text=''; $description=''; $type=0; |
|
| 453 | + |
|
| 454 | + // Code to show product duplicated from commonobject->printObjectLine |
|
| 455 | + if ($objp->fk_product > 0) |
|
| 456 | + { |
|
| 457 | + $product_static = new Product($db); |
|
| 458 | + |
|
| 459 | + $product_static->type=$objp->fk_product_type; |
|
| 460 | + $product_static->id=$objp->fk_product; |
|
| 461 | + $product_static->ref=$objp->ref; |
|
| 462 | + $product_static->entity=$objp->pentity; |
|
| 463 | + $text=$product_static->getNomUrl(1); |
|
| 464 | + } |
|
| 465 | + |
|
| 466 | + // Product |
|
| 467 | + if ($objp->fk_product > 0) |
|
| 468 | + { |
|
| 469 | + // Define output language |
|
| 470 | + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
| 471 | + { |
|
| 472 | + $prod = new Product($db); |
|
| 473 | + $prod->fetch($objp->fk_product); |
|
| 474 | + |
|
| 475 | + $outputlangs = $langs; |
|
| 476 | + $newlang=''; |
|
| 477 | + if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); |
|
| 478 | + if (empty($newlang)) $newlang=$object->default_lang; |
|
| 479 | + if (! empty($newlang)) |
|
| 480 | + { |
|
| 481 | + $outputlangs = new Translate("",$conf); |
|
| 482 | + $outputlangs->setDefaultLang($newlang); |
|
| 483 | + } |
|
| 484 | + |
|
| 485 | + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
| 486 | + } |
|
| 487 | + else |
|
| 488 | + { |
|
| 489 | + $label = $objp->product_label; |
|
| 490 | + } |
|
| 491 | + |
|
| 492 | + $text.= ' - '.(! empty($objp->label)?$objp->label:$label); |
|
| 493 | + $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); |
|
| 494 | + } |
|
| 495 | + |
|
| 496 | + if (($objp->info_bits & 2) == 2) { ?> |
|
| 497 | 497 | <a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>"> |
| 498 | 498 | <?php |
| 499 | - $txt=''; |
|
| 500 | - print img_object($langs->trans("ShowReduc"),'reduc').' '; |
|
| 501 | - if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
| 502 | - elseif ($objp->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
| 503 | - elseif ($objp->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
| 504 | - //else $txt=$langs->trans("Discount"); |
|
| 505 | - print $txt; |
|
| 506 | - ?> |
|
| 499 | + $txt=''; |
|
| 500 | + print img_object($langs->trans("ShowReduc"),'reduc').' '; |
|
| 501 | + if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
| 502 | + elseif ($objp->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
| 503 | + elseif ($objp->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
| 504 | + //else $txt=$langs->trans("Discount"); |
|
| 505 | + print $txt; |
|
| 506 | + ?> |
|
| 507 | 507 | </a> |
| 508 | 508 | <?php |
| 509 | - if ($objp->description) |
|
| 510 | - { |
|
| 511 | - if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) |
|
| 512 | - { |
|
| 513 | - $discount=new DiscountAbsolute($db); |
|
| 514 | - $discount->fetch($objp->fk_remise_except); |
|
| 515 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); |
|
| 516 | - } |
|
| 517 | - if ($objp->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
|
| 518 | - { |
|
| 519 | - $discount=new DiscountAbsolute($db); |
|
| 520 | - $discount->fetch($objp->fk_remise_except); |
|
| 521 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
|
| 522 | - } |
|
| 523 | - elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
| 524 | - { |
|
| 525 | - $discount=new DiscountAbsolute($db); |
|
| 526 | - $discount->fetch($objp->fk_remise_except); |
|
| 527 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
|
| 528 | - } |
|
| 529 | - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
|
| 530 | - { |
|
| 531 | - $discount=new DiscountAbsolute($db); |
|
| 532 | - $discount->fetch($objp->fk_remise_except); |
|
| 533 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
|
| 534 | - // Add date of deposit |
|
| 535 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; |
|
| 536 | - } |
|
| 537 | - else |
|
| 538 | - { |
|
| 539 | - echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); |
|
| 540 | - } |
|
| 541 | - } |
|
| 542 | - } |
|
| 543 | - else |
|
| 544 | - { |
|
| 545 | - if ($objp->fk_product > 0) { |
|
| 546 | - |
|
| 547 | - echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); |
|
| 548 | - |
|
| 549 | - // Show range |
|
| 550 | - echo get_date_range($objp->date_start, $objp->date_end); |
|
| 551 | - |
|
| 552 | - // Add description in form |
|
| 553 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
| 554 | - { |
|
| 555 | - print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; |
|
| 556 | - } |
|
| 557 | - } else { |
|
| 558 | - |
|
| 559 | - if (! empty($objp->label) || ! empty($objp->description)) |
|
| 560 | - { |
|
| 561 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
| 562 | - else $text = img_object($langs->trans('Product'),'product'); |
|
| 563 | - |
|
| 564 | - if (! empty($objp->label)) { |
|
| 565 | - $text.= ' <strong>'.$objp->label.'</strong>'; |
|
| 566 | - echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); |
|
| 567 | - } else { |
|
| 568 | - echo $text.' '.dol_htmlentitiesbr($objp->description); |
|
| 569 | - } |
|
| 570 | - } |
|
| 571 | - |
|
| 572 | - // Show range |
|
| 573 | - echo get_date_range($objp->date_start,$objp->date_end); |
|
| 574 | - } |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - /* |
|
| 509 | + if ($objp->description) |
|
| 510 | + { |
|
| 511 | + if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) |
|
| 512 | + { |
|
| 513 | + $discount=new DiscountAbsolute($db); |
|
| 514 | + $discount->fetch($objp->fk_remise_except); |
|
| 515 | + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); |
|
| 516 | + } |
|
| 517 | + if ($objp->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
|
| 518 | + { |
|
| 519 | + $discount=new DiscountAbsolute($db); |
|
| 520 | + $discount->fetch($objp->fk_remise_except); |
|
| 521 | + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
|
| 522 | + } |
|
| 523 | + elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
| 524 | + { |
|
| 525 | + $discount=new DiscountAbsolute($db); |
|
| 526 | + $discount->fetch($objp->fk_remise_except); |
|
| 527 | + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
|
| 528 | + } |
|
| 529 | + elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
|
| 530 | + { |
|
| 531 | + $discount=new DiscountAbsolute($db); |
|
| 532 | + $discount->fetch($objp->fk_remise_except); |
|
| 533 | + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
|
| 534 | + // Add date of deposit |
|
| 535 | + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; |
|
| 536 | + } |
|
| 537 | + else |
|
| 538 | + { |
|
| 539 | + echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); |
|
| 540 | + } |
|
| 541 | + } |
|
| 542 | + } |
|
| 543 | + else |
|
| 544 | + { |
|
| 545 | + if ($objp->fk_product > 0) { |
|
| 546 | + |
|
| 547 | + echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); |
|
| 548 | + |
|
| 549 | + // Show range |
|
| 550 | + echo get_date_range($objp->date_start, $objp->date_end); |
|
| 551 | + |
|
| 552 | + // Add description in form |
|
| 553 | + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
| 554 | + { |
|
| 555 | + print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; |
|
| 556 | + } |
|
| 557 | + } else { |
|
| 558 | + |
|
| 559 | + if (! empty($objp->label) || ! empty($objp->description)) |
|
| 560 | + { |
|
| 561 | + if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
| 562 | + else $text = img_object($langs->trans('Product'),'product'); |
|
| 563 | + |
|
| 564 | + if (! empty($objp->label)) { |
|
| 565 | + $text.= ' <strong>'.$objp->label.'</strong>'; |
|
| 566 | + echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); |
|
| 567 | + } else { |
|
| 568 | + echo $text.' '.dol_htmlentitiesbr($objp->description); |
|
| 569 | + } |
|
| 570 | + } |
|
| 571 | + |
|
| 572 | + // Show range |
|
| 573 | + echo get_date_range($objp->date_start,$objp->date_end); |
|
| 574 | + } |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + /* |
|
| 578 | 578 | $prodreftxt=''; |
| 579 | 579 | if ($objp->prod_id > 0) |
| 580 | 580 | { |
@@ -592,35 +592,35 @@ discard block |
||
| 592 | 592 | $prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; |
| 593 | 593 | } |
| 594 | 594 | */ |
| 595 | - print '</td>'; |
|
| 595 | + print '</td>'; |
|
| 596 | 596 | |
| 597 | - //print '<td align="left">'.$prodreftxt.'</td>'; |
|
| 597 | + //print '<td align="left">'.$prodreftxt.'</td>'; |
|
| 598 | 598 | |
| 599 | - print '<td align="right">'.$objp->prod_qty.'</td>'; |
|
| 600 | - $total_qty+=$objp->prod_qty; |
|
| 599 | + print '<td align="right">'.$objp->prod_qty.'</td>'; |
|
| 600 | + $total_qty+=$objp->prod_qty; |
|
| 601 | 601 | |
| 602 | - print '<td align="right">'.price($objp->total_ht).'</td>'; |
|
| 603 | - $total_ht+=$objp->total_ht; |
|
| 602 | + print '<td align="right">'.price($objp->total_ht).'</td>'; |
|
| 603 | + $total_ht+=$objp->total_ht; |
|
| 604 | 604 | |
| 605 | - print '<td align="right">'.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).'</td>'; |
|
| 605 | + print '<td align="right">'.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).'</td>'; |
|
| 606 | 606 | |
| 607 | - print "</tr>\n"; |
|
| 608 | - $i++; |
|
| 609 | - } |
|
| 607 | + print "</tr>\n"; |
|
| 608 | + $i++; |
|
| 609 | + } |
|
| 610 | 610 | |
| 611 | - print '<tr class="liste_total">'; |
|
| 612 | - print '<td>' . $langs->trans('Total') . '</td>'; |
|
| 613 | - print '<td colspan="3"></td>'; |
|
| 614 | - print '<td align="right">' . $total_qty . '</td>'; |
|
| 615 | - print '<td align="right">' . price($total_ht) . '</td>'; |
|
| 616 | - print '<td align="right">' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '</td>'; |
|
| 617 | - print "</table>"; |
|
| 618 | - print '</div>'; |
|
| 611 | + print '<tr class="liste_total">'; |
|
| 612 | + print '<td>' . $langs->trans('Total') . '</td>'; |
|
| 613 | + print '<td colspan="3"></td>'; |
|
| 614 | + print '<td align="right">' . $total_qty . '</td>'; |
|
| 615 | + print '<td align="right">' . price($total_ht) . '</td>'; |
|
| 616 | + print '<td align="right">' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '</td>'; |
|
| 617 | + print "</table>"; |
|
| 618 | + print '</div>'; |
|
| 619 | 619 | |
| 620 | - if ($num > $limit) { |
|
| 621 | - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); |
|
| 622 | - } |
|
| 623 | - $db->free($resql); |
|
| 620 | + if ($num > $limit) { |
|
| 621 | + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); |
|
| 622 | + } |
|
| 623 | + $db->free($resql); |
|
| 624 | 624 | } |
| 625 | 625 | else if (empty($type_element) || $type_element == -1) |
| 626 | 626 | { |
@@ -636,18 +636,18 @@ discard block |
||
| 636 | 636 | print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); |
| 637 | 637 | print "</tr>\n"; |
| 638 | 638 | |
| 639 | - print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>'; |
|
| 639 | + print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>'; |
|
| 640 | 640 | |
| 641 | - print "</table>"; |
|
| 641 | + print "</table>"; |
|
| 642 | 642 | } |
| 643 | 643 | else { |
| 644 | 644 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
| 645 | 645 | |
| 646 | 646 | print '<table class="liste" width="100%">'."\n"; |
| 647 | 647 | |
| 648 | - print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'; |
|
| 648 | + print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'; |
|
| 649 | 649 | |
| 650 | - print "</table>"; |
|
| 650 | + print "</table>"; |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | print "</form>"; |
@@ -32,41 +32,41 @@ discard block |
||
| 32 | 32 | require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; |
| 33 | 33 | |
| 34 | 34 | // Security check |
| 35 | -$socid = GETPOST('socid','int'); |
|
| 36 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 35 | +$socid = GETPOST('socid', 'int'); |
|
| 36 | +if ($user->societe_id) $socid = $user->societe_id; |
|
| 37 | 37 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
| 38 | 38 | $object = new Societe($db); |
| 39 | 39 | if ($socid > 0) $object->fetch($socid); |
| 40 | 40 | |
| 41 | 41 | // Sort & Order fields |
| 42 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
| 43 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 44 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 45 | -$page = GETPOST("page",'int'); |
|
| 42 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 43 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 44 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 45 | +$page = GETPOST("page", 'int'); |
|
| 46 | 46 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 47 | 47 | $offset = $limit * $page; |
| 48 | 48 | $pageprev = $page - 1; |
| 49 | 49 | $pagenext = $page + 1; |
| 50 | -if (! $sortorder) $sortorder='DESC'; |
|
| 51 | -if (! $sortfield) $sortfield='dateprint'; |
|
| 50 | +if (!$sortorder) $sortorder = 'DESC'; |
|
| 51 | +if (!$sortfield) $sortfield = 'dateprint'; |
|
| 52 | 52 | |
| 53 | 53 | // Search fields |
| 54 | -$sref=GETPOST("sref"); |
|
| 55 | -$sprod_fulldescr=GETPOST("sprod_fulldescr"); |
|
| 56 | -$month = GETPOST('month','int'); |
|
| 57 | -$year = GETPOST('year','int'); |
|
| 54 | +$sref = GETPOST("sref"); |
|
| 55 | +$sprod_fulldescr = GETPOST("sprod_fulldescr"); |
|
| 56 | +$month = GETPOST('month', 'int'); |
|
| 57 | +$year = GETPOST('year', 'int'); |
|
| 58 | 58 | |
| 59 | 59 | // Clean up on purge search criteria ? |
| 60 | -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers |
|
| 60 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers |
|
| 61 | 61 | { |
| 62 | - $sref=''; |
|
| 63 | - $sprod_fulldescr=''; |
|
| 64 | - $year=''; |
|
| 65 | - $month=''; |
|
| 62 | + $sref = ''; |
|
| 63 | + $sprod_fulldescr = ''; |
|
| 64 | + $year = ''; |
|
| 65 | + $month = ''; |
|
| 66 | 66 | } |
| 67 | 67 | // Customer or supplier selected in drop box |
| 68 | 68 | $thirdTypeSelect = GETPOST("third_select_id"); |
| 69 | -$type_element = GETPOST('type_element')?GETPOST('type_element'):''; |
|
| 69 | +$type_element = GETPOST('type_element') ?GETPOST('type_element') : ''; |
|
| 70 | 70 | |
| 71 | 71 | // Load translation files required by the page |
| 72 | 72 | $langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products")); |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * Actions |
| 80 | 80 | */ |
| 81 | 81 | |
| 82 | -$parameters=array('id'=>$socid); |
|
| 83 | -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 82 | +$parameters = array('id'=>$socid); |
|
| 83 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 84 | 84 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 85 | 85 | |
| 86 | 86 | |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $form = new Form($db); |
| 93 | 93 | $formother = new FormOther($db); |
| 94 | -$productstatic=new Product($db); |
|
| 94 | +$productstatic = new Product($db); |
|
| 95 | 95 | |
| 96 | -$title = $langs->trans("Referers",$object->name); |
|
| 97 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; |
|
| 98 | -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
|
| 99 | -llxHeader('',$title,$help_url); |
|
| 96 | +$title = $langs->trans("Referers", $object->name); |
|
| 97 | +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$title; |
|
| 98 | +$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
|
| 99 | +llxHeader('', $title, $help_url); |
|
| 100 | 100 | |
| 101 | 101 | if (empty($socid)) |
| 102 | 102 | { |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
| 111 | 111 | |
| 112 | -dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); |
|
| 112 | +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom'); |
|
| 113 | 113 | |
| 114 | 114 | print '<div class="fichecenter">'; |
| 115 | 115 | |
| 116 | 116 | print '<div class="underbanner clearboth"></div>'; |
| 117 | 117 | print '<table class="border" width="100%">'; |
| 118 | 118 | |
| 119 | -if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 119 | +if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 120 | 120 | { |
| 121 | 121 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 122 | 122 | } |
@@ -131,19 +131,19 @@ discard block |
||
| 131 | 131 | if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
| 132 | 132 | print '</td></tr>'; |
| 133 | 133 | $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; |
| 134 | - $resql=$db->query($sql); |
|
| 134 | + $resql = $db->query($sql); |
|
| 135 | 135 | if (!$resql) dol_print_error($db); |
| 136 | 136 | |
| 137 | 137 | $obj = $db->fetch_object($resql); |
| 138 | 138 | $nbFactsClient = $obj->nb; |
| 139 | - $thirdTypeArray['customer']=$langs->trans("customer"); |
|
| 140 | - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 141 | - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 142 | - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 143 | - if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 139 | + $thirdTypeArray['customer'] = $langs->trans("customer"); |
|
| 140 | + if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); |
|
| 141 | + if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); |
|
| 142 | + if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); |
|
| 143 | + if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | -if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); |
|
| 146 | +if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions'); |
|
| 147 | 147 | |
| 148 | 148 | if ($object->fournisseur) |
| 149 | 149 | { |
@@ -153,15 +153,15 @@ discard block |
||
| 153 | 153 | if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
| 154 | 154 | print '</td></tr>'; |
| 155 | 155 | $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; |
| 156 | - $resql=$db->query($sql); |
|
| 156 | + $resql = $db->query($sql); |
|
| 157 | 157 | if (!$resql) dol_print_error($db); |
| 158 | 158 | |
| 159 | 159 | $obj = $db->fetch_object($resql); |
| 160 | 160 | $nbCmdsFourn = $obj->nb; |
| 161 | - $thirdTypeArray['supplier']=$langs->trans("supplier"); |
|
| 162 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 163 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 164 | - if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 161 | + $thirdTypeArray['supplier'] = $langs->trans("supplier"); |
|
| 162 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 163 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 164 | + if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal'] = $langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 165 | 165 | } |
| 166 | 166 | print '</table>'; |
| 167 | 167 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?socid='.$socid.'">'; |
| 175 | 175 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 176 | 176 | |
| 177 | -$sql_select=''; |
|
| 177 | +$sql_select = ''; |
|
| 178 | 178 | /*if ($type_element == 'action') |
| 179 | 179 | { // Customer : show products from invoices |
| 180 | 180 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
@@ -188,192 +188,192 @@ discard block |
||
| 188 | 188 | if ($type_element == 'fichinter') |
| 189 | 189 | { // Customer : show products from invoices |
| 190 | 190 | require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
| 191 | - $documentstatic=new Fichinter($db); |
|
| 191 | + $documentstatic = new Fichinter($db); |
|
| 192 | 192 | $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, '; |
| 193 | - $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. |
|
| 193 | + $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. |
|
| 194 | 194 | $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 195 | - $where.= " AND f.entity = ".$conf->entity; |
|
| 195 | + $where .= " AND f.entity = ".$conf->entity; |
|
| 196 | 196 | $dateprint = 'f.datec'; |
| 197 | - $doc_number='f.ref'; |
|
| 197 | + $doc_number = 'f.ref'; |
|
| 198 | 198 | } |
| 199 | 199 | if ($type_element == 'invoice') |
| 200 | 200 | { // Customer : show products from invoices |
| 201 | 201 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 202 | - $documentstatic=new Facture($db); |
|
| 202 | + $documentstatic = new Facture($db); |
|
| 203 | 203 | $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; |
| 204 | 204 | $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; |
| 205 | 205 | $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 206 | - $where.= " AND d.fk_facture = f.rowid"; |
|
| 207 | - $where.= " AND f.entity = ".$conf->entity; |
|
| 206 | + $where .= " AND d.fk_facture = f.rowid"; |
|
| 207 | + $where .= " AND f.entity = ".$conf->entity; |
|
| 208 | 208 | $dateprint = 'f.datef'; |
| 209 | - $doc_number='f.ref'; |
|
| 210 | - $thirdTypeSelect='customer'; |
|
| 209 | + $doc_number = 'f.ref'; |
|
| 210 | + $thirdTypeSelect = 'customer'; |
|
| 211 | 211 | } |
| 212 | 212 | if ($type_element == 'propal') |
| 213 | 213 | { |
| 214 | 214 | require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
| 215 | - $documentstatic=new Propal($db); |
|
| 215 | + $documentstatic = new Propal($db); |
|
| 216 | 216 | $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, '; |
| 217 | 217 | $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; |
| 218 | 218 | $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 219 | - $where.= " AND d.fk_propal = c.rowid"; |
|
| 220 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 219 | + $where .= " AND d.fk_propal = c.rowid"; |
|
| 220 | + $where .= " AND c.entity = ".$conf->entity; |
|
| 221 | 221 | $datePrint = 'c.datep'; |
| 222 | - $doc_number='c.ref'; |
|
| 223 | - $thirdTypeSelect='customer'; |
|
| 222 | + $doc_number = 'c.ref'; |
|
| 223 | + $thirdTypeSelect = 'customer'; |
|
| 224 | 224 | } |
| 225 | 225 | if ($type_element == 'order') |
| 226 | 226 | { |
| 227 | 227 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
| 228 | - $documentstatic=new Commande($db); |
|
| 228 | + $documentstatic = new Commande($db); |
|
| 229 | 229 | $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, '; |
| 230 | 230 | $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; |
| 231 | 231 | $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 232 | - $where.= " AND d.fk_commande = c.rowid"; |
|
| 233 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 232 | + $where .= " AND d.fk_commande = c.rowid"; |
|
| 233 | + $where .= " AND c.entity = ".$conf->entity; |
|
| 234 | 234 | $dateprint = 'c.date_commande'; |
| 235 | - $doc_number='c.ref'; |
|
| 236 | - $thirdTypeSelect='customer'; |
|
| 235 | + $doc_number = 'c.ref'; |
|
| 236 | + $thirdTypeSelect = 'customer'; |
|
| 237 | 237 | } |
| 238 | 238 | if ($type_element == 'supplier_invoice') |
| 239 | 239 | { // Supplier : Show products from invoices. |
| 240 | 240 | require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
| 241 | - $documentstatic=new FactureFournisseur($db); |
|
| 241 | + $documentstatic = new FactureFournisseur($db); |
|
| 242 | 242 | $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; |
| 243 | 243 | $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; |
| 244 | 244 | $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 245 | - $where.= " AND d.fk_facture_fourn = f.rowid"; |
|
| 246 | - $where.= " AND f.entity = ".$conf->entity; |
|
| 245 | + $where .= " AND d.fk_facture_fourn = f.rowid"; |
|
| 246 | + $where .= " AND f.entity = ".$conf->entity; |
|
| 247 | 247 | $dateprint = 'f.datef'; |
| 248 | - $doc_number='f.ref'; |
|
| 249 | - $thirdTypeSelect='supplier'; |
|
| 248 | + $doc_number = 'f.ref'; |
|
| 249 | + $thirdTypeSelect = 'supplier'; |
|
| 250 | 250 | } |
| 251 | 251 | if ($type_element == 'supplier_proposal') |
| 252 | 252 | { |
| 253 | 253 | require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; |
| 254 | - $documentstatic=new SupplierProposal($db); |
|
| 254 | + $documentstatic = new SupplierProposal($db); |
|
| 255 | 255 | $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; |
| 256 | 256 | $tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d"; |
| 257 | 257 | $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 258 | - $where.= " AND d.fk_supplier_proposal = c.rowid"; |
|
| 259 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 258 | + $where .= " AND d.fk_supplier_proposal = c.rowid"; |
|
| 259 | + $where .= " AND c.entity = ".$conf->entity; |
|
| 260 | 260 | $dateprint = 'c.date_valid'; |
| 261 | - $doc_number='c.ref'; |
|
| 262 | - $thirdTypeSelect='supplier'; |
|
| 261 | + $doc_number = 'c.ref'; |
|
| 262 | + $thirdTypeSelect = 'supplier'; |
|
| 263 | 263 | } |
| 264 | 264 | if ($type_element == 'supplier_order') |
| 265 | 265 | { // Supplier : Show products from orders. |
| 266 | 266 | require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
| 267 | - $documentstatic=new CommandeFournisseur($db); |
|
| 267 | + $documentstatic = new CommandeFournisseur($db); |
|
| 268 | 268 | $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; |
| 269 | 269 | $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; |
| 270 | 270 | $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 271 | - $where.= " AND d.fk_commande = c.rowid"; |
|
| 272 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 271 | + $where .= " AND d.fk_commande = c.rowid"; |
|
| 272 | + $where .= " AND c.entity = ".$conf->entity; |
|
| 273 | 273 | $dateprint = 'c.date_valid'; |
| 274 | - $doc_number='c.ref'; |
|
| 275 | - $thirdTypeSelect='supplier'; |
|
| 274 | + $doc_number = 'c.ref'; |
|
| 275 | + $thirdTypeSelect = 'supplier'; |
|
| 276 | 276 | } |
| 277 | 277 | if ($type_element == 'contract') |
| 278 | 278 | { // Order |
| 279 | 279 | require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
| 280 | - $documentstatic=new Contrat($db); |
|
| 281 | - $documentstaticline=new ContratLigne($db); |
|
| 280 | + $documentstatic = new Contrat($db); |
|
| 281 | + $documentstaticline = new ContratLigne($db); |
|
| 282 | 282 | $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; |
| 283 | 283 | $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; |
| 284 | 284 | $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; |
| 285 | - $where.= " AND d.fk_contrat = c.rowid"; |
|
| 286 | - $where.= " AND c.entity = ".$conf->entity; |
|
| 285 | + $where .= " AND d.fk_contrat = c.rowid"; |
|
| 286 | + $where .= " AND c.entity = ".$conf->entity; |
|
| 287 | 287 | $dateprint = 'c.date_valid'; |
| 288 | - $doc_number='c.ref'; |
|
| 289 | - $thirdTypeSelect='customer'; |
|
| 288 | + $doc_number = 'c.ref'; |
|
| 289 | + $thirdTypeSelect = 'customer'; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | -$parameters=array(); |
|
| 293 | -$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook |
|
| 292 | +$parameters = array(); |
|
| 293 | +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook |
|
| 294 | 294 | |
| 295 | 295 | if (!empty($sql_select)) |
| 296 | 296 | { |
| 297 | 297 | $sql = $sql_select; |
| 298 | - $sql.= ' d.description as description,'; |
|
| 299 | - if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 300 | - if ($type_element == 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 301 | - if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 302 | - if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 303 | - $sql.= " s.rowid as socid "; |
|
| 304 | - if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 305 | - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; |
|
| 306 | - if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 307 | - $sql.= $where; |
|
| 298 | + $sql .= ' d.description as description,'; |
|
| 299 | + if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 300 | + if ($type_element == 'supplier_proposal') $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 301 | + if ($type_element == 'contract') $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 302 | + if ($type_element != 'fichinter') $sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 303 | + $sql .= " s.rowid as socid "; |
|
| 304 | + if ($type_element != 'fichinter') $sql .= ", p.ref as prod_ref, p.label as product_label"; |
|
| 305 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; |
|
| 306 | + if ($type_element != 'fichinter') $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 307 | + $sql .= $where; |
|
| 308 | 308 | if ($month > 0) { |
| 309 | 309 | if ($year > 0) { |
| 310 | 310 | $start = dol_mktime(0, 0, 0, $month, 1, $year); |
| 311 | - $end = dol_time_plus_duree($start,1,'m') - 1; |
|
| 312 | - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 311 | + $end = dol_time_plus_duree($start, 1, 'm') - 1; |
|
| 312 | + $sql .= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 313 | 313 | } else { |
| 314 | - $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; |
|
| 314 | + $sql .= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d', $month)."'"; |
|
| 315 | 315 | } |
| 316 | 316 | } else if ($year > 0) { |
| 317 | 317 | $start = dol_mktime(0, 0, 0, 1, 1, $year); |
| 318 | - $end = dol_time_plus_duree($start,1,'y') - 1; |
|
| 319 | - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 318 | + $end = dol_time_plus_duree($start, 1, 'y') - 1; |
|
| 319 | + $sql .= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
|
| 320 | 320 | } |
| 321 | - if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 321 | + if ($sref) $sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 322 | 322 | if ($sprod_fulldescr) |
| 323 | 323 | { |
| 324 | - $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 325 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 326 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 327 | - $sql.=")"; |
|
| 324 | + $sql .= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 325 | + if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 326 | + if (GETPOST('type_element') != 'fichinter') $sql .= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 327 | + $sql .= ")"; |
|
| 328 | 328 | } |
| 329 | - $sql.= $db->order($sortfield,$sortorder); |
|
| 329 | + $sql .= $db->order($sortfield, $sortorder); |
|
| 330 | 330 | |
| 331 | - $resql=$db->query($sql); |
|
| 331 | + $resql = $db->query($sql); |
|
| 332 | 332 | $totalnboflines = $db->num_rows($resql); |
| 333 | 333 | |
| 334 | - $sql.= $db->plimit($limit + 1, $offset); |
|
| 334 | + $sql .= $db->plimit($limit + 1, $offset); |
|
| 335 | 335 | //print $sql; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | -$disabled=0; |
|
| 339 | -$showempty=2; |
|
| 340 | -if (empty($elementTypeArray) && ! $object->client && ! $object->fournisseur) |
|
| 338 | +$disabled = 0; |
|
| 339 | +$showempty = 2; |
|
| 340 | +if (empty($elementTypeArray) && !$object->client && !$object->fournisseur) |
|
| 341 | 341 | { |
| 342 | - $showempty=$langs->trans("ThirdpartyNotCustomerNotSupplierSoNoRef"); |
|
| 343 | - $disabled=1; |
|
| 342 | + $showempty = $langs->trans("ThirdpartyNotCustomerNotSupplierSoNoRef"); |
|
| 343 | + $disabled = 1; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // Define type of elements |
| 347 | 347 | $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), $showempty, 0, 0, '', 0, 0, $disabled, '', 'maxwidth150onsmartphone'); |
| 348 | 348 | $button = '<input type="submit" class="button" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; |
| 349 | 349 | |
| 350 | -$param=''; |
|
| 351 | -$param.="&sref=".urlencode($sref); |
|
| 352 | -$param.="&month=".urlencode($month); |
|
| 353 | -$param.="&year=".urlencode($year); |
|
| 354 | -$param.="&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 355 | -$param.="&socid=".urlencode($socid); |
|
| 356 | -$param.="&type_element=".urlencode($type_element); |
|
| 350 | +$param = ''; |
|
| 351 | +$param .= "&sref=".urlencode($sref); |
|
| 352 | +$param .= "&month=".urlencode($month); |
|
| 353 | +$param .= "&year=".urlencode($year); |
|
| 354 | +$param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 355 | +$param .= "&socid=".urlencode($socid); |
|
| 356 | +$param .= "&type_element=".urlencode($type_element); |
|
| 357 | 357 | |
| 358 | -$total_qty=0; |
|
| 358 | +$total_qty = 0; |
|
| 359 | 359 | |
| 360 | 360 | if ($sql_select) |
| 361 | 361 | { |
| 362 | - $resql=$db->query($sql); |
|
| 362 | + $resql = $db->query($sql); |
|
| 363 | 363 | if (!$resql) dol_print_error($db); |
| 364 | 364 | |
| 365 | 365 | $num = $db->num_rows($resql); |
| 366 | 366 | |
| 367 | - $param="&socid=".$socid."&type_element=".$type_element; |
|
| 368 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 369 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 370 | - if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 371 | - if ($sref) $param.= "&sref=".urlencode($sref); |
|
| 372 | - if ($month) $param.= "&month=".$month; |
|
| 373 | - if ($year) $param.= "&year=".$year; |
|
| 374 | - if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 367 | + $param = "&socid=".$socid."&type_element=".$type_element; |
|
| 368 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; |
|
| 369 | + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; |
|
| 370 | + if ($sprod_fulldescr) $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 371 | + if ($sref) $param .= "&sref=".urlencode($sref); |
|
| 372 | + if ($month) $param .= "&month=".$month; |
|
| 373 | + if ($year) $param .= "&year=".$year; |
|
| 374 | + if ($optioncss != '') $param .= '&optioncss='.$optioncss; |
|
| 375 | 375 | |
| 376 | - print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); |
|
| 376 | + print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, '', 0, '', '', $limit); |
|
| 377 | 377 | |
| 378 | 378 | print '<div class="div-table-responsive-no-min">'; |
| 379 | 379 | print '<table class="liste" width="100%">'."\n"; |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">'; |
| 385 | 385 | print '</td>'; |
| 386 | 386 | print '<td class="liste_titre nowrap center">'; // date |
| 387 | - print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle'); |
|
| 388 | - $formother->select_year($year?$year:-1,'year',1, 20, 1); |
|
| 387 | + print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); |
|
| 388 | + $formother->select_year($year ? $year : -1, 'year', 1, 20, 1); |
|
| 389 | 389 | print '</td>'; |
| 390 | 390 | print '<td class="liste_titre" align="center">'; |
| 391 | 391 | print '</td>'; |
@@ -397,42 +397,42 @@ discard block |
||
| 397 | 397 | print '<td class="liste_titre" align="center">'; |
| 398 | 398 | print '</td>'; |
| 399 | 399 | print '<td class="liste_titre" align="right">'; |
| 400 | - $searchpicto=$form->showFilterAndCheckAddButtons(0); |
|
| 400 | + $searchpicto = $form->showFilterAndCheckAddButtons(0); |
|
| 401 | 401 | print $searchpicto; |
| 402 | 402 | print '</td>'; |
| 403 | 403 | print '</tr>'; |
| 404 | 404 | |
| 405 | 405 | // Titles with sort buttons |
| 406 | 406 | print '<tr class="liste_titre">'; |
| 407 | - print_liste_field_titre('Ref',$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); |
|
| 408 | - print_liste_field_titre('Date',$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); |
|
| 409 | - print_liste_field_titre('Status',$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); |
|
| 410 | - print_liste_field_titre('Product',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); |
|
| 411 | - print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); |
|
| 412 | - print_liste_field_titre('TotalHT',$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); |
|
| 413 | - print_liste_field_titre('UnitPrice',$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); |
|
| 407 | + print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, 'align="left"', $sortfield, $sortorder); |
|
| 408 | + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); |
|
| 409 | + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, 'align="center"', $sortfield, $sortorder); |
|
| 410 | + print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, 'align="left"', $sortfield, $sortorder); |
|
| 411 | + print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, 'align="right"', $sortfield, $sortorder); |
|
| 412 | + print_liste_field_titre('TotalHT', $_SERVER['PHP_SELF'], 'total_ht', '', $param, 'align="right"', $sortfield, $sortorder); |
|
| 413 | + print_liste_field_titre('UnitPrice', $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); |
|
| 414 | 414 | print "</tr>\n"; |
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | $i = 0; |
| 418 | 418 | while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) |
| 419 | 419 | { |
| 420 | - $documentstatic->id=$objp->doc_id; |
|
| 421 | - $documentstatic->ref=$objp->doc_number; |
|
| 422 | - $documentstatic->type=$objp->doc_type; |
|
| 423 | - $documentstatic->fk_statut=$objp->status; |
|
| 424 | - $documentstatic->fk_status=$objp->status; |
|
| 425 | - $documentstatic->statut=$objp->status; |
|
| 426 | - $documentstatic->status=$objp->status; |
|
| 427 | - $documentstatic->paye=$objp->paid; |
|
| 420 | + $documentstatic->id = $objp->doc_id; |
|
| 421 | + $documentstatic->ref = $objp->doc_number; |
|
| 422 | + $documentstatic->type = $objp->doc_type; |
|
| 423 | + $documentstatic->fk_statut = $objp->status; |
|
| 424 | + $documentstatic->fk_status = $objp->status; |
|
| 425 | + $documentstatic->statut = $objp->status; |
|
| 426 | + $documentstatic->status = $objp->status; |
|
| 427 | + $documentstatic->paye = $objp->paid; |
|
| 428 | 428 | |
| 429 | - if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; |
|
| 429 | + if (is_object($documentstaticline)) $documentstaticline->statut = $objp->status; |
|
| 430 | 430 | |
| 431 | 431 | print '<tr class="oddeven">'; |
| 432 | 432 | print '<td class="nobordernopadding nowrap" width="100">'; |
| 433 | 433 | print $documentstatic->getNomUrl(1); |
| 434 | 434 | print '</td>'; |
| 435 | - print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),'day').'</td>'; |
|
| 435 | + print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->dateprint), 'day').'</td>'; |
|
| 436 | 436 | |
| 437 | 437 | // Status |
| 438 | 438 | print '<td align="center">'; |
@@ -449,58 +449,58 @@ discard block |
||
| 449 | 449 | print '<td>'; |
| 450 | 450 | |
| 451 | 451 | // Define text, description and type |
| 452 | - $text=''; $description=''; $type=0; |
|
| 452 | + $text = ''; $description = ''; $type = 0; |
|
| 453 | 453 | |
| 454 | 454 | // Code to show product duplicated from commonobject->printObjectLine |
| 455 | 455 | if ($objp->fk_product > 0) |
| 456 | 456 | { |
| 457 | 457 | $product_static = new Product($db); |
| 458 | 458 | |
| 459 | - $product_static->type=$objp->fk_product_type; |
|
| 460 | - $product_static->id=$objp->fk_product; |
|
| 461 | - $product_static->ref=$objp->ref; |
|
| 462 | - $product_static->entity=$objp->pentity; |
|
| 463 | - $text=$product_static->getNomUrl(1); |
|
| 459 | + $product_static->type = $objp->fk_product_type; |
|
| 460 | + $product_static->id = $objp->fk_product; |
|
| 461 | + $product_static->ref = $objp->ref; |
|
| 462 | + $product_static->entity = $objp->pentity; |
|
| 463 | + $text = $product_static->getNomUrl(1); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | // Product |
| 467 | 467 | if ($objp->fk_product > 0) |
| 468 | 468 | { |
| 469 | 469 | // Define output language |
| 470 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
| 470 | + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
| 471 | 471 | { |
| 472 | 472 | $prod = new Product($db); |
| 473 | 473 | $prod->fetch($objp->fk_product); |
| 474 | 474 | |
| 475 | 475 | $outputlangs = $langs; |
| 476 | - $newlang=''; |
|
| 477 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); |
|
| 478 | - if (empty($newlang)) $newlang=$object->default_lang; |
|
| 479 | - if (! empty($newlang)) |
|
| 476 | + $newlang = ''; |
|
| 477 | + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); |
|
| 478 | + if (empty($newlang)) $newlang = $object->default_lang; |
|
| 479 | + if (!empty($newlang)) |
|
| 480 | 480 | { |
| 481 | - $outputlangs = new Translate("",$conf); |
|
| 481 | + $outputlangs = new Translate("", $conf); |
|
| 482 | 482 | $outputlangs->setDefaultLang($newlang); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
| 485 | + $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
| 486 | 486 | } |
| 487 | 487 | else |
| 488 | 488 | { |
| 489 | 489 | $label = $objp->product_label; |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - $text.= ' - '.(! empty($objp->label)?$objp->label:$label); |
|
| 493 | - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); |
|
| 492 | + $text .= ' - '.(!empty($objp->label) ? $objp->label : $label); |
|
| 493 | + $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description)); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | if (($objp->info_bits & 2) == 2) { ?> |
| 497 | 497 | <a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>"> |
| 498 | 498 | <?php |
| 499 | - $txt=''; |
|
| 500 | - print img_object($langs->trans("ShowReduc"),'reduc').' '; |
|
| 501 | - if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
| 502 | - elseif ($objp->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
| 503 | - elseif ($objp->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
| 499 | + $txt = ''; |
|
| 500 | + print img_object($langs->trans("ShowReduc"), 'reduc').' '; |
|
| 501 | + if ($objp->description == '(DEPOSIT)') $txt = $langs->trans("Deposit"); |
|
| 502 | + elseif ($objp->description == '(EXCESS RECEIVED)') $txt = $langs->trans("ExcessReceived"); |
|
| 503 | + elseif ($objp->description == '(EXCESS PAID)') $txt = $langs->trans("ExcessPaid"); |
|
| 504 | 504 | //else $txt=$langs->trans("Discount"); |
| 505 | 505 | print $txt; |
| 506 | 506 | ?> |
@@ -510,33 +510,33 @@ discard block |
||
| 510 | 510 | { |
| 511 | 511 | if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) |
| 512 | 512 | { |
| 513 | - $discount=new DiscountAbsolute($db); |
|
| 513 | + $discount = new DiscountAbsolute($db); |
|
| 514 | 514 | $discount->fetch($objp->fk_remise_except); |
| 515 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); |
|
| 515 | + echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); |
|
| 516 | 516 | } |
| 517 | 517 | if ($objp->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) |
| 518 | 518 | { |
| 519 | - $discount=new DiscountAbsolute($db); |
|
| 519 | + $discount = new DiscountAbsolute($db); |
|
| 520 | 520 | $discount->fetch($objp->fk_remise_except); |
| 521 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
|
| 521 | + echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); |
|
| 522 | 522 | } |
| 523 | 523 | elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
| 524 | 524 | { |
| 525 | - $discount=new DiscountAbsolute($db); |
|
| 525 | + $discount = new DiscountAbsolute($db); |
|
| 526 | 526 | $discount->fetch($objp->fk_remise_except); |
| 527 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
|
| 527 | + echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); |
|
| 528 | 528 | } |
| 529 | 529 | elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
| 530 | 530 | { |
| 531 | - $discount=new DiscountAbsolute($db); |
|
| 531 | + $discount = new DiscountAbsolute($db); |
|
| 532 | 532 | $discount->fetch($objp->fk_remise_except); |
| 533 | - echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
|
| 533 | + echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); |
|
| 534 | 534 | // Add date of deposit |
| 535 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; |
|
| 535 | + if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; |
|
| 536 | 536 | } |
| 537 | 537 | else |
| 538 | 538 | { |
| 539 | - echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); |
|
| 539 | + echo ($txt ? ' - ' : '').dol_htmlentitiesbr($objp->description); |
|
| 540 | 540 | } |
| 541 | 541 | } |
| 542 | 542 | } |
@@ -544,33 +544,33 @@ discard block |
||
| 544 | 544 | { |
| 545 | 545 | if ($objp->fk_product > 0) { |
| 546 | 546 | |
| 547 | - echo $form->textwithtooltip($text,$description,3,'','',$i,0,''); |
|
| 547 | + echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, ''); |
|
| 548 | 548 | |
| 549 | 549 | // Show range |
| 550 | 550 | echo get_date_range($objp->date_start, $objp->date_end); |
| 551 | 551 | |
| 552 | 552 | // Add description in form |
| 553 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
| 553 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
| 554 | 554 | { |
| 555 | - print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; |
|
| 555 | + print (!empty($objp->description) && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : ''; |
|
| 556 | 556 | } |
| 557 | 557 | } else { |
| 558 | 558 | |
| 559 | - if (! empty($objp->label) || ! empty($objp->description)) |
|
| 559 | + if (!empty($objp->label) || !empty($objp->description)) |
|
| 560 | 560 | { |
| 561 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
| 562 | - else $text = img_object($langs->trans('Product'),'product'); |
|
| 561 | + if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); |
|
| 562 | + else $text = img_object($langs->trans('Product'), 'product'); |
|
| 563 | 563 | |
| 564 | - if (! empty($objp->label)) { |
|
| 565 | - $text.= ' <strong>'.$objp->label.'</strong>'; |
|
| 566 | - echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,''); |
|
| 564 | + if (!empty($objp->label)) { |
|
| 565 | + $text .= ' <strong>'.$objp->label.'</strong>'; |
|
| 566 | + echo $form->textwithtooltip($text, dol_htmlentitiesbr($objp->description), 3, '', '', $i, 0, ''); |
|
| 567 | 567 | } else { |
| 568 | 568 | echo $text.' '.dol_htmlentitiesbr($objp->description); |
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | // Show range |
| 573 | - echo get_date_range($objp->date_start,$objp->date_end); |
|
| 573 | + echo get_date_range($objp->date_start, $objp->date_end); |
|
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
@@ -597,43 +597,43 @@ discard block |
||
| 597 | 597 | //print '<td align="left">'.$prodreftxt.'</td>'; |
| 598 | 598 | |
| 599 | 599 | print '<td align="right">'.$objp->prod_qty.'</td>'; |
| 600 | - $total_qty+=$objp->prod_qty; |
|
| 600 | + $total_qty += $objp->prod_qty; |
|
| 601 | 601 | |
| 602 | 602 | print '<td align="right">'.price($objp->total_ht).'</td>'; |
| 603 | - $total_ht+=$objp->total_ht; |
|
| 603 | + $total_ht += $objp->total_ht; |
|
| 604 | 604 | |
| 605 | - print '<td align="right">'.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).'</td>'; |
|
| 605 | + print '<td align="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).'</td>'; |
|
| 606 | 606 | |
| 607 | 607 | print "</tr>\n"; |
| 608 | 608 | $i++; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | print '<tr class="liste_total">'; |
| 612 | - print '<td>' . $langs->trans('Total') . '</td>'; |
|
| 612 | + print '<td>'.$langs->trans('Total').'</td>'; |
|
| 613 | 613 | print '<td colspan="3"></td>'; |
| 614 | - print '<td align="right">' . $total_qty . '</td>'; |
|
| 615 | - print '<td align="right">' . price($total_ht) . '</td>'; |
|
| 616 | - print '<td align="right">' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '</td>'; |
|
| 614 | + print '<td align="right">'.$total_qty.'</td>'; |
|
| 615 | + print '<td align="right">'.price($total_ht).'</td>'; |
|
| 616 | + print '<td align="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).'</td>'; |
|
| 617 | 617 | print "</table>"; |
| 618 | 618 | print '</div>'; |
| 619 | 619 | |
| 620 | 620 | if ($num > $limit) { |
| 621 | - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); |
|
| 621 | + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); |
|
| 622 | 622 | } |
| 623 | 623 | $db->free($resql); |
| 624 | 624 | } |
| 625 | 625 | else if (empty($type_element) || $type_element == -1) |
| 626 | 626 | { |
| 627 | - print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
|
| 627 | + print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', ''); |
|
| 628 | 628 | |
| 629 | 629 | print '<table class="liste" width="100%">'."\n"; |
| 630 | 630 | // Titles with sort buttons |
| 631 | 631 | print '<tr class="liste_titre">'; |
| 632 | - print_liste_field_titre('Ref',$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); |
|
| 633 | - print_liste_field_titre('Date',$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); |
|
| 634 | - print_liste_field_titre('Status',$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder); |
|
| 635 | - print_liste_field_titre('Product',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); |
|
| 636 | - print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); |
|
| 632 | + print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, 'align="left"', $sortfield, $sortorder); |
|
| 633 | + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); |
|
| 634 | + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, 'align="center"', $sortfield, $sortorder); |
|
| 635 | + print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, 'align="left"', $sortfield, $sortorder); |
|
| 636 | + print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, 'align="right"', $sortfield, $sortorder); |
|
| 637 | 637 | print "</tr>\n"; |
| 638 | 638 | |
| 639 | 639 | print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>'; |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | print "</table>"; |
| 642 | 642 | } |
| 643 | 643 | else { |
| 644 | - print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
|
| 644 | + print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', ''); |
|
| 645 | 645 | |
| 646 | 646 | print '<table class="liste" width="100%">'."\n"; |
| 647 | 647 | |
@@ -33,10 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | // Security check |
| 35 | 35 | $socid = GETPOST('socid','int'); |
| 36 | -if ($user->societe_id) $socid=$user->societe_id; |
|
| 36 | +if ($user->societe_id) { |
|
| 37 | + $socid=$user->societe_id; |
|
| 38 | +} |
|
| 37 | 39 | $result = restrictedArea($user, 'societe', $socid, '&societe'); |
| 38 | 40 | $object = new Societe($db); |
| 39 | -if ($socid > 0) $object->fetch($socid); |
|
| 41 | +if ($socid > 0) { |
|
| 42 | + $object->fetch($socid); |
|
| 43 | +} |
|
| 40 | 44 | |
| 41 | 45 | // Sort & Order fields |
| 42 | 46 | $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
@@ -47,8 +51,12 @@ discard block |
||
| 47 | 51 | $offset = $limit * $page; |
| 48 | 52 | $pageprev = $page - 1; |
| 49 | 53 | $pagenext = $page + 1; |
| 50 | -if (! $sortorder) $sortorder='DESC'; |
|
| 51 | -if (! $sortfield) $sortfield='dateprint'; |
|
| 54 | +if (! $sortorder) { |
|
| 55 | + $sortorder='DESC'; |
|
| 56 | +} |
|
| 57 | +if (! $sortfield) { |
|
| 58 | + $sortfield='dateprint'; |
|
| 59 | +} |
|
| 52 | 60 | |
| 53 | 61 | // Search fields |
| 54 | 62 | $sref=GETPOST("sref"); |
@@ -57,9 +65,11 @@ discard block |
||
| 57 | 65 | $year = GETPOST('year','int'); |
| 58 | 66 | |
| 59 | 67 | // Clean up on purge search criteria ? |
| 60 | -if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers |
|
| 68 | +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) { |
|
| 69 | + // Both test are required to be compatible with all browsers |
|
| 61 | 70 | { |
| 62 | 71 | $sref=''; |
| 72 | +} |
|
| 63 | 73 | $sprod_fulldescr=''; |
| 64 | 74 | $year=''; |
| 65 | 75 | $month=''; |
@@ -81,7 +91,9 @@ discard block |
||
| 81 | 91 | |
| 82 | 92 | $parameters=array('id'=>$socid); |
| 83 | 93 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 84 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 94 | +if ($reshook < 0) { |
|
| 95 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 96 | +} |
|
| 85 | 97 | |
| 86 | 98 | |
| 87 | 99 | |
@@ -94,7 +106,9 @@ discard block |
||
| 94 | 106 | $productstatic=new Product($db); |
| 95 | 107 | |
| 96 | 108 | $title = $langs->trans("Referers",$object->name); |
| 97 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; |
|
| 109 | +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 110 | + $title=$object->name." - ".$title; |
|
| 111 | +} |
|
| 98 | 112 | $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
| 99 | 113 | llxHeader('',$title,$help_url); |
| 100 | 114 | |
@@ -116,10 +130,12 @@ discard block |
||
| 116 | 130 | print '<div class="underbanner clearboth"></div>'; |
| 117 | 131 | print '<table class="border" width="100%">'; |
| 118 | 132 | |
| 119 | -if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 133 | +if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 134 | + // Old not used prefix field |
|
| 120 | 135 | { |
| 121 | 136 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 122 | 137 | } |
| 138 | +} |
|
| 123 | 139 | |
| 124 | 140 | //if ($conf->agenda->enabled && $user->rights->agenda->myactions->read) $elementTypeArray['action']=$langs->transnoentitiesnoconv('Events'); |
| 125 | 141 | |
@@ -128,41 +144,65 @@ discard block |
||
| 128 | 144 | print '<tr><td class="titlefield">'; |
| 129 | 145 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 130 | 146 | print $object->code_client; |
| 131 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 147 | + if ($object->check_codeclient() <> 0) { |
|
| 148 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 149 | + } |
|
| 132 | 150 | print '</td></tr>'; |
| 133 | 151 | $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; |
| 134 | 152 | $resql=$db->query($sql); |
| 135 | - if (!$resql) dol_print_error($db); |
|
| 153 | + if (!$resql) { |
|
| 154 | + dol_print_error($db); |
|
| 155 | + } |
|
| 136 | 156 | |
| 137 | 157 | $obj = $db->fetch_object($resql); |
| 138 | 158 | $nbFactsClient = $obj->nb; |
| 139 | 159 | $thirdTypeArray['customer']=$langs->trans("customer"); |
| 140 | - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 141 | - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 142 | - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 143 | - if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 144 | -} |
|
| 160 | + if ($conf->propal->enabled && $user->rights->propal->lire) { |
|
| 161 | + $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); |
|
| 162 | + } |
|
| 163 | + if ($conf->commande->enabled && $user->rights->commande->lire) { |
|
| 164 | + $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); |
|
| 165 | + } |
|
| 166 | + if ($conf->facture->enabled && $user->rights->facture->lire) { |
|
| 167 | + $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); |
|
| 168 | + } |
|
| 169 | + if ($conf->contrat->enabled && $user->rights->contrat->lire) { |
|
| 170 | + $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); |
|
| 171 | + } |
|
| 172 | + } |
|
| 145 | 173 | |
| 146 | -if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); |
|
| 174 | +if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) { |
|
| 175 | + $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions'); |
|
| 176 | +} |
|
| 147 | 177 | |
| 148 | 178 | if ($object->fournisseur) |
| 149 | 179 | { |
| 150 | 180 | print '<tr><td class="titlefield">'; |
| 151 | 181 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 152 | 182 | print $object->code_fournisseur; |
| 153 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 183 | + if ($object->check_codefournisseur() <> 0) { |
|
| 184 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 185 | + } |
|
| 154 | 186 | print '</td></tr>'; |
| 155 | 187 | $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; |
| 156 | 188 | $resql=$db->query($sql); |
| 157 | - if (!$resql) dol_print_error($db); |
|
| 189 | + if (!$resql) { |
|
| 190 | + dol_print_error($db); |
|
| 191 | + } |
|
| 158 | 192 | |
| 159 | 193 | $obj = $db->fetch_object($resql); |
| 160 | 194 | $nbCmdsFourn = $obj->nb; |
| 161 | 195 | $thirdTypeArray['supplier']=$langs->trans("supplier"); |
| 162 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 163 | - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 164 | - if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 165 | -} |
|
| 196 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) { |
|
| 197 | + $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices'); |
|
| 198 | + } |
|
| 199 | + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) { |
|
| 200 | + $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders'); |
|
| 201 | + } |
|
| 202 | + if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) { |
|
| 203 | + $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals'); |
|
| 204 | + } |
|
| 205 | + } |
|
| 166 | 206 | print '</table>'; |
| 167 | 207 | |
| 168 | 208 | print '</div>'; |
@@ -296,14 +336,26 @@ discard block |
||
| 296 | 336 | { |
| 297 | 337 | $sql = $sql_select; |
| 298 | 338 | $sql.= ' d.description as description,'; |
| 299 | - if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 300 | - if ($type_element == 'supplier_proposal') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 301 | - if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 302 | - if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 339 | + if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') { |
|
| 340 | + $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 341 | + } |
|
| 342 | + if ($type_element == 'supplier_proposal') { |
|
| 343 | + $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 344 | + } |
|
| 345 | + if ($type_element == 'contract') { |
|
| 346 | + $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; |
|
| 347 | + } |
|
| 348 | + if ($type_element != 'fichinter') { |
|
| 349 | + $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; |
|
| 350 | + } |
|
| 303 | 351 | $sql.= " s.rowid as socid "; |
| 304 | - if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 352 | + if ($type_element != 'fichinter') { |
|
| 353 | + $sql.= ", p.ref as prod_ref, p.label as product_label"; |
|
| 354 | + } |
|
| 305 | 355 | $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; |
| 306 | - if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 356 | + if ($type_element != 'fichinter') { |
|
| 357 | + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; |
|
| 358 | + } |
|
| 307 | 359 | $sql.= $where; |
| 308 | 360 | if ($month > 0) { |
| 309 | 361 | if ($year > 0) { |
@@ -318,12 +370,18 @@ discard block |
||
| 318 | 370 | $end = dol_time_plus_duree($start,1,'y') - 1; |
| 319 | 371 | $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; |
| 320 | 372 | } |
| 321 | - if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 373 | + if ($sref) { |
|
| 374 | + $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; |
|
| 375 | + } |
|
| 322 | 376 | if ($sprod_fulldescr) |
| 323 | 377 | { |
| 324 | 378 | $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
| 325 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 326 | - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 379 | + if (GETPOST('type_element') != 'fichinter') { |
|
| 380 | + $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 381 | + } |
|
| 382 | + if (GETPOST('type_element') != 'fichinter') { |
|
| 383 | + $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; |
|
| 384 | + } |
|
| 327 | 385 | $sql.=")"; |
| 328 | 386 | } |
| 329 | 387 | $sql.= $db->order($sortfield,$sortorder); |
@@ -360,18 +418,34 @@ discard block |
||
| 360 | 418 | if ($sql_select) |
| 361 | 419 | { |
| 362 | 420 | $resql=$db->query($sql); |
| 363 | - if (!$resql) dol_print_error($db); |
|
| 421 | + if (!$resql) { |
|
| 422 | + dol_print_error($db); |
|
| 423 | + } |
|
| 364 | 424 | |
| 365 | 425 | $num = $db->num_rows($resql); |
| 366 | 426 | |
| 367 | 427 | $param="&socid=".$socid."&type_element=".$type_element; |
| 368 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 369 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 370 | - if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 371 | - if ($sref) $param.= "&sref=".urlencode($sref); |
|
| 372 | - if ($month) $param.= "&month=".$month; |
|
| 373 | - if ($year) $param.= "&year=".$year; |
|
| 374 | - if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 428 | + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 429 | + $param.='&contextpage='.$contextpage; |
|
| 430 | + } |
|
| 431 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 432 | + $param.='&limit='.$limit; |
|
| 433 | + } |
|
| 434 | + if ($sprod_fulldescr) { |
|
| 435 | + $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); |
|
| 436 | + } |
|
| 437 | + if ($sref) { |
|
| 438 | + $param.= "&sref=".urlencode($sref); |
|
| 439 | + } |
|
| 440 | + if ($month) { |
|
| 441 | + $param.= "&month=".$month; |
|
| 442 | + } |
|
| 443 | + if ($year) { |
|
| 444 | + $param.= "&year=".$year; |
|
| 445 | + } |
|
| 446 | + if ($optioncss != '') { |
|
| 447 | + $param.='&optioncss='.$optioncss; |
|
| 448 | + } |
|
| 375 | 449 | |
| 376 | 450 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); |
| 377 | 451 | |
@@ -426,7 +500,9 @@ discard block |
||
| 426 | 500 | $documentstatic->status=$objp->status; |
| 427 | 501 | $documentstatic->paye=$objp->paid; |
| 428 | 502 | |
| 429 | - if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; |
|
| 503 | + if (is_object($documentstaticline)) { |
|
| 504 | + $documentstaticline->statut=$objp->status; |
|
| 505 | + } |
|
| 430 | 506 | |
| 431 | 507 | print '<tr class="oddeven">'; |
| 432 | 508 | print '<td class="nobordernopadding nowrap" width="100">'; |
@@ -439,8 +515,7 @@ discard block |
||
| 439 | 515 | if ($type_element == 'contract') |
| 440 | 516 | { |
| 441 | 517 | print $documentstaticline->getLibStatut(2); |
| 442 | - } |
|
| 443 | - else |
|
| 518 | + } else |
|
| 444 | 519 | { |
| 445 | 520 | print $documentstatic->getLibStatut(2); |
| 446 | 521 | } |
@@ -474,8 +549,12 @@ discard block |
||
| 474 | 549 | |
| 475 | 550 | $outputlangs = $langs; |
| 476 | 551 | $newlang=''; |
| 477 | - if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); |
|
| 478 | - if (empty($newlang)) $newlang=$object->default_lang; |
|
| 552 | + if (empty($newlang) && GETPOST('lang_id','aZ09')) { |
|
| 553 | + $newlang=GETPOST('lang_id','aZ09'); |
|
| 554 | + } |
|
| 555 | + if (empty($newlang)) { |
|
| 556 | + $newlang=$object->default_lang; |
|
| 557 | + } |
|
| 479 | 558 | if (! empty($newlang)) |
| 480 | 559 | { |
| 481 | 560 | $outputlangs = new Translate("",$conf); |
@@ -483,8 +562,7 @@ discard block |
||
| 483 | 562 | } |
| 484 | 563 | |
| 485 | 564 | $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
| 486 | - } |
|
| 487 | - else |
|
| 565 | + } else |
|
| 488 | 566 | { |
| 489 | 567 | $label = $objp->product_label; |
| 490 | 568 | } |
@@ -498,9 +576,13 @@ discard block |
||
| 498 | 576 | <?php |
| 499 | 577 | $txt=''; |
| 500 | 578 | print img_object($langs->trans("ShowReduc"),'reduc').' '; |
| 501 | - if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); |
|
| 502 | - elseif ($objp->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); |
|
| 503 | - elseif ($objp->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); |
|
| 579 | + if ($objp->description == '(DEPOSIT)') { |
|
| 580 | + $txt=$langs->trans("Deposit"); |
|
| 581 | + } elseif ($objp->description == '(EXCESS RECEIVED)') { |
|
| 582 | + $txt=$langs->trans("ExcessReceived"); |
|
| 583 | + } elseif ($objp->description == '(EXCESS PAID)') { |
|
| 584 | + $txt=$langs->trans("ExcessPaid"); |
|
| 585 | + } |
|
| 504 | 586 | //else $txt=$langs->trans("Discount"); |
| 505 | 587 | print $txt; |
| 506 | 588 | ?> |
@@ -519,28 +601,26 @@ discard block |
||
| 519 | 601 | $discount=new DiscountAbsolute($db); |
| 520 | 602 | $discount->fetch($objp->fk_remise_except); |
| 521 | 603 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0)); |
| 522 | - } |
|
| 523 | - elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
| 604 | + } elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) |
|
| 524 | 605 | { |
| 525 | 606 | $discount=new DiscountAbsolute($db); |
| 526 | 607 | $discount->fetch($objp->fk_remise_except); |
| 527 | 608 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0)); |
| 528 | - } |
|
| 529 | - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
|
| 609 | + } elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) |
|
| 530 | 610 | { |
| 531 | 611 | $discount=new DiscountAbsolute($db); |
| 532 | 612 | $discount->fetch($objp->fk_remise_except); |
| 533 | 613 | echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); |
| 534 | 614 | // Add date of deposit |
| 535 | - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; |
|
| 536 | - } |
|
| 537 | - else |
|
| 615 | + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) { |
|
| 616 | + echo ' ('.dol_print_date($discount->datec).')'; |
|
| 617 | + } |
|
| 618 | + } else |
|
| 538 | 619 | { |
| 539 | 620 | echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description); |
| 540 | 621 | } |
| 541 | 622 | } |
| 542 | - } |
|
| 543 | - else |
|
| 623 | + } else |
|
| 544 | 624 | { |
| 545 | 625 | if ($objp->fk_product > 0) { |
| 546 | 626 | |
@@ -558,8 +638,11 @@ discard block |
||
| 558 | 638 | |
| 559 | 639 | if (! empty($objp->label) || ! empty($objp->description)) |
| 560 | 640 | { |
| 561 | - if ($type==1) $text = img_object($langs->trans('Service'),'service'); |
|
| 562 | - else $text = img_object($langs->trans('Product'),'product'); |
|
| 641 | + if ($type==1) { |
|
| 642 | + $text = img_object($langs->trans('Service'),'service'); |
|
| 643 | + } else { |
|
| 644 | + $text = img_object($langs->trans('Product'),'product'); |
|
| 645 | + } |
|
| 563 | 646 | |
| 564 | 647 | if (! empty($objp->label)) { |
| 565 | 648 | $text.= ' <strong>'.$objp->label.'</strong>'; |
@@ -621,8 +704,7 @@ discard block |
||
| 621 | 704 | print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); |
| 622 | 705 | } |
| 623 | 706 | $db->free($resql); |
| 624 | -} |
|
| 625 | -else if (empty($type_element) || $type_element == -1) |
|
| 707 | +} else if (empty($type_element) || $type_element == -1) |
|
| 626 | 708 | { |
| 627 | 709 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
| 628 | 710 | |
@@ -639,8 +721,7 @@ discard block |
||
| 639 | 721 | print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>'; |
| 640 | 722 | |
| 641 | 723 | print "</table>"; |
| 642 | -} |
|
| 643 | -else { |
|
| 724 | +} else { |
|
| 644 | 725 | print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); |
| 645 | 726 | |
| 646 | 727 | print '<table class="liste" width="100%">'."\n"; |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | // Security check |
| 43 | 43 | if ($user->societe_id > 0) |
| 44 | 44 | { |
| 45 | - unset($action); |
|
| 46 | - $socid = $user->societe_id; |
|
| 45 | + unset($action); |
|
| 46 | + $socid = $user->societe_id; |
|
| 47 | 47 | } |
| 48 | 48 | $result = restrictedArea($user, 'societe', $id, '&societe'); |
| 49 | 49 | |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | $object = new Societe($db); |
| 62 | 62 | if ($id > 0 || ! empty($ref)) |
| 63 | 63 | { |
| 64 | - $result = $object->fetch($id, $ref); |
|
| 64 | + $result = $object->fetch($id, $ref); |
|
| 65 | 65 | |
| 66 | - $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ; |
|
| 67 | - $courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id,0,0,0,$object,'thirdparty'); |
|
| 66 | + $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ; |
|
| 67 | + $courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id,0,0,0,$object,'thirdparty'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -92,24 +92,24 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | if ($object->id) |
| 94 | 94 | { |
| 95 | - /* |
|
| 95 | + /* |
|
| 96 | 96 | * Show tabs |
| 97 | 97 | */ |
| 98 | - if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 99 | - $head = societe_prepare_head($object); |
|
| 98 | + if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 99 | + $head = societe_prepare_head($object); |
|
| 100 | 100 | |
| 101 | - $form=new Form($db); |
|
| 101 | + $form=new Form($db); |
|
| 102 | 102 | |
| 103 | - dol_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company'); |
|
| 103 | + dol_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company'); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | - // Build file list |
|
| 107 | - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); |
|
| 108 | - $totalsize=0; |
|
| 109 | - foreach($filearray as $key => $file) |
|
| 110 | - { |
|
| 111 | - $totalsize+=$file['size']; |
|
| 112 | - } |
|
| 106 | + // Build file list |
|
| 107 | + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); |
|
| 108 | + $totalsize=0; |
|
| 109 | + foreach($filearray as $key => $file) |
|
| 110 | + { |
|
| 111 | + $totalsize+=$file['size']; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
| 115 | 115 | |
@@ -118,53 +118,53 @@ discard block |
||
| 118 | 118 | print '<div class="fichecenter">'; |
| 119 | 119 | |
| 120 | 120 | print '<div class="underbanner clearboth"></div>'; |
| 121 | - print '<table class="border centpercent">'; |
|
| 122 | - |
|
| 123 | - // Prefix |
|
| 124 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 125 | - { |
|
| 126 | - print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - if ($object->client) |
|
| 130 | - { |
|
| 131 | - print '<tr><td class="titlefield">'; |
|
| 132 | - print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
|
| 133 | - print $object->code_client; |
|
| 134 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 135 | - print '</td></tr>'; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - if ($object->fournisseur) |
|
| 139 | - { |
|
| 140 | - print '<tr><td class="titlefield">'; |
|
| 141 | - print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
|
| 142 | - print $object->code_fournisseur; |
|
| 143 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 144 | - print '</td></tr>'; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - // Number of files |
|
| 148 | - print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; |
|
| 149 | - |
|
| 150 | - // Total size |
|
| 151 | - print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>'; |
|
| 152 | - |
|
| 153 | - print '</table>'; |
|
| 154 | - |
|
| 155 | - print '</div>'; |
|
| 156 | - |
|
| 157 | - dol_fiche_end(); |
|
| 158 | - |
|
| 159 | - $modulepart = 'societe'; |
|
| 160 | - $permission = $user->rights->societe->creer; |
|
| 161 | - $permtoedit = $user->rights->societe->creer; |
|
| 162 | - $param = '&id=' . $object->id; |
|
| 163 | - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
|
| 121 | + print '<table class="border centpercent">'; |
|
| 122 | + |
|
| 123 | + // Prefix |
|
| 124 | + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 125 | + { |
|
| 126 | + print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + if ($object->client) |
|
| 130 | + { |
|
| 131 | + print '<tr><td class="titlefield">'; |
|
| 132 | + print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
|
| 133 | + print $object->code_client; |
|
| 134 | + if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 135 | + print '</td></tr>'; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + if ($object->fournisseur) |
|
| 139 | + { |
|
| 140 | + print '<tr><td class="titlefield">'; |
|
| 141 | + print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
|
| 142 | + print $object->code_fournisseur; |
|
| 143 | + if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 144 | + print '</td></tr>'; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + // Number of files |
|
| 148 | + print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; |
|
| 149 | + |
|
| 150 | + // Total size |
|
| 151 | + print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>'; |
|
| 152 | + |
|
| 153 | + print '</table>'; |
|
| 154 | + |
|
| 155 | + print '</div>'; |
|
| 156 | + |
|
| 157 | + dol_fiche_end(); |
|
| 158 | + |
|
| 159 | + $modulepart = 'societe'; |
|
| 160 | + $permission = $user->rights->societe->creer; |
|
| 161 | + $permtoedit = $user->rights->societe->creer; |
|
| 162 | + $param = '&id=' . $object->id; |
|
| 163 | + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
|
| 164 | 164 | } |
| 165 | 165 | else |
| 166 | 166 | { |
| 167 | - accessforbidden('',0,0); |
|
| 167 | + accessforbidden('',0,0); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // End of page |
@@ -55,8 +55,12 @@ discard block |
||
| 55 | 55 | $offset = $conf->liste_limit * $page; |
| 56 | 56 | $pageprev = $page - 1; |
| 57 | 57 | $pagenext = $page + 1; |
| 58 | -if (! $sortorder) $sortorder="ASC"; |
|
| 59 | -if (! $sortfield) $sortfield="position_name"; |
|
| 58 | +if (! $sortorder) { |
|
| 59 | + $sortorder="ASC"; |
|
| 60 | +} |
|
| 61 | +if (! $sortfield) { |
|
| 62 | + $sortfield="position_name"; |
|
| 63 | +} |
|
| 60 | 64 | |
| 61 | 65 | $object = new Societe($db); |
| 62 | 66 | if ($id > 0 || ! empty($ref)) |
@@ -86,7 +90,9 @@ discard block |
||
| 86 | 90 | $form = new Form($db); |
| 87 | 91 | |
| 88 | 92 | $title=$langs->trans("ThirdParty").' - '.$langs->trans("Files"); |
| 89 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files"); |
|
| 93 | +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) { |
|
| 94 | + $title=$object->name.' - '.$langs->trans("Files"); |
|
| 95 | +} |
|
| 90 | 96 | $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
| 91 | 97 | llxHeader('',$title,$help_url); |
| 92 | 98 | |
@@ -95,7 +101,9 @@ discard block |
||
| 95 | 101 | /* |
| 96 | 102 | * Show tabs |
| 97 | 103 | */ |
| 98 | - if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 104 | + if (! empty($conf->notification->enabled)) { |
|
| 105 | + $langs->load("mails"); |
|
| 106 | + } |
|
| 99 | 107 | $head = societe_prepare_head($object); |
| 100 | 108 | |
| 101 | 109 | $form=new Form($db); |
@@ -121,17 +129,21 @@ discard block |
||
| 121 | 129 | print '<table class="border centpercent">'; |
| 122 | 130 | |
| 123 | 131 | // Prefix |
| 124 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 132 | + if (! empty($conf->global->SOCIETE_USEPREFIX)) { |
|
| 133 | + // Old not used prefix field |
|
| 125 | 134 | { |
| 126 | 135 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 127 | 136 | } |
| 137 | + } |
|
| 128 | 138 | |
| 129 | 139 | if ($object->client) |
| 130 | 140 | { |
| 131 | 141 | print '<tr><td class="titlefield">'; |
| 132 | 142 | print $langs->trans('CustomerCode').'</td><td colspan="3">'; |
| 133 | 143 | print $object->code_client; |
| 134 | - if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 144 | + if ($object->check_codeclient() <> 0) { |
|
| 145 | + print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; |
|
| 146 | + } |
|
| 135 | 147 | print '</td></tr>'; |
| 136 | 148 | } |
| 137 | 149 | |
@@ -140,7 +152,9 @@ discard block |
||
| 140 | 152 | print '<tr><td class="titlefield">'; |
| 141 | 153 | print $langs->trans('SupplierCode').'</td><td colspan="3">'; |
| 142 | 154 | print $object->code_fournisseur; |
| 143 | - if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 155 | + if ($object->check_codefournisseur() <> 0) { |
|
| 156 | + print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; |
|
| 157 | + } |
|
| 144 | 158 | print '</td></tr>'; |
| 145 | 159 | } |
| 146 | 160 | |
@@ -161,8 +175,7 @@ discard block |
||
| 161 | 175 | $permtoedit = $user->rights->societe->creer; |
| 162 | 176 | $param = '&id=' . $object->id; |
| 163 | 177 | include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
| 164 | -} |
|
| 165 | -else |
|
| 178 | +} else |
|
| 166 | 179 | { |
| 167 | 180 | accessforbidden('',0,0); |
| 168 | 181 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 31 | 31 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 32 | -require DOL_BASE_PATH . 'main.inc.php'; |
|
| 32 | +require DOL_BASE_PATH.'main.inc.php'; |
|
| 33 | 33 | |
| 34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
| 35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $langs->loadLangs(array("companies", "other")); |
| 40 | 40 | |
| 41 | -$action=GETPOST('action','aZ09'); |
|
| 42 | -$confirm=GETPOST('confirm'); |
|
| 43 | -$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int')); |
|
| 41 | +$action = GETPOST('action', 'aZ09'); |
|
| 42 | +$confirm = GETPOST('confirm'); |
|
| 43 | +$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); |
|
| 44 | 44 | $ref = GETPOST('ref', 'alpha'); |
| 45 | 45 | |
| 46 | 46 | // Security check |
@@ -52,27 +52,27 @@ discard block |
||
| 52 | 52 | $result = restrictedArea($user, 'societe', $id, '&societe'); |
| 53 | 53 | |
| 54 | 54 | // Get parameters |
| 55 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 56 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 57 | -$page = GETPOST("page",'int'); |
|
| 55 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 56 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 57 | +$page = GETPOST("page", 'int'); |
|
| 58 | 58 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 59 | 59 | $offset = $conf->liste_limit * $page; |
| 60 | 60 | $pageprev = $page - 1; |
| 61 | 61 | $pagenext = $page + 1; |
| 62 | -if (! $sortorder) $sortorder="ASC"; |
|
| 63 | -if (! $sortfield) $sortfield="position_name"; |
|
| 62 | +if (!$sortorder) $sortorder = "ASC"; |
|
| 63 | +if (!$sortfield) $sortfield = "position_name"; |
|
| 64 | 64 | |
| 65 | 65 | $object = new Societe($db); |
| 66 | -if ($id > 0 || ! empty($ref)) |
|
| 66 | +if ($id > 0 || !empty($ref)) |
|
| 67 | 67 | { |
| 68 | 68 | $result = $object->fetch($id, $ref); |
| 69 | 69 | |
| 70 | - $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ; |
|
| 71 | - $courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id,0,0,0,$object,'thirdparty'); |
|
| 70 | + $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; |
|
| 71 | + $courrier_dir = $conf->societe->multidir_output[$object->entity]."/courrier/".get_exdir($object->id, 0, 0, 0, $object, 'thirdparty'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 75 | -$hookmanager->initHooks(array('thirdpartydocument','globalcard')); |
|
| 75 | +$hookmanager->initHooks(array('thirdpartydocument', 'globalcard')); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * Actions |
| 81 | 81 | */ |
| 82 | 82 | |
| 83 | -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; |
|
| 83 | +include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; |
|
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | /* |
@@ -89,35 +89,35 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $form = new Form($db); |
| 91 | 91 | |
| 92 | -$title=$langs->trans("ThirdParty").' - '.$langs->trans("Files"); |
|
| 93 | -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files"); |
|
| 94 | -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
|
| 95 | -llxHeader('',$title,$help_url); |
|
| 92 | +$title = $langs->trans("ThirdParty").' - '.$langs->trans("Files"); |
|
| 93 | +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name.' - '.$langs->trans("Files"); |
|
| 94 | +$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; |
|
| 95 | +llxHeader('', $title, $help_url); |
|
| 96 | 96 | |
| 97 | 97 | if ($object->id) |
| 98 | 98 | { |
| 99 | 99 | /* |
| 100 | 100 | * Show tabs |
| 101 | 101 | */ |
| 102 | - if (! empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 102 | + if (!empty($conf->notification->enabled)) $langs->load("mails"); |
|
| 103 | 103 | $head = societe_prepare_head($object); |
| 104 | 104 | |
| 105 | - $form=new Form($db); |
|
| 105 | + $form = new Form($db); |
|
| 106 | 106 | |
| 107 | 107 | dol_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company'); |
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | // Build file list |
| 111 | - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); |
|
| 112 | - $totalsize=0; |
|
| 113 | - foreach($filearray as $key => $file) |
|
| 111 | + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); |
|
| 112 | + $totalsize = 0; |
|
| 113 | + foreach ($filearray as $key => $file) |
|
| 114 | 114 | { |
| 115 | - $totalsize+=$file['size']; |
|
| 115 | + $totalsize += $file['size']; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
| 119 | 119 | |
| 120 | - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); |
|
| 120 | + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom'); |
|
| 121 | 121 | |
| 122 | 122 | print '<div class="fichecenter">'; |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | print '<table class="border centpercent">'; |
| 126 | 126 | |
| 127 | 127 | // Prefix |
| 128 | - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 128 | + if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field |
|
| 129 | 129 | { |
| 130 | 130 | print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; |
| 131 | 131 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; |
| 153 | 153 | |
| 154 | 154 | // Total size |
| 155 | - print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>'; |
|
| 155 | + print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>'; |
|
| 156 | 156 | |
| 157 | 157 | print '</table>'; |
| 158 | 158 | |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | $modulepart = 'societe'; |
| 164 | 164 | $permission = $user->rights->societe->creer; |
| 165 | 165 | $permtoedit = $user->rights->societe->creer; |
| 166 | - $param = '&id=' . $object->id; |
|
| 167 | - include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
|
| 166 | + $param = '&id='.$object->id; |
|
| 167 | + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; |
|
| 168 | 168 | } |
| 169 | 169 | else |
| 170 | 170 | { |
| 171 | - accessforbidden('',0,0); |
|
| 171 | + accessforbidden('', 0, 0); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // End of page |
@@ -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 | ?> |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | <?php |
| 155 | 155 | for ($i=1; $i<=4; $i++) { |
| 156 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 157 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 158 | - echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
| 159 | - echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
| 160 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 161 | - } else { |
|
| 162 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 163 | - echo '<td> </td>'; |
|
| 164 | - echo '<td> </td>'; |
|
| 165 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 166 | - } |
|
| 156 | + if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 157 | + if ($i==1 || $i==3) echo '<tr>'; |
|
| 158 | + echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
|
| 159 | + echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
|
| 160 | + if ($i==2 || $i==4) echo '</tr>'; |
|
| 161 | + } else { |
|
| 162 | + if ($i==1 || $i==3) echo '<tr>'; |
|
| 163 | + echo '<td> </td>'; |
|
| 164 | + echo '<td> </td>'; |
|
| 165 | + if ($i==2 || $i==4) echo '</tr>'; |
|
| 166 | + } |
|
| 167 | 167 | } |
| 168 | 168 | ?> |
| 169 | 169 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | // Protection to avoid direct call of template |
| 20 | -if (empty($conf) || ! is_object($conf)) |
|
| 20 | +if (empty($conf) || !is_object($conf)) |
|
| 21 | 21 | { |
| 22 | 22 | print "Error, template page can't be called as URL"; |
| 23 | 23 | exit; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | <tr> |
| 61 | 61 | <td><span class="fieldrequired"><?php echo $langs->trans('ThirdPartyName'); ?></span></td> |
| 62 | 62 | <td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
| 63 | - <?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 63 | + <?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 64 | 64 | <td><?php echo $langs->trans('Prefix'); ?></td> |
| 65 | 65 | <td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>"></td> |
| 66 | 66 | <?php } ?> |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | </tr> |
| 104 | 104 | <?php } }?> |
| 105 | 105 | |
| 106 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
| 106 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
| 107 | 107 | <tr> |
| 108 | 108 | <td><?php echo $langs->trans('Gencod'); ?></td> |
| 109 | 109 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | </tr> |
| 141 | 141 | |
| 142 | 142 | <tr> |
| 143 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
| 143 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
| 144 | 144 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
| 145 | 145 | <td><?php echo $langs->trans('Web'); ?></td> |
| 146 | 146 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
@@ -152,17 +152,17 @@ discard block |
||
| 152 | 152 | </tr> |
| 153 | 153 | |
| 154 | 154 | <?php |
| 155 | -for ($i=1; $i<=4; $i++) { |
|
| 156 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 157 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 155 | +for ($i = 1; $i <= 4; $i++) { |
|
| 156 | + if ($this->control->tpl['langprofid'.$i] != '-') { |
|
| 157 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
| 158 | 158 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
| 159 | 159 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
| 160 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 160 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
| 161 | 161 | } else { |
| 162 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 162 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
| 163 | 163 | echo '<td> </td>'; |
| 164 | 164 | echo '<td> </td>'; |
| 165 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 165 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | ?> |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | <td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td> |
| 180 | 180 | </tr> |
| 181 | 181 | |
| 182 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 182 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 183 | 183 | <tr> |
| 184 | 184 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
| 185 | 185 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | <td class="nowrap"><?php echo $this->control->tpl['tva_intra']; ?></td> |
| 194 | 194 | </tr> |
| 195 | 195 | |
| 196 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 196 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 197 | 197 | |
| 198 | 198 | <?php if ($user->rights->societe->client->voir) { ?> |
| 199 | 199 | <tr> |
@@ -43,7 +43,10 @@ discard block |
||
| 43 | 43 | <?php echo $this->control->tpl['ajax_selectcountry']; ?> |
| 44 | 44 | <?php } ?> |
| 45 | 45 | |
| 46 | -<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> |
|
| 46 | +<?php if ($this->control->tpl['js_checkVatPopup']) { |
|
| 47 | + echo $this->control->tpl['js_checkVatPopup']; |
|
| 48 | +} |
|
| 49 | +?> |
|
| 47 | 50 | |
| 48 | 51 | <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc"> |
| 49 | 52 | |
@@ -154,15 +157,23 @@ discard block |
||
| 154 | 157 | <?php |
| 155 | 158 | for ($i=1; $i<=4; $i++) { |
| 156 | 159 | if ($this->control->tpl['langprofid'.$i]!='-') { |
| 157 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 160 | + if ($i==1 || $i==3) { |
|
| 161 | + echo '<tr>'; |
|
| 162 | + } |
|
| 158 | 163 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
| 159 | 164 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
| 160 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 165 | + if ($i==2 || $i==4) { |
|
| 166 | + echo '</tr>'; |
|
| 167 | + } |
|
| 161 | 168 | } else { |
| 162 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 169 | + if ($i==1 || $i==3) { |
|
| 170 | + echo '<tr>'; |
|
| 171 | + } |
|
| 163 | 172 | echo '<td> </td>'; |
| 164 | 173 | echo '<td> </td>'; |
| 165 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 174 | + if ($i==2 || $i==4) { |
|
| 175 | + echo '</tr>'; |
|
| 176 | + } |
|
| 166 | 177 | } |
| 167 | 178 | } |
| 168 | 179 | ?> |
@@ -193,7 +204,10 @@ discard block |
||
| 193 | 204 | <td class="nowrap"><?php echo $this->control->tpl['tva_intra']; ?></td> |
| 194 | 205 | </tr> |
| 195 | 206 | |
| 196 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 207 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
| 208 | + echo $this->control->tpl['localtax']; |
|
| 209 | +} |
|
| 210 | +?> |
|
| 197 | 211 | |
| 198 | 212 | <?php if ($user->rights->societe->client->voir) { ?> |
| 199 | 213 | <tr> |
@@ -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 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Protection to avoid direct call of template |
| 19 | -if (empty($conf) || ! is_object($conf)) |
|
| 19 | +if (empty($conf) || !is_object($conf)) |
|
| 20 | 20 | { |
| 21 | 21 | print "Error, template page can't be called as URL"; |
| 22 | 22 | exit; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $head = societe_prepare_head($soc); |
| 34 | 34 | |
| 35 | -dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); |
|
| 35 | +dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); |
|
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | 38 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | <td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td> |
| 48 | 48 | </tr> |
| 49 | 49 | |
| 50 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 50 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 51 | 51 | <tr> |
| 52 | 52 | <td><?php echo $langs->trans('Prefix'); ?></td> |
| 53 | 53 | <td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td> |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | </tr> |
| 77 | 77 | <?php } ?> |
| 78 | 78 | |
| 79 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
| 79 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
| 80 | 80 | <tr> |
| 81 | 81 | <td><?php echo $langs->trans('Gencod'); ?></td> |
| 82 | 82 | <td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td> |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | </tr> |
| 121 | 121 | |
| 122 | 122 | <?php |
| 123 | -for ($i=1; $i<=4; $i++) { |
|
| 124 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 125 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 123 | +for ($i = 1; $i <= 4; $i++) { |
|
| 124 | + if ($this->control->tpl['langprofid'.$i] != '-') { |
|
| 125 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
| 126 | 126 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
| 127 | 127 | echo '<td>'.$this->control->tpl['profid'.$i]; |
| 128 | 128 | if ($this->control->tpl['profid'.$i]) { |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | else echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
| 131 | 131 | } |
| 132 | 132 | echo '</td>'; |
| 133 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 133 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
| 134 | 134 | } else { |
| 135 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 135 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
| 136 | 136 | echo '<td> </td>'; |
| 137 | 137 | echo '<td> </td>'; |
| 138 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 138 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | ?> |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | <td><?php echo $this->control->tpl['tva_intra']; ?></td> |
| 148 | 148 | </tr> |
| 149 | 149 | |
| 150 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 150 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 151 | 151 | |
| 152 | 152 | <tr> |
| 153 | 153 | <td><?php echo $langs->trans('Capital'); ?></td> |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | <td><?php echo $this->control->tpl['effectif']; ?></td> |
| 172 | 172 | </tr> |
| 173 | 173 | |
| 174 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 174 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 175 | 175 | <tr> |
| 176 | 176 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
| 177 | 177 | <td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td> |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | </tr> |
| 226 | 226 | </table> |
| 227 | 227 | </td> |
| 228 | - <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
| 228 | + <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
| 229 | 229 | </tr> |
| 230 | 230 | |
| 231 | -<?php if (! empty($conf->adherent->enabled)) { ?> |
|
| 231 | +<?php if (!empty($conf->adherent->enabled)) { ?> |
|
| 232 | 232 | <tr> |
| 233 | 233 | <td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td> |
| 234 | 234 | <td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td> |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | <?php if ($user->rights->societe->supprimer) { ?> |
| 248 | 248 | <?php if ($conf->use_javascript_ajax) { ?> |
| 249 | 249 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
| 250 | - <?php } else { ?> |
|
| 250 | + <?php } else { ?> |
|
| 251 | 251 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
| 252 | 252 | <?php } ?> |
| 253 | 253 | <?php } ?> |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | /* |
| 263 | 263 | * Documents generes |
| 264 | 264 | */ |
| 265 | -$filedir=$conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
| 266 | -$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid; |
|
| 267 | -$genallowed=$user->rights->societe->lire; |
|
| 268 | -$delallowed=$user->rights->societe->creer; |
|
| 265 | +$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
| 266 | +$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid; |
|
| 267 | +$genallowed = $user->rights->societe->lire; |
|
| 268 | +$delallowed = $user->rights->societe->creer; |
|
| 269 | 269 | |
| 270 | -print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); |
|
| 270 | +print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang); |
|
| 271 | 271 | ?> |
| 272 | 272 | |
| 273 | 273 | </td> |
@@ -279,13 +279,13 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | <?php |
| 281 | 281 | // Subsidiaries list |
| 282 | -$result=show_subsidiaries($conf,$langs,$db,$soc); |
|
| 282 | +$result = show_subsidiaries($conf, $langs, $db, $soc); |
|
| 283 | 283 | |
| 284 | 284 | // Contacts list |
| 285 | -$result=show_contacts($conf,$langs,$db,$soc); |
|
| 285 | +$result = show_contacts($conf, $langs, $db, $soc); |
|
| 286 | 286 | |
| 287 | 287 | // Projects list |
| 288 | -$result=show_projects($conf,$langs,$db,$soc); |
|
| 288 | +$result = show_projects($conf, $langs, $db, $soc); |
|
| 289 | 289 | ?> |
| 290 | 290 | |
| 291 | 291 | <!-- END PHP TEMPLATE --> |
| 292 | 292 | \ No newline at end of file |
@@ -36,9 +36,18 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | 38 | |
| 39 | -<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?> |
|
| 40 | -<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> |
|
| 41 | -<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> |
|
| 39 | +<?php if ($this->control->tpl['error']) { |
|
| 40 | + echo $this->control->tpl['error']; |
|
| 41 | +} |
|
| 42 | +?> |
|
| 43 | +<?php if ($this->control->tpl['action_delete']) { |
|
| 44 | + echo $this->control->tpl['action_delete']; |
|
| 45 | +} |
|
| 46 | +?> |
|
| 47 | +<?php if ($this->control->tpl['js_checkVatPopup']) { |
|
| 48 | + echo $this->control->tpl['js_checkVatPopup']; |
|
| 49 | +} |
|
| 50 | +?> |
|
| 42 | 51 | |
| 43 | 52 | <table class="border allwidth"> |
| 44 | 53 | |
@@ -122,20 +131,31 @@ discard block |
||
| 122 | 131 | <?php |
| 123 | 132 | for ($i=1; $i<=4; $i++) { |
| 124 | 133 | if ($this->control->tpl['langprofid'.$i]!='-') { |
| 125 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 134 | + if ($i==1 || $i==3) { |
|
| 135 | + echo '<tr>'; |
|
| 136 | + } |
|
| 126 | 137 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
| 127 | 138 | echo '<td>'.$this->control->tpl['profid'.$i]; |
| 128 | 139 | 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>'; |
|
| 140 | + if ($this->control->tpl['checkprofid'.$i] > 0) { |
|
| 141 | + echo ' '.$this->control->tpl['urlprofid'.$i]; |
|
| 142 | + } else { |
|
| 143 | + echo ' <font class="error">('.$langs->trans("ErrorWrongValue").')</font>'; |
|
| 144 | + } |
|
| 131 | 145 | } |
| 132 | 146 | echo '</td>'; |
| 133 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 147 | + if ($i==2 || $i==4) { |
|
| 148 | + echo '</tr>'; |
|
| 149 | + } |
|
| 134 | 150 | } else { |
| 135 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 151 | + if ($i==1 || $i==3) { |
|
| 152 | + echo '<tr>'; |
|
| 153 | + } |
|
| 136 | 154 | echo '<td> </td>'; |
| 137 | 155 | echo '<td> </td>'; |
| 138 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 156 | + if ($i==2 || $i==4) { |
|
| 157 | + echo '</tr>'; |
|
| 158 | + } |
|
| 139 | 159 | } |
| 140 | 160 | } |
| 141 | 161 | ?> |
@@ -147,14 +167,20 @@ discard block |
||
| 147 | 167 | <td><?php echo $this->control->tpl['tva_intra']; ?></td> |
| 148 | 168 | </tr> |
| 149 | 169 | |
| 150 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 170 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
| 171 | + echo $this->control->tpl['localtax']; |
|
| 172 | +} |
|
| 173 | +?> |
|
| 151 | 174 | |
| 152 | 175 | <tr> |
| 153 | 176 | <td><?php echo $langs->trans('Capital'); ?></td> |
| 154 | 177 | <td colspan="3"> |
| 155 | 178 | <?php |
| 156 | - if ($this->control->tpl['capital']) echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
| 157 | - else echo ' '; |
|
| 179 | + if ($this->control->tpl['capital']) { |
|
| 180 | + echo $this->control->tpl['capital'].' '.$langs->trans("Currency".$conf->currency); |
|
| 181 | + } else { |
|
| 182 | + echo ' '; |
|
| 183 | + } |
|
| 158 | 184 | ?> |
| 159 | 185 | </td> |
| 160 | 186 | </tr> |
@@ -247,7 +273,7 @@ discard block |
||
| 247 | 273 | <?php if ($user->rights->societe->supprimer) { ?> |
| 248 | 274 | <?php if ($conf->use_javascript_ajax) { ?> |
| 249 | 275 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
| 250 | - <?php } else { ?> |
|
| 276 | + <?php } else { ?> |
|
| 251 | 277 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
| 252 | 278 | <?php } ?> |
| 253 | 279 | <?php } ?> |
@@ -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 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | // Protection to avoid direct call of template |
| 20 | -if (empty($conf) || ! is_object($conf)) |
|
| 20 | +if (empty($conf) || !is_object($conf)) |
|
| 21 | 21 | { |
| 22 | 22 | print "Error, template page can't be called as URL"; |
| 23 | 23 | exit; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | <td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
| 54 | 54 | </tr> |
| 55 | 55 | |
| 56 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 56 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 57 | 57 | <tr> |
| 58 | 58 | <td><?php echo $langs->trans("Prefix"); ?></td> |
| 59 | 59 | <td colspan="3"> |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | </tr> |
| 119 | 119 | <?php } }?> |
| 120 | 120 | |
| 121 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
| 121 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
| 122 | 122 | <tr> |
| 123 | 123 | <td><?php echo $langs->trans('Gencod'); ?></td> |
| 124 | 124 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -155,24 +155,24 @@ discard block |
||
| 155 | 155 | </tr> |
| 156 | 156 | |
| 157 | 157 | <tr> |
| 158 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
| 158 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
| 159 | 159 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
| 160 | 160 | <td><?php echo $langs->trans('Web'); ?></td> |
| 161 | 161 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
| 162 | 162 | </tr> |
| 163 | 163 | |
| 164 | 164 | <?php |
| 165 | -for ($i=1; $i<=4; $i++) { |
|
| 166 | - if ($this->control->tpl['langprofid'.$i]!='-') { |
|
| 167 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 165 | +for ($i = 1; $i <= 4; $i++) { |
|
| 166 | + if ($this->control->tpl['langprofid'.$i] != '-') { |
|
| 167 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
| 168 | 168 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
| 169 | 169 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
| 170 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 170 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
| 171 | 171 | } else { |
| 172 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 172 | + if ($i == 1 || $i == 3) echo '<tr>'; |
|
| 173 | 173 | echo '<td> </td>'; |
| 174 | 174 | echo '<td> </td>'; |
| 175 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 175 | + if ($i == 2 || $i == 4) echo '</tr>'; |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | ?> |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | <td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td> |
| 202 | 202 | </tr> |
| 203 | 203 | |
| 204 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 204 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 205 | 205 | <tr> |
| 206 | 206 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
| 207 | 207 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
| 208 | 208 | </tr> |
| 209 | 209 | <?php } ?> |
| 210 | 210 | |
| 211 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 211 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 212 | 212 | |
| 213 | 213 | </table> |
| 214 | 214 | <br> |
@@ -35,7 +35,10 @@ discard block |
||
| 35 | 35 | <?php echo $this->control->tpl['error']; ?> |
| 36 | 36 | |
| 37 | 37 | <?php echo $this->control->tpl['ajax_selectcountry']; ?> |
| 38 | -<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> |
|
| 38 | +<?php if ($this->control->tpl['js_checkVatPopup']) { |
|
| 39 | + echo $this->control->tpl['js_checkVatPopup']; |
|
| 40 | +} |
|
| 41 | +?> |
|
| 39 | 42 | |
| 40 | 43 | <form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc"> |
| 41 | 44 | <input type="hidden" name="canvas" value="<?php echo $canvas ?>"> |
@@ -164,15 +167,23 @@ discard block |
||
| 164 | 167 | <?php |
| 165 | 168 | for ($i=1; $i<=4; $i++) { |
| 166 | 169 | if ($this->control->tpl['langprofid'.$i]!='-') { |
| 167 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 170 | + if ($i==1 || $i==3) { |
|
| 171 | + echo '<tr>'; |
|
| 172 | + } |
|
| 168 | 173 | echo '<td>'.$this->control->tpl['langprofid'.$i].'</td>'; |
| 169 | 174 | echo '<td>'.$this->control->tpl['showprofid'.$i].'</td>'; |
| 170 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 175 | + if ($i==2 || $i==4) { |
|
| 176 | + echo '</tr>'; |
|
| 177 | + } |
|
| 171 | 178 | } else { |
| 172 | - if ($i==1 || $i==3) echo '<tr>'; |
|
| 179 | + if ($i==1 || $i==3) { |
|
| 180 | + echo '<tr>'; |
|
| 181 | + } |
|
| 173 | 182 | echo '<td> </td>'; |
| 174 | 183 | echo '<td> </td>'; |
| 175 | - if ($i==2 || $i==4) echo '</tr>'; |
|
| 184 | + if ($i==2 || $i==4) { |
|
| 185 | + echo '</tr>'; |
|
| 186 | + } |
|
| 176 | 187 | } |
| 177 | 188 | } |
| 178 | 189 | ?> |
@@ -208,7 +219,10 @@ discard block |
||
| 208 | 219 | </tr> |
| 209 | 220 | <?php } ?> |
| 210 | 221 | |
| 211 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 222 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
| 223 | + echo $this->control->tpl['localtax']; |
|
| 224 | +} |
|
| 225 | +?> |
|
| 212 | 226 | |
| 213 | 227 | </table> |
| 214 | 228 | <br> |
@@ -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 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function __construct($db, $dirmodule, $targetmodule, $canvas, $card) |
| 42 | 42 | { |
| 43 | - $this->db = $db; |
|
| 44 | - $this->dirmodule = $dirmodule; |
|
| 45 | - $this->targetmodule = $targetmodule; |
|
| 46 | - $this->canvas = $canvas; |
|
| 47 | - $this->card = $card; |
|
| 43 | + $this->db = $db; |
|
| 44 | + $this->dirmodule = $dirmodule; |
|
| 45 | + $this->targetmodule = $targetmodule; |
|
| 46 | + $this->canvas = $canvas; |
|
| 47 | + $this->card = $card; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | global $langs; |
| 59 | 59 | |
| 60 | - $out=''; |
|
| 60 | + $out = ''; |
|
| 61 | 61 | |
| 62 | - if ($action == 'view') $out.= $langs->trans("ThirdParty"); |
|
| 63 | - if ($action == 'edit') $out.= $langs->trans("EditCompany"); |
|
| 64 | - if ($action == 'create') $out.= $langs->trans("NewCompany"); |
|
| 62 | + if ($action == 'view') $out .= $langs->trans("ThirdParty"); |
|
| 63 | + if ($action == 'edit') $out .= $langs->trans("EditCompany"); |
|
| 64 | + if ($action == 'create') $out .= $langs->trans("NewCompany"); |
|
| 65 | 65 | |
| 66 | 66 | return $out; |
| 67 | 67 | } |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | * @param string $ref Ref of object |
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | - function assign_values(&$action, $id=0, $ref='') |
|
| 79 | + function assign_values(&$action, $id = 0, $ref = '') |
|
| 80 | 80 | { |
| 81 | 81 | // phpcs:enable |
| 82 | 82 | global $conf, $langs, $user, $mysoc; |
| 83 | 83 | global $form, $formadmin, $formcompany; |
| 84 | 84 | |
| 85 | - $ret = $this->getObject($id,$ref); |
|
| 85 | + $ret = $this->getObject($id, $ref); |
|
| 86 | 86 | |
| 87 | 87 | parent::assign_values($action); |
| 88 | 88 | |
| 89 | 89 | $this->tpl['title'] = load_fiche_titre($this->getTitle($action)); |
| 90 | 90 | |
| 91 | - $this->tpl['profid1'] = $this->object->idprof1; |
|
| 91 | + $this->tpl['profid1'] = $this->object->idprof1; |
|
| 92 | 92 | $this->tpl['profid2'] = $this->object->idprof2; |
| 93 | 93 | $this->tpl['profid3'] = $this->object->idprof3; |
| 94 | 94 | $this->tpl['profid4'] = $this->object->idprof4; |
@@ -96,46 +96,46 @@ discard block |
||
| 96 | 96 | if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) |
| 97 | 97 | { |
| 98 | 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"; |
|
| 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 | 105 | $this->tpl['js_checkVatPopup'] = $js; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if ($action == 'create' || $action == 'edit') |
| 109 | 109 | { |
| 110 | - for ($i=1; $i<=4; $i++) |
|
| 110 | + for ($i = 1; $i <= 4; $i++) |
|
| 111 | 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); |
|
| 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 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Type |
| 117 | - $this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id); |
|
| 117 | + $this->tpl['select_companytype'] = $form->selectarray("typent_id", $formcompany->typent_array(0), $this->object->typent_id); |
|
| 118 | 118 | |
| 119 | 119 | // Juridical Status |
| 120 | - $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->country_code); |
|
| 120 | + $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code, $this->object->country_code); |
|
| 121 | 121 | |
| 122 | 122 | // Workforce |
| 123 | - $this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id); |
|
| 123 | + $this->tpl['select_workforce'] = $form->selectarray("effectif_id", $formcompany->effectif_array(0), $this->object->effectif_id); |
|
| 124 | 124 | |
| 125 | 125 | // VAT intra |
| 126 | - $s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 126 | + $s = '<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 127 | 127 | if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
| 128 | 128 | { |
| 129 | - $s.=' '; |
|
| 129 | + $s .= ' '; |
|
| 130 | 130 | |
| 131 | 131 | if ($conf->use_javascript_ajax) |
| 132 | 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); |
|
| 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 | 135 | } |
| 136 | 136 | else |
| 137 | 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>'; |
|
| 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 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | else |
@@ -148,33 +148,33 @@ discard block |
||
| 148 | 148 | // Confirm delete third party |
| 149 | 149 | if ($action == 'delete') |
| 150 | 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"); |
|
| 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 | 152 | } |
| 153 | 153 | |
| 154 | - for ($i=1; $i<=4; $i++) |
|
| 154 | + for ($i = 1; $i <= 4; $i++) |
|
| 155 | 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); |
|
| 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 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // TVA intra |
| 162 | 162 | if ($this->object->tva_intra) |
| 163 | 163 | { |
| 164 | - $s=$this->object->tva_intra; |
|
| 165 | - $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 164 | + $s = $this->object->tva_intra; |
|
| 165 | + $s .= '<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">'; |
|
| 166 | 166 | if (empty($conf->global->MAIN_DISABLEVATCHECK)) |
| 167 | 167 | { |
| 168 | - $s.=' '; |
|
| 168 | + $s .= ' '; |
|
| 169 | 169 | |
| 170 | 170 | if ($conf->use_javascript_ajax) |
| 171 | 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); |
|
| 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 | 174 | } |
| 175 | 175 | else |
| 176 | 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>'; |
|
| 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 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | else |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | { |
| 193 | 193 | $socm = new Societe($this->db); |
| 194 | 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 : ''); |
|
| 195 | + $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client ? "(".$socm->code_client.")" : ""); |
|
| 196 | + $this->tpl['parent_company'] .= ($socm->town ? ' - '.$socm->town : ''); |
|
| 197 | 197 | } |
| 198 | 198 | else |
| 199 | 199 | { |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | * @param string $dbt_select Field name for select if not rowid. (optional) |
| 216 | 216 | * @return int 1 |
| 217 | 217 | */ |
| 218 | - function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
|
| 218 | + function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') |
|
| 219 | 219 | { |
| 220 | - return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select); |
|
| 220 | + return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); |
|
| 221 | 221 | } |
| 222 | 222 | } |
@@ -59,9 +59,15 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $out=''; |
| 61 | 61 | |
| 62 | - if ($action == 'view') $out.= $langs->trans("ThirdParty"); |
|
| 63 | - if ($action == 'edit') $out.= $langs->trans("EditCompany"); |
|
| 64 | - if ($action == 'create') $out.= $langs->trans("NewCompany"); |
|
| 62 | + if ($action == 'view') { |
|
| 63 | + $out.= $langs->trans("ThirdParty"); |
|
| 64 | + } |
|
| 65 | + if ($action == 'edit') { |
|
| 66 | + $out.= $langs->trans("EditCompany"); |
|
| 67 | + } |
|
| 68 | + if ($action == 'create') { |
|
| 69 | + $out.= $langs->trans("NewCompany"); |
|
| 70 | + } |
|
| 65 | 71 | |
| 66 | 72 | return $out; |
| 67 | 73 | } |
@@ -132,18 +138,15 @@ discard block |
||
| 132 | 138 | { |
| 133 | 139 | $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
| 134 | 140 | $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
| 135 | - } |
|
| 136 | - else |
|
| 141 | + } else |
|
| 137 | 142 | { |
| 138 | 143 | $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
| 139 | 144 | } |
| 140 | - } |
|
| 141 | - else |
|
| 145 | + } else |
|
| 142 | 146 | { |
| 143 | 147 | $this->tpl['tva_intra'] = $s; |
| 144 | 148 | } |
| 145 | - } |
|
| 146 | - else |
|
| 149 | + } else |
|
| 147 | 150 | { |
| 148 | 151 | // Confirm delete third party |
| 149 | 152 | if ($action == 'delete') |
@@ -171,18 +174,15 @@ discard block |
||
| 171 | 174 | { |
| 172 | 175 | $s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>'; |
| 173 | 176 | $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); |
| 174 | - } |
|
| 175 | - else |
|
| 177 | + } else |
|
| 176 | 178 | { |
| 177 | 179 | $this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>'; |
| 178 | 180 | } |
| 179 | - } |
|
| 180 | - else |
|
| 181 | + } else |
|
| 181 | 182 | { |
| 182 | 183 | $this->tpl['tva_intra'] = $s; |
| 183 | 184 | } |
| 184 | - } |
|
| 185 | - else |
|
| 185 | + } else |
|
| 186 | 186 | { |
| 187 | 187 | $this->tpl['tva_intra'] = ' '; |
| 188 | 188 | } |
@@ -194,8 +194,7 @@ discard block |
||
| 194 | 194 | $socm->fetch($this->object->parent); |
| 195 | 195 | $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); |
| 196 | 196 | $this->tpl['parent_company'].= ($socm->town ? ' - ' . $socm->town : ''); |
| 197 | - } |
|
| 198 | - else |
|
| 197 | + } else |
|
| 199 | 198 | { |
| 200 | 199 | $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); |
| 201 | 200 | } |
@@ -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 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @var string Error code (or message) |
| 47 | 47 | */ |
| 48 | - public $error=''; |
|
| 48 | + public $error = ''; |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * @param ref $ref Object ref |
| 62 | 62 | * @return object Object loaded |
| 63 | 63 | */ |
| 64 | - protected function getObject($id,$ref='') |
|
| 64 | + protected function getObject($id, $ref = '') |
|
| 65 | 65 | { |
| 66 | 66 | //$ret = $this->getInstanceDao(); |
| 67 | 67 | |
| 68 | 68 | $object = new Societe($this->db); |
| 69 | - if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
| 69 | + if (!empty($id) || !empty($ref)) $object->fetch($id, $ref); |
|
| 70 | 70 | $this->object = $object; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param string $ref Ref of object |
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | - function assign_values(&$action, $id=0, $ref='') |
|
| 82 | + function assign_values(&$action, $id = 0, $ref = '') |
|
| 83 | 83 | { |
| 84 | 84 | // phpcs:enable |
| 85 | 85 | global $conf, $langs, $user, $mysoc, $canvas; |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | if ($action == 'add' || $action == 'update') $this->assign_post($action); |
| 89 | 89 | |
| 90 | - if ($_GET["type"]=='f') { $this->object->fournisseur=1; } |
|
| 91 | - if ($_GET["type"]=='c') { $this->object->client=1; } |
|
| 92 | - if ($_GET["type"]=='p') { $this->object->client=2; } |
|
| 93 | - if ($_GET["type"]=='cp') { $this->object->client=3; } |
|
| 94 | - if ($_REQUEST["private"]==1) { $this->object->particulier=1; } |
|
| 90 | + if ($_GET["type"] == 'f') { $this->object->fournisseur = 1; } |
|
| 91 | + if ($_GET["type"] == 'c') { $this->object->client = 1; } |
|
| 92 | + if ($_GET["type"] == 'p') { $this->object->client = 2; } |
|
| 93 | + if ($_GET["type"] == 'cp') { $this->object->client = 3; } |
|
| 94 | + if ($_REQUEST["private"] == 1) { $this->object->particulier = 1; } |
|
| 95 | 95 | |
| 96 | - foreach($this->object as $key => $value) |
|
| 96 | + foreach ($this->object as $key => $value) |
|
| 97 | 97 | { |
| 98 | 98 | $this->tpl[$key] = $value; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors); |
|
| 102 | - if (is_array($GLOBALS['errors'])) $this->tpl['error'] = get_htmloutput_mesg('',$GLOBALS['errors'],'error'); |
|
| 101 | + $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors); |
|
| 102 | + if (is_array($GLOBALS['errors'])) $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error'); |
|
| 103 | 103 | |
| 104 | 104 | if ($action == 'create') |
| 105 | 105 | { |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Load object modCodeClient |
| 143 | - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); |
|
| 143 | + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); |
|
| 144 | 144 | if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
| 145 | 145 | { |
| 146 | - $module = substr($module, 0, dol_strlen($module)-4); |
|
| 146 | + $module = substr($module, 0, dol_strlen($module) - 4); |
|
| 147 | 147 | } |
| 148 | - $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); |
|
| 148 | + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); |
|
| 149 | 149 | foreach ($dirsociete as $dirroot) |
| 150 | 150 | { |
| 151 | - $res=dol_include_once($dirroot.$module.'.php'); |
|
| 151 | + $res = dol_include_once($dirroot.$module.'.php'); |
|
| 152 | 152 | if ($res) break; |
| 153 | 153 | } |
| 154 | 154 | $modCodeClient = new $module($db); |
@@ -166,25 +166,25 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // Customer |
| 168 | 168 | $this->tpl['customercode'] = $this->object->code_client; |
| 169 | - if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0); |
|
| 169 | + if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0); |
|
| 170 | 170 | $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable(); |
| 171 | - $s=$modCodeClient->getToolTip($langs,$this->object,0); |
|
| 172 | - $this->tpl['help_customercode'] = $form->textwithpicto('',$s,1); |
|
| 171 | + $s = $modCodeClient->getToolTip($langs, $this->object, 0); |
|
| 172 | + $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1); |
|
| 173 | 173 | |
| 174 | - if (! empty($conf->fournisseur->enabled)) |
|
| 174 | + if (!empty($conf->fournisseur->enabled)) |
|
| 175 | 175 | { |
| 176 | 176 | $this->tpl['supplier_enabled'] = 1; |
| 177 | 177 | |
| 178 | 178 | // Load object modCodeFournisseur |
| 179 | - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; |
|
| 179 | + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; |
|
| 180 | 180 | if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') |
| 181 | 181 | { |
| 182 | - $module = substr($module, 0, dol_strlen($module)-4); |
|
| 182 | + $module = substr($module, 0, dol_strlen($module) - 4); |
|
| 183 | 183 | } |
| 184 | - $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']); |
|
| 184 | + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); |
|
| 185 | 185 | foreach ($dirsociete as $dirroot) |
| 186 | 186 | { |
| 187 | - $res=dol_include_once($dirroot.$module.'.php'); |
|
| 187 | + $res = dol_include_once($dirroot.$module.'.php'); |
|
| 188 | 188 | if ($res) break; |
| 189 | 189 | } |
| 190 | 190 | $modCodeFournisseur = new $module; |
@@ -193,69 +193,69 @@ discard block |
||
| 193 | 193 | if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
| 194 | 194 | |
| 195 | 195 | // Supplier |
| 196 | - $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
|
| 196 | + $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1); |
|
| 197 | 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); |
|
| 198 | + if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1); |
|
| 199 | 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); |
|
| 200 | + $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1); |
|
| 201 | + $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1); |
|
| 202 | 202 | |
| 203 | 203 | $this->object->LoadSupplierCateg(); |
| 204 | 204 | $this->tpl['suppliercategory'] = $this->object->SupplierCategories; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Zip |
| 208 | - $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); |
|
| 208 | + $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); |
|
| 209 | 209 | |
| 210 | 210 | // Town |
| 211 | - $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id')); |
|
| 211 | + $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); |
|
| 212 | 212 | |
| 213 | 213 | // Country |
| 214 | 214 | $this->object->country_id = ($this->object->country_id ? $this->object->country_id : $mysoc->country_id); |
| 215 | 215 | $this->object->country_code = ($this->object->country_code ? $this->object->country_code : $mysoc->country_code); |
| 216 | - $this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id'); |
|
| 216 | + $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id'); |
|
| 217 | 217 | $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; |
| 218 | 218 | |
| 219 | - if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 219 | + if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 220 | 220 | |
| 221 | 221 | // State |
| 222 | - if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code); |
|
| 222 | + if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code); |
|
| 223 | 223 | else $this->tpl['select_state'] = $countrynotdefined; |
| 224 | 224 | |
| 225 | 225 | // Language |
| 226 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); |
|
| 226 | + if (!empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT), 'default_lang', 0, 0, 1); |
|
| 227 | 227 | |
| 228 | 228 | // VAT |
| 229 | - $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation |
|
| 229 | + $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1); // Assujeti par defaut en creation |
|
| 230 | 230 | |
| 231 | 231 | // Select users |
| 232 | 232 | $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); |
| 233 | 233 | |
| 234 | 234 | // Local Tax |
| 235 | 235 | // TODO mettre dans une classe propre au pays |
| 236 | - if($mysoc->country_code=='ES') |
|
| 236 | + if ($mysoc->country_code == 'ES') |
|
| 237 | 237 | { |
| 238 | 238 | $this->tpl['localtax'] = ''; |
| 239 | 239 | |
| 240 | - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") |
|
| 240 | + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") |
|
| 241 | 241 | { |
| 242 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>'; |
|
| 243 | - $this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); |
|
| 244 | - $this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>'; |
|
| 245 | - $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
|
| 246 | - $this->tpl['localtax'].= '</td></tr>'; |
|
| 242 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>'; |
|
| 243 | + $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); |
|
| 244 | + $this->tpl['localtax'] .= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>'; |
|
| 245 | + $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); |
|
| 246 | + $this->tpl['localtax'] .= '</td></tr>'; |
|
| 247 | 247 | } |
| 248 | - elseif($mysoc->localtax1_assuj=="1") |
|
| 248 | + elseif ($mysoc->localtax1_assuj == "1") |
|
| 249 | 249 | { |
| 250 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; |
|
| 251 | - $this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); |
|
| 252 | - $this->tpl['localtax'].= '</td><tr>'; |
|
| 250 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; |
|
| 251 | + $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); |
|
| 252 | + $this->tpl['localtax'] .= '</td><tr>'; |
|
| 253 | 253 | } |
| 254 | - elseif($mysoc->localtax2_assuj=="1") |
|
| 254 | + elseif ($mysoc->localtax2_assuj == "1") |
|
| 255 | 255 | { |
| 256 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; |
|
| 257 | - $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
|
| 258 | - $this->tpl['localtax'].= '</td><tr>'; |
|
| 256 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; |
|
| 257 | + $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); |
|
| 258 | + $this->tpl['localtax'] .= '</td><tr>'; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -263,78 +263,78 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $head = societe_prepare_head($this->object); |
| 265 | 265 | |
| 266 | - $this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company'); |
|
| 267 | - $this->tpl['showend']=dol_get_fiche_end(); |
|
| 266 | + $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company'); |
|
| 267 | + $this->tpl['showend'] = dol_get_fiche_end(); |
|
| 268 | 268 | |
| 269 | - $this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom'); |
|
| 269 | + $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); |
|
| 270 | 270 | |
| 271 | 271 | $this->tpl['checkcustomercode'] = $this->object->check_codeclient(); |
| 272 | 272 | $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur(); |
| 273 | - $this->tpl['address'] = dol_nl2br($this->object->address); |
|
| 273 | + $this->tpl['address'] = dol_nl2br($this->object->address); |
|
| 274 | 274 | |
| 275 | - $img=picto_from_langcode($this->object->country_code); |
|
| 276 | - if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); |
|
| 277 | - $this->tpl['country'] = ($img?$img.' ':'').$this->object->country; |
|
| 275 | + $img = picto_from_langcode($this->object->country_code); |
|
| 276 | + if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img ? $img.' ' : '').$this->object->country, $langs->trans("CountryIsInEEC"), 1, 0); |
|
| 277 | + $this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country; |
|
| 278 | 278 | |
| 279 | - $this->tpl['phone'] = dol_print_phone($this->object->phone,$this->object->country_code,0,$this->object->id,'AC_TEL'); |
|
| 280 | - $this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->country_code,0,$this->object->id,'AC_FAX'); |
|
| 281 | - $this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL'); |
|
| 279 | + $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); |
|
| 280 | + $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX'); |
|
| 281 | + $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); |
|
| 282 | 282 | $this->tpl['url'] = dol_print_url($this->object->url); |
| 283 | 283 | |
| 284 | - $this->tpl['tva_assuj'] = yn($this->object->tva_assuj); |
|
| 284 | + $this->tpl['tva_assuj'] = yn($this->object->tva_assuj); |
|
| 285 | 285 | |
| 286 | 286 | // Third party type |
| 287 | 287 | $arr = $formcompany->typent_array(1); |
| 288 | 288 | $this->tpl['typent'] = $arr[$this->object->typent_code]; |
| 289 | 289 | |
| 290 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
| 290 | + if (!empty($conf->global->MAIN_MULTILANGS)) |
|
| 291 | 291 | { |
| 292 | 292 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
| 293 | 293 | //$s=picto_from_langcode($this->default_lang); |
| 294 | 294 | //print ($s?$s.' ':''); |
| 295 | 295 | $langs->load("languages"); |
| 296 | - $this->tpl['default_lang'] = ($this->default_lang?$langs->trans('Language_'.$this->object->default_lang):''); |
|
| 296 | + $this->tpl['default_lang'] = ($this->default_lang ? $langs->trans('Language_'.$this->object->default_lang) : ''); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - $this->tpl['image_edit'] = img_edit(); |
|
| 299 | + $this->tpl['image_edit'] = img_edit(); |
|
| 300 | 300 | |
| 301 | - $this->tpl['display_rib'] = $this->object->display_rib(); |
|
| 301 | + $this->tpl['display_rib'] = $this->object->display_rib(); |
|
| 302 | 302 | |
| 303 | 303 | // Sales representatives |
| 304 | 304 | $this->tpl['sales_representatives'] = ''; |
| 305 | - $listsalesrepresentatives=$this->object->getSalesRepresentatives($user); |
|
| 306 | - $nbofsalesrepresentative=count($listsalesrepresentatives); |
|
| 305 | + $listsalesrepresentatives = $this->object->getSalesRepresentatives($user); |
|
| 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) |
|
| 315 | + $userstatic = new User($this->db); |
|
| 316 | + $i = 0; |
|
| 317 | + foreach ($listsalesrepresentatives as $val) |
|
| 318 | 318 | { |
| 319 | - $userstatic->id=$val['id']; |
|
| 320 | - $userstatic->lastname=$val['name']; |
|
| 321 | - $userstatic->firstname=$val['firstname']; |
|
| 322 | - $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
|
| 319 | + $userstatic->id = $val['id']; |
|
| 320 | + $userstatic->lastname = $val['name']; |
|
| 321 | + $userstatic->firstname = $val['firstname']; |
|
| 322 | + $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1); |
|
| 323 | 323 | $i++; |
| 324 | - if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
| 324 | + if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'] .= ', '; |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | - else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
|
| 327 | + else $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected"); |
|
| 328 | 328 | |
| 329 | 329 | // Linked member |
| 330 | - if (! empty($conf->adherent->enabled)) |
|
| 330 | + if (!empty($conf->adherent->enabled)) |
|
| 331 | 331 | { |
| 332 | 332 | $langs->load("members"); |
| 333 | - $adh=new Adherent($this->db); |
|
| 334 | - $result=$adh->fetch('','',$this->object->id); |
|
| 333 | + $adh = new Adherent($this->db); |
|
| 334 | + $result = $adh->fetch('', '', $this->object->id); |
|
| 335 | 335 | if ($result > 0) |
| 336 | 336 | { |
| 337 | - $adh->ref=$adh->getFullName($langs); |
|
| 337 | + $adh->ref = $adh->getFullName($langs); |
|
| 338 | 338 | $this->tpl['linked_member'] = $adh->getNomUrl(1); |
| 339 | 339 | } |
| 340 | 340 | else |
@@ -345,26 +345,26 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | // Local Tax |
| 347 | 347 | // TODO mettre dans une classe propre au pays |
| 348 | - if($mysoc->country_code=='ES') |
|
| 348 | + if ($mysoc->country_code == 'ES') |
|
| 349 | 349 | { |
| 350 | 350 | $this->tpl['localtax'] = ''; |
| 351 | 351 | |
| 352 | - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") |
|
| 352 | + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") |
|
| 353 | 353 | { |
| 354 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
| 355 | - $this->tpl['localtax'].= '<td>'.yn($this->object->localtax1_assuj).'</td>'; |
|
| 356 | - $this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
| 357 | - $this->tpl['localtax'].= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
| 354 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
| 355 | + $this->tpl['localtax'] .= '<td>'.yn($this->object->localtax1_assuj).'</td>'; |
|
| 356 | + $this->tpl['localtax'] .= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
| 357 | + $this->tpl['localtax'] .= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
| 358 | 358 | } |
| 359 | - elseif($mysoc->localtax1_assuj=="1") |
|
| 359 | + elseif ($mysoc->localtax1_assuj == "1") |
|
| 360 | 360 | { |
| 361 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
| 362 | - $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>'; |
|
| 361 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
|
| 362 | + $this->tpl['localtax'] .= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>'; |
|
| 363 | 363 | } |
| 364 | - elseif($mysoc->localtax2_assuj=="1") |
|
| 364 | + elseif ($mysoc->localtax2_assuj == "1") |
|
| 365 | 365 | { |
| 366 | - $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
| 367 | - $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
| 366 | + $this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
|
| 367 | + $this->tpl['localtax'] .= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>'; |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | } |
@@ -382,47 +382,47 @@ discard block |
||
| 382 | 382 | // phpcs:enable |
| 383 | 383 | global $langs, $mysoc; |
| 384 | 384 | |
| 385 | - $this->object->id = $_POST["socid"]; |
|
| 386 | - $this->object->name = $_POST["nom"]; |
|
| 387 | - $this->object->prefix_comm = $_POST["prefix_comm"]; |
|
| 388 | - $this->object->client = $_POST["client"]; |
|
| 389 | - $this->object->code_client = $_POST["code_client"]; |
|
| 390 | - $this->object->fournisseur = $_POST["fournisseur"]; |
|
| 391 | - $this->object->code_fournisseur = $_POST["code_fournisseur"]; |
|
| 392 | - $this->object->address = $_POST["adresse"]; |
|
| 393 | - $this->object->zip = $_POST["zipcode"]; |
|
| 394 | - $this->object->town = $_POST["town"]; |
|
| 395 | - $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; |
|
| 396 | - $this->object->state_id = $_POST["state_id"]; |
|
| 397 | - $this->object->phone = $_POST["tel"]; |
|
| 398 | - $this->object->fax = $_POST["fax"]; |
|
| 399 | - $this->object->email = $_POST["email"]; |
|
| 400 | - $this->object->url = $_POST["url"]; |
|
| 401 | - $this->object->capital = $_POST["capital"]; |
|
| 402 | - $this->object->idprof1 = $_POST["idprof1"]; |
|
| 403 | - $this->object->idprof2 = $_POST["idprof2"]; |
|
| 404 | - $this->object->idprof3 = $_POST["idprof3"]; |
|
| 405 | - $this->object->idprof4 = $_POST["idprof4"]; |
|
| 406 | - $this->object->typent_id = $_POST["typent_id"]; |
|
| 407 | - $this->object->effectif_id = $_POST["effectif_id"]; |
|
| 408 | - $this->object->barcode = $_POST["barcode"]; |
|
| 409 | - $this->object->forme_juridique_code = $_POST["forme_juridique_code"]; |
|
| 410 | - $this->object->default_lang = $_POST["default_lang"]; |
|
| 411 | - $this->object->commercial_id = $_POST["commercial_id"]; |
|
| 412 | - |
|
| 413 | - $this->object->tva_assuj = $_POST["assujtva_value"]?$_POST["assujtva_value"]:1; |
|
| 414 | - $this->object->tva_intra = $_POST["tva_intra"]; |
|
| 385 | + $this->object->id = $_POST["socid"]; |
|
| 386 | + $this->object->name = $_POST["nom"]; |
|
| 387 | + $this->object->prefix_comm = $_POST["prefix_comm"]; |
|
| 388 | + $this->object->client = $_POST["client"]; |
|
| 389 | + $this->object->code_client = $_POST["code_client"]; |
|
| 390 | + $this->object->fournisseur = $_POST["fournisseur"]; |
|
| 391 | + $this->object->code_fournisseur = $_POST["code_fournisseur"]; |
|
| 392 | + $this->object->address = $_POST["adresse"]; |
|
| 393 | + $this->object->zip = $_POST["zipcode"]; |
|
| 394 | + $this->object->town = $_POST["town"]; |
|
| 395 | + $this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id; |
|
| 396 | + $this->object->state_id = $_POST["state_id"]; |
|
| 397 | + $this->object->phone = $_POST["tel"]; |
|
| 398 | + $this->object->fax = $_POST["fax"]; |
|
| 399 | + $this->object->email = $_POST["email"]; |
|
| 400 | + $this->object->url = $_POST["url"]; |
|
| 401 | + $this->object->capital = $_POST["capital"]; |
|
| 402 | + $this->object->idprof1 = $_POST["idprof1"]; |
|
| 403 | + $this->object->idprof2 = $_POST["idprof2"]; |
|
| 404 | + $this->object->idprof3 = $_POST["idprof3"]; |
|
| 405 | + $this->object->idprof4 = $_POST["idprof4"]; |
|
| 406 | + $this->object->typent_id = $_POST["typent_id"]; |
|
| 407 | + $this->object->effectif_id = $_POST["effectif_id"]; |
|
| 408 | + $this->object->barcode = $_POST["barcode"]; |
|
| 409 | + $this->object->forme_juridique_code = $_POST["forme_juridique_code"]; |
|
| 410 | + $this->object->default_lang = $_POST["default_lang"]; |
|
| 411 | + $this->object->commercial_id = $_POST["commercial_id"]; |
|
| 412 | + |
|
| 413 | + $this->object->tva_assuj = $_POST["assujtva_value"] ? $_POST["assujtva_value"] : 1; |
|
| 414 | + $this->object->tva_intra = $_POST["tva_intra"]; |
|
| 415 | 415 | |
| 416 | 416 | //Local Taxes |
| 417 | - $this->object->localtax1_assuj = $_POST["localtax1assuj_value"]; |
|
| 418 | - $this->object->localtax2_assuj = $_POST["localtax2assuj_value"]; |
|
| 417 | + $this->object->localtax1_assuj = $_POST["localtax1assuj_value"]; |
|
| 418 | + $this->object->localtax2_assuj = $_POST["localtax2assuj_value"]; |
|
| 419 | 419 | |
| 420 | 420 | // We set country_id, and country_code label of the chosen country |
| 421 | 421 | if ($this->object->country_id) |
| 422 | 422 | { |
| 423 | - $tmparray=getCountry($this->object->country_id,'all',$this->db,$langs,0); |
|
| 424 | - $this->object->country_code = $tmparray['code']; |
|
| 425 | - $this->object->country_label= $tmparray['label']; |
|
| 423 | + $tmparray = getCountry($this->object->country_id, 'all', $this->db, $langs, 0); |
|
| 424 | + $this->object->country_code = $tmparray['code']; |
|
| 425 | + $this->object->country_label = $tmparray['label']; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -66,7 +66,9 @@ discard block |
||
| 66 | 66 | //$ret = $this->getInstanceDao(); |
| 67 | 67 | |
| 68 | 68 | $object = new Societe($this->db); |
| 69 | - if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); |
|
| 69 | + if (! empty($id) || ! empty($ref)) { |
|
| 70 | + $object->fetch($id,$ref); |
|
| 71 | + } |
|
| 70 | 72 | $this->object = $object; |
| 71 | 73 | } |
| 72 | 74 | |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | global $conf, $langs, $user, $mysoc, $canvas; |
| 86 | 88 | global $form, $formadmin, $formcompany; |
| 87 | 89 | |
| 88 | - if ($action == 'add' || $action == 'update') $this->assign_post($action); |
|
| 90 | + if ($action == 'add' || $action == 'update') { |
|
| 91 | + $this->assign_post($action); |
|
| 92 | + } |
|
| 89 | 93 | |
| 90 | 94 | if ($_GET["type"]=='f') { $this->object->fournisseur=1; } |
| 91 | 95 | if ($_GET["type"]=='c') { $this->object->client=1; } |
@@ -99,7 +103,9 @@ discard block |
||
| 99 | 103 | } |
| 100 | 104 | |
| 101 | 105 | $this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors); |
| 102 | - if (is_array($GLOBALS['errors'])) $this->tpl['error'] = get_htmloutput_mesg('',$GLOBALS['errors'],'error'); |
|
| 106 | + if (is_array($GLOBALS['errors'])) { |
|
| 107 | + $this->tpl['error'] = get_htmloutput_mesg('',$GLOBALS['errors'],'error'); |
|
| 108 | + } |
|
| 103 | 109 | |
| 104 | 110 | if ($action == 'create') |
| 105 | 111 | { |
@@ -149,12 +155,16 @@ discard block |
||
| 149 | 155 | foreach ($dirsociete as $dirroot) |
| 150 | 156 | { |
| 151 | 157 | $res=dol_include_once($dirroot.$module.'.php'); |
| 152 | - if ($res) break; |
|
| 158 | + if ($res) { |
|
| 159 | + break; |
|
| 160 | + } |
|
| 153 | 161 | } |
| 154 | 162 | $modCodeClient = new $module($db); |
| 155 | 163 | $this->tpl['auto_customercode'] = $modCodeClient->code_auto; |
| 156 | 164 | // We verified if the tag prefix is used |
| 157 | - if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); |
|
| 165 | + if ($modCodeClient->code_auto) { |
|
| 166 | + $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); |
|
| 167 | + } |
|
| 158 | 168 | |
| 159 | 169 | // TODO create a function |
| 160 | 170 | $this->tpl['select_customertype'] = Form::selectarray('client', array( |
@@ -166,7 +176,9 @@ discard block |
||
| 166 | 176 | |
| 167 | 177 | // Customer |
| 168 | 178 | $this->tpl['customercode'] = $this->object->code_client; |
| 169 | - if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0); |
|
| 179 | + if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) { |
|
| 180 | + $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object,0); |
|
| 181 | + } |
|
| 170 | 182 | $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable(); |
| 171 | 183 | $s=$modCodeClient->getToolTip($langs,$this->object,0); |
| 172 | 184 | $this->tpl['help_customercode'] = $form->textwithpicto('',$s,1); |
@@ -185,17 +197,23 @@ discard block |
||
| 185 | 197 | foreach ($dirsociete as $dirroot) |
| 186 | 198 | { |
| 187 | 199 | $res=dol_include_once($dirroot.$module.'.php'); |
| 188 | - if ($res) break; |
|
| 200 | + if ($res) { |
|
| 201 | + break; |
|
| 202 | + } |
|
| 189 | 203 | } |
| 190 | 204 | $modCodeFournisseur = new $module; |
| 191 | 205 | $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; |
| 192 | 206 | // We verified if the tag prefix is used |
| 193 | - if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
| 207 | + if ($modCodeFournisseur->code_auto) { |
|
| 208 | + $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); |
|
| 209 | + } |
|
| 194 | 210 | |
| 195 | 211 | // Supplier |
| 196 | 212 | $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->object->fournisseur,1); |
| 197 | 213 | $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); |
|
| 214 | + if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { |
|
| 215 | + $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object,1); |
|
| 216 | + } |
|
| 199 | 217 | $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); |
| 200 | 218 | $s=$modCodeFournisseur->getToolTip($langs,$this->object,1); |
| 201 | 219 | $this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1); |
@@ -216,14 +234,21 @@ discard block |
||
| 216 | 234 | $this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id'); |
| 217 | 235 | $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; |
| 218 | 236 | |
| 219 | - if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 237 | + if ($user->admin) { |
|
| 238 | + $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 239 | + } |
|
| 220 | 240 | |
| 221 | 241 | // State |
| 222 | - if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code); |
|
| 223 | - else $this->tpl['select_state'] = $countrynotdefined; |
|
| 242 | + if ($this->object->country_id) { |
|
| 243 | + $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->country_code); |
|
| 244 | + } else { |
|
| 245 | + $this->tpl['select_state'] = $countrynotdefined; |
|
| 246 | + } |
|
| 224 | 247 | |
| 225 | 248 | // Language |
| 226 | - if (! empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); |
|
| 249 | + if (! empty($conf->global->MAIN_MULTILANGS)) { |
|
| 250 | + $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); |
|
| 251 | + } |
|
| 227 | 252 | |
| 228 | 253 | // VAT |
| 229 | 254 | $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation |
@@ -244,22 +269,19 @@ discard block |
||
| 244 | 269 | $this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>'; |
| 245 | 270 | $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
| 246 | 271 | $this->tpl['localtax'].= '</td></tr>'; |
| 247 | - } |
|
| 248 | - elseif($mysoc->localtax1_assuj=="1") |
|
| 272 | + } elseif($mysoc->localtax1_assuj=="1") |
|
| 249 | 273 | { |
| 250 | 274 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; |
| 251 | 275 | $this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->object->localtax1_assuj,1); |
| 252 | 276 | $this->tpl['localtax'].= '</td><tr>'; |
| 253 | - } |
|
| 254 | - elseif($mysoc->localtax2_assuj=="1") |
|
| 277 | + } elseif($mysoc->localtax2_assuj=="1") |
|
| 255 | 278 | { |
| 256 | 279 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; |
| 257 | 280 | $this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->object->localtax1_assuj,1); |
| 258 | 281 | $this->tpl['localtax'].= '</td><tr>'; |
| 259 | 282 | } |
| 260 | 283 | } |
| 261 | - } |
|
| 262 | - else |
|
| 284 | + } else |
|
| 263 | 285 | { |
| 264 | 286 | $head = societe_prepare_head($this->object); |
| 265 | 287 | |
@@ -273,7 +295,9 @@ discard block |
||
| 273 | 295 | $this->tpl['address'] = dol_nl2br($this->object->address); |
| 274 | 296 | |
| 275 | 297 | $img=picto_from_langcode($this->object->country_code); |
| 276 | - if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); |
|
| 298 | + if ($this->object->isInEEC()) { |
|
| 299 | + $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); |
|
| 300 | + } |
|
| 277 | 301 | $this->tpl['country'] = ($img?$img.' ':'').$this->object->country; |
| 278 | 302 | |
| 279 | 303 | $this->tpl['phone'] = dol_print_phone($this->object->phone,$this->object->country_code,0,$this->object->id,'AC_TEL'); |
@@ -304,13 +328,14 @@ discard block |
||
| 304 | 328 | $this->tpl['sales_representatives'] = ''; |
| 305 | 329 | $listsalesrepresentatives=$this->object->getSalesRepresentatives($user); |
| 306 | 330 | $nbofsalesrepresentative=count($listsalesrepresentatives); |
| 307 | - if ($nbofsalesrepresentative > 3) // We print only number |
|
| 331 | + if ($nbofsalesrepresentative > 3) { |
|
| 332 | + // We print only number |
|
| 308 | 333 | { |
| 309 | 334 | $this->tpl['sales_representatives'].= '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$this->object->id.'">'; |
| 335 | + } |
|
| 310 | 336 | $this->tpl['sales_representatives'].= $nbofsalesrepresentative; |
| 311 | 337 | $this->tpl['sales_representatives'].= '</a>'; |
| 312 | - } |
|
| 313 | - else if ($nbofsalesrepresentative > 0) |
|
| 338 | + } else if ($nbofsalesrepresentative > 0) |
|
| 314 | 339 | { |
| 315 | 340 | $userstatic=new User($this->db); |
| 316 | 341 | $i=0; |
@@ -321,10 +346,13 @@ discard block |
||
| 321 | 346 | $userstatic->firstname=$val['firstname']; |
| 322 | 347 | $this->tpl['sales_representatives'].= $userstatic->getNomUrl(1); |
| 323 | 348 | $i++; |
| 324 | - if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', '; |
|
| 349 | + if ($i < $nbofsalesrepresentative) { |
|
| 350 | + $this->tpl['sales_representatives'].= ', '; |
|
| 351 | + } |
|
| 325 | 352 | } |
| 353 | + } else { |
|
| 354 | + $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
|
| 326 | 355 | } |
| 327 | - else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected"); |
|
| 328 | 356 | |
| 329 | 357 | // Linked member |
| 330 | 358 | if (! empty($conf->adherent->enabled)) |
@@ -336,8 +364,7 @@ discard block |
||
| 336 | 364 | { |
| 337 | 365 | $adh->ref=$adh->getFullName($langs); |
| 338 | 366 | $this->tpl['linked_member'] = $adh->getNomUrl(1); |
| 339 | - } |
|
| 340 | - else |
|
| 367 | + } else |
|
| 341 | 368 | { |
| 342 | 369 | $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember"); |
| 343 | 370 | } |
@@ -355,13 +382,11 @@ discard block |
||
| 355 | 382 | $this->tpl['localtax'].= '<td>'.yn($this->object->localtax1_assuj).'</td>'; |
| 356 | 383 | $this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
| 357 | 384 | $this->tpl['localtax'].= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>'; |
| 358 | - } |
|
| 359 | - elseif($mysoc->localtax1_assuj=="1") |
|
| 385 | + } elseif($mysoc->localtax1_assuj=="1") |
|
| 360 | 386 | { |
| 361 | 387 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>'; |
| 362 | 388 | $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>'; |
| 363 | - } |
|
| 364 | - elseif($mysoc->localtax2_assuj=="1") |
|
| 389 | + } elseif($mysoc->localtax2_assuj=="1") |
|
| 365 | 390 | { |
| 366 | 391 | $this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>'; |
| 367 | 392 | $this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>'; |
@@ -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 | ?> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | // Protection to avoid direct call of template |
| 20 | -if (empty($conf) || ! is_object($conf)) |
|
| 20 | +if (empty($conf) || !is_object($conf)) |
|
| 21 | 21 | { |
| 22 | 22 | print "Error, template page can't be called as URL"; |
| 23 | 23 | exit; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | <tr> |
| 59 | 59 | <td><span class="fieldrequired"><?php echo $langs->trans('LastName'); ?></span></td> |
| 60 | 60 | <td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td> |
| 61 | - <?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 61 | + <?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 62 | 62 | <td><?php echo $langs->trans('Prefix'); ?></td> |
| 63 | 63 | <td><input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->control->tpl['prefix_comm']; ?>"></td> |
| 64 | 64 | <?php } ?> |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | </tr> |
| 114 | 114 | <?php } }?> |
| 115 | 115 | |
| 116 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
| 116 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
| 117 | 117 | <tr> |
| 118 | 118 | <td><?php echo $langs->trans('Gencod'); ?></td> |
| 119 | 119 | <td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td> |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | </tr> |
| 151 | 151 | |
| 152 | 152 | <tr> |
| 153 | - <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td> |
|
| 153 | + <td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td> |
|
| 154 | 154 | <td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td> |
| 155 | 155 | <td><?php echo $langs->trans('Web'); ?></td> |
| 156 | 156 | <td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td> |
| 157 | 157 | </tr> |
| 158 | 158 | |
| 159 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 159 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 160 | 160 | <tr> |
| 161 | 161 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
| 162 | 162 | <td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td> |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | <td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td> |
| 169 | 169 | </tr> |
| 170 | 170 | |
| 171 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 171 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 172 | 172 | |
| 173 | 173 | <?php if ($user->rights->societe->client->voir) { ?> |
| 174 | 174 | <tr> |
@@ -168,7 +168,10 @@ |
||
| 168 | 168 | <td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td> |
| 169 | 169 | </tr> |
| 170 | 170 | |
| 171 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 171 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
| 172 | + echo $this->control->tpl['localtax']; |
|
| 173 | +} |
|
| 174 | +?> |
|
| 172 | 175 | |
| 173 | 176 | <?php if ($user->rights->societe->client->voir) { ?> |
| 174 | 177 | <tr> |
@@ -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 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | // Protection to avoid direct call of template |
| 19 | -if (empty($conf) || ! is_object($conf)) |
|
| 19 | +if (empty($conf) || !is_object($conf)) |
|
| 20 | 20 | { |
| 21 | 21 | print "Error, template page can't be called as URL"; |
| 22 | 22 | exit; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $head = societe_prepare_head($object); |
| 34 | 34 | |
| 35 | -dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); |
|
| 35 | +dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); |
|
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | <td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td> |
| 47 | 47 | </tr> |
| 48 | 48 | |
| 49 | -<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 49 | +<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?> |
|
| 50 | 50 | <tr> |
| 51 | 51 | <td><?php echo $langs->trans('Prefix'); ?></td> |
| 52 | 52 | <td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td> |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | </tr> |
| 76 | 76 | <?php } ?> |
| 77 | 77 | |
| 78 | -<?php if (! empty($conf->barcode->enabled)) { ?> |
|
| 78 | +<?php if (!empty($conf->barcode->enabled)) { ?> |
|
| 79 | 79 | <tr> |
| 80 | 80 | <td><?php echo $langs->trans('Gencod'); ?></td> |
| 81 | 81 | <td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td> |
@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | <td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td> |
| 124 | 124 | </tr> |
| 125 | 125 | |
| 126 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 126 | +<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 127 | 127 | |
| 128 | 128 | <tr> |
| 129 | 129 | <td><?php echo $langs->trans("Type"); ?></td> |
| 130 | 130 | <td colspan="3"><?php echo $this->control->tpl['typent']; ?></td> |
| 131 | 131 | </tr> |
| 132 | 132 | |
| 133 | -<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 133 | +<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?> |
|
| 134 | 134 | <tr> |
| 135 | 135 | <td><?php echo $langs->trans("DefaultLang"); ?></td> |
| 136 | 136 | <td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td> |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | </tr> |
| 171 | 171 | </table> |
| 172 | 172 | </td> |
| 173 | - <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
| 173 | + <td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td> |
|
| 174 | 174 | </tr> |
| 175 | 175 | |
| 176 | -<?php if (! empty($conf->adherent->enabled)) { ?> |
|
| 176 | +<?php if (!empty($conf->adherent->enabled)) { ?> |
|
| 177 | 177 | <tr> |
| 178 | 178 | <td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td> |
| 179 | 179 | <td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td> |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | <?php if ($user->rights->societe->supprimer) { ?> |
| 193 | 193 | <?php if ($conf->use_javascript_ajax) { ?> |
| 194 | 194 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
| 195 | - <?php } else { ?> |
|
| 195 | + <?php } else { ?> |
|
| 196 | 196 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
| 197 | 197 | <?php } ?> |
| 198 | 198 | <?php } ?> |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | /* |
| 207 | 207 | * Documents generes |
| 208 | 208 | */ |
| 209 | -$filedir=$conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
| 210 | -$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid; |
|
| 211 | -$genallowed=$user->rights->societe->lire; |
|
| 212 | -$delallowed=$user->rights->societe->creer; |
|
| 209 | +$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; |
|
| 210 | +$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid; |
|
| 211 | +$genallowed = $user->rights->societe->lire; |
|
| 212 | +$delallowed = $user->rights->societe->creer; |
|
| 213 | 213 | |
| 214 | -print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang); |
|
| 214 | +print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang); |
|
| 215 | 215 | ?> |
| 216 | 216 | |
| 217 | 217 | </td> |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | <?php |
| 225 | 225 | // Subsidiaries list |
| 226 | -$result=show_subsidiaries($conf,$langs,$db,$object); |
|
| 226 | +$result = show_subsidiaries($conf, $langs, $db, $object); |
|
| 227 | 227 | |
| 228 | 228 | // Contacts list |
| 229 | -$result=show_contacts($conf,$langs,$db,$object); |
|
| 229 | +$result = show_contacts($conf, $langs, $db, $object); |
|
| 230 | 230 | |
| 231 | 231 | // Projects list |
| 232 | -$result=show_projects($conf,$langs,$db,$object); |
|
| 232 | +$result = show_projects($conf, $langs, $db, $object); |
|
| 233 | 233 | ?> |
| 234 | 234 | |
| 235 | 235 | <!-- END PHP TEMPLATE --> |
| 236 | 236 | \ No newline at end of file |
@@ -36,8 +36,14 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | 38 | |
| 39 | -<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?> |
|
| 40 | -<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> |
|
| 39 | +<?php if ($this->control->tpl['error']) { |
|
| 40 | + echo $this->control->tpl['error']; |
|
| 41 | +} |
|
| 42 | +?> |
|
| 43 | +<?php if ($this->control->tpl['action_delete']) { |
|
| 44 | + echo $this->control->tpl['action_delete']; |
|
| 45 | +} |
|
| 46 | +?> |
|
| 41 | 47 | |
| 42 | 48 | <table class="border allwidth"> |
| 43 | 49 | |
@@ -123,7 +129,10 @@ discard block |
||
| 123 | 129 | <td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td> |
| 124 | 130 | </tr> |
| 125 | 131 | |
| 126 | -<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?> |
|
| 132 | +<?php if(!empty($this->control->tpl['localtax'])) { |
|
| 133 | + echo $this->control->tpl['localtax']; |
|
| 134 | +} |
|
| 135 | +?> |
|
| 127 | 136 | |
| 128 | 137 | <tr> |
| 129 | 138 | <td><?php echo $langs->trans("Type"); ?></td> |
@@ -192,7 +201,7 @@ discard block |
||
| 192 | 201 | <?php if ($user->rights->societe->supprimer) { ?> |
| 193 | 202 | <?php if ($conf->use_javascript_ajax) { ?> |
| 194 | 203 | <span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span> |
| 195 | - <?php } else { ?> |
|
| 204 | + <?php } else { ?> |
|
| 196 | 205 | <a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> |
| 197 | 206 | <?php } ?> |
| 198 | 207 | <?php } ?> |