Patch level : 10.1026

Files correlati     :  ve0.exe ve2.exe mg1.exe mg3.exe mg4.exe db0.exe
Ricompilazione Demo : [ ]
Commento            :



Aggiunto il parametro (CUSTOM_SEARCH_47(2)=X dove 47 e' l'identificatore del file anamag e 2 e' il numero della chiaveper descrizione) nel paragrafo Main del file ini della ditta  per aggiungere la descrizione estesa alle discerche per descrizione degli articoli


git-svn-id: svn://10.65.10.50/branches/R_10_00@22280 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-06-17 10:47:42 +00:00
parent 63e847f578
commit 2b08b4cf00
2 changed files with 82 additions and 7 deletions

View File

@ -19,6 +19,7 @@
#include <validate.h>
#include <virtkeyb.h>
#include "../mg/anamag.h"
#include <nditte.h>
// @doc INTERNAL
@ -2132,7 +2133,9 @@ TBrowse::TBrowse(TEdit_field* f, TRelation* r, int key, const char* filter)
_relation(r), _cursor(new TCursor (r, "", key)),
_filter(filter), _secondary(false),
_custom_filter_handler(NULL)
{}
{
custom_cursor();
}
// Certified 100%
@ -2140,7 +2143,9 @@ TBrowse::TBrowse(TEdit_field* f, TCursor* c)
: TBrowse_button(f),
_relation(NULL), _cursor(c), _secondary(false),
_custom_filter_handler(NULL)
{}
{
custom_cursor();
}
// Certified 100%
@ -2154,6 +2159,70 @@ TBrowse::~TBrowse()
}
}
static bool descr_filter_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TString expr;
if (!f.get().empty()) // Filtro attivato!
{
const short id = f.dlg()-500;
TString e = f.mask().get(id); // Espressione regolare
e.strip("\"'"); // Tolgo caratteri che potrebbero dare problemi
if (!e.blank())
expr << "(DESCR+DESCRAGG)" << "?=\"" << e << '"';
if (expr.empty())
f.reset();
}
((TBrowse_sheet&) f.mask()).add_custom_filter(expr);
}
return true;
}
void TBrowse::custom_cursor()
{
TRelation * relation = _relation == NULL ? _cursor->relation() : _relation;
int logicnum = relation->lfile().num();
switch(logicnum)
{
case LF_ANAMAG :
if (_cursor->key() == 2 && ini_get_bool(CONFIG_DITTA, "Main", "CUSTOM_SEARCH_" TOSTRING(LF_ANAMAG), false, 2))
{
delete _cursor;
_cursor = new TSorted_cursor(relation, ANAMAG_DESCR "|" ANAMAG_DESCRAGG, "", 2);
set_custom_filter_handler(descr_filter_handler);
}
break;
default:
break;
}
}
void TBrowse::custom_display()
{
switch(_cursor->file().num())
{
case LF_ANAMAG :
if (_cursor->key() == 2 && ini_get_bool(CONFIG_DITTA, "Main", "CUSTOM_SEARCH_" TOSTRING(LF_ANAMAG), false, 2))
{
TToken_string & it = (TToken_string &) items();
if (it.find(ANAMAG_DESCRAGG) < 0)
{
const char * s = it.get(0);
for (int i = 0; s && *s; s = it.get(++i))
if (strcmp(s, ANAMAG_DESCR) == 0)
{
add_display_field("Descrizione aggiuntiva@50", ANAMAG_DESCRAGG, i + 1);
break;
}
}
}
break;
default:
break;
}
}
// Certified 100%
void TBrowse::parse_display(TScanner& scanner)
@ -2336,7 +2405,7 @@ void TBrowse::add_input_field(const char * id, const char * name, const int pos,
if (select)
strid << '@';
if (pos < 0)
if (pos < 0 || pos >= _items.items())
{
_inp_id.add(strid);
_inp_fn.add(name);
@ -2390,7 +2459,7 @@ void TBrowse::copy_output(const TBrowse * b)
void TBrowse::add_display_field(const char * hd, const char * name, const int pos)
{
if (pos < 0)
if (pos < 0 || pos >= _items.items())
{
_head.add(dictionary_translate_header(hd));
_items.add(name);
@ -2418,7 +2487,7 @@ void TBrowse::remove_input_field(const int pos)
void TBrowse::add_output_field(const char * id, const char * name, const int pos)
{
if (pos < 0)
if (pos < 0 || pos >= _items.items())
{
_out_id.add(id);
_out_fn.add(name);

View File

@ -935,9 +935,15 @@ protected:
// @cmember Crea lista identificatori di ricerca
TToken_string& create_siblings(TToken_string& siblings);
// @access Public Member
// @cmember Modifica il cursore
void custom_cursor();
// @access Public Member
public:
// @cmember Ritorna il numero di inputs senza contare quelli che funzionano
// @cmember Modifica il display
void custom_display();
// @cmember Ritorna il numero di inputs senza contare quelli che funzionano
// solo da filtro
int input_fields();