64 public function select_contract($socid = -1, $selected =
'', $htmlname =
'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0)
67 global $db, $user, $conf, $langs;
69 $hideunselectables =
false;
70 if (!empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables =
true;
73 $sql =
'SELECT c.rowid, c.ref, c.fk_soc, c.statut,';
74 $sql .=
' c.ref_customer, c.ref_supplier';
75 $sql .=
' FROM '.MAIN_DB_PREFIX.
'contrat as c';
76 $sql .=
" WHERE c.entity = ".$conf->entity;
81 if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
82 $sql .=
" AND (c.fk_soc=".$socid.
" OR c.fk_soc IS NULL)";
83 } elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY !=
'all') {
84 $sql .=
" AND (c.fk_soc IN (".$socid.
", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.
") ";
85 $sql .=
" OR c.fk_soc IS NULL)";
88 if ($socid == 0) $sql .=
" AND (c.fk_soc = 0 OR c.fk_soc IS NULL)";
89 $sql .=
" ORDER BY c.ref ";
91 dol_syslog(get_class($this).
"::select_contract", LOG_DEBUG);
95 print '<select class="flat" name="'.$htmlname.
'">';
96 if ($showempty)
print '<option value="0"> </option>';
103 $obj = $this->
db->fetch_object(
$resql);
105 if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->rights->societe->lire)
113 if ($obj->ref_customer) $labeltoshow = $labeltoshow.
" - ".$obj->ref_customer;
114 if ($obj->ref_supplier) $labeltoshow = $labeltoshow.
" - ".$obj->ref_supplier;
119 if (!empty($selected) && $selected == $obj->rowid && $obj->statut > 0)
121 print '<option value="'.$obj->rowid.
'" selected>'.$labeltoshow.
'</option>';
124 if ($obj->statut == 0)
127 $labeltoshow .=
' ('.$langs->trans(
"Draft").
')';
129 if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
132 $labeltoshow .=
' - '.$langs->trans(
"LinkedToAnotherCompany");
135 if ($hideunselectables && $disabled)
139 $resultat =
'<option value="'.$obj->rowid.
'"';
140 if ($disabled) $resultat .=
' disabled';
143 $resultat .=
'>'.$labeltoshow;
144 $resultat .=
'</option>';
155 if (!empty($conf->use_javascript_ajax))
158 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
181 public function formSelectContract($page, $socid = -1, $selected =
'', $htmlname =
'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0)
186 print '<form method="post" action="'.$page.
'">';
187 print '<input type="hidden" name="action" value="setcontract">';
188 print '<input type="hidden" name="token" value="'.newToken().
'">';
189 $this->
select_contract($socid, $selected, $htmlname, $maxlength, $showempty, $showRef);
190 print '<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
$conf db
API class for accounts.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.