diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 1d51ea6f7fb..e4ff0e4e0d1 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1330,17 +1330,23 @@ class Categorie extends CommonObject * Build thumb * * @param string $file Chemin du fichier d'origine - * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut) - * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @return void */ - function add_thumb($file, $maxWidth = 160, $maxHeight = 120) + function add_thumb($file) { - require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; + global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ... if (file_exists($file)) { - vignette($file,$maxWidth,$maxHeight); + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality); } } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index ffc01a998d5..78b786d2366 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -400,7 +400,7 @@ if ($id > 0) // display amount and link to unpaid bill $outstandigBills = $object->get_OutstandingBill(); if ($outstandigBills != 0) - print " / ".price($outstandigBills).''; + print " (".$langs->trans("CurrentOutstandingBill")." ".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).')'; print ''; print ''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a3ef72bb6ca..da6e56c9460 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -182,9 +182,9 @@ if ($search_author) { $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'"; } -if ($search_montant_ht) +if ($search_montant_ht != '') { - $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; + $sql.= natural_search("p.total_ht", $search_montant_ht, 1); } if ($sall) { $sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall); @@ -316,12 +316,12 @@ if ($result) print ''; print ' '; // Amount - print ''; - print ''; + print ''; + print ''; print ''; // Author print ''; - print ''; + print ''; print ''; print ''; $formpropal->selectProposalStatus($viewstatut,1); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6baca9550b9..5f6c085831f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -220,13 +220,13 @@ if (empty($reshook)) if ($datecommande == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors'); $action = 'create'; - $error ++; + $error++; } if ($socid < 1) { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors'); $action = 'create'; - $error ++; + $error++; } if (! $error) { @@ -350,7 +350,7 @@ if (empty($reshook)) $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options); if ($result < 0) { - $error ++; + $error++; break; } @@ -365,14 +365,14 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook if ($reshook < 0) - $error ++; + $error++; } else { setEventMessage($srcobject->error, 'errors'); - $error ++; + $error++; } } else { setEventMessage($object->error, 'errors'); - $error ++; + $error++; } } else { // Required extrafield left blank, error message already defined by setOptionalsFromPost() @@ -408,7 +408,7 @@ if (empty($reshook)) $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); if ($result < 0) { setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); - $error ++; + $error++; } } @@ -579,24 +579,24 @@ if (empty($reshook)) if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error ++; + $error++; } if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); - $error ++; + $error++; } if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); - $error ++; + $error++; } if ($qty == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error ++; + $error++; } if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); - $error ++; + $error++; } if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { @@ -852,7 +852,7 @@ if (empty($reshook)) if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors'); - $error ++; + $error++; } } else { $type = GETPOST('type'); @@ -861,7 +861,7 @@ if (empty($reshook)) // Check parameters if (GETPOST('type') < 0) { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors'); - $error ++; + $error++; } } @@ -1125,10 +1125,10 @@ if (empty($reshook)) if (empty($reshook)) { $result = $object->insertExtraFields(); if ($result < 0) { - $error ++; + $error++; } } else if ($reshook < 0) - $error ++; + $error++; } if ($error) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 9d143d87eb2..c38b1a8e34f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -51,6 +51,7 @@ $sall=GETPOST('sall'); $socid=GETPOST('socid','int'); $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); +$search_total_ht=GETPOST('search_total_ht','alpha'); // Security check $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int')); @@ -79,6 +80,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_ref=''; $search_ref_customer=''; $search_company=''; + $search_total_ht=''; $orderyear=''; $ordermonth=''; $deliverymonth=''; @@ -96,6 +98,7 @@ $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + /* * View */ @@ -198,7 +201,10 @@ if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; } - +if ($search_total_ht != '') +{ + $sql.= natural_search('c.total_ht', $search_total_ht, 1); +} $sql.= ' ORDER BY '.$sortfield.' '.$sortorder; $nbtotalofrecords = 0; @@ -252,7 +258,8 @@ if ($resql) if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; - + if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; + $num = $db->num_rows($resql); print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); $i = 0; @@ -316,7 +323,9 @@ if ($resql) print ''; $formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); print ''; - print ' '; + print ''; + print ''; + print ''; print ''; print ''; print "\n"; @@ -328,7 +337,8 @@ if ($resql) $generic_commande = new Commande($db); $generic_product = new Product($db); - while ($i < min($num,$limit)) { + while ($i < min($num,$limit)) + { $objp = $db->fetch_object($resql); $var=!$var; print ''; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 050db37fefc..9c9f0574c31 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -174,7 +174,11 @@ foreach ($accounts as $key=>$type) $total[$acc->currency_code] += $solde; } } -if (! $found) print ''.$langs->trans("None").''; +if (! $found) +{ + $var = !$var; + print ''.$langs->trans("None").''; +} // Total foreach ($total as $key=>$solde) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4cb696836bd..d38519bf6d5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1962,11 +1962,11 @@ if ($action == 'create') // Outstanding Bill $outstandigBills = $soc->get_OutstandingBill(); print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; - print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency); + print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency); if ($soc->outstanding_limit != '') { if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); - print ' / ' . price($soc->outstanding_limit); + print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); } print ')'; print ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 56bd57c725a..dc081424ace 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -187,13 +187,13 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } -if ($search_montant_ht) +if ($search_montant_ht != '') { - $sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\''; + $sql.= natural_search('f.total', $search_montant_ht, 1); } -if ($search_montant_ttc) +if ($search_montant_ttc != '') { - $sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\''; + $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); } if ($search_status != '') { @@ -263,8 +263,8 @@ if ($resql) if ($search_societe) $param.='&search_societe=' .$search_societe; if ($search_sale > 0) $param.='&search_sale=' .$search_sale; if ($search_user > 0) $param.='&search_user=' .$search_user; - if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; - if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc; + if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; + if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); $i = 0; @@ -323,9 +323,9 @@ if ($resql) print ''; print ' '; print ''; - print ''; + print ''; print ' '; - print ''; + print ''; print ' '; print ''; print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8ad8ecd2331..02ccd13b97c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2141,7 +2141,8 @@ abstract class CommonObject $fieldstatus="fk_statut"; if ($elementTable == 'user') $fieldstatus="statut"; if ($elementTable == 'expensereport') $fieldstatus="fk_c_expensereport_statuts"; - + if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status"; + $sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable; $sql.= " SET ".$fieldstatus." = ".$status; // If status = 1 = validated, update also fk_user_valid diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 67b5b8147d5..b6cc390ca33 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -452,7 +452,7 @@ class Conf $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); // Define list of limited modules - if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. + if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,askpricesupplier,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. // Enable select2 if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)) $conf->global->MAIN_USE_JQUERY_MULTISELECT='select2'; diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 5ea5b33c1f4..2abc0c38485 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -57,11 +57,11 @@ class FormOrder { print '0'; - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); - } + if ($seller->tva_assuj == "0") echo '0'; + else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); ?> - "> - - element == 'askpricesupplier' || GETPOST('prod_entry_mode') != 'predef') { ?> "> - "> @@ -301,13 +294,13 @@ else { service->enabled) && $dateSelector && GETPOST('type') != '0') +if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required { if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10; else $colspan = 9; if($this->situation_cycle_ref) $colspan++; if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc - if (in_array($object->element,array('propal', 'askpricesupplier','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button + if (in_array($object->element,array('propal','askpricesupplier','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button if (! empty($usemargins)) { @@ -555,6 +548,11 @@ jQuery(document).ready(function() { if (jQuery('#idprod').val() > 0) jQuery('#dp_desc').focus(); if (jQuery('#idprodfournprice').val() > 0) jQuery('#dp_desc').focus(); }); + + + setforpredef(); + + }); /* Function to set fields from choice */ @@ -582,10 +580,8 @@ function setforpredef() { jQuery("#select_type").val(-1); jQuery("#prod_entry_mode_free").attr('checked',false); jQuery("#prod_entry_mode_predef").attr('checked',true); - element != 'askpricesupplier') { ?> - jQuery("#price_ht").hide(); - jQuery("#title_up_ht").hide(); - + jQuery("#price_ht").hide(); + jQuery("#title_up_ht").hide(); jQuery("#price_ttc").hide(); // May no exists jQuery("#tva_tx").hide(); jQuery("#buying_price").show(); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index d5d82f2baa3..973066971a3 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -402,7 +402,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("KeepToShip").''; if (! empty($conf->stock->enabled)) { - print ''.$langs->trans("Stock").''; + print ''.$langs->trans("RealStock").''; } else { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a75d97ec252..b9477d0adc8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -106,6 +106,8 @@ class CommandeFournisseur extends CommonOrder */ function __construct($db) { + global $conf; + $this->db = $db; $this->products = array(); $this->lines = array(); @@ -114,7 +116,8 @@ class CommandeFournisseur extends CommonOrder $this->statuts[0] = 'StatusOrderDraft'; $this->statuts[1] = 'StatusOrderValidated'; $this->statuts[2] = 'StatusOrderApproved'; - $this->statuts[3] = 'StatusOrderOnProcess'; + if (empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) $this->statuts[3] = 'StatusOrderOnProcess'; + else $this->statuts[3] = 'StatusOrderOnProcessWithValidation'; $this->statuts[4] = 'StatusOrderReceivedPartially'; $this->statuts[5] = 'StatusOrderReceivedAll'; $this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled @@ -1618,19 +1621,65 @@ class CommandeFournisseur extends CommonOrder } } + + /** + * Return array of dispathed lines waiting to be approved for this order + * + * @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines) + * @return array Array of lines + */ + function getDispachedLines($status=-1) + { + $ret = array(); + + // List of already dispatched lines + $sql = "SELECT p.ref, p.label,"; + $sql.= " e.rowid as warehouse_id, e.label as entrepot,"; + $sql.= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as p,"; + $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; + $sql.= " WHERE cfd.fk_commande = ".$this->id; + $sql.= " AND cfd.fk_product = p.rowid"; + if ($status >= 0) $sql.=" AND cfd.status = ".$status; + $sql.= " ORDER BY cfd.rowid ASC"; + + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $objp = $this->db->fetch_object($resql); + if ($objp) $ret[]=array('id'=>$objp->dispatchedlineid, 'productid'=>$objp->fk_product, 'warehouseid'=>$objp->warehouse_id); + + $i++; + } + } + else dol_print_error($this->db, 'Failed to execute request to get dispatched lines'); + + return $ret; + } + + /** * Set a delivery in database for this supplier order * * @param User $user User that input data * @param date $date Date of reception - * @param string $type Type of receipt + * @param string $type Type of receipt ('tot' = total/done, 'par' = partial, 'nev' = never, 'can' = cancel) * @param string $comment Comment * @return int <0 if KO, >0 if OK */ function Livraison($user, $date, $type, $comment) { + global $conf; + $result = 0; - + $error = 0; + dol_syslog(get_class($this)."::Livraison"); if ($user->rights->fournisseur->commande->receptionner) @@ -1640,7 +1689,27 @@ class CommandeFournisseur extends CommonOrder if ($type == 'nev') $statut = 7; if ($type == 'can') $statut = 7; - if ($statut == 4 or $statut == 5 or $statut == 7) + if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && ($type == 'tot')) + { + // If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done" + $dispatchedlinearray=$this->getDispachedLines(0); + if (count($dispatchedlinearray) > 0) + { + $result=-1; + $error++; + $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove'; + dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG); + } + } + + if (! $error && ! ($statut == 4 or $statut == 5 or $statut == 7)) + { + $error++; + dol_syslog(get_class($this)."::Livraison Error -2", LOG_ERR); + $result = -2; + } + + if (! $error) { $this->db->begin(); @@ -1665,11 +1734,6 @@ class CommandeFournisseur extends CommonOrder $result = -1; } } - else - { - dol_syslog(get_class($this)."::Livraison Error -2", LOG_ERR); - $result = -2; - } } else { diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 370b61de881..e7aea53945e 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -17,7 +17,7 @@ */ /** - * \file dev/skeletons/commandefournisseurdispatch.class.php + * \file fourn/class/fournisseur.commande.dispatch.class.php * \ingroup fournisseur stock * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) * Initialy built by build_class_from_table on 2015-02-24 10:38 @@ -70,10 +70,10 @@ class CommandeFournisseurDispatch extends CommonObject // List of language codes for status $this->statuts[0] = 'Received'; - $this->statuts[1] = 'Approved'; + $this->statuts[1] = 'Verified'; $this->statuts[2] = 'Denied'; $this->statutshort[0] = 'Received'; - $this->statutshort[1] = 'Approved'; + $this->statutshort[1] = 'Verified'; $this->statutshort[2] = 'Denied'; return 1; @@ -494,23 +494,17 @@ class CommandeFournisseurDispatch extends CommonObject if ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); - if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut3'); - if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut5'); + if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); } if ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); - if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); + if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 5) { if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); - if ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); - if ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut3'); - if ($statut==3) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut5'); + if ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 7630f5bcfba..6101aa7e17d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -143,7 +143,7 @@ if (empty($reshook)) } // Set incoterm - if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) + if ($action == 'set_incoterms' && $user->rights->fournisseur->commande->creer) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); @@ -288,7 +288,7 @@ if (empty($reshook)) $idprod=0; $productsupplier = new ProductFournisseur($db); - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-2; // Same behaviour than with combolist. When not select idprodfournprice is now -2 (to avoid conflict with next action that may return -1) + if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) if (GETPOST('idprodfournprice') > 0) { @@ -332,12 +332,12 @@ if (empty($reshook)) $array_options ); } - if ($idprod == -2 || $idprod == 0) + if ($idprod == -99 || $idprod == 0) { - // Product not selected - $error++; - $langs->load("errors"); - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")), 'errors'); + // Product not selected + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).' '.$langs->trans("or").' '.$langs->trans("NoPriceDefinedForThisSupplier"), 'errors'); } if ($idprod == -1) { @@ -734,15 +734,14 @@ if (empty($reshook)) } } - // Receive + // Set status of reception (complete, partial, ...) if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) { - - if ($_POST["type"]) + if (GETPOST("type") != '') { - $date_liv = dol_mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); + $date_liv = dol_mktime(GETPOST('rehour'),GETPOST('remin'),GETPOST('resec'),GETPOST("remonth"),GETPOST("reday"),GETPOST("reyear")); - $result = $object->Livraison($user, $date_liv, $_POST["type"], $_POST["comment"]); + $result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment")); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); @@ -754,8 +753,7 @@ if (empty($reshook)) } else { - dol_print_error($db,$object->error); - exit; + setEventMessages($object->error, $object->errors, 'errors'); } } else @@ -2598,14 +2596,21 @@ elseif (! empty($object->id)) } // Reopen - if (in_array($object->statut, array(2, 5, 6, 7, 9))) + if (in_array($object->statut, array(2))) + { + if ($user->rights->fournisseur->commande->commander) + { + print ''.$langs->trans("Disapprove").''; + } + } + if (in_array($object->statut, array(5, 6, 7, 9))) { if ($user->rights->fournisseur->commande->commander) { print ''.$langs->trans("ReOpen").''; } } - + // Create bill if (! empty($conf->fournisseur->enabled) && $object->statut >= 2) // 2 means accepted { diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 81c9e410c28..2610111023a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -46,6 +46,8 @@ if (! empty($conf->productbatch->enabled)) $langs->load('productbatch'); // Security check $id = GETPOST("id",'int'); +$lineid = GETPOST('lineid', 'int'); +$action = GETPOST('action'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); @@ -65,7 +67,35 @@ $mesg=''; * Actions */ -if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->receptionner) +if ($action == 'checkdispatchline') +{ + $supplierorderdispatch = new CommandeFournisseurDispatch($db); + $result=$supplierorderdispatch->fetch($lineid); + if (! $result) dol_print_error($db); + $result=$supplierorderdispatch->setStatut(1); + if ($result < 0) + { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error++; + $action=''; + } +} + +if ($action == 'uncheckdispatchline') +{ + $supplierorderdispatch = new CommandeFournisseurDispatch($db); + $result=$supplierorderdispatch->fetch($lineid); + if (! $result) dol_print_error($db); + $result=$supplierorderdispatch->setStatut(0); + if ($result < 0) + { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error++; + $action=''; + } +} + +if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) { $commande = new CommandeFournisseur($db); $commande->fetch($id); @@ -76,33 +106,40 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece foreach($_POST as $key => $value) { - if (preg_match('/^product_([0-9]+)$/i', $key, $reg)) + if (preg_match('/^product_([0-9]+)$/i', $key, $reg)) // without batch module enabled { + $numline=$reg[1] + 1; // line of product $prod = "product_".$reg[1]; $qty = "qty_".$reg[1]; $ent = "entrepot_".$reg[1]; $pu = "pu_".$reg[1]; // This is unit price including discount $fk_commandefourndet = "fk_commandefourndet_".$reg[1]; - if (GETPOST($ent,'int') > 0) + + if (GETPOST($qty) > 0) // We ask to move a qty { - $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int')); - if ($result < 0) + if (! GETPOST($ent,'int') > 0) { - setEventMessages($commande->error, $commande->errors, 'errors'); + dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); + $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' ' .($numline); + setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); $error++; } - } - else - { - dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); - $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').'' .($reg[1]-1); - setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); - $error++; + + if (! $error) + { + $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int')); + if ($result < 0) + { + setEventMessages($commande->error, $commande->errors, 'errors'); + $error++; + } + } } } - else if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) + if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) // with batch module enabled { //eat-by date dispatch + $numline=$reg[2] + 1; // line of product $prod = "product_".$reg[1]."_".$reg[2]; $qty = "qty_".$reg[1]."_".$reg[2]; $ent = "entrepot_".$reg[1]."_".$reg[2]; @@ -112,24 +149,25 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1]."_".$reg[2].'month'], $_POST['dluo_'.$reg[1]."_".$reg[2].'day'], $_POST['dluo_'.$reg[1]."_".$reg[2].'year']); $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1]."_".$reg[2].'month'], $_POST['dlc_'.$reg[1]."_".$reg[2].'day'], $_POST['dlc_'.$reg[1]."_".$reg[2].'year']); - if (! (GETPOST($ent,'int') > 0)) + if (GETPOST($qty) > 0) // We ask to move a qty { - dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); - $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').'' .($reg[1]-1); - setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); - $error++; - } - - if (! $error) - { - if (! ((GETPOST($qty) > 0) && ($_POST[$lot] || $dDLUO || $dDLC))) + if (! (GETPOST($ent,'int') > 0)) { - dol_syslog('No dispatch for line '.$key.' as qty is not set or eat-by date are not set'); - $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').'' .($reg[1]-1); + dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); + $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' ' .($numline).'-'.($reg[1]+1); setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); $error++; } - else + + if (! ($_POST[$lot] || $dDLUO || $dDLC)) + { + dol_syslog('No dispatch for line '.$key.' as serial/eat-by/sellby date are not set'); + $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').' ' .($numline).'-'.($reg[1]+1); + setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); + $error++; + } + + if (! $error) { $result = $commande->dispatchProduct($user, GETPOST($prod,'int'), GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int')); if ($result < 0) @@ -511,7 +549,7 @@ if ($id > 0 || ! empty($ref)) // List of already dispatching $sql = "SELECT p.ref, p.label,"; $sql.= " e.rowid as warehouse_id, e.label as entrepot,"; - $sql.= " cfd.rowid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; + $sql.= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; @@ -545,7 +583,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''.$langs->trans("Warehouse").''; print ''.$langs->trans("Comment").''; - if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) print ''.$langs->trans("Status").''; + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) print ''.$langs->trans("Status").''; print "\n"; $var=false; @@ -553,6 +591,7 @@ if ($id > 0 || ! empty($ref)) while ($i < $num) { $objp = $db->fetch_object($resql); + print ""; print ''; print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; @@ -588,8 +627,22 @@ if ($id > 0 || ! empty($ref)) //print $supplierorderdispatch->status; print $supplierorderdispatch->getLibStatut(5); print ''; - } + // Add button to check/uncheck disaptching + print ''; + $disabled=''; + if ($commande->statut == 5) $disabled=1; + if (empty($objp->status)) + { + print 'dispatchlineid.'">'.$langs->trans("Check").''; + } + else + { + print 'dispatchlineid.'">'.$langs->trans("Uncheck").''; + } + print ''; + } + print "\n"; $i++; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 613eb463366..7e525a9d080 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -45,7 +45,7 @@ $search_user=GETPOST('search_user'); $search_ht=GETPOST('search_ht'); $search_ttc=GETPOST('search_ttc'); $sall=GETPOST('search_all'); -$search_status=(GETPOST('search_status','int')!=''?GETPOST('search_status','int'):GETPOST('statut','int')); +$search_status=(GETPOST('search_status','alpha')!=''?GETPOST('search_status','alpha'):GETPOST('statut','alpha')); // alpha and not intbecause it can be '6,7' $page = GETPOST('page','int'); $socid = GETPOST('socid','int'); @@ -100,7 +100,7 @@ $offset = $conf->liste_limit * $page ; /* - * Mode Liste + * Mode list */ $sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,"; @@ -130,13 +130,13 @@ if ($search_user) { $sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'"; } -if ($search_ht) +if ($search_ht != '') { - $sql .= " AND cf.total_ht = '".$db->escape(price2num($search_ht))."'"; + $sql .= natural_search("cf.total_ht",$search_ht, 1); } -if ($search_ttc) +if ($search_ttc != '') { - $sql .= " AND cf.total_ttc = '".$db->escape(price2num($search_ttc))."'"; + $sql .= natural_search("cf.total_ttc", $search_ttc, 1); } if ($sall) { @@ -153,9 +153,9 @@ if ($search_refsupp) { $sql.= " AND (cf.ref_supplier LIKE '%".$db->escape($search_refsupp)."%')"; } -if ($search_status >= 0) +if ($search_status != '' && $search_status >= 0) { - if ($search_status == 6 || $search_status == 7) $sql.=" AND cf.fk_statut IN (6,7)"; + if (strstr($search_status, ',')) $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; else $sql.=" AND cf.fk_statut = ".$search_status; } @@ -205,17 +205,17 @@ if ($resql) print ''; - print ''; + print ''; if (empty($conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER)) print ''; - print ''; + print ''; if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) { print ''; print ''; } print ''; - print ''; - print ''; + print ''; + print ''; print ' '; print ' '; print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index d59870d8fc5..66ad20e4c05 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -153,7 +153,7 @@ if ($search_ref) if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref); else $sql .= natural_search('fac.ref', $search_ref); } -if (search_ref_supplier) +if ($search_ref_supplier) { $sql .= natural_search('fac.ref_supplier', $search_ref_supplier); } @@ -178,14 +178,14 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company); } -if ($search_amount_no_tax) +if ($search_amount_no_tax != '') { - $sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'"; + $sql .= natural_search('fac.total_ht', $search_amount_no_tax, 1); } -if ($search_amount_all_tax) +if ($search_amount_all_tax != '') { - $sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'"; + $sql .= natural_search('fac.total_ttc', $search_amount_all_tax, 1); } $nbtotalofrecords = 0; @@ -270,9 +270,9 @@ if ($resql) print ''; } print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; $liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid")); print $form->selectarray('filtre', $liststatus, $filter, 1); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index afaf4c8e796..33e1ea46dd9 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -125,7 +125,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); } -$sql .= " ORDER BY ".$sortfield." ".$sortorder; +$sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($limit + 1, $offset); dol_syslog("fourn/product/list.php:", LOG_DEBUG); @@ -225,11 +225,11 @@ if ($resql) if ($companystatic->id > 0) print $companystatic->getNomUrl(1,'supplier'); print ''; - print ''.price($objp->price).''; + print ''.(isset($objp->price) ? price($objp->price) : '').''; print ''.$objp->qty.''; - print ''.price($objp->unitprice).''; + print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').''; print "\n"; $i++; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index be75e3a96a3..3d83901194b 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -160,6 +160,7 @@ ErrorPriceExpressionInternal=Internal error '%s' ErrorPriceExpressionUnknown=Unknown error '%s' ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without batch/serial information, on a product requiring batch/serial information +ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified before being allowed to do this action # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index be893d52569..551807aad59 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -159,6 +159,7 @@ Search=Search SearchOf=Search Valid=Valid Approve=Approve +Disapprove=Disapprove ReOpen=Re-Open Upload=Send file ToLink=Link @@ -524,6 +525,7 @@ DateFromTo=From %s to %s DateFrom=From %s DateUntil=Until %s Check=Check +Uncheck=Uncheck Internal=Internal External=External Internals=Internal diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 4f6e0b0dfb2..ea3659b90de 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -42,6 +42,7 @@ StatusOrderCanceled=Canceled StatusOrderDraft=Draft (needs to be validated) StatusOrderValidated=Validated StatusOrderOnProcess=Ordered - Standby reception +StatusOrderOnProcessWithValidation=Ordered - Standby reception or validation StatusOrderProcessed=Processed StatusOrderToBill=Delivered StatusOrderToBill2=To bill diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f73a6bac70d..56e721b67ac 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1250,14 +1250,14 @@ class Product extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -3; } } } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -2; } } @@ -3262,11 +3262,9 @@ class Product extends CommonObject * * @param string $sdir Target directory * @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...) - * @param int $maxWidth Largeur maximum que dois faire la miniature (160 by defaut) - * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 by defaut) * @return int <0 if KO, >0 if OK */ - function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) + function add_photo($sdir, $file) { global $conf; @@ -3276,10 +3274,12 @@ class Product extends CommonObject $dir = $sdir; if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos"; + else $dir .= '/'.dol_sanitizeFileName($this->ref); dol_mkdir($dir); $dir_osencoded=$dir; + if (is_dir($dir_osencoded)) { $originImage = $dir . '/' . $file['name']; @@ -3290,7 +3290,7 @@ class Product extends CommonObject if (file_exists(dol_osencode($originImage))) { // Cree fichier en taille vignette - $this->add_thumb($originImage,$maxWidth,$maxHeight); + $this->add_thumb($originImage); } } @@ -3302,18 +3302,24 @@ class Product extends CommonObject * Build thumb * * @param string $file Chemin du fichier d'origine - * @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut) - * @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut) * @return void */ - function add_thumb($file, $maxWidth = 160, $maxHeight = 120) + function add_thumb($file) { - require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; + global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ... $file_osencoded=dol_osencode($file); if (file_exists($file_osencoded)) { - vignette($file,$maxWidth,$maxHeight); + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality); } } diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 2ae1dcd1582..49a443938ab 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -141,9 +141,9 @@ if ($id > 0 || ! empty($ref)) $sql.= " AND d.fk_commande = c.rowid"; $sql.= " AND d.fk_product =".$product->id; if (! empty($search_month)) - $sql.= ' AND MONTH(f.datef) IN (' . $search_month . ')'; + $sql.= ' AND MONTH(c.date_commande) IN (' . $search_month . ')'; if (! empty($search_year)) - $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')'; + $sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')'; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND c.fk_soc = ".$socid; $sql.= " ORDER BY $sortfield $sortorder "; @@ -189,12 +189,14 @@ if ($id > 0 || ! empty($ref)) print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,''); print '
'; - print $langs->trans('Period').'('.$langs->trans("DateInvoice") .') '; + print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - '; print $langs->trans('Month') . ': '; print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print '
'; print ''; print ''; print '
'; + print '
'; $i = 0; print ''; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 3141b3266e9..8cbdea41495 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -150,9 +150,9 @@ if ($id > 0 || ! empty($ref)) { $sql .= " AND d.fk_commande = c.rowid"; $sql .= " AND d.fk_product =" . $product->id; if (! empty($search_month)) - $sql .= ' AND MONTH(f.datef) IN (' . $search_month . ')'; + $sql .= ' AND MONTH(c.date_commande) IN (' . $search_month . ')'; if (! empty($search_year)) - $sql .= ' AND YEAR(f.datef) IN (' . $search_year . ')'; + $sql .= ' AND YEAR(c.date_commande) IN (' . $search_year . ')'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; if ($socid) @@ -199,12 +199,14 @@ if ($id > 0 || ! empty($ref)) { print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); print '
'; - print $langs->trans('Period') . '(' . $langs->trans("DateInvoice") . ') '; + print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - '; print $langs->trans('Month') . ': '; print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print '
'; print ''; print ''; print '
'; + print '
'; $i = 0; print '
'; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index b59bc008f17..2ae8164b0f9 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -190,12 +190,14 @@ if ($id > 0 || ! empty($ref)) print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,''); print '
'; - print $langs->trans('Period').'('.$langs->trans("DateInvoice") .') '; + print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - '; print $langs->trans('Month') . ': '; print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print '
'; print ''; print ''; print '
'; + print '
'; $i = 0; print '
'; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 0feb415cc43..2e8e84621ba 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -191,12 +191,14 @@ if ($id > 0 || ! empty($ref)) print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); print '
'; - print $langs->trans('Period') . '(' . $langs->trans("DateInvoice") . ') '; + print $langs->trans('Period') . ' (' . $langs->trans("DateInvoice") . ') - '; print $langs->trans('Month') . ': '; print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print '
'; print ''; print ''; print '
'; + print '
'; $i = 0; print '
'; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 50d7c952b6d..10fd8247204 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -192,12 +192,14 @@ if ($id > 0 || ! empty($ref)) print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); print '
'; - print $langs->trans('Period') . '(' . $langs->trans("DateInvoice") . ') '; + print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - '; print $langs->trans('Month') . ': '; print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print '
'; print ''; print ''; print '
'; + print '
'; $i = 0; print '
'; diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index bd41d0735a5..c7f3d27dcfb 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -1125,6 +1125,24 @@ td.formdocbutton {padding-top:6px;} ); color:white; } +.button:disabled { + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + cursor: auto; +} +.buttonRefused { + pointer-events: none; + cursor: default; + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; +} + /* ============================================================================== */ /* Tables */ diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 35e0cdd36c9..7278521e092 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -184,6 +184,23 @@ legend { margin-bottom: 8px; } padding: 0px 2px 0px 2px; margin: 0px 0px 0px 0px; } +.button:disabled { + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + cursor: auto; +} +.buttonRefused { + pointer-events: none; + cursor: default; + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; +} form { padding: 0em 0em 0em 0em; margin: 0em 0em 0em 0em; diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index b720bd4a802..31071f0b10c 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -209,6 +209,23 @@ legend { margin-bottom: 8px; } padding: 0px 2px 0px 2px; margin: 0px 0px 0px 0px; } +.button:disabled { + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + cursor: auto; +} +.buttonRefused { + pointer-events: none; + cursor: default; + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; +} form { padding: 0em 0em 0em 0em; margin: 0em 0em 0em 0em; diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index a49ad6daaec..d09cb844b88 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -185,6 +185,23 @@ legend { margin-bottom: 8px; } padding: 0px 2px 0px 2px; margin: 0px 0px 0px 0px; } +.button:disabled { + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + cursor: auto; +} +.buttonRefused { + pointer-events: none; + cursor: default; + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; +} form { padding: 0em 0em 0em 0em; margin: 0em 0em 0em 0em; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ccf54a6f9b5..206b1df019e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -361,6 +361,15 @@ fieldset { border: 1px solid #AAAAAA !important; box-shadow: 2px 2px 3px #DDD; } -moz-box-shadow: none; cursor: auto; } +.buttonRefused { + pointer-events: none; + cursor: default; + opacity: 0.4; + filter: alpha(opacity=40); /* For IE8 and earlier */ + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; +} form { padding:0px; margin:0px;