function beforePDFCreation($parameters, &$object, &$action, $hookmanager) { if ($object->element == 'facture') { if (isset($object->thirdparty)) { $societe =& $object->thirdparty; } else { dol_include_once('/societe/class/societe.class.php'); $societe = new Societe($db); $societe->fetch($object->socid); } if (!empty($societe->id)) { global $db, $conf; if (!empty($societe->array_options['options_fk_soc_factor']) && $societe->array_options['options_factor_suivi'] == 1) { define('INC_FROM_DOLIBARR', true); dol_include_once('/factor/config.php'); dol_include_once('/factor/class/factor.class.php'); $PDOdb = new TPDOdb(); $factor = new TFactor(); $factor->loadBy($PDOdb, $societe->array_options['options_fk_soc_factor'], 'fk_soc'); if (!empty($factor->mention)) { if (strpos($object->note_public, $factor->mention) === false) { $object->note_public = $factor->mention . (!empty($object->note_public) ? "\n\n" . $object->note_public : ''); $r = $object->update_note($object->note_public, '_public'); } } } } } }
static function getRefByObject(&$object) { global $db; $ref = ''; if ($object->element == 'societe' && !empty($object->code_client)) { $ref = $object->code_client; } else { if ($object->element == 'societe') { $ref = $object->name; } else { if ($object->element == 'contact') { dol_include_once('/societe/class/societe.class.php'); $soc = new Societe($db); $soc->fetch($object->socid); $ref = trim((!empty($soc->code_client) ? $soc->code_client : $soc->name) . '_' . $object->lastname); } else { if ($object->element == 'user' && !empty($object->login)) { $ref = $object->login; } elseif (!empty($object->ref)) { $ref = $object->ref; } } } } return $ref; }
/** * Get object from id or ref and save it into this->object * * @param int $id Object id * @param ref $ref Object ref * @return object Object loaded */ protected function getObject($id,$ref='') { $ret = $this->getInstanceDao(); $object = new Societe($this->db); if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); $this->object = $object; }
/** * Add a product into cart * * @return void */ public function ajoutArticle() { global $conf, $db, $mysoc; $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; $societe = new Societe($db); $societe->fetch($thirdpartyid); $product = new Product($db); $product->fetch($this->id); $sql = "SELECT taux"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva"; $sql .= " WHERE rowid = " . $this->tva(); dol_syslog("ajoutArticle", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); $vat_rate = $obj->taux; //var_dump($vat_rate);exit; } else { dol_print_error($db); } // Define part of HT, VAT, TTC $resultarray = calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, 0, 0, 0, 'HT', 0, $product->type, $mysoc); // Calcul du total ht sans remise $total_ht = $resultarray[0]; $total_vat = $resultarray[1]; $total_ttc = $resultarray[2]; // Calcul du montant de la remise if ($this->remisePercent()) { $remise_percent = $this->remisePercent(); } else { $remise_percent = 0; } $montant_remise_ht = $resultarray[6] - $resultarray[0]; $this->montantRemise($montant_remise_ht); $newcartarray = $_SESSION['poscart']; $i = count($newcartarray); $newcartarray[$i]['id'] = $i; $newcartarray[$i]['ref'] = $product->ref; $newcartarray[$i]['label'] = $product->label; $newcartarray[$i]['price'] = $product->price; $newcartarray[$i]['price_ttc'] = $product->price_ttc; if (!empty($conf->global->PRODUIT_MULTIPRICES)) { if (isset($product->multiprices[$societe->price_level])) { $newcartarray[$i]['price'] = $product->multiprices[$societe->price_level]; $newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level]; } } $newcartarray[$i]['fk_article'] = $this->id; $newcartarray[$i]['qte'] = $this->qte(); $newcartarray[$i]['fk_tva'] = $this->tva(); $newcartarray[$i]['remise_percent'] = $remise_percent; $newcartarray[$i]['remise'] = price2num($montant_remise_ht); $newcartarray[$i]['total_ht'] = price2num($total_ht, 'MT'); $newcartarray[$i]['total_ttc'] = price2num($total_ttc, 'MT'); $_SESSION['poscart'] = $newcartarray; $this->raz(); }
function _get_company_object(&$TRender) { global $db, $conf, $langs, $user; dol_include_once('/societe/class/societe.class.php'); foreach ($TRender as $fk_soc => &$line) { $s = new Societe($db); $s->fetch($fk_soc); $line['client'] = $s->name; } }
public function update(Societe $societe) { $query = $this->_db->prepare(' UPDATE t_societe SET raisonSociale=:raisonSociale, dateCreation=:dateCreation WHERE id=:id') or die(print_r($this->_db->errorInfo())); $query->bindValue(':id', $societe->id()); $query->bindValue(':raisonSociale', $societe->raisonSociale()); $query->bindValue(':dateCreation', $societe->dateCreation()); $query->execute(); $query->closeCursor(); }
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $conf, $user, $langs, $db; $langs->load("boxes"); $this->max = $max; include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $thirdpartystatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max)); if ($user->rights->societe->lire) { $sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE s.fournisseur = 1"; $sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id; } $sql .= " ORDER BY s.tms DESC "; $sql .= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT . "/fourn/fiche.php?socid=" . $objp->socid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3)); $i++; } if ($num == 0) { $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedSuppliers")); } $db->free($result); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); $this->max = $max; $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max)); if ($user->rights->societe->lire) { $sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status"; $sql .= ", s.nom as socname"; $sql .= ", s.code_client"; $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON sp.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE sp.entity IN (" . getEntity('societe', 1) . ")"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = "******" AND sp.fk_soc = " . $user->societe_id; } $sql .= " ORDER BY sp.tms DESC"; $sql .= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $contactstatic = new Contact($db); $societestatic = new Societe($db); $line = 0; while ($line < $num) { $objp = $db->fetch_object($result); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $contactstatic->id = $objp->id; $contactstatic->lastname = $objp->lastname; $contactstatic->firstname = $objp->firstname; $contactstatic->civility_id = $objp->civility_id; $contactstatic->statut = $objp->status; $societestatic->id = $objp->fk_soc; $societestatic->code_client = $objp->code_client; $societestatic->name = $objp->socname; $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $contactstatic->getNomUrl(1), 'asis' => 1); $this->info_box_contents[$line][] = array('td' => 'align="left"', 'text' => $objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : '', 'asis' => 1); $this->info_box_contents[$line][] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$line][] = array('td' => 'align="right" class="nowrap" width="18"', 'text' => $contactstatic->getLibStatut(3), 'asis' => 1); $line++; } if ($num == 0) { $this->info_box_contents[$line][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedContacts")); } $db->free($result); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
/** * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code * @param Object $object Object * @param User $user Object user * @param Translate $langs Object langs * @param conf $conf Object conf * @return int <0 if KO, 0 if no triggered ran, >0 if OK */ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { // Mettre ici le code a executer en reaction de l'action // Les donnees de l'action sont stockees dans $object if ($action == 'PAYPAL_PAYMENT_OK') { dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". source=" . $object->source . " ref=" . $object->ref); if (!empty($object->source)) { if ($object->source == 'membersubscription') { //require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherents.class.php'; // TODO add subscription treatment } else { require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $soc = new Societe($this->db); // Parse element/subelement (ex: project_task) $element = $path = $filename = $object->source; if (preg_match('/^([^_]+)_([^_]+)/i', $object->source, $regs)) { $element = $path = $regs[1]; $filename = $regs[2]; } // For compatibility if ($element == 'order') { $path = $filename = 'commande'; } if ($element == 'invoice') { $path = 'compta/facture'; $filename = 'facture'; } dol_include_once('/' . $path . '/class/' . $filename . '.class.php'); $classname = ucfirst($filename); $obj = new $classname($this->db); $ret = $obj->fetch('', $object->ref); if ($ret < 0) { return -1; } // Add payer id $soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid); // Add transaction id $obj->setValueFrom('ref_int', $object->resArray["TRANSACTIONID"]); } } else { // TODO add free tag treatment } } return 0; }
static function getRemise(&$PDOdb, $type, $total, $zip = '', $fk_shipment_mode = 0, $fk_soc = 0) { global $db, $conf; if (!empty($conf->global->REMISE_USE_THIRDPARTY_DISCOUNT) && !empty($fk_soc)) { dol_include_once('/societe/class/societe.class.php'); $s = new Societe($db); $s->fetch($fk_soc); return $s->array_options['options_remsup']; } $TRemise = TRemise::getAll($PDOdb, $type, true, !empty($zip), !empty($fk_shipment_mode)); $remise_used = 0; $find = false; if (!empty($TRemise)) { foreach ($TRemise as &$remise) { if ($type === 'WEIGHT' && $total >= $remise['palier'] && ($remise['remise'] > $remise_used || empty($remise_used))) { if (!empty($zip) && !empty($remise['zip']) && strpos($zip, $remise['zip']) === 0) { $remise_used = $remise['remise']; $find = true; break; } else { if (empty($zip) && empty($remise['zip'])) { // pas de remise associée au code poste trouvé avant $find = true; $remise_used = $remise['remise']; break; } } } else { if ($type === 'AMOUNT') { if ($total >= $remise['palier'] && ($remise['remise'] > $remise_used || empty($remise_used))) { $remise_used = $remise['remise']; $find = true; } } } } } if (!$find && !empty($zip)) { return TRemise::getRemise($PDOdb, $type, $total); } else { return $remise_used; } }
/** * Constructor * * @param DoliDB $db Database handler * @param Societe $object Supplier invoice */ function __construct($db, $object) { global $conf, $langs, $mysoc; $langs->load("main"); $langs->load("bills"); $this->db = $db; $this->name = "canelle"; $this->description = $langs->trans('SuppliersInvoiceModel'); // Dimension page pour format A4 $this->type = 'pdf'; $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); $this->marge_gauche = 10; $this->marge_droite = 10; $this->marge_haute = 10; $this->marge_basse = 10; $this->option_logo = 1; // Affiche logo $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_modereg = 1; // Affiche mode reglement $this->option_condreg = 1; // Affiche conditions reglement $this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_multilang = 1; // Dispo en plusieurs langues $this->franchise = !$mysoc->tva_assuj; // Get source company if (!is_object($object->thirdparty)) { $object->fetch_thirdparty(); } $this->emetteur = $object->thirdparty; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); } // By default, if was not defined // Defini position des colonnes $this->posxdesc = $this->marge_gauche + 1; $this->posxtva = 111; $this->posxup = 126; $this->posxqty = 145; $this->posxdiscount = 162; $this->postotalht = 174; $this->tva = array(); $this->localtax1 = array(); $this->localtax2 = array(); $this->atleastoneratenotnull = 0; $this->atleastonediscount = 0; }
function generateCSV() { global $db, $conf; $TFactRef = $_REQUEST['toGenerate']; // Création et attribution droits fichier $dir = $conf->lcr->dir_output; $filename = 'lcr_' . date('YmdHis') . '.csv'; $f = fopen($dir . '/' . $filename, 'w+'); chmod($dir . '/' . $filename, 0777); $TTitle = array('Code client', 'Raison sociale', 'Adresse 1', 'Adresse 2', 'Code postal', 'Ville', 'Téléphone', 'Référence', 'SIREN', 'RIB', 'Agence', 'Montant', 'Monnaie', 'Accepté', 'Référence', 'Date de création', 'Date d\'échéance'); fputcsv($f, $TTitle, ';'); $fact = new Facture($db); $s = new Societe($db); foreach ($TFactRef as $ref_fact) { if ($fact->fetch('', $ref_fact) > 0 && $s->fetch($fact->socid) > 0) { $rib = $s->get_all_rib(); fputcsv($f, array($s->code_client, $s->name, $s->address, '', $s->zip, $s->town, $s->phone, $ref_fact, $s->idprof1, $rib[0]->iban, '', price($fact->total_ttc), 'E', 1, $ref_fact, date('d/m/Y', $fact->date), date('d/m/Y', $fact->date_lim_reglement)), ';'); } } fclose($f); }
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $user, $langs, $db, $conf; $this->max = $max; include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $thirdpartystatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $max)); if ($user->rights->societe->lire) { $sql = "SELECT s.nom as name, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql .= " WHERE s.client IN (2, 3)"; $sql .= " AND s.entity IN (" . getEntity('societe', 1) . ")"; if (!$user->rights->societe->client->voir && !$user->societe_id) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = "******" AND s.rowid = " . $user->societe_id; } $sql .= " ORDER BY s.tms DESC"; $sql .= $db->plimit($max, 0); dol_syslog(get_class($this) . "::loadBox", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $prospectstatic = new Prospect($db); while ($i < $num) { $objp = $db->fetch_object($resql); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->name, 'url' => DOL_URL_ROOT . "/comm/card.php?socid=" . $objp->socid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => str_replace('img ', 'img height="14" ', $prospectstatic->LibProspStatut($objp->fk_stcomm, 3))); $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status, 3)); $i++; } if ($num == 0) { $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedProspects")); } $db->free($resql); } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { dol_syslog("box_prospect::loadBox not allowed de read this box content", LOG_ERR); $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
/** * Delete thirdparty * * @param int $id Thirparty ID * @return type * * @url DELETE thirdparty/{id} */ function delete($id) { if (!DolibarrApiAccess::$user->rights->societe->supprimer) { throw new RestException(401); } $result = $this->company->fetch($id); if (!$result) { throw new RestException(404, 'Thirdparty not found'); } if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } return $this->company->delete($id); }
/** * \file htdocs/societe/note.php * \brief Tab for notes on third party * \ingroup societe */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; $action = GETPOST('action'); $langs->load("companies"); // Security check $id = GETPOST('id') ? GETPOST('id', 'int') : GETPOST('socid', 'int'); if ($user->societe_id) { $id = $user->societe_id; } $result = restrictedArea($user, 'societe', $id, '&societe'); $object = new Societe($db); if ($id > 0) { $object->fetch($id); } $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php /* * Actions */ include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once /* * View */ $form = new Form($db); $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; $langs->load("supplier_proposal"); $langs->load("companies"); // Security check $socid = GETPOST('socid', 'int'); if (isset($user->societe_id) && $user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } $result = restrictedArea($user, 'supplier_proposal'); /* * View */ $now = dol_now(); $supplier_proposalstatic = new SupplierProposal($db); $companystatic = new Societe($db); $form = new Form($db); $formfile = new FormFile($db); $help_url = "EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur"; llxHeader("", $langs->trans("SupplierProposalArea"), $help_url); print load_fiche_titre($langs->trans("SupplierProposalArea")); print '<div class="fichecenter"><div class="fichethirdleft">'; /* * Search form */ $var = false; print '<form method="post" action="' . DOL_URL_ROOT . '/supplier_proposal/list.php">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<table class="noborder nohover" width="100%">'; print '<tr class="liste_titre"><td colspan="3">' . $langs->trans("SearchRequest") . '</td></tr>'; print '<tr ' . $bc[$var] . '><td>';
$tableparams = array(); $tableparams['search_categ'] = $selected_cat; $tableparams['subcat'] = $subcat === true ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); $headerparams = array_merge($commonparams, $headerparams); $tableparams = array_merge($commonparams, $tableparams); foreach ($allparams as $key => $value) { $paramslink .= '&' . $key . '=' . $value; } /* * View */ llxHeader(); $form = new Form($db); $thirdparty_static = new Societe($db); $formother = new FormOther($db); // Show report header if ($modecompta == "CREANCES-DETTES") { $nom = $langs->trans("SalesTurnover") . ', ' . $langs->trans("ByThirdParties"); $calcmode = $langs->trans("CalcModeDebt"); $calcmode .= '<br>(' . $langs->trans("SeeReportInInputOutputMode", '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . $year . '&modecompta=RECETTES-DEPENSES">', '</a>') . ')'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); //$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; $description = $langs->trans("RulesCADue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { $description .= $langs->trans("DepositsAreIncluded"); } $builddate = time();
/* * Fiche en mode visu */ print '<table class="border" width="100%">'; $linkback = '<a href="' . DOL_URL_ROOT . '/contact/list.php">' . $langs->trans("BackToList") . '</a>'; // Ref print '<tr><td>' . $langs->trans("Ref") . '</td><td colspan="3">'; print $form->showrefnav($contact, 'id', $linkback); print '</td></tr>'; // Name print '<tr><td width="20%">' . $langs->trans("Lastname") . ' / ' . $langs->trans("Label") . '</td><td>' . $contact->lastname . '</td>'; print '<td width="20%">' . $langs->trans("Firstname") . '</td><td width="25%">' . $contact->firstname . '</td></tr>'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { if ($contact->socid > 0) { $objsoc = new Societe($db); $objsoc->fetch($contact->socid); print '<tr><td width="15%">' . $langs->trans("ThirdParty") . '</td><td colspan="3">' . $objsoc->getNomUrl(1) . '</td></tr>'; } else { print '<tr><td width="15%">' . $langs->trans("ThirdParty") . '</td><td colspan="3">'; print $langs->trans("ContactNotLinkedToCompany"); print '</td></tr>'; } } // Civility print '<tr><td>' . $langs->trans("UserTitle") . '</td><td colspan="3">'; print $contact->getCivilityLabel(); print '</td></tr>'; print '</table>'; print '</div>'; print '<br>';
} $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ', p.ref DESC'; $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); } //print $sql; $sql .= $db->plimit($limit + 1, $offset); $result = $db->query($sql); if ($result) { $objectstatic = new Propal($db); $userstatic = new User($db); $num = $db->num_rows($result); if ($socid) { $soc = new Societe($db); $soc->fetch($socid); } $param = '&socid=' . $socid . '&viewstatut=' . $viewstatut; if ($month) { $param .= '&month=' . $month; } if ($year) { $param .= '&year=' . $year; } if ($search_ref) { $param .= '&search_ref=' . $search_ref; } if ($search_refcustomer) { $param .= '&search_refcustomer=' . $search_refcustomer; }
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = preg_match('/\\*/', GETPOST("tva_tx")) ? 1 : 0; $result = $prodcustprice->update($user, 0, $update_child_soc); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } $action = ''; } /* * View */ $form = new Form($db); $soc = new Societe($db); $result = $soc->fetch($socid); llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer')); if (!empty($conf->notification->enabled)) { $langs->load("mails"); } $head = societe_prepare_head($soc); dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company'); print '<table class="border" width="100%">'; print '<tr><td width="25%">' . $langs->trans("ThirdPartyName") . '</td><td colspan="3">'; print $form->showrefnav($soc, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom'); print '</td></tr>'; if (!empty($conf->global->SOCIETE_USEPREFIX)) { print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $soc->prefix_comm . '</td></tr>'; } if ($soc->client) {
* the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; include_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) { $company = new Societe($db); $company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); $companyLink = $company->getNomUrl(1); } if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) { $bankcash = new Account($db); $bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]); $bankcash->label = $bankcash->ref; $bankcashLink = $bankcash->getNomUrl(1); } if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) { $bankcb = new Account($db); $bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]); $bankcbLink = $bankcb->getNomUrl(1); } if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; $sql .= " s.nom, s.rowid"; $resql = $db->query($sql); if ($resql) { $var = false; $num = $db->num_rows($resql); print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td colspan="2">' . $langs->trans("BillsSuppliersUnpaid", $num) . ' <a href="' . DOL_URL_ROOT . '/fourn/facture/impayees.php">(' . $num . ')</a></td>'; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { print '<td align="right">' . $langs->trans("AmountHT") . '</td>'; } print '<td align="right">' . $langs->trans("AmountTTC") . '</td>'; print '<td align="right">' . $langs->trans("Paid") . '</td>'; print '<td width="16"> </td>'; print "</tr>\n"; $societestatic = new Societe($db); if ($num) { $i = 0; $total = $total_ttc = $totalam = 0; while ($i < $num) { $obj = $db->fetch_object($resql); print '<tr ' . $bc[$var] . '><td>'; $facstatic->ref = $obj->ref; $facstatic->id = $obj->rowid; print $facstatic->getNomUrl(1, ''); print '</td>'; $societestatic->id = $obj->socid; $societestatic->nom = $obj->nom; $societestatic->client = 0; print '<td>' . $societestatic->getNomUrl(1, 'supplier', 44) . '</td>'; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
$langs->load("bills"); $socid = GETPOST('id', 'int'); // Security check if ($user->societe_id > 0) { $socid = $user->societe_id; } $backtopage = GETPOST('backtopage', 'alpha'); /* * Actions */ if (GETPOST('cancel') && !empty($backtopage)) { header("Location: " . $backtopage); exit; } if (GETPOST("action") == 'setremise') { $soc = new Societe($db); $soc->fetch($_GET["id"]); $result = $soc->set_remise_client($_POST["remise"], $_POST["note"], $user); if ($result > 0) { if (!empty($backtopage)) { header("Location: " . $backtopage); exit; } else { header("Location: remise.php?id=" . $_GET["id"]); exit; } } else { setEventMessage($soc->error, 'errors'); } } /*
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { print '<tr><td>'; print '<table width="100%" class="nobordernopadding"><tr><td>'; print $langs->trans('ParentCompany'); print '<td><td align="right">'; if ($user->rights->societe->creer) print '<a href="'.DOL_URL_ROOT.'/societe/lien.php?socid='.$object->id.'">'.img_edit() .'</a>'; else print ' '; print '</td></tr></table>'; print '</td>'; print '<td colspan="3">'; if ($object->parent) { $socm = new Societe($db); $socm->load($object->parent); print $socm->getNomUrl(1).' '.($socm->code_client?"(".$socm->code_client.")":""); print $socm->town?' - '.$socm->town:''; } else { print $langs->trans("NoParentCompany"); } print '</td></tr>'; } // Sales representative include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'); // Module Adherent if ($conf->adherent->enabled)
$langs->load("companies"); $mine = GETPOST('mode') == 'mine' ? 1 : 0; // Security check $socid = 0; if ($user->societe_id > 0) { $socid = $user->societe_id; } if (!$user->rights->projet->lire) { accessforbidden(); } $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); /* * View */ $socstatic = new Societe($db); $projectstatic = new Project($db); $userstatic = new User($db); $tasktmp = new Task($db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine ? $mine : (empty($user->rights->projet->all->lire) ? 0 : 2), 1); //var_dump($projectsListId); llxHeader("", $langs->trans("Projects"), "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); $text = $langs->trans("Projects"); if ($mine) { $text = $langs->trans("MyProjects"); } print_fiche_titre($text); // Show description of content if ($mine) { print $langs->trans("MyProjectsDesc") . '<br><br>'; } else {
/** * \brief Show header of page * \param pdf Object PDF * \param object Object invoice * \param showadress 0=no, 1=yes * \param outputlangs Object lang for output */ function _pagehead(&$pdf, $object, $showadress=1, $outputlangs) { global $langs,$conf,$mysoc; $outputlangs->load("main"); $outputlangs->load("bills"); $outputlangs->load("orders"); $outputlangs->load("companies"); $default_font_size = pdf_getPDFFontSize($outputlangs); // Do not add the BACKGROUND as this is for suppliers //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); $pdf->SetTextColor(0,0,60); $pdf->SetFont('','B', $default_font_size + 3); $posy=$this->marge_haute; $pdf->SetXY($this->marge_gauche,$posy); // Logo /* $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; if ($mysoc->logo) { if (is_readable($logo)) { $pdf->Image($logo, $this->marge_gauche, $posy, 0, 24); } else { $pdf->SetTextColor(200,0,0); $pdf->SetFont('','B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); } } else {*/ $text=$this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); //} $pdf->SetFont('','B', $default_font_size + 3); $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("SupplierInvoice")." ".$outputlangs->convToOutputCharset($object->ref), '' , 'R'); $pdf->SetFont('','', $default_font_size + 2); $posy+=6; $pdf->SetXY(100,$posy); if ($object->date) { $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R'); } else { $pdf->SetTextColor(255,0,0); $pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R'); } if ($showadress) { // Receive email $posy=42; $hautcadre=40; $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($this->marge_gauche,$posy-5); $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillTo").":",0,"L"); $pdf->SetXY($this->marge_gauche,$posy); $pdf->SetFillColor(230,230,230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); // Nom emetteur $carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->name); $pdf->SetTextColor(0,0,60); $pdf->SetFont('','B', $default_font_size); $pdf->SetXY($this->marge_gauche+2,$posy+3); $pdf->MultiCell(80, 4, $carac_emetteur_name, 0, 'L'); // Sender properties $carac_emetteur = pdf_build_address($outputlangs,$mysoc); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->marge_gauche+2,$posy+8); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); // Client destinataire $posy=42; $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY(100,$posy-5); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("Supplier").":"); // $client = new Societe($this->db); $client->fetch($object->socid); $object->client = $client; // // Cadre client destinataire $pdf->rect(100, $posy, 100, $hautcadre); // Recipient name if (! empty($usecontact)) { // On peut utiliser le nom de la societe du contact if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname; else $socname = $object->client->nom; $carac_client_name=$outputlangs->convToOutputCharset($socname); } else { $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); } $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); // Show customer/recipient $pdf->SetXY(102,$posy+3); $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell(96,4, $carac_client_name, 0, 'L'); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY(102,$posy+8); $pdf->MultiCell(96,4, $carac_client, 0, 'L'); } }
$delivery = new Livraison($db); $result = $delivery->fetch($_GET["id"]); $delivery->fetch_thirdparty(); $expedition=new Expedition($db); $result = $expedition->fetch($delivery->origin_id); $typeobject = $expedition->origin; if ($delivery->origin_id) { $delivery->fetch_origin(); } if ( $delivery->id > 0) { $soc = new Societe($db); $soc->fetch($delivery->socid); $head=delivery_prepare_head($delivery); dol_fiche_head($head, 'delivery', $langs->trans("Sending"), 0, 'sending'); /* * Confirmation de la suppression * */ if ($_GET["action"] == 'delete') { $expedition_id = $_GET["expid"]; $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); if ($ret == 'html') print '<br>'; }
setEventMessages($object->error, $object->errors, 'errors'); } } else { $action = 'addline'; } } if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) { $accline = new AccountLine($db); $result = $accline->fetch(GETPOST("rowid")); $result = $accline->delete(); } /* * View */ llxHeader('', $langs->trans("FinancialAccount") . '-' . $langs->trans("Transactions")); $societestatic = new Societe($db); $userstatic = new User($db); $chargestatic = new ChargeSociales($db); $loanstatic = new Loan($db); $memberstatic = new Adherent($db); $paymentstatic = new Paiement($db); $paymentsupplierstatic = new PaiementFourn($db); $paymentvatstatic = new TVA($db); $paymentsalstatic = new PaymentSalary($db); $donstatic = new Don($db); $expensereportstatic = new ExpenseReport($db); $bankstatic = new Account($db); $banklinestatic = new AccountLine($db); $form = new Form($db); if ($id > 0 || !empty($ref)) { if ($vline) {
} elseif ($module == 'order_supplier') { $permission = $user->rights->fournisseur->commande->creer; } elseif ($module == 'project') { $permission = $user->rights->projet->creer; } elseif ($module == 'action') { $permission = $user->rights->agenda->myactions->create; } elseif ($module == 'shipping') { $permission = $user->rights->expedition->creer; } elseif ($module == 'project_task') { $permission = $user->rights->projet->creer; } elseif (!isset($permission)) { $permission = $user->rights->{$module}->creer; } // If already defined by caller page $formcompany = new FormCompany($db); $companystatic = new Societe($db); $contactstatic = new Contact($db); $userstatic = new User($db); ?> <!-- BEGIN PHP TEMPLATE CONTACTS --> <div class="tagtable centpercent noborder allwidth"> <?php if ($permission) { ?> <form class="tagtr liste_titre"> <div class="tagtd"><?php echo $langs->trans("Source"); ?> </div>
*/ // Remove element from category if ($id > 0 && $removeelem > 0) { if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) { require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; $tmpobject = new Product($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; } else { if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'fournisseur'; } else { if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'societe'; } else { if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; } else { if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'contact'; }