Look and feel v17

This commit is contained in:
Laurent Destailleur 2022-09-15 03:08:33 +02:00
parent 0cd0314369
commit 91bdaae898
13 changed files with 114 additions and 60 deletions

View File

@ -1742,7 +1742,7 @@ if ($action == 'create') {
//$warehouse_id = $soc->warehouse_id; //$warehouse_id = $soc->warehouse_id;
} else { } else {
print '<td class="valuefieldcreate">'; print '<td class="valuefieldcreate">';
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@ -204,7 +204,7 @@ if (empty($user->socid)) {
$checkedtypetiers = 0; $checkedtypetiers = 0;
$arrayfields = array( $arrayfields = array(
'p.ref'=>array('label'=>"Ref", 'checked'=>1), 'p.ref'=>array('label'=>"Ref", 'checked'=>1),
'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1), 'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1),
'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1)), 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1)),
'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1)), 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
@ -249,6 +249,28 @@ $arrayfields = array(
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
); );
// List of fields to search into when doing a "search in all"
/*$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}*/
// Definition of array of fields for columns
/*$arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
}
}*/
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -529,7 +551,7 @@ $sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) { if ($sall || $search_product_category > 0 || $search_user > 0) {
$sql = 'SELECT DISTINCT'; $sql = 'SELECT DISTINCT';
} }
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, ';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,"; $sql .= " ava.rowid as availability,";
$sql .= " country.code as country_code,"; $sql .= " country.code as country_code,";
@ -1520,6 +1542,7 @@ if ($resql) {
'sortorder' => $sortorder, 'sortorder' => $sortorder,
'totalarray' => &$totalarray, 'totalarray' => &$totalarray,
); );
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) { if (!empty($arrayfields['p.datec']['checked'])) {
@ -1562,8 +1585,11 @@ if ($resql) {
$total_ht = 0; $total_ht = 0;
$total_margin = 0; $total_margin = 0;
$last_num = min($num, $limit); $savnbfield = $totalarray['nbfield'];
while ($i < $last_num) { $totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$objectstatic->id = $obj->rowid; $objectstatic->id = $obj->rowid;
@ -1578,6 +1604,7 @@ if ($resql) {
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias; $companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
$companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
$companystatic->phone = $obj->phone; $companystatic->phone = $obj->phone;
@ -1671,7 +1698,7 @@ if ($resql) {
if (!empty($arrayfields['p.ref_client']['checked'])) { if (!empty($arrayfields['p.ref_client']['checked'])) {
// Customer ref // Customer ref
print '<td class="nowrap tdoverflowmax200">'; print '<td class="nowrap tdoverflowmax200">';
print $obj->ref_client; print dol_escape_htmltag($obj->ref_client);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -1694,7 +1721,7 @@ if ($resql) {
// Project label // Project label
print '<td class="nowrap">'; print '<td class="nowrap">';
if ($obj->project_id > 0) { if ($obj->project_id > 0) {
print $projectstatic->title; print dol_escape_htmltag($projectstatic->title);
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -1704,7 +1731,7 @@ if ($resql) {
// Thirdparty // Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) { if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax150">';
print $companystatic->getNomUrl(1, 'customer'); print $companystatic->getNomUrl(1, 'customer');
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -1988,7 +2015,7 @@ if ($resql) {
// Author // Author
if (!empty($arrayfields['u.login']['checked'])) { if (!empty($arrayfields['u.login']['checked'])) {
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax150">';
if ($userstatic->id) { if ($userstatic->id) {
print $userstatic->getNomUrl(-1); print $userstatic->getNomUrl(-1);
} }
@ -2080,7 +2107,7 @@ if ($resql) {
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
} }
if ($i >= $last_num - 1) { if ($i >= $imaxinloop - 1) {
if (!empty($total_ht)) { if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else { } else {

View File

@ -1751,7 +1751,7 @@ if ($action == 'create' && $usercancreate) {
print '</td>'; print '</td>';
} else { } else {
print '<td>'; print '<td>';
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@ -792,7 +792,7 @@ $sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) { if ($sall || $search_product_category > 0 || $search_user > 0) {
$sql = 'SELECT DISTINCT'; $sql = 'SELECT DISTINCT';
} }
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " country.code as country_code,"; $sql .= " country.code as country_code,";
@ -1862,8 +1862,10 @@ if ($resql) {
$total_ht = 0; $total_ht = 0;
$total_margin = 0; $total_margin = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num); $imaxinloop = ($limit ? min($num, $limit) : $num);
$last_num = min($num, $limit);
while ($i < $imaxinloop) { while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -1877,6 +1879,7 @@ if ($resql) {
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias; $companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
$companystatic->fournisseur = $obj->fournisseur;
$companystatic->code_client = $obj->code_client; $companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
$companystatic->phone = $obj->phone; $companystatic->phone = $obj->phone;
@ -1893,7 +1896,6 @@ if ($resql) {
$generic_commande->statut = $obj->fk_statut; $generic_commande->statut = $obj->fk_statut;
$generic_commande->billed = $obj->billed; $generic_commande->billed = $obj->billed;
$generic_commande->date = $db->jdate($obj->date_commande); $generic_commande->date = $db->jdate($obj->date_commande);
$generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated
$generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
$generic_commande->ref_client = $obj->ref_client; $generic_commande->ref_client = $obj->ref_client;
$generic_commande->total_ht = $obj->total_ht; $generic_commande->total_ht = $obj->total_ht;
@ -1978,7 +1980,7 @@ if ($resql) {
// Third party // Third party
if (!empty($arrayfields['s.nom']['checked'])) { if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax200">'; print '<td class="tdoverflowmax150">';
print $getNomUrl_cache[$obj->socid]; print $getNomUrl_cache[$obj->socid];
// If module invoices enabled and user with invoice creation permissions // If module invoices enabled and user with invoice creation permissions
@ -2314,7 +2316,7 @@ if ($resql) {
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
} }
if ($i >= $last_num - 1) { if ($i >= $imaxinloop - 1) {
if (!empty($total_ht)) { if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else { } else {

View File

@ -3192,7 +3192,7 @@ if ($action == 'create') {
} else { } else {
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print img_picto('', 'company').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); print img_picto('', 'company').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
// Option to reload page to retrieve customer informations. // Option to reload page to retrieve customer informations.
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script type="text/javascript"> print '<script type="text/javascript">
@ -4410,9 +4410,7 @@ if ($action == 'create') {
// Type // Type
print '<tr><td class="titlefield fieldname_type">'.$langs->trans('Type').'</td><td class="valuefield fieldname_type">'; print '<tr><td class="titlefield fieldname_type">'.$langs->trans('Type').'</td><td class="valuefield fieldname_type">';
print '<span class="badgeneutral">'; print $object->getLibType(2);
print $object->getLibType();
print '</span>';
if ($object->module_source) { if ($object->module_source) {
print ' <span class="opacitymediumbycolor paddingleft">('.$langs->trans("POS").' '.ucfirst($object->module_source).' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>'; print ' <span class="opacitymediumbycolor paddingleft">('.$langs->trans("POS").' '.ucfirst($object->module_source).' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
} }

View File

@ -1821,21 +1821,10 @@ class Facture extends CommonInvoice
if ($user->rights->facture->lire) { if ($user->rights->facture->lire) {
$label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->trans("Invoice").'</u>'; $label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->trans("Invoice").'</u>';
if ($this->type == self::TYPE_REPLACEMENT) {
$label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->transnoentitiesnoconv("ReplacementInvoice").'</u>';
}
if ($this->type == self::TYPE_CREDIT_NOTE) {
$label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->transnoentitiesnoconv("CreditNote").'</u>';
}
if ($this->type == self::TYPE_DEPOSIT) {
$label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->transnoentitiesnoconv("Deposit").'</u>';
}
if ($this->type == self::TYPE_SITUATION) {
$label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->transnoentitiesnoconv("InvoiceSituation").'</u>';
}
if (isset($this->statut) && isset($this->alreadypaid)) { if (isset($this->statut) && isset($this->alreadypaid)) {
$label .= ' '.$this->getLibStatut(5, $this->alreadypaid); $label .= ' '.$this->getLibStatut(5, $this->alreadypaid);
} }
$label .= ' &nbsp; '.$this->getLibType(1);
if (!empty($this->ref)) { if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
} }

View File

@ -1273,15 +1273,15 @@ if ($resql) {
print '<td class="liste_titre maxwidthonsmartphone">'; print '<td class="liste_titre maxwidthonsmartphone">';
$listtype = array( $listtype = array(
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
); );
if (!empty($conf->global->INVOICE_USE_SITUATION)) { if (!empty($conf->global->INVOICE_USE_SITUATION)) {
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
} }
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order. //$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100'); print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
print '</td>'; print '</td>';
} }
// Date invoice // Date invoice
@ -1734,8 +1734,11 @@ if ($resql) {
$total_ht = 0; $total_ht = 0;
$total_margin = 0; $total_margin = 0;
$last_num = min($num, $limit); $savnbfield = $totalarray['nbfield'];
while ($i < $last_num) { $totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$datelimit = $db->jdate($obj->datelimite); $datelimit = $db->jdate($obj->datelimite);
@ -1752,7 +1755,8 @@ if ($resql) {
$facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht; $facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
$facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat; $facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
$facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$facturestatic->statut = $obj->fk_statut; $facturestatic->statut = $obj->fk_statut; // deprecated
$facturestatic->status = $obj->fk_statut;
$facturestatic->close_code = $obj->close_code; $facturestatic->close_code = $obj->close_code;
$facturestatic->total_ttc = $obj->total_ttc; $facturestatic->total_ttc = $obj->total_ttc;
$facturestatic->paye = $obj->paye; $facturestatic->paye = $obj->paye;
@ -1764,6 +1768,7 @@ if ($resql) {
$facturestatic->note_public = $obj->note_public; $facturestatic->note_public = $obj->note_public;
$facturestatic->note_private = $obj->note_private; $facturestatic->note_private = $obj->note_private;
if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$facturestatic->retained_warranty = $obj->retained_warranty; $facturestatic->retained_warranty = $obj->retained_warranty;
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit; $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
@ -1899,7 +1904,7 @@ if ($resql) {
// Type // Type
if (!empty($arrayfields['f.type']['checked'])) { if (!empty($arrayfields['f.type']['checked'])) {
print '<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().'">'; print '<td class="nowraponall tdoverflowmax100" title="'.$facturestatic->getLibType().'">';
print $facturestatic->getLibType(); print $facturestatic->getLibType(2);
print "</td>"; print "</td>";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -2340,7 +2345,7 @@ if ($resql) {
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
} }
if ($i >= $last_num - 1) { if ($i >= $imaxinloop - 1) {
if (!empty($total_ht)) { if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else { } else {

View File

@ -131,8 +131,8 @@ abstract class CommonInvoice extends CommonObject
* Return amount of payments already done. This must include ONLY the record into the payment table. * Return amount of payments already done. This must include ONLY the record into the payment table.
* Payments dones using discounts, credit notes, etc are not included. * Payments dones using discounts, credit notes, etc are not included.
* *
* @param int $multicurrency Return multicurrency_amount instead of amount * @param int $multicurrency Return multicurrency_amount instead of amount
* @return float Amount of payment already done, <0 and set ->error if KO * @return float|int Amount of payment already done, <0 and set ->error if KO
*/ */
public function getSommePaiement($multicurrency = 0) public function getSommePaiement($multicurrency = 0)
{ {
@ -148,17 +148,23 @@ abstract class CommonInvoice extends CommonObject
$sql .= " WHERE ".$field." = ".((int) $this->id); $sql .= " WHERE ".$field." = ".((int) $this->id);
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->db->free($resql); $this->db->free($resql);
if ($multicurrency) {
$this->sumpayed_multicurrency = $obj->multicurrency_amount; if ($obj) {
return $obj->multicurrency_amount; if ($multicurrency) {
$this->sumpayed_multicurrency = $obj->multicurrency_amount;
return (float) $obj->multicurrency_amount;
} else {
$this->sumpayed = $obj->amount;
return (float) $obj->amount;
}
} else { } else {
$this->sumpayed = $obj->amount; return 0;
return $obj->amount;
} }
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
@ -513,25 +519,43 @@ abstract class CommonInvoice extends CommonObject
/** /**
* Return label of type of invoice * Return label of type of invoice
* *
* @return string Label of type of invoice * @param int $withbadge 1=Add span for badge css, 2=Add span and show short label
* @return string Label of type of invoice
*/ */
public function getLibType() public function getLibType($withbadge = 0)
{ {
global $langs; global $langs;
$labellong = "Unknown";
if ($this->type == CommonInvoice::TYPE_STANDARD) { if ($this->type == CommonInvoice::TYPE_STANDARD) {
return $langs->trans("InvoiceStandard"); $labellong = "InvoiceStandard";
$labelshort = "InvoiceStandardShort";
} elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) { } elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) {
return $langs->trans("InvoiceReplacement"); $labellong = "InvoiceReplacement";
$labelshort = "InvoiceReplacementShort";
} elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) { } elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) {
return $langs->trans("InvoiceAvoir"); $labellong = "InvoiceAvoir";
$labelshort = "CreditNote";
} elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) { } elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) {
return $langs->trans("InvoiceDeposit"); $labellong = "InvoiceDeposit";
$labelshort = "Deposit";
} elseif ($this->type == CommonInvoice::TYPE_PROFORMA) { } elseif ($this->type == CommonInvoice::TYPE_PROFORMA) {
return $langs->trans("InvoiceProForma"); // Not used. $labellong = "InvoiceProForma"; // Not used.
$labelshort = "ProForma";
} elseif ($this->type == CommonInvoice::TYPE_SITUATION) { } elseif ($this->type == CommonInvoice::TYPE_SITUATION) {
return $langs->trans("InvoiceSituation"); $labellong = "InvoiceSituation";
$labelshort = "Situation";
} }
return $langs->trans("Unknown");
$out = '';
if ($withbadge) {
$out .= '<span class="badgeneutral" title="'.dol_escape_htmltag($langs->trans($labellong)).'">';
}
$out .= $langs->trans($withbadge == 2 ? $labelshort : $labellong);
if ($withbadge) {
$out .= '</span>';
}
return $out;
} }
/** /**

View File

@ -1698,7 +1698,7 @@ if ($action == 'create') {
print $societe->getNomUrl(1, 'supplier'); print $societe->getNomUrl(1, 'supplier');
print '<input type="hidden" name="socid" value="'.$societe->id.'">'; print '<input type="hidden" name="socid" value="'.$societe->id.'">';
} else { } else {
print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', 's.fournisseur=1', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
print '<script> print '<script>

View File

@ -755,7 +755,7 @@ $sql = 'SELECT';
if ($sall || $search_product_category > 0) { if ($sall || $search_product_category > 0) {
$sql = 'SELECT DISTINCT'; $sql = 'SELECT DISTINCT';
} }
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.email,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.email,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as date_livraison,cf.date_valid, cf.date_approve,"; $sql .= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as date_livraison,cf.date_valid, cf.date_approve,";
@ -1627,7 +1627,7 @@ if ($resql) {
} }
// Ref Supplier // Ref Supplier
if (!empty($arrayfields['cf.ref_supplier']['checked'])) { if (!empty($arrayfields['cf.ref_supplier']['checked'])) {
print '<td>'.$obj->ref_supplier.'</td>'."\n"; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_supplier).'">'.dol_escape_htmltag($obj->ref_supplier).'</td>'."\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@ -1671,6 +1671,8 @@ if ($resql) {
$thirdpartytmp->name = $obj->name; $thirdpartytmp->name = $obj->name;
$thirdpartytmp->email = $obj->email; $thirdpartytmp->email = $obj->email;
$thirdpartytmp->name_alias = $obj->alias; $thirdpartytmp->name_alias = $obj->alias;
$thirdpartytmp->client = $obj->client;
$thirdpartytmp->fournisseur = $obj->fournisseur;
print $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); print $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
print '</td>'."\n"; print '</td>'."\n";
if (!$i) { if (!$i) {

View File

@ -2053,7 +2053,7 @@ if ($action == 'create') {
print $societe->getNomUrl(1, 'supplier'); print $societe->getNomUrl(1, 'supplier');
print '<input type="hidden" name="socid" value="'.$societe->id.'">'; print '<input type="hidden" name="socid" value="'.$societe->id.'">';
} else { } else {
print img_picto('', 'company').$form->select_company(!empty($societe->id) ? $societe->id : 0, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); print img_picto('', 'company').$form->select_company(!empty($societe->id) ? $societe->id : 0, 'socid', 's.fournisseur=1', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500');
// reload page to retrieve supplier informations // reload page to retrieve supplier informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@ -17,6 +17,7 @@ DisabledBecauseNotErasable=Disabled because cannot be erased
InvoiceStandard=Standard invoice InvoiceStandard=Standard invoice
InvoiceStandardAsk=Standard invoice InvoiceStandardAsk=Standard invoice
InvoiceStandardDesc=This kind of invoice is the common invoice. InvoiceStandardDesc=This kind of invoice is the common invoice.
InvoiceStandardShort=Standard
InvoiceDeposit=Down payment invoice InvoiceDeposit=Down payment invoice
InvoiceDepositAsk=Down payment invoice InvoiceDepositAsk=Down payment invoice
InvoiceDepositDesc=This kind of invoice is done when a down payment has been received. InvoiceDepositDesc=This kind of invoice is done when a down payment has been received.
@ -24,6 +25,7 @@ InvoiceProForma=Proforma invoice
InvoiceProFormaAsk=Proforma invoice InvoiceProFormaAsk=Proforma invoice
InvoiceProFormaDesc=<b>Proforma invoice</b> is an image of a true invoice but has no accountancy value. InvoiceProFormaDesc=<b>Proforma invoice</b> is an image of a true invoice but has no accountancy value.
InvoiceReplacement=Replacement invoice InvoiceReplacement=Replacement invoice
InvoiceReplacementShort=Replacement
InvoiceReplacementAsk=Replacement invoice for invoice InvoiceReplacementAsk=Replacement invoice for invoice
InvoiceReplacementDesc=<b>Replacement invoice</b> is used to completely replace an invoice with no payment already received.<br><br>Note: Only invoices with no payment on it can be replaced. If the invoice you replace is not yet closed, it will be automatically closed to 'abandoned'. InvoiceReplacementDesc=<b>Replacement invoice</b> is used to completely replace an invoice with no payment already received.<br><br>Note: Only invoices with no payment on it can be replaced. If the invoice you replace is not yet closed, it will be automatically closed to 'abandoned'.
InvoiceAvoir=Credit note InvoiceAvoir=Credit note

View File

@ -2658,11 +2658,16 @@ class Societe extends CommonObject
if (isset($this->status)) { if (isset($this->status)) {
$label .= ' '.$this->getLibStatut(5); $label .= ' '.$this->getLibStatut(5);
} }
if (isset($this->client) && isset($this->fournisseur)) {
$label .= ' &nbsp; ';
$label .= $this->getTypeUrl(1);
}
$label .= '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag($this->name); $label .= '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag($this->name);
if (!empty($this->name_alias)) { if (!empty($this->name_alias)) {
$label .= ' ('.dol_escape_htmltag($this->name_alias).')'; $label .= ' ('.dol_escape_htmltag($this->name_alias).')';
} }
if ($this->email) { if ($this->email) {
$label .= '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; $label .= '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
} }