65 public function selectProposalStatus($selected =
'', $short = 0, $excludedraft = 0, $showempty = 1, $mode =
'customer', $htmlname =
'propal_statut', $morecss =
'')
70 $listofstatus = array();
71 if ($mode ==
'supplier') {
72 $prefix =
'SupplierProposalStatus';
74 $langs->load(
"supplier_proposal");
75 $listofstatus = array(
76 0=>array(
'id'=>0,
'code'=>
'PR_DRAFT'),
77 1=>array(
'id'=>1,
'code'=>
'PR_OPEN'),
78 2=>array(
'id'=>2,
'code'=>
'PR_SIGNED'),
79 3=>array(
'id'=>3,
'code'=>
'PR_NOTSIGNED'),
80 4=>array(
'id'=>4,
'code'=>
'PR_CLOSED')
83 $prefix =
"PropalStatus";
85 $sql =
"SELECT id, code, label, active FROM ".$this->db->prefix().
"c_propalst";
86 $sql .=
" WHERE active = 1";
87 dol_syslog(get_class($this).
"::selectProposalStatus", LOG_DEBUG);
88 $resql = $this->db->query($sql);
90 $num = $this->db->num_rows($resql);
94 $obj = $this->db->fetch_object($resql);
95 $listofstatus[$obj->id] = array(
'id'=>$obj->id,
'code'=>$obj->code,
'label'=>$obj->label);
104 print
'<select id="'.$htmlname.
'" name="'.$htmlname.
'" class="flat'.($morecss ?
' '.$morecss :
'').
'">';
106 print
'<option value="-1"> </option>';
110 foreach ($listofstatus as $key => $obj) {
112 if ($obj[
'code'] ==
'Draft' || $obj[
'code'] ==
'PR_DRAFT') {
117 if ($selected !=
'' && $selected == $obj[
'id']) {
118 print
'<option value="'.$obj[
'id'].
'" selected>';
120 print
'<option value="'.$obj[
'id'].
'">';
123 if ($langs->trans($prefix.$key.($short ?
'Short' :
'')) != $prefix.$key.($short ?
'Short' :
'')) {
124 print $langs->trans($prefix.$key.($short ?
'Short' :
''));
126 $conv_to_new_code = array(
'PR_DRAFT'=>
'Draft',
'PR_OPEN'=>
'Validated',
'PR_CLOSED'=>
'Closed',
'PR_SIGNED'=>
'Signed',
'PR_NOTSIGNED'=>
'NotSigned',
'PR_FAC'=>
'Billed');
127 if (!empty($conv_to_new_code[$obj[
'code']])) {
128 $key = $conv_to_new_code[$obj[
'code']];
131 print ($langs->trans($prefix.$key.($short ?
'Short' :
'')) != $prefix.$key.($short ?
'Short' :
'')) ? $langs->trans($prefix.$key.($short ?
'Short' :
'')) : ($obj[
'label'] ? $obj[
'label'] : $obj[
'code']);
137 if ($mode ==
'customer') {
138 if ($selected !=
'' && $selected ==
"2,4") {
139 print
'<option value="2,4" selected>';
141 print
'<option value="2,4">';
143 print($langs->trans($prefix.
'Signed'.($short ?
'Short' :
'')).
' '.$langs->trans(
"or").
' '.$langs->trans($prefix.
'Billed'.($short ?
'Short' :
'')));
148 print
ajax_combobox($htmlname, array(), 0, 0,
'resolve', ($showempty < 0 ? (
string) $showempty :
'-1'), $morecss);