Changeset 2413


Ignore:
Timestamp:
06/24/20 18:57:32 (4 years ago)
Author:
nanardon
Message:

Add object support feature

Location:
trunk
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/MANIFEST

    r2362 r2413  
    6666lib/LATMOS/Accounts/Web/Controller/Summary/Offices.pm 
    6767lib/LATMOS/Accounts/Web/Controller/Summary/Tree.pm 
     68lib/LATMOS/Accounts/Web/Controller/Support.pm 
    6869lib/LATMOS/Accounts/Web/Controller/Templates.pm 
    6970lib/LATMOS/Accounts/Web/Controller/Tools/CSV.pm 
     
    162163root/html/summary/rh/index.tt 
    163164root/html/summary/tree/index.tt 
     165root/html/support/default.tt 
     166root/html/support/index.tt 
    164167root/html/sutype/default.tt 
    165168root/html/sutype/index.tt 
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/Accounts.pm

    r2387 r2413  
    7878        address => 'Adresse', 
    7979        employement => 'Statut', 
     80        support => 'Support', 
    8081    }->{$ref}; 
    8182} 
     
    9192        aliases => 'aliases', 
    9293        service => 'services', 
     94        support => 'support', 
    9395    }->{$ref} || $ref; 
    9496 
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r2389 r2413  
    182182            endOfWarranty 
    183183            serialNumber 
     184            support 
    184185            inventoryNumber 
    185186            expire 
     
    296297        )], 
    297298    }, 
     299    support => { 
     300        name => 'Support', 
     301        attrs => [ qw( 
     302            description 
     303            comment 
     304            phone 
     305            mail 
     306            address 
     307        ) ], 
     308    }, 
    298309}; 
    299310 
  • trunk/LATMOS-Accounts/Changes

    r2410 r2413  
    116.1.2 
     2    # WARNING: database schema need to be upgraded 
     3 
    24    - Fix: account export when employment end later 
    35    - Fix ACL, replace $ROOT by @ROOT: '$' has special meaning here 
     
    1517    - always try to create missing object in destination (regardless recent changes) 
    1618    - Fix: dynamics attributes not properly compute after object creation 
     19    - add support objects (hardare support contact) 
    1720 
    18216.1.1 
  • trunk/LATMOS-Accounts/MANIFEST

    r2385 r2413  
    7474lib/LATMOS/Accounts/Bases/Ldap/Aliases.pm 
    7575lib/LATMOS/Accounts/Bases/Ldap/Group.pm 
     76lib/LATMOS/Accounts/Bases/Ldap/Groupofnames.pm 
    7677lib/LATMOS/Accounts/Bases/Ldap/Onlyaddress.pm 
    7778lib/LATMOS/Accounts/Bases/Ldap/User.pm 
     
    9495lib/LATMOS/Accounts/Bases/Sql/Employmentsummary.pm 
    9596lib/LATMOS/Accounts/Bases/Sql/Group.pm 
     97lib/LATMOS/Accounts/Bases/Sql/Groupofnames.pm 
    9698lib/LATMOS/Accounts/Bases/Sql/Nethost.pm 
    9799lib/LATMOS/Accounts/Bases/Sql/Netzone.pm 
     
    101103lib/LATMOS/Accounts/Bases/Sql/Site.pm 
    102104lib/LATMOS/Accounts/Bases/Sql/Stat.pm 
     105lib/LATMOS/Accounts/Bases/Sql/Support.pm 
    103106lib/LATMOS/Accounts/Bases/Sql/Sutype.pm 
    104107lib/LATMOS/Accounts/Bases/Sql/Templates.pm 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm

    r2352 r2413  
    1818our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
    1919 
    20 sub SCHEMA_VERSION { 37 }; 
     20sub SCHEMA_VERSION { 38 }; 
    2121 
    2222=head1 NAME 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Nethost.pm

    r2390 r2413  
    268268                label => l('Locked'), 
    269269            }, 
    270  
     270            support => { 
     271                reference => 'support', 
     272                label => l('Support'), 
     273            }, 
    271274        } 
    272275    ) 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/upgrade.pm

    r2352 r2413  
    13511351            ], 
    13521352        }, 
     1353        { 
     1354            ver => 38, 
     1355            sql => [ 
     1356                q{ 
     1357 
     1358                CREATE TABLE public.support 
     1359                ( 
     1360                  CONSTRAINT support_pkey PRIMARY KEY (name), 
     1361                  CONSTRAINT support_ikey_uniq UNIQUE (ikey) 
     1362                ) 
     1363                INHERITS (public.objects) 
     1364                WITH ( 
     1365                  OIDS=FALSE 
     1366                ); 
     1367                ALTER TABLE public.support 
     1368                  OWNER TO latmos; 
     1369 
     1370 
     1371                CREATE TRIGGER support_update_rev_tg 
     1372                  BEFORE INSERT OR UPDATE OR DELETE 
     1373                  ON public.support 
     1374                  FOR EACH ROW 
     1375                  EXECUTE PROCEDURE public.rev_tg_f(); 
     1376 
     1377 
     1378                CREATE TABLE public.support_attributes 
     1379                ( 
     1380                  CONSTRAINT support_attributes_pkey PRIMARY KEY (attr_key), 
     1381                  CONSTRAINT support_attr_support_okey_fkey FOREIGN KEY (okey) 
     1382                      REFERENCES public.support (ikey) MATCH SIMPLE 
     1383                      ON UPDATE CASCADE ON DELETE CASCADE 
     1384                ) 
     1385                INHERITS (public.attributes) 
     1386                WITH ( 
     1387                  OIDS=FALSE 
     1388                ); 
     1389 
     1390                CREATE OR REPLACE FUNCTION public.support_attr_update_ref() 
     1391                  RETURNS trigger AS 
     1392                $BODY$begin 
     1393 
     1394                IF (TG_OP != 'INSERT') then 
     1395                update "support" set date = now() where "support".ikey = old.okey; 
     1396                end if; 
     1397                IF (TG_OP != 'DELETE') then 
     1398                update "support"  set date = now() where "support".ikey = new.okey; 
     1399                end if; 
     1400 
     1401                IF (TG_OP = 'DELETE') then 
     1402                  return old; 
     1403                ELSE 
     1404                  return new; 
     1405                END IF; 
     1406 
     1407                END;$BODY$ 
     1408                  LANGUAGE plpgsql VOLATILE 
     1409                  COST 100; 
     1410 
     1411                CREATE INDEX fki_support_attributes_attr_fkey 
     1412                  ON public.support_attributes 
     1413                  USING btree 
     1414                  (attr COLLATE pg_catalog."default"); 
     1415 
     1416                CREATE INDEX support_attr_value_idx 
     1417                  ON public.support_attributes 
     1418                  USING btree 
     1419                  (value COLLATE pg_catalog."default"); 
     1420 
     1421                  CREATE TRIGGER support_attr_update 
     1422                  AFTER INSERT OR UPDATE OR DELETE 
     1423                  ON public.support_attributes 
     1424                  FOR EACH ROW 
     1425                  EXECUTE PROCEDURE public.support_attr_update_ref(); 
     1426 
     1427                CREATE TABLE public.nethost_attributes_supports 
     1428                ( 
     1429                  CONSTRAINT nethost_attributes_support_pkey PRIMARY KEY (attr_key), 
     1430                  CONSTRAINT nethost_attr_support_okey_fkey FOREIGN KEY (okey) 
     1431                      REFERENCES public.nethost (ikey) MATCH SIMPLE 
     1432                      ON UPDATE CASCADE ON DELETE CASCADE, 
     1433                  CONSTRAINT nethost_attributes_support_support_fkey FOREIGN KEY (value) 
     1434                      REFERENCES public."support" (name) MATCH SIMPLE 
     1435                      ON UPDATE CASCADE ON DELETE CASCADE, 
     1436                  CONSTRAINT nethost_attributes_support_uniq UNIQUE (okey, attr, value) 
     1437                ) 
     1438                INHERITS (public.nethost_attributes) 
     1439                WITH ( 
     1440                  OIDS=FALSE 
     1441                ); 
     1442 
     1443                CREATE INDEX fki_nethost_attr_support_okey_fkey 
     1444                  ON public.nethost_attributes_supports 
     1445                  USING btree 
     1446                  (okey); 
     1447 
     1448                CREATE INDEX fki_nethost_attributes_support_attr_fkey 
     1449                  ON public.nethost_attributes_supports 
     1450                  USING btree 
     1451                  (attr COLLATE pg_catalog."default"); 
     1452 
     1453 
     1454                CREATE INDEX fki_nethost_attributes_support_support_fkey 
     1455                  ON public.nethost_attributes_supports 
     1456                  USING btree 
     1457                  (value COLLATE pg_catalog."default"); 
     1458 
     1459                CREATE TRIGGER nethost_attributes_support_update_ref 
     1460                  AFTER INSERT OR UPDATE OR DELETE 
     1461                  ON public.nethost_attributes_supports 
     1462                  FOR EACH ROW 
     1463                  EXECUTE PROCEDURE public.nethost_attr_update_ref(); 
     1464 
     1465                CREATE OR REPLACE FUNCTION public.nethost_sort_fields() 
     1466                  RETURNS trigger AS 
     1467                $BODY$BEGIN 
     1468 
     1469                              IF (TG_OP='INSERT') then 
     1470                              IF (new.attr='ip') THEN 
     1471                              insert into nethost_attributes_ips VALUES (new.*); 
     1472                              RETURN NULL; 
     1473                              END IF; 
     1474 
     1475                              IF (new.attr='macaddr') THEN 
     1476                              insert into nethost_attributes_macs VALUES (new.*); 
     1477                              RETURN NULL; 
     1478                              END IF; 
     1479 
     1480                              IF (new.attr='owner') THEN 
     1481                              insert into nethost_attributes_users VALUES (new.*); 
     1482                              RETURN NULL; 
     1483                              END IF; 
     1484 
     1485                              IF (new.attr='user') THEN 
     1486                              insert into nethost_attributes_users VALUES (new.*); 
     1487                              RETURN NULL; 
     1488                              END IF; 
     1489 
     1490                          IF (new.attr='related') THEN 
     1491                              insert into nethost_attributes_nethosts VALUES (new.*); 
     1492                              RETURN NULL; 
     1493                              END IF; 
     1494 
     1495                          IF (new.attr='support') THEN 
     1496                              insert into nethost_attributes_supports VALUES (new.*); 
     1497                              RETURN NULL; 
     1498                              END IF; 
     1499 
     1500                              end if; 
     1501 
     1502                              if (TG_OP='DELETE') THEN 
     1503                              RETURN old; 
     1504                              else 
     1505                              RETURN new; 
     1506                              end if; 
     1507                              END;$BODY$ 
     1508                  LANGUAGE plpgsql VOLATILE 
     1509                  COST 100; 
     1510 
     1511                } 
     1512            ], 
     1513        }, 
    13531514    ); 
    13541515 
Note: See TracChangeset for help on using the changeset viewer.