--- /tmp/dsg/dolibarr/htdocs/fourn/github_card.php +++ /tmp/dsg/dolibarr/htdocs/fourn/client_card.php @@ -65,15 +65,6 @@ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('suppliercard', 'globalcard')); -// Security check -$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); - -if ($object->id > 0) { - if (!($object->fournisseur > 0) || empty($user->rights->fournisseur->lire)) { - accessforbidden(); - } -} - /* * Action @@ -94,8 +85,8 @@ { $result = $object->fetch($id); $object->code_compta_fournisseur = $_POST["supplieraccountancycode"]; - $result = $object->update($object->id, $user, 1, 0, 1); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + $result = $object->update($object->id, $user, 1, 0, 1); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } // terms of the settlement if ($action == 'setconditions' && $user->rights->societe->creer) @@ -122,23 +113,23 @@ } if ($action == 'update_extras') { - $object->fetch($id); - - $object->oldcopy = dol_clone($object); - - // Fill array 'array_options' with data from update form - $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); - - if ($ret < 0) $error++; - - if (!$error) - { - $result = $object->insertExtraFields('COMPANY_MODIFY'); - if ($result < 0) $error++; - } - - if ($error) $action = 'edit_extras'; - } + $object->fetch($id); + + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); + + if ($ret < 0) $error++; + + if (!$error) + { + $result = $object->insertExtraFields('COMPANY_MODIFY'); + if ($result < 0) $error++; + } + + if ($error) $action = 'edit_extras'; + } } @@ -168,7 +159,7 @@ */ $head = societe_prepare_head($object); - print dol_get_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), -1, 'company'); + dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; @@ -176,34 +167,31 @@ print '
'; - print '
'; + print '
'; print ''; - if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } + if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + { + print ''; + } if ($object->fournisseur) { print ''; print ''; print ''; $langs->load('compta'); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } // Assujetti a TVA ou pas @@ -229,10 +217,10 @@ print ''; } - // TVA Intra - print ''; + // TVA Intra + print ''; // Default terms of the settlement $langs->load('bills'); @@ -247,7 +235,9 @@ if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', -1, 1); - } else { + } + else + { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'none'); } print ""; @@ -264,7 +254,9 @@ if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1); - } else { + } + else + { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'none'); } print ""; @@ -318,11 +310,11 @@ // Categories if (!empty($conf->categorie->enabled)) { - $langs->load("categories"); - print ''; - print '"; + $langs->load("categories"); + print ''; + print '"; } // Other attributes @@ -330,24 +322,26 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Module Adherent - if (!empty($conf->adherent->enabled)) - { - $langs->load("members"); - $langs->load("users"); - print ''; - print ''; - print "\n"; - } + if (!empty($conf->adherent->enabled)) + { + $langs->load("members"); + $langs->load("users"); + print ''; + print ''; + print "\n"; + } print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'.$langs->trans("SupplierCode").''; print $object->code_fournisseur; - $tmpcheck = $object->check_codefournisseur(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; - } + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
'; - print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer); - print ''; - print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer); - print '
'; + print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer); + print ''; + print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer); + print '
'.$langs->trans('VATIntra').''; - print $object->tva_intra; - print '
'.$langs->trans('VATIntra').''; + print $object->tva_intra; + print '
'.$langs->trans("SuppliersCategoriesShort").''; - print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); - print "
'.$langs->trans("SuppliersCategoriesShort").''; + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); + print "
'.$langs->trans("LinkedToDolibarrMember").''; - $adh = new Adherent($db); - $result = $adh->fetch('', '', $object->id); - if ($result > 0) - { - $adh->ref = $adh->getFullName($langs); - print $adh->getNomUrl(1); - } else { - print $langs->trans("ThirdpartyNotLinkedToMember"); - } - print '
'.$langs->trans("LinkedToDolibarrMember").''; + $adh = new Adherent($db); + $result = $adh->fetch('', '', $object->id); + if ($result > 0) + { + $adh->ref = $adh->getFullName($langs); + print $adh->getNomUrl(1); + } + else + { + print $langs->trans("ThirdpartyNotLinkedToMember"); + } + print '
'; @@ -368,81 +362,67 @@ if ($conf->supplier_proposal->enabled) { - // Box proposals - $tmp = $object->getOutstandingProposals('supplier'); - $outstandingOpened = $tmp['opened']; - $outstandingTotal = $tmp['total_ht']; - $outstandingTotalIncTax = $tmp['total_ttc']; - $text = $langs->trans("OverAllSupplierProposals"); - $link = DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id; - $icon = 'bill'; - if ($link) $boxstat .= ''; - $boxstat .= '
'; - $boxstat .= ''.img_object("", $icon).' '.$text.'
'; - $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; - $boxstat .= '
'; - if ($link) $boxstat .= '
'; + // Box proposals + $tmp = $object->getOutstandingProposals('supplier'); + $outstandingOpened = $tmp['opened']; + $outstandingTotal = $tmp['total_ht']; + $outstandingTotalIncTax = $tmp['total_ttc']; + $text = $langs->trans("OverAllSupplierProposals"); + $link = DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id; + $icon = 'bill'; + if ($link) $boxstat .= ''; + $boxstat .= '
'; + $boxstat .= ''.img_object("", $icon).' '.$text.'
'; + $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; + $boxstat .= '
'; + if ($link) $boxstat .= '
'; } if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - // Box proposals - $tmp = $object->getOutstandingOrders('supplier'); - $outstandingOpened = $tmp['opened']; - $outstandingTotal = $tmp['total_ht']; - $outstandingTotalIncTax = $tmp['total_ttc']; - $text = $langs->trans("OverAllOrders"); - $link = DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id; - $icon = 'bill'; - if ($link) $boxstat .= ''; - $boxstat .= '
'; - $boxstat .= ''.img_object("", $icon).' '.$text.'
'; - $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; - $boxstat .= '
'; - if ($link) $boxstat .= '
'; + // Box proposals + $tmp = $object->getOutstandingOrders('supplier'); + $outstandingOpened = $tmp['opened']; + $outstandingTotal = $tmp['total_ht']; + $outstandingTotalIncTax = $tmp['total_ttc']; + $text = $langs->trans("OverAllOrders"); + $link = DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id; + $icon = 'bill'; + if ($link) $boxstat .= ''; + $boxstat .= '
'; + $boxstat .= ''.img_object("", $icon).' '.$text.'
'; + $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; + $boxstat .= '
'; + if ($link) $boxstat .= '
'; } if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { - $tmp = $object->getOutstandingBills('supplier'); - $outstandingOpened = $tmp['opened']; - $outstandingTotal = $tmp['total_ht']; - $outstandingTotalIncTax = $tmp['total_ttc']; - - $text = $langs->trans("OverAllInvoices"); - $link = DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id; - $icon = 'bill'; - if ($link) $boxstat .= ''; - $boxstat .= '
'; - $boxstat .= ''.img_object("", $icon).' '.$text.'
'; - $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; - $boxstat .= '
'; - if ($link) $boxstat .= '
'; - - // Box outstanding bill - $text = $langs->trans("CurrentOutstandingBill"); - $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id; - $icon = 'bill'; - if ($link) $boxstat .= ''; - $boxstat .= '
'; - $boxstat .= ''.img_object("", $icon).' '.$text.'
'; - $boxstat .= ''.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.''; - $boxstat .= '
'; - if ($link) $boxstat .= '
'; - - $tmp = $object->getOutstandingBills('supplier', 1); - $outstandingOpenedLate = $tmp['opened']; - if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) { - $text = $langs->trans("CurrentOutstandingBillLate"); - $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id; - $icon = 'bill'; - if ($link) $boxstat .= ''; - $boxstat .= '
'; - $boxstat .= ''.img_object("", $icon).' '.$text.'
'; - $boxstat .= ''.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency).$warn.''; - $boxstat .= '
'; - if ($link) $boxstat .= '
'; - } + $tmp = $object->getOutstandingBills('supplier'); + $outstandingOpened = $tmp['opened']; + $outstandingTotal = $tmp['total_ht']; + $outstandingTotalIncTax = $tmp['total_ttc']; + + $text = $langs->trans("OverAllInvoices"); + $link = DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id; + $icon = 'bill'; + if ($link) $boxstat .= ''; + $boxstat .= '
'; + $boxstat .= ''.img_object("", $icon).' '.$text.'
'; + $boxstat .= ''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; + $boxstat .= '
'; + if ($link) $boxstat .= '
'; + + // Box outstanding bill + $text = $langs->trans("CurrentOutstandingBill"); + $link = DOL_URL_ROOT.'/fourn/recap-fourn.php?socid='.$object->id; + $icon = 'bill'; + if ($link) $boxstat .= ''; + $boxstat .= '
'; + $boxstat .= ''.img_object("", $icon).' '.$text.'
'; + $boxstat .= ''.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.''; + $boxstat .= '
'; + if ($link) $boxstat .= '
'; } $boxstat .= ''; @@ -482,15 +462,15 @@ $sql .= $db->plimit($MAXLIST); $query = $db->query($sql); - if (!$query) dol_print_error($db); - - $num = $db->num_rows($query); - - print ''; - print ''; - print ''; + if (!$query) dol_print_error($db); + + $num = $db->num_rows($query); + + print '
'.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("AllProductReferencesOfSupplier").''.$object->nbOfProductRefs().''; - print '
'; + print ''; + print ''; $return = array(); if ($num > 0) @@ -520,12 +500,12 @@ //print (isset($objp->unitprice) ? price($objp->unitprice) : ''); if (isset($objp->price)) { - print price($objp->price); - if ($objp->quantity > 1) - { - print ' / '; - print $objp->quantity; - } + print price($objp->price); + if ($objp->quantity > 1) + { + print ' / '; + print $objp->quantity; + } } print ''; print ''; @@ -543,65 +523,67 @@ if ($user->rights->supplier_proposal->lire) { - $langs->loadLangs(array("supplier_proposal")); - - $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc"; - $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p "; - $sql .= " WHERE p.fk_soc =".$object->id; - $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")"; - $sql .= " ORDER BY p.date_valid DESC"; - $sql .= " ".$db->plimit($MAXLIST); - - $resql = $db->query($sql); - if ($resql) - { - $i = 0; - $num = $db->num_rows($resql); - - if ($num > 0) - { - print '
'.$langs->trans("ProductsAndServices").''; + print ''.$langs->trans("AllProductReferencesOfSupplier").''.$object->nbOfProductRefs().''; + print '
'; - - print ''; - print ''; - } - - while ($i < $num && $i <= $MAXLIST) - { - $obj = $db->fetch_object($resql); - - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - $db->free($resql); - - if ($num > 0) print "
'; - print ''; - print ''; - print ''; - print '
'.$langs->trans("LastSupplierProposals", ($num < $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllPriceRequests").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; - print '
'; - $proposalstatic->id = $obj->rowid; - $proposalstatic->ref = $obj->ref; - $proposalstatic->total_ht = $obj->total_ht; - $proposalstatic->total_tva = $obj->total_tva; - $proposalstatic->total_ttc = $obj->total_ttc; - print $proposalstatic->getNomUrl(1); - print ''; - if ($obj->dc) - { - print dol_print_date($db->jdate($obj->dc), 'day'); - } else { - print "-"; - } - print ''.$proposalstatic->LibStatut($obj->fk_statut, 5).'
"; - } else { - dol_print_error($db); - } + $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc"; + $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p "; + $sql .= " WHERE p.fk_soc =".$object->id; + $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")"; + $sql .= " ORDER BY p.date_valid DESC"; + $sql .= " ".$db->plimit($MAXLIST); + + $resql = $db->query($sql); + if ($resql) + { + $i = 0; + $num = $db->num_rows($resql); + + if ($num > 0) + { + print ''; + + print ''; + print ''; + } + + while ($i < $num && $i <= $MAXLIST) + { + $obj = $db->fetch_object($resql); + + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + $db->free($resql); + + if ($num > 0) print "
'; + print ''; + print ''; + print ''; + print '
'.$langs->trans("LastSupplierProposals", ($num < $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllPriceRequests").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; + print '
'; + $proposalstatic->id = $obj->rowid; + $proposalstatic->ref = $obj->ref; + $proposalstatic->total_ht = $obj->total_ht; + $proposalstatic->total_tva = $obj->total_tva; + $proposalstatic->total_ttc = $obj->total_ttc; + print $proposalstatic->getNomUrl(1); + print ''; + if ($obj->dc) + { + print dol_print_date($db->jdate($obj->dc), 'day'); + } + else + { + print "-"; + } + print ''.$proposalstatic->LibStatut($obj->fk_statut, 5).'
"; + } + else + { + dol_print_error($db); + } } /* @@ -623,10 +605,12 @@ // Show orders we can bill if (empty($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS)) { - $sql2 .= " AND c.fk_statut IN (".$db->sanitize(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php - } else { + $sql2 .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; // Must match filter in htdocs/fourn/orderstoinvoice.php + } + else + { // CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY - $sql2 .= " AND c.fk_statut IN (".$db->sanitize($db->escape($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS)).")"; + $sql2 .= " AND c.fk_statut IN (".$db->escape($conf->global->SUPPLIER_ORDER_TO_INVOICE_STATUS).")"; } $sql2 .= " AND c.billed = 0"; // Find order that are not already invoiced @@ -665,15 +649,15 @@ if ($num > 0) { - print ''; - - print ''; - print ''; + print '
'; - print ''; - print ''; - print ''; - print '
'.$langs->trans("LastSupplierOrders", ($num < $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllOrders").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; - print '
'; + + print ''; + print ''; } while ($i < $num && $i < $MAXLIST) @@ -681,19 +665,21 @@ $obj = $db->fetch_object($resql); print ''; - print ''; + print ''; print ''; @@ -704,7 +690,9 @@ $db->free($resql); if ($num > 0) print "
'; + print ''; + print ''; + print ''; + print '
'.$langs->trans("LastSupplierOrders", ($num < $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllOrders").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; + print '
'; - $orderstatic->id = $obj->rowid; - $orderstatic->ref = $obj->ref; - $orderstatic->total_ht = $obj->total_ht; - $orderstatic->total_tva = $obj->total_tva; - $orderstatic->total_ttc = $obj->total_ttc; - print $orderstatic->getNomUrl(1); - print ''; + $orderstatic->id = $obj->rowid; + $orderstatic->ref = $obj->ref; + $orderstatic->total_ht = $obj->total_ht; + $orderstatic->total_tva = $obj->total_tva; + $orderstatic->total_ttc = $obj->total_ttc; + print $orderstatic->getNomUrl(1); + print ''; if ($obj->dc) { print dol_print_date($db->jdate($obj->dc), 'day'); - } else { + } + else + { print "-"; } print '
"; - } else { + } + else + { dol_print_error($db); } } @@ -734,14 +722,14 @@ $num = $db->num_rows($resql); if ($num > 0) { - print ''; - - print ''; - print ''; + print '
'; - print ''; - print ''; - print '
'.$langs->trans('LastSuppliersBills', ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans('AllBills').''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; - print '
'; + + print ''; + print ''; } while ($i < min($num, $MAXLIST)) @@ -757,8 +745,8 @@ $facturestatic->libelle = $obj->label; // deprecated $facturestatic->label = $obj->label; $facturestatic->total_ht = $obj->total_ht; - $facturestatic->total_tva = $obj->total_tva; - $facturestatic->total_ttc = $obj->total_ttc; + $facturestatic->total_tva = $obj->total_tva; + $facturestatic->total_ttc = $obj->total_ttc; print $facturestatic->getNomUrl(1); print $obj->ref_supplier ? ' - '.$obj->ref_supplier : ''; print ($obj->label ? ' - ' : '').dol_trunc($obj->label, 14); @@ -773,7 +761,9 @@ } $db->free($resql); if ($num > 0) print '
'; + print ''; + print ''; + print '
'.$langs->trans('LastSuppliersBills', ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans('AllBills').''.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; + print '
'; - } else { + } + else + { dol_print_error($db); } } @@ -781,7 +771,7 @@ print '
'; print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); /* @@ -794,64 +784,70 @@ // modified by hook if (empty($reshook)) { - if ($object->status != 1) - { - print '
'.$langs->trans("ThirdPartyIsClosed").'
'; - } + if ($object->status != 1) + { + print '
'.$langs->trans("ThirdPartyIsClosed").'
'; + } if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer) { $langs->load("supplier_proposal"); - if ($object->status == 1) { - print ''.$langs->trans("AddSupplierProposal").''; - } else { - print ''.$langs->trans("AddSupplierProposal").''; - } - } - - if ($user->rights->fournisseur->commande->creer) + if ($object->status == 1) { + print ''.$langs->trans("AddSupplierProposal").''; + } else { + print ''.$langs->trans("AddSupplierProposal").''; + } + } + + if ($user->rights->fournisseur->commande->creer) { $langs->load("orders"); - if ($object->status == 1) { - print ''.$langs->trans("AddOrder").''; - } else { - print ''.$langs->trans("AddOrder").''; - } + if ($object->status == 1) { + print ''.$langs->trans("AddOrder").''; + } else { + print ''.$langs->trans("AddOrder").''; + } } if ($user->rights->fournisseur->facture->creer) { if (!empty($orders2invoice) && $orders2invoice > 0) { - if ($object->status == 1) { + if ($object->status == 1) + { // Company is open - print '
'.$langs->trans("CreateInvoiceForThisSupplier").'
'; - } else { + print '
'.$langs->trans("CreateInvoiceForThisCustomer").'
'; + } + else + { print '
'.$langs->trans("CreateInvoiceForThisCustomer").'
'; } - } else print '
trans("WithReceptionFinished").')').'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'
'; + } + else print '
trans("WithReceptionFinished").')').'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'
'; } if ($user->rights->fournisseur->facture->creer) { $langs->load("bills"); - if ($object->status == 1) { - print ''.$langs->trans("AddBill").''; - } else { - print ''.$langs->trans("AddBill").''; - } - } - - // Add action - if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) - { - if ($user->rights->agenda->myactions->create) - { - print ''.$langs->trans("AddAction").''; - } else { - print ''.$langs->trans("AddAction").''; - } - } + if ($object->status == 1) { + print ''.$langs->trans("AddBill").''; + } else { + print ''.$langs->trans("AddBill").''; + } + } + + // Add action + if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) + { + if ($user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } } print ''; @@ -859,22 +855,24 @@ if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) { - print '
'; - // List of contacts - show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); + print '
'; + // List of contacts + show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); } if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) { - print load_fiche_titre($langs->trans("ActionsOnCompany"), '', ''); - - // List of todo actions - show_actions_todo($conf, $langs, $db, $object); - - // List of done actions - show_actions_done($conf, $langs, $db, $object); - } -} else { + print load_fiche_titre($langs->trans("ActionsOnCompany"), '', ''); + + // List of todo actions + show_actions_todo($conf, $langs, $db, $object); + + // List of done actions + show_actions_done($conf, $langs, $db, $object); + } +} +else +{ dol_print_error($db); } --- /tmp/dsg/dolibarr/htdocs/fourn/github_contact.php +++ /tmp/dsg/dolibarr/htdocs/fourn/client_contact.php @@ -37,8 +37,8 @@ // Security check if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; + $action = ''; + $socid = $user->socid; } $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -69,21 +69,21 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (dol_strlen($stcomm)) { - $sql .= " AND s.fk_stcomm=$stcomm"; + $sql .= " AND s.fk_stcomm=$stcomm"; } if (dol_strlen($begin)) { - $sql .= " AND p.name LIKE '$begin%'"; + $sql .= " AND p.name LIKE '$begin%'"; } if ($contactname) { - $sql .= " AND p.name LIKE '%".strtolower($contactname)."%'"; - $sortfield = "p.name"; - $sortorder = "ASC"; + $sql .= " AND p.name LIKE '%".strtolower($contactname)."%'"; + $sortfield = "p.name"; + $sortorder = "ASC"; } if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".$socid; } $sql .= " ORDER BY $sortfield $sortorder "; @@ -92,40 +92,42 @@ $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $db->num_rows($result); - $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); - print_barre_liste($title." (".$langs->trans("Suppliers").")", $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); + $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); + print_barre_liste($title." (".$langs->trans("Suppliers").")", $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); - print ''; - print ''; - print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "p.name", $begin, "", "", $sortfield, $sortorder); - print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "p.firstname", $begin, "", "", $sortfield, $sortorder); - print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", $begin, "", "", $sortfield, $sortorder); - print_liste_field_titre("Email"); - print_liste_field_titre("Phone"); - print "\n"; + print '
'; + print ''; + print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "p.name", $begin, "", "", $sortfield, $sortorder); + print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "p.firstname", $begin, "", "", $sortfield, $sortorder); + print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", $begin, "", "", $sortfield, $sortorder); + print_liste_field_titre("Email"); + print_liste_field_titre("Phone"); + print "\n"; - $i = 0; - while ($i < min($num, $limit)) - { - $obj = $db->fetch_object($result); + $i = 0; + while ($i < min($num, $limit)) + { + $obj = $db->fetch_object($result); - print ''; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print "\n"; - $i++; - } - print "
'.img_object($langs->trans("ShowContact"), "contact").' '.$obj->lastname.''.$obj->firstname.''.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''.$obj->email.''.$obj->phone.''.img_object($langs->trans("ShowContact"), "contact").' '.$obj->lastname.''.$obj->firstname.''.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''.$obj->email.''.$obj->phone.'
"; - $db->free($result); -} else { - dol_print_error($db); + print "\n"; + $i++; + } + print ""; + $db->free($result); +} +else +{ + dol_print_error($db); } // End of page --- /tmp/dsg/dolibarr/htdocs/fourn/github_index.php +++ /tmp/dsg/dolibarr/htdocs/fourn/client_index.php @@ -89,7 +89,9 @@ print ""; print "
\n"; $db->free($resql); -} else { +} +else +{ dol_print_error($db); } @@ -208,7 +210,9 @@ print "
\n"; } $db->free($resql); - } else { + } + else + { dol_print_error($db); } } @@ -260,7 +264,9 @@ print "\n"; $db->free($resql); -} else { +} +else +{ dol_print_error($db); } --- /tmp/dsg/dolibarr/htdocs/fourn/github_recap-fourn.php +++ /tmp/dsg/dolibarr/htdocs/fourn/client_recap-fourn.php @@ -34,8 +34,8 @@ $socid = GETPOST("socid", 'int'); if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; + $action = ''; + $socid = $user->socid; } @@ -53,138 +53,144 @@ if ($socid > 0) { - $societe = new Societe($db); - $societe->fetch($socid); + $societe = new Societe($db); + $societe->fetch($socid); - /* + /* * Affichage onglets */ - $head = societe_prepare_head($societe); + $head = societe_prepare_head($societe); - print dol_get_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), 0, 'company'); + dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"), 0, 'company'); dol_banner_tab($societe, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); - print dol_get_fiche_end(); + dol_fiche_end(); - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->facture->lire) - { - // Invoice list - print load_fiche_titre($langs->trans("SupplierPreview")); + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->facture->lire) + { + // Invoice list + print load_fiche_titre($langs->trans("SupplierPreview")); - print ''; + print '
'; - $sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,"; - $sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,"; - $sql .= " u.login, u.rowid as userid"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; - $sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Recognition of the entity attributed to this invoice for Multicompany - $sql .= " AND f.fk_user_valid = u.rowid"; - $sql .= " ORDER BY f.datef DESC"; + $sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,"; + $sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,"; + $sql .= " u.login, u.rowid as userid"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; + $sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Recognition of the entity attributed to this invoice for Multicompany + $sql .= " AND f.fk_user_valid = u.rowid"; + $sql .= " ORDER BY f.datef DESC"; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - if (!$num > 0) - { - print ''; - } + if (!$num > 0) + { + print ''; + } - $solde = 0; + $solde = 0; - // Boucle sur chaque facture - for ($i = 0; $i < $num; $i++) - { - $objf = $db->fetch_object($resql); + // Boucle sur chaque facture + for ($i = 0; $i < $num; $i++) + { + $objf = $db->fetch_object($resql); - $fac = new FactureFournisseur($db); - $ret = $fac->fetch($objf->facid); - if ($ret < 0) - { - print $fac->error."
"; - continue; - } - $totalpaye = $fac->getSommePaiement(); + $fac = new FactureFournisseur($db); + $ret = $fac->fetch($objf->facid); + if ($ret < 0) + { + print $fac->error."
"; + continue; + } + $totalpaye = $fac->getSommePaiement(); - print ''; + print ''; - print "\n"; - print "\n"; + print "\n"; + print "\n"; - print ''; - print '\n"; - $solde = $solde + $fac->total_ttc; + print ''; + print '\n"; + $solde = $solde + $fac->total_ttc; - print ''; - print '\n"; + print ''; + print '\n"; - // Author - print ''; + // Author + print ''; - print "\n"; + print "\n"; - // Payments - $sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,"; - $sql .= " p.fk_user_author, u.login, u.rowid as userid"; - $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,"; - $sql .= " ".MAIN_DB_PREFIX."paiementfourn as p"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_author = u.rowid"; - $sql .= " WHERE pf.fk_paiementfourn = p.rowid"; - $sql .= " AND pf.fk_facturefourn = ".$fac->id; + // Payments + $sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,"; + $sql .= " p.fk_user_author, u.login, u.rowid as userid"; + $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,"; + $sql .= " ".MAIN_DB_PREFIX."paiementfourn as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_author = u.rowid"; + $sql .= " WHERE pf.fk_paiementfourn = p.rowid"; + $sql .= " AND pf.fk_facturefourn = ".$fac->id; - $resqlp = $db->query($sql); - if ($resqlp) - { - $nump = $db->num_rows($resqlp); - $j = 0; + $resqlp = $db->query($sql); + if ($resqlp) + { + $nump = $db->num_rows($resqlp); + $j = 0; - while ($j < $nump) - { - $objp = $db->fetch_object($resqlp); - // - print ''; - print '\n"; - print ''; - print "\n"; - print "\n"; - print ''; - $solde = $solde - $objp->amount; - print '\n"; + while ($j < $nump) + { + $objp = $db->fetch_object($resqlp); + // + print ''; + print '\n"; + print ''; + print "\n"; + print "\n"; + print ''; + $solde = $solde - $objp->amount; + print '\n"; - // Auteur - print ''; + // Auteur + print ''; - print ''; + print ''; - $j++; - } + $j++; + } - $db->free($resqlp); - } else { - dol_print_error($db); - } - } - } else { - dol_print_error($db); - } + $db->free($resqlp); + } + else + { + dol_print_error($db); + } + } + } + else + { + dol_print_error($db); + } - print "
'.$langs->trans("Date").' '.$langs->trans("Status").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").' 
'.$langs->trans("Date").' '.$langs->trans("Status").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").' 
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'
".dol_print_date($fac->date)."id\">".img_object($langs->trans("ShowBill"), "bill")." ".$fac->ref."".dol_print_date($fac->date)."id\">".img_object($langs->trans("ShowBill"), "bill")." ".$fac->ref."'.$fac->getLibStatut(2, $totalpaye).''.price($fac->total_ttc)."'.$fac->getLibStatut(2, $totalpaye).''.price($fac->total_ttc)." '.price($solde)." '.price($solde)."'.img_object($langs->trans("ShowUser"), 'user').' '.$objf->login.''.img_object($langs->trans("ShowUser"), 'user').' '.$objf->login.'
'.dol_print_date($db->jdate($objp->dp))."'; - print '      '; // Decalage - print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$langs->trans("Payment").' '.$objp->rowid.'  '.price($objp->amount).''.price($solde)."
'.dol_print_date($db->jdate($objp->dp))."'; + print '      '; // Decalage + print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$langs->trans("Payment").' '.$objp->rowid.'  '.price($objp->amount).''.price($solde)."'.img_object($langs->trans("ShowUser"), 'user').' '.$objp->login.''.img_object($langs->trans("ShowUser"), 'user').' '.$objp->login.'
"; - } -} else { - dol_print_error($db); + print ""; + } +} +else +{ + dol_print_error($db); } // End of page