/** * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string &$action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void */ function assign_values(&$action, $id=0, $ref='') { global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; $tmpobject = new Product($this->db); if (! empty($id) || ! empty($ref)) $tmpobject->fetch($id,$ref); $this->object = $tmpobject; //parent::assign_values($action); foreach($this->object as $key => $value) { $this->tpl[$key] = $value; } $this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors); // canvas $this->tpl['canvas'] = $this->canvas; // id $this->tpl['id'] = $this->id; // Ref $this->tpl['ref'] = $this->ref; // Label $this->tpl['label'] = $this->libelle; // Description $this->tpl['description'] = nl2br($this->description); // Statut $this->tpl['status'] = $this->getLibStatut(2); // Note $this->tpl['note'] = nl2br($this->note); if ($action == 'create') { // Price $this->tpl['price'] = $this->price; $this->tpl['price_min'] = $this->price_min; $this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type"); // VAT $this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,''); } if ($action == 'create' || $action == 'edit') { // Status $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status); //To Buy $statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No")); $this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy); $this->tpl['description'] = $this->description; $this->tpl['note'] = $this->note; } if ($action == 'view') { $head = product_prepare_head($this->object,$user); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref'); $titre=$langs->trans("CardProduct".$this->object->type); $picto=($this->object->type==1?'service':'product'); $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $titre, 0, $picto); $this->tpl['showend']=dol_get_fiche_end(); // Accountancy buy code $this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer); $this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer); // Accountancy sell code $this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer); $this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer); } $this->tpl['finished'] = $this->object->finished; $this->tpl['ref'] = $this->object->ref; $this->tpl['label'] = $this->object->label; $this->tpl['id'] = $this->object->id; $this->tpl['type'] = $this->object->type; $this->tpl['note'] = $this->object->note; $this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte; // Duration $this->tpl['duration_value'] = $this->object->duration_value; if ($action == 'create') { // Title $this->tpl['title'] = $langs->trans("NewService"); } if ($action == 'edit') { $this->tpl['title'] = $langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->object->ref; } if ($action == 'create' || $action == 'edit') { // Status $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $this->tpl['status'] = $form->selectarray('statut',$statutarray,$_POST["statut"]); $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); $this->tpl['status_buy'] = $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]); // Duration unit // TODO creer fonction $duration_unit = '<input name="duration_unit" type="radio" value="h"'.($this->object->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); $duration_unit.= ' '; $duration_unit.= '<input name="duration_unit" type="radio" value="d"'.($this->object->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); $duration_unit.= ' '; $duration_unit.= '<input name="duration_unit" type="radio" value="w"'.($this->object->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); $duration_unit.= ' '; $duration_unit.= '<input name="duration_unit" type="radio" value="m"'.($this->object->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); $duration_unit.= ' '; $duration_unit.= '<input name="duration_unit" type="radio" value="y"'.($this->object->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); $this->tpl['duration_unit'] = $duration_unit; } if ($action == 'view') { // Status $this->tpl['status'] = $this->object->getLibStatut(2,0); $this->tpl['status_buy'] = $this->object->getLibStatut(2,1); // Photo $this->tpl['nblignes'] = 4; if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity])) { $this->tpl['photos'] = $this->object->show_photos($conf->service->multidir_output[$this->object->entity],1,1,0,0,0,80); } // Duration if ($this->object->duration_value > 1) { $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); } else if ($this->object->duration_value > 0) { $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); } $this->tpl['duration_unit'] = $langs->trans($dur[$this->object->duration_unit]); $this->tpl['fiche_end']=dol_get_fiche_end(); } if ($action == 'list') { $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']); } }
/** * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void */ function assign_values(&$action, $id = 0, $ref = '') { global $conf, $langs, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; if ($action == 'add' || $action == 'update') { $this->assign_post($action); } if ($_GET["type"] == 'f') { $this->object->fournisseur = 1; } if ($_GET["type"] == 'c') { $this->object->client = 1; } if ($_GET["type"] == 'p') { $this->object->client = 2; } if ($_GET["type"] == 'cp') { $this->object->client = 3; } if ($_REQUEST["private"] == 1) { $this->object->particulier = 1; } foreach ($this->object as $key => $value) { $this->tpl[$key] = $value; } $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors); if (is_array($GLOBALS['errors'])) { $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error'); } if ($action == 'create') { if ($conf->use_javascript_ajax) { $this->tpl['ajax_selecttype'] = "\n" . '<script type="text/javascript" language="javascript"> $(document).ready(function () { $("#radiocompany").click(function() { document.formsoc.action.value="create"; document.formsoc.canvas.value="company"; document.formsoc.private.value=0; document.formsoc.submit(); }); $("#radioprivate").click(function() { document.formsoc.action.value="create"; document.formsoc.canvas.value="individual"; document.formsoc.private.value=1; document.formsoc.submit(); }); }); </script>' . "\n"; } } if ($action == 'create' || $action == 'edit') { if ($conf->use_javascript_ajax) { $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript"> $(document).ready(function () { $("#selectcountry_id").change(function() { document.formsoc.action.value="' . $action . '"; document.formsoc.canvas.value="' . $canvas . '"; document.formsoc.submit(); }); }) </script>' . "\n"; } // Load object modCodeClient $module = !empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { $res = dol_include_once($dirroot . $module . '.php'); if ($res) { break; } } $modCodeClient = new $module($db); $this->tpl['auto_customercode'] = $modCodeClient->code_auto; // We verified if the tag prefix is used if ($modCodeClient->code_auto) { $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); } // TODO create a function $this->tpl['select_customertype'] = '<select class="flat" name="client">'; $this->tpl['select_customertype'] .= '<option value="2"' . ($this->object->client == 2 ? ' selected="selected"' : '') . '>' . $langs->trans('Prospect') . '</option>'; $this->tpl['select_customertype'] .= '<option value="3"' . ($this->object->client == 3 ? ' selected="selected"' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>'; $this->tpl['select_customertype'] .= '<option value="1"' . ($this->object->client == 1 ? ' selected="selected"' : '') . '>' . $langs->trans('Customer') . '</option>'; $this->tpl['select_customertype'] .= '<option value="0"' . ($this->object->client == 0 ? ' selected="selected"' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>'; $this->tpl['select_customertype'] .= '</select>'; // Customer $this->tpl['customercode'] = $this->object->code_client; if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) { $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0); } $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable(); $s = $modCodeClient->getToolTip($langs, $this->object, 0); $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1); if (!empty($conf->fournisseur->enabled)) { $this->tpl['supplier_enabled'] = 1; // Load object modCodeFournisseur $module = $conf->global->SOCIETE_CODECLIENT_ADDON; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { $res = dol_include_once($dirroot . $module . '.php'); if ($res) { break; } } $modCodeFournisseur = new $module(); $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; // We verified if the tag prefix is used if ($modCodeFournisseur->code_auto) { $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); } // Supplier $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1); $this->tpl['suppliercode'] = $this->object->code_fournisseur; if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1); } $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1); $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1); $this->object->LoadSupplierCateg(); $this->tpl['suppliercategory'] = $this->object->SupplierCategories; } // Zip $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); // Town $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); // Country $this->object->country_id = $this->object->country_id ? $this->object->country_id : $mysoc->country_id; $this->object->country_code = $this->object->country_code ? $this->object->country_code : $mysoc->country_code; $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id'); $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')'; if ($user->admin) { $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } // State if ($this->object->country_id) { $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code); } else { $this->tpl['select_state'] = $countrynotdefined; } // Language 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); } // VAT $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1); // Assujeti par defaut en creation // Select users $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1); // Local Tax // TODO mettre dans une classe propre au pays if ($mysoc->country_code == 'ES') { $this->tpl['localtax'] = ''; if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td>'; $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td>'; $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td></tr>'; } elseif ($mysoc->localtax1_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td colspan="3">'; $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td><tr>'; } elseif ($mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td colspan="3">'; $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td><tr>'; } } } else { $head = societe_prepare_head($this->object); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company'); $this->tpl['showend'] = dol_get_fiche_end(); $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom'); $this->tpl['checkcustomercode'] = $this->object->check_codeclient(); $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur(); $this->tpl['address'] = dol_nl2br($this->object->address); $img = picto_from_langcode($this->object->country_code); if ($this->object->isInEEC()) { $this->tpl['country'] = $form->textwithpicto(($img ? $img . ' ' : '') . $this->object->country, $langs->trans("CountryIsInEEC"), 1, 0); } $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country; $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX'); $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); $this->tpl['url'] = dol_print_url($this->object->url); $this->tpl['tva_assuj'] = yn($this->object->tva_assuj); // Third party type $arr = $formcompany->typent_array(1); $this->tpl['typent'] = $arr[$this->object->typent_code]; if (!empty($conf->global->MAIN_MULTILANGS)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; //$s=picto_from_langcode($this->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); $this->tpl['default_lang'] = $this->default_lang ? $langs->trans('Language_' . $this->object->default_lang) : ''; } $this->tpl['image_edit'] = img_edit(); $this->tpl['display_rib'] = $this->object->display_rib(); // Sales representatives $this->tpl['sales_representatives'] = ''; $listsalesrepresentatives = $this->object->getSalesRepresentatives($user); $nbofsalesrepresentative = count($listsalesrepresentatives); if ($nbofsalesrepresentative > 3) { $this->tpl['sales_representatives'] .= '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $this->object->id . '">'; $this->tpl['sales_representatives'] .= $nbofsalesrepresentative; $this->tpl['sales_representatives'] .= '</a>'; } else { if ($nbofsalesrepresentative > 0) { $userstatic = new User($this->db); $i = 0; foreach ($listsalesrepresentatives as $val) { $userstatic->id = $val['id']; $userstatic->lastname = $val['name']; $userstatic->firstname = $val['firstname']; $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) { $this->tpl['sales_representatives'] .= ', '; } } } else { $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected"); } } // Linked member if (!empty($conf->adherent->enabled)) { $langs->load("members"); $adh = new Adherent($this->db); $result = $adh->fetch('', '', $this->object->id); if ($result > 0) { $adh->ref = $adh->getFullName($langs); $this->tpl['linked_member'] = $adh->getNomUrl(1); } else { $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember"); } } // Local Tax // TODO mettre dans une classe propre au pays if ($mysoc->country_code == 'ES') { $this->tpl['localtax'] = ''; if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax1_assuj) . '</td>'; $this->tpl['localtax'] .= '<td>' . $langs->trans("LocalTax2IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax2_assuj) . '</td></tr>'; } elseif ($mysoc->localtax1_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax1_assuj) . '</td></tr>'; } elseif ($mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax2_assuj) . '</td></tr>'; } } } }
/** * Assign custom values for canvas * * @param string &$action Type of action * @param int $id Id * @return void */ function assign_values(&$action, $id) { global $conf, $db, $langs, $user; global $form; $ret = $this->getObject($id); parent::assign_values($action, $id); $this->tpl['title'] = $this->getTitle($action); $this->tpl['error'] = $this->error; $this->tpl['errors'] = $this->errors; if ($action == 'view') { // Card header $head = contact_prepare_head($this->object); $title = $this->getTitle($action); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'contact'); $this->tpl['showend'] = dol_get_fiche_end(); $objsoc = new Societe($db); $objsoc->fetch($this->object->socid); $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); } else { // Confirm delete contact if ($action == 'delete' && $user->rights->societe->contact->supprimer) { $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1); } } if ($action == 'list') { $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']); } }
/** * Show tab footer of a card * @param notab 0=Add tab footer, 1=no tab footer */ function dol_fiche_end($notab = 0) { print dol_get_fiche_end($notab); }
/** * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void */ function assign_values(&$action, $id = 0, $ref = '') { global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; $tmpobject = new Product($this->db); if (!empty($id) || !empty($ref)) { $tmpobject->fetch($id, $ref); } $this->object = $tmpobject; //parent::assign_values($action); foreach ($this->object as $key => $value) { $this->tpl[$key] = $value; } $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors); // canvas $this->tpl['canvas'] = $this->canvas; // id $this->tpl['id'] = $this->id; // Ref $this->tpl['ref'] = $this->ref; // Label $this->tpl['label'] = $this->libelle; // Description $this->tpl['description'] = nl2br($this->description); // Statut $this->tpl['status'] = $this->object->getLibStatut(2); // Note $this->tpl['note'] = nl2br($this->note); if ($action == 'create') { // Price $this->tpl['price'] = $this->price; $this->tpl['price_min'] = $this->price_min; $this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type"); // VAT $this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, ''); } if ($action == 'create' || $action == 'edit') { // Status $statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $this->tpl['status'] = $form->selectarray('statut', $statutarray, $this->status); //To Buy $statutarray = array('1' => $langs->trans("Yes"), '0' => $langs->trans("No")); $this->tpl['tobuy'] = $form->selectarray('tobuy', $statutarray, $this->status_buy); $this->tpl['description'] = $this->description; $this->tpl['note'] = $this->note; } if ($action == 'view') { $head = product_prepare_head($this->object, $user); $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'ref', '', 1, 'ref'); $titre = $langs->trans("CardProduct" . $this->object->type); $picto = $this->object->type == 1 ? 'service' : 'product'; $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $titre, 0, $picto); $this->tpl['showend'] = dol_get_fiche_end(); // Accountancy buy code $this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer); $this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode", 'productaccountancycodesell', $this->accountancy_code_sell, $this, $user->rights->produit->creer); // Accountancy sell code $this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer); $this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode", 'productaccountancycodebuy', $this->accountancy_code_buy, $this, $user->rights->produit->creer); } $this->tpl['finished'] = $this->object->finished; $this->tpl['ref'] = $this->object->ref; $this->tpl['label'] = $this->object->label; $this->tpl['id'] = $this->object->id; $this->tpl['type'] = $this->object->type; $this->tpl['note'] = $this->object->note; $this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte; if ($action == 'create') { // Title $this->tpl['title'] = $langs->trans("NewProduct"); } if ($action == 'edit') { $this->tpl['title'] = $langs->trans('Modify') . ' ' . $langs->trans('Product') . ' : ' . $this->object->ref; } if ($action == 'create' || $action == 'edit') { // Status $statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $this->tpl['status'] = $form->selectarray('statut', $statutarray, $_POST["statut"]); $statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); $this->tpl['status_buy'] = $form->selectarray('statut_buy', $statutarray, $_POST["statut_buy"]); // Finished $statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); $this->tpl['finished'] = $form->selectarray('finished', $statutarray, $this->object->finished); // Weight $this->tpl['weight'] = $this->object->weight; $this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units", "weight", $this->object->weight_units); // Length $this->tpl['length'] = $this->object->length; $this->tpl['length_units'] = $formproduct->load_measuring_units("length_units", "size", $this->object->length_units); // Surface $this->tpl['surface'] = $this->object->surface; $this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units", "surface", $this->object->surface_units); // Volume $this->tpl['volume'] = $this->object->volume; $this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units", "volume", $this->object->volume_units); } if ($action == 'view') { // Status $this->tpl['status'] = $this->object->getLibStatut(2, 0); $this->tpl['status_buy'] = $this->object->getLibStatut(2, 1); // Photo $this->tpl['nblignes'] = 4; if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity])) { $this->tpl['photos'] = $this->object->show_photos($conf->product->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80); } // Nature $this->tpl['finished'] = $this->object->getLibFinished(); // Weight if ($this->object->weight != '') { $this->tpl['weight'] = $this->object->weight . " " . measuring_units_string($this->object->weight_units, "weight"); } // Length if ($this->object->length != '') { $this->tpl['length'] = $this->object->length . " " . measuring_units_string($this->object->length_units, "size"); } // Surface if ($this->object->surface != '') { $this->tpl['surface'] = $this->object->surface . " " . measuring_units_string($this->object->surface_units, "surface"); } // Volume if ($this->object->volume != '') { $this->tpl['volume'] = $this->object->volume . " " . measuring_units_string($this->object->volume_units, "volume"); } $this->tpl['fiche_end'] = dol_get_fiche_end(); } if ($action == 'list') { $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']); } }
/** * Assign custom values for canvas * @param action Type of action */ function assign_values($action='') { global $conf, $db, $langs, $user; global $form; parent::assign_values($action); $this->tpl['title'] = $this->getTitle($action); $this->tpl['error'] = $this->error; $this->tpl['errors']= $this->errors; if ($action == 'view') { // Card header $head = contact_prepare_head($this->object); $title = $this->getTitle($action); $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'contact'); $this->tpl['showend']=dol_get_fiche_end(); // Confirm delete contact if ($user->rights->societe->contact->supprimer) { if ($_GET["action"] == 'delete') { $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); } } $objsoc = new Societe($db); $objsoc->fetch($this->object->fk_soc); $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1); $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1); } }
/** * Show tab footer of a card * * @param int $notab 0=Add tab footer, 1=no tab footer * @return void */ function dol_fiche_end($notab = 0) { print dol_get_fiche_end($notab); print end_box(); print '</div>'; }