/** * 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; }
} } /* * Generate document */ if ($action == 'builddoc') { // En get ou en post if (is_numeric(GETPOST('model'))) { $error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Model")); } else { require_once(DOL_DOCUMENT_ROOT . '/core/modules/societe/modules_societe.class.php'); $object = new Societe($db); $object->load($socid); $object->fetch_thirdparty(); // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $fac->client->default_lang; if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = thirdparty_doc_create($db, $object->id, '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { dol_print_error($db, $result);